@glandais/vcyclist-engine 3.0.0 → 3.1.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/vcyclist-fit.js CHANGED
@@ -1,53 +1,72 @@
1
1
  (function (factory) {
2
2
  if (typeof define === 'function' && define.amd)
3
- define(['exports', '@garmin/fitsdk', './kotlin-kotlin-stdlib.js'], factory);
3
+ define(['exports', './kotlin-kotlin-stdlib.js', './fit-kotlin-sdk.js'], factory);
4
4
  else if (typeof exports === 'object')
5
- factory(module.exports, require('@garmin/fitsdk'), require('./kotlin-kotlin-stdlib.js'));
5
+ factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./fit-kotlin-sdk.js'));
6
6
  else {
7
- if (typeof FitSdk === 'undefined') {
8
- throw new Error("Error loading module 'vcyclist-fit'. Its dependency '@garmin/fitsdk' was not found. Please, check whether '@garmin/fitsdk' is loaded prior to 'vcyclist-fit'.");
9
- }
10
7
  if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
11
8
  throw new Error("Error loading module 'vcyclist-fit'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'vcyclist-fit'.");
12
9
  }
13
- globalThis['vcyclist-fit'] = factory(typeof globalThis['vcyclist-fit'] === 'undefined' ? {} : globalThis['vcyclist-fit'], FitSdk, globalThis['kotlin-kotlin-stdlib']);
10
+ if (typeof globalThis['fit-kotlin-sdk'] === 'undefined') {
11
+ throw new Error("Error loading module 'vcyclist-fit'. Its dependency 'fit-kotlin-sdk' was not found. Please, check whether 'fit-kotlin-sdk' is loaded prior to 'vcyclist-fit'.");
12
+ }
13
+ globalThis['vcyclist-fit'] = factory(typeof globalThis['vcyclist-fit'] === 'undefined' ? {} : globalThis['vcyclist-fit'], globalThis['kotlin-kotlin-stdlib'], globalThis['fit-kotlin-sdk']);
14
14
  }
15
- }(function (_, FitSdk, kotlin_kotlin) {
15
+ }(function (_, kotlin_kotlin, kotlin_io_github_glandais_fit_kotlin_sdk) {
16
16
  'use strict';
17
17
  //region block: imports
18
18
  var imul = Math.imul;
19
- var Unit_instance = kotlin_kotlin.$_$.t;
20
- var Enum = kotlin_kotlin.$_$.z7;
21
- var protoOf = kotlin_kotlin.$_$.a6;
22
- var initMetadataForClass = kotlin_kotlin.$_$.l5;
19
+ var Unit_instance = kotlin_kotlin.$_$.g1;
20
+ var Enum = kotlin_kotlin.$_$.j9;
21
+ var protoOf = kotlin_kotlin.$_$.c7;
22
+ var initMetadataForClass = kotlin_kotlin.$_$.n6;
23
23
  var VOID = kotlin_kotlin.$_$.a;
24
- var initMetadataForCompanion = kotlin_kotlin.$_$.m5;
25
- var toString = kotlin_kotlin.$_$.c6;
26
- var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.m1;
27
- var Collection = kotlin_kotlin.$_$.z1;
28
- var isInterface = kotlin_kotlin.$_$.t5;
29
- var getStringHashCode = kotlin_kotlin.$_$.j5;
30
- var hashCode = kotlin_kotlin.$_$.k5;
31
- var equals = kotlin_kotlin.$_$.f5;
32
- var getNumberHashCode = kotlin_kotlin.$_$.h5;
33
- var Long = kotlin_kotlin.$_$.d8;
34
- var roundToInt = kotlin_kotlin.$_$.d6;
35
- var initMetadataForObject = kotlin_kotlin.$_$.r5;
36
- var Companion_getInstance = kotlin_kotlin.$_$.q;
37
- var listOf = kotlin_kotlin.$_$.z2;
38
- var collectionSizeOrDefault = kotlin_kotlin.$_$.j2;
39
- var ArrayList_init_$Create$ = kotlin_kotlin.$_$.w;
40
- var last = kotlin_kotlin.$_$.y2;
41
- var numberToLong = kotlin_kotlin.$_$.s4;
42
- var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.u;
43
- var toDuration = kotlin_kotlin.$_$.w7;
44
- var isNaN_0 = kotlin_kotlin.$_$.p8;
45
- var until = kotlin_kotlin.$_$.n6;
46
- var round = kotlin_kotlin.$_$.f6;
47
- var numberToInt = kotlin_kotlin.$_$.y5;
48
- var toNumber = kotlin_kotlin.$_$.u4;
49
- var get_lastIndex = kotlin_kotlin.$_$.w2;
50
- var first = kotlin_kotlin.$_$.s2;
24
+ var initMetadataForCompanion = kotlin_kotlin.$_$.o6;
25
+ var toString = kotlin_kotlin.$_$.f7;
26
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.a2;
27
+ var Collection = kotlin_kotlin.$_$.n2;
28
+ var isInterface = kotlin_kotlin.$_$.v6;
29
+ var getStringHashCode = kotlin_kotlin.$_$.l6;
30
+ var hashCode = kotlin_kotlin.$_$.m6;
31
+ var equals = kotlin_kotlin.$_$.g6;
32
+ var getNumberHashCode = kotlin_kotlin.$_$.j6;
33
+ var FileIdMesg_init_$Create$ = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.n;
34
+ var File_COURSE_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.f;
35
+ var Manufacturer_DYNASTREAM_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.g;
36
+ var _UShort___init__impl__jigrne = kotlin_kotlin.$_$.t;
37
+ var _UInt___init__impl__l7qpdl = kotlin_kotlin.$_$.p;
38
+ var toShort = kotlin_kotlin.$_$.e7;
39
+ var CourseMesg_init_$Create$ = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.l;
40
+ var LapMesg_init_$Create$ = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.o;
41
+ var RecordMesg_init_$Create$ = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.p;
42
+ var toByte = kotlin_kotlin.$_$.d7;
43
+ var _UByte___init__impl__g9hnc4 = kotlin_kotlin.$_$.m;
44
+ var roundToInt = kotlin_kotlin.$_$.g7;
45
+ var EventMesg_init_$Create$ = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.m;
46
+ var Event_TIMER_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.b;
47
+ var Sport_CYCLING_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.h;
48
+ var Sport_RUNNING_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.j;
49
+ var Sport_GENERIC_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.i;
50
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.fa;
51
+ var Companion_getInstance = kotlin_kotlin.$_$.c1;
52
+ var numberToLong = kotlin_kotlin.$_$.o5;
53
+ var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.w;
54
+ var toDuration = kotlin_kotlin.$_$.g9;
55
+ var Endianness_LITTLE_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.k;
56
+ var FitEncoder = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.a;
57
+ var get_lastIndex = kotlin_kotlin.$_$.m3;
58
+ var first = kotlin_kotlin.$_$.i3;
59
+ var EventType_START_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.c;
60
+ var last = kotlin_kotlin.$_$.o3;
61
+ var EventType_STOP_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.e;
62
+ var EventType_STOP_ALL_getInstance = kotlin_io_github_glandais_fit_kotlin_sdk.$_$.d;
63
+ var initMetadataForObject = kotlin_kotlin.$_$.t6;
64
+ var Long = kotlin_kotlin.$_$.n9;
65
+ var listOf = kotlin_kotlin.$_$.p3;
66
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.x2;
67
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.i1;
68
+ var isNaN_0 = kotlin_kotlin.$_$.da;
69
+ var until = kotlin_kotlin.$_$.q7;
51
70
  //endregion
52
71
  //region block: pre-declaration
53
72
  initMetadataForClass(FitSport, 'FitSport', VOID, Enum);
@@ -56,24 +75,24 @@
56
75
  initMetadataForClass(FitSegment, 'FitSegment');
57
76
  initMetadataForClass(FitRecord, 'FitRecord');
58
77
  initMetadataForClass(FitLap, 'FitLap');
78
+ initMetadataForObject(FitEncoder_0, 'FitEncoder');
59
79
  initMetadataForObject(FitUnits, 'FitUnits');
60
- initMetadataForObject(FitEncoder, 'FitEncoder');
61
80
  //endregion
62
- var FitSport_CYCLING_instance;
63
- var FitSport_RUNNING_instance;
64
- var FitSport_GENERIC_instance;
65
- var FitSport_entriesInitialized;
66
- function FitSport_initEntries() {
67
- if (FitSport_entriesInitialized)
81
+ var static_init_called;
82
+ function static_init() {
83
+ if (static_init_called)
68
84
  return Unit_instance;
69
- FitSport_entriesInitialized = true;
85
+ static_init_called = true;
70
86
  FitSport_CYCLING_instance = new FitSport('CYCLING', 0, 2);
71
87
  FitSport_RUNNING_instance = new FitSport('RUNNING', 1, 1);
72
88
  FitSport_GENERIC_instance = new FitSport('GENERIC', 2, 0);
73
89
  }
90
+ var FitSport_CYCLING_instance;
91
+ var FitSport_RUNNING_instance;
92
+ var FitSport_GENERIC_instance;
74
93
  function FitSport(name, ordinal, value) {
75
94
  Enum.call(this, name, ordinal);
76
- this.j1x_1 = value;
95
+ this.value_1 = value;
77
96
  }
78
97
  function Companion() {
79
98
  }
@@ -83,23 +102,23 @@
83
102
  }
84
103
  function FitCourse(name, startTime, segments, sport) {
85
104
  sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
86
- this.k1x_1 = name;
87
- this.l1x_1 = startTime;
88
- this.m1x_1 = segments;
89
- this.n1x_1 = sport;
105
+ this.name_1 = name;
106
+ this.startTime_1 = startTime;
107
+ this.segments_1 = segments;
108
+ this.sport_1 = sport;
90
109
  // Inline function 'kotlin.collections.isNotEmpty' call
91
110
  // Inline function 'kotlin.require' call
92
- if (!!this.m1x_1.n()) {
111
+ if (!!this.segments_1.isEmpty_y1axqb_k$()) {
93
112
  var message = 'A FIT course needs at least one segment';
94
113
  throw IllegalArgumentException_init_$Create$(toString(message));
95
114
  }
96
- var tmp0 = this.m1x_1;
115
+ var tmp0 = this.segments_1;
97
116
  var tmp$ret$3;
98
117
  $l$block_0: {
99
118
  // Inline function 'kotlin.collections.all' call
100
119
  var tmp;
101
120
  if (isInterface(tmp0, Collection)) {
102
- tmp = tmp0.n();
121
+ tmp = tmp0.isEmpty_y1axqb_k$();
103
122
  } else {
104
123
  tmp = false;
105
124
  }
@@ -107,11 +126,11 @@
107
126
  tmp$ret$3 = true;
108
127
  break $l$block_0;
109
128
  }
110
- var _iterator__ex2g4s = tmp0.i();
111
- while (_iterator__ex2g4s.j()) {
112
- var element = _iterator__ex2g4s.k();
129
+ var _iterator__ex2g4s = tmp0.iterator_jk1svi_k$();
130
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
131
+ var element = _iterator__ex2g4s.next_20eer_k$();
113
132
  // Inline function 'kotlin.collections.isNotEmpty' call
114
- if (!!element.o1x_1.n()) {
133
+ if (!!element.records_1.isEmpty_y1axqb_k$()) {
115
134
  tmp$ret$3 = false;
116
135
  break $l$block_0;
117
136
  }
@@ -125,13 +144,13 @@
125
144
  }
126
145
  }
127
146
  protoOf(FitCourse).toString = function () {
128
- return 'FitCourse(name=' + this.k1x_1 + ', startTime=' + this.l1x_1.toString() + ', segments=' + toString(this.m1x_1) + ', sport=' + this.n1x_1.toString() + ')';
147
+ return 'FitCourse(name=' + this.name_1 + ', startTime=' + this.startTime_1.toString() + ', segments=' + toString(this.segments_1) + ', sport=' + this.sport_1.toString() + ')';
129
148
  };
130
149
  protoOf(FitCourse).hashCode = function () {
131
- var result = getStringHashCode(this.k1x_1);
132
- result = imul(result, 31) + this.l1x_1.hashCode() | 0;
133
- result = imul(result, 31) + hashCode(this.m1x_1) | 0;
134
- result = imul(result, 31) + this.n1x_1.hashCode() | 0;
150
+ var result = getStringHashCode(this.name_1);
151
+ result = imul(result, 31) + this.startTime_1.hashCode() | 0;
152
+ result = imul(result, 31) + hashCode(this.segments_1) | 0;
153
+ result = imul(result, 31) + this.sport_1.hashCode() | 0;
135
154
  return result;
136
155
  };
137
156
  protoOf(FitCourse).equals = function (other) {
@@ -139,26 +158,26 @@
139
158
  return true;
140
159
  if (!(other instanceof FitCourse))
141
160
  return false;
142
- if (!(this.k1x_1 === other.k1x_1))
161
+ if (!(this.name_1 === other.name_1))
143
162
  return false;
144
- if (!this.l1x_1.equals(other.l1x_1))
163
+ if (!this.startTime_1.equals(other.startTime_1))
145
164
  return false;
146
- if (!equals(this.m1x_1, other.m1x_1))
165
+ if (!equals(this.segments_1, other.segments_1))
147
166
  return false;
148
- if (!this.n1x_1.equals(other.n1x_1))
167
+ if (!this.sport_1.equals(other.sport_1))
149
168
  return false;
150
169
  return true;
151
170
  };
152
171
  function FitSegment(records, lap) {
153
- this.o1x_1 = records;
154
- this.p1x_1 = lap;
172
+ this.records_1 = records;
173
+ this.lap_1 = lap;
155
174
  }
156
175
  protoOf(FitSegment).toString = function () {
157
- return 'FitSegment(records=' + toString(this.o1x_1) + ', lap=' + this.p1x_1.toString() + ')';
176
+ return 'FitSegment(records=' + toString(this.records_1) + ', lap=' + this.lap_1.toString() + ')';
158
177
  };
159
178
  protoOf(FitSegment).hashCode = function () {
160
- var result = hashCode(this.o1x_1);
161
- result = imul(result, 31) + this.p1x_1.hashCode() | 0;
179
+ var result = hashCode(this.records_1);
180
+ result = imul(result, 31) + this.lap_1.hashCode() | 0;
162
181
  return result;
163
182
  };
164
183
  protoOf(FitSegment).equals = function (other) {
@@ -166,9 +185,9 @@
166
185
  return true;
167
186
  if (!(other instanceof FitSegment))
168
187
  return false;
169
- if (!equals(this.o1x_1, other.o1x_1))
188
+ if (!equals(this.records_1, other.records_1))
170
189
  return false;
171
- if (!this.p1x_1.equals(other.p1x_1))
190
+ if (!this.lap_1.equals(other.lap_1))
172
191
  return false;
173
192
  return true;
174
193
  };
@@ -179,31 +198,31 @@
179
198
  heartRate = heartRate === VOID ? null : heartRate;
180
199
  cadence = cadence === VOID ? null : cadence;
181
200
  temperatureC = temperatureC === VOID ? null : temperatureC;
182
- this.q1x_1 = timestamp;
183
- this.r1x_1 = latitudeDeg;
184
- this.s1x_1 = longitudeDeg;
185
- this.t1x_1 = altitudeM;
186
- this.u1x_1 = distanceM;
187
- this.v1x_1 = speedMs;
188
- this.w1x_1 = powerW;
189
- this.x1x_1 = heartRate;
190
- this.y1x_1 = cadence;
191
- this.z1x_1 = temperatureC;
201
+ this.timestamp_1 = timestamp;
202
+ this.latitudeDeg_1 = latitudeDeg;
203
+ this.longitudeDeg_1 = longitudeDeg;
204
+ this.altitudeM_1 = altitudeM;
205
+ this.distanceM_1 = distanceM;
206
+ this.speedMs_1 = speedMs;
207
+ this.powerW_1 = powerW;
208
+ this.heartRate_1 = heartRate;
209
+ this.cadence_1 = cadence;
210
+ this.temperatureC_1 = temperatureC;
192
211
  }
193
212
  protoOf(FitRecord).toString = function () {
194
- return 'FitRecord(timestamp=' + this.q1x_1.toString() + ', latitudeDeg=' + this.r1x_1 + ', longitudeDeg=' + this.s1x_1 + ', altitudeM=' + this.t1x_1 + ', distanceM=' + this.u1x_1 + ', speedMs=' + this.v1x_1 + ', powerW=' + this.w1x_1 + ', heartRate=' + this.x1x_1 + ', cadence=' + this.y1x_1 + ', temperatureC=' + this.z1x_1 + ')';
213
+ return 'FitRecord(timestamp=' + this.timestamp_1.toString() + ', latitudeDeg=' + this.latitudeDeg_1 + ', longitudeDeg=' + this.longitudeDeg_1 + ', altitudeM=' + this.altitudeM_1 + ', distanceM=' + this.distanceM_1 + ', speedMs=' + this.speedMs_1 + ', powerW=' + this.powerW_1 + ', heartRate=' + this.heartRate_1 + ', cadence=' + this.cadence_1 + ', temperatureC=' + this.temperatureC_1 + ')';
195
214
  };
196
215
  protoOf(FitRecord).hashCode = function () {
197
- var result = this.q1x_1.hashCode();
198
- result = imul(result, 31) + getNumberHashCode(this.r1x_1) | 0;
199
- result = imul(result, 31) + getNumberHashCode(this.s1x_1) | 0;
200
- result = imul(result, 31) + (this.t1x_1 == null ? 0 : getNumberHashCode(this.t1x_1)) | 0;
201
- result = imul(result, 31) + getNumberHashCode(this.u1x_1) | 0;
202
- result = imul(result, 31) + (this.v1x_1 == null ? 0 : getNumberHashCode(this.v1x_1)) | 0;
203
- result = imul(result, 31) + (this.w1x_1 == null ? 0 : this.w1x_1) | 0;
204
- result = imul(result, 31) + (this.x1x_1 == null ? 0 : this.x1x_1) | 0;
205
- result = imul(result, 31) + (this.y1x_1 == null ? 0 : this.y1x_1) | 0;
206
- result = imul(result, 31) + (this.z1x_1 == null ? 0 : getNumberHashCode(this.z1x_1)) | 0;
216
+ var result = this.timestamp_1.hashCode();
217
+ result = imul(result, 31) + getNumberHashCode(this.latitudeDeg_1) | 0;
218
+ result = imul(result, 31) + getNumberHashCode(this.longitudeDeg_1) | 0;
219
+ result = imul(result, 31) + (this.altitudeM_1 == null ? 0 : getNumberHashCode(this.altitudeM_1)) | 0;
220
+ result = imul(result, 31) + getNumberHashCode(this.distanceM_1) | 0;
221
+ result = imul(result, 31) + (this.speedMs_1 == null ? 0 : getNumberHashCode(this.speedMs_1)) | 0;
222
+ result = imul(result, 31) + (this.powerW_1 == null ? 0 : this.powerW_1) | 0;
223
+ result = imul(result, 31) + (this.heartRate_1 == null ? 0 : this.heartRate_1) | 0;
224
+ result = imul(result, 31) + (this.cadence_1 == null ? 0 : this.cadence_1) | 0;
225
+ result = imul(result, 31) + (this.temperatureC_1 == null ? 0 : getNumberHashCode(this.temperatureC_1)) | 0;
207
226
  return result;
208
227
  };
209
228
  protoOf(FitRecord).equals = function (other) {
@@ -211,25 +230,25 @@
211
230
  return true;
212
231
  if (!(other instanceof FitRecord))
213
232
  return false;
214
- if (!this.q1x_1.equals(other.q1x_1))
233
+ if (!this.timestamp_1.equals(other.timestamp_1))
215
234
  return false;
216
- if (!equals(this.r1x_1, other.r1x_1))
235
+ if (!equals(this.latitudeDeg_1, other.latitudeDeg_1))
217
236
  return false;
218
- if (!equals(this.s1x_1, other.s1x_1))
237
+ if (!equals(this.longitudeDeg_1, other.longitudeDeg_1))
219
238
  return false;
220
- if (!equals(this.t1x_1, other.t1x_1))
239
+ if (!equals(this.altitudeM_1, other.altitudeM_1))
221
240
  return false;
222
- if (!equals(this.u1x_1, other.u1x_1))
241
+ if (!equals(this.distanceM_1, other.distanceM_1))
223
242
  return false;
224
- if (!equals(this.v1x_1, other.v1x_1))
243
+ if (!equals(this.speedMs_1, other.speedMs_1))
225
244
  return false;
226
- if (!(this.w1x_1 == other.w1x_1))
245
+ if (!(this.powerW_1 == other.powerW_1))
227
246
  return false;
228
- if (!(this.x1x_1 == other.x1x_1))
247
+ if (!(this.heartRate_1 == other.heartRate_1))
229
248
  return false;
230
- if (!(this.y1x_1 == other.y1x_1))
249
+ if (!(this.cadence_1 == other.cadence_1))
231
250
  return false;
232
- if (!equals(this.z1x_1, other.z1x_1))
251
+ if (!equals(this.temperatureC_1, other.temperatureC_1))
233
252
  return false;
234
253
  return true;
235
254
  };
@@ -241,37 +260,37 @@
241
260
  startLongitudeDeg = startLongitudeDeg === VOID ? null : startLongitudeDeg;
242
261
  endLatitudeDeg = endLatitudeDeg === VOID ? null : endLatitudeDeg;
243
262
  endLongitudeDeg = endLongitudeDeg === VOID ? null : endLongitudeDeg;
244
- this.a1y_1 = startTime;
245
- this.b1y_1 = totalElapsedTimeS;
246
- this.c1y_1 = totalTimerTimeS;
247
- this.d1y_1 = totalDistanceM;
248
- this.e1y_1 = totalAscentM;
249
- this.f1y_1 = totalDescentM;
250
- this.g1y_1 = maxSpeedMs;
251
- this.h1y_1 = minAltitudeM;
252
- this.i1y_1 = maxAltitudeM;
253
- this.j1y_1 = startLatitudeDeg;
254
- this.k1y_1 = startLongitudeDeg;
255
- this.l1y_1 = endLatitudeDeg;
256
- this.m1y_1 = endLongitudeDeg;
263
+ this.startTime_1 = startTime;
264
+ this.totalElapsedTimeS_1 = totalElapsedTimeS;
265
+ this.totalTimerTimeS_1 = totalTimerTimeS;
266
+ this.totalDistanceM_1 = totalDistanceM;
267
+ this.totalAscentM_1 = totalAscentM;
268
+ this.totalDescentM_1 = totalDescentM;
269
+ this.maxSpeedMs_1 = maxSpeedMs;
270
+ this.minAltitudeM_1 = minAltitudeM;
271
+ this.maxAltitudeM_1 = maxAltitudeM;
272
+ this.startLatitudeDeg_1 = startLatitudeDeg;
273
+ this.startLongitudeDeg_1 = startLongitudeDeg;
274
+ this.endLatitudeDeg_1 = endLatitudeDeg;
275
+ this.endLongitudeDeg_1 = endLongitudeDeg;
257
276
  }
258
277
  protoOf(FitLap).toString = function () {
259
- return 'FitLap(startTime=' + this.a1y_1.toString() + ', totalElapsedTimeS=' + this.b1y_1 + ', totalTimerTimeS=' + this.c1y_1 + ', totalDistanceM=' + this.d1y_1 + ', totalAscentM=' + this.e1y_1 + ', totalDescentM=' + this.f1y_1 + ', maxSpeedMs=' + this.g1y_1 + ', minAltitudeM=' + this.h1y_1 + ', maxAltitudeM=' + this.i1y_1 + ', startLatitudeDeg=' + this.j1y_1 + ', startLongitudeDeg=' + this.k1y_1 + ', endLatitudeDeg=' + this.l1y_1 + ', endLongitudeDeg=' + this.m1y_1 + ')';
278
+ return 'FitLap(startTime=' + this.startTime_1.toString() + ', totalElapsedTimeS=' + this.totalElapsedTimeS_1 + ', totalTimerTimeS=' + this.totalTimerTimeS_1 + ', totalDistanceM=' + this.totalDistanceM_1 + ', totalAscentM=' + this.totalAscentM_1 + ', totalDescentM=' + this.totalDescentM_1 + ', maxSpeedMs=' + this.maxSpeedMs_1 + ', minAltitudeM=' + this.minAltitudeM_1 + ', maxAltitudeM=' + this.maxAltitudeM_1 + ', startLatitudeDeg=' + this.startLatitudeDeg_1 + ', startLongitudeDeg=' + this.startLongitudeDeg_1 + ', endLatitudeDeg=' + this.endLatitudeDeg_1 + ', endLongitudeDeg=' + this.endLongitudeDeg_1 + ')';
260
279
  };
261
280
  protoOf(FitLap).hashCode = function () {
262
- var result = this.a1y_1.hashCode();
263
- result = imul(result, 31) + getNumberHashCode(this.b1y_1) | 0;
264
- result = imul(result, 31) + getNumberHashCode(this.c1y_1) | 0;
265
- result = imul(result, 31) + getNumberHashCode(this.d1y_1) | 0;
266
- result = imul(result, 31) + this.e1y_1 | 0;
267
- result = imul(result, 31) + this.f1y_1 | 0;
268
- result = imul(result, 31) + (this.g1y_1 == null ? 0 : getNumberHashCode(this.g1y_1)) | 0;
269
- result = imul(result, 31) + (this.h1y_1 == null ? 0 : getNumberHashCode(this.h1y_1)) | 0;
270
- result = imul(result, 31) + (this.i1y_1 == null ? 0 : getNumberHashCode(this.i1y_1)) | 0;
271
- result = imul(result, 31) + (this.j1y_1 == null ? 0 : getNumberHashCode(this.j1y_1)) | 0;
272
- result = imul(result, 31) + (this.k1y_1 == null ? 0 : getNumberHashCode(this.k1y_1)) | 0;
273
- result = imul(result, 31) + (this.l1y_1 == null ? 0 : getNumberHashCode(this.l1y_1)) | 0;
274
- result = imul(result, 31) + (this.m1y_1 == null ? 0 : getNumberHashCode(this.m1y_1)) | 0;
281
+ var result = this.startTime_1.hashCode();
282
+ result = imul(result, 31) + getNumberHashCode(this.totalElapsedTimeS_1) | 0;
283
+ result = imul(result, 31) + getNumberHashCode(this.totalTimerTimeS_1) | 0;
284
+ result = imul(result, 31) + getNumberHashCode(this.totalDistanceM_1) | 0;
285
+ result = imul(result, 31) + this.totalAscentM_1 | 0;
286
+ result = imul(result, 31) + this.totalDescentM_1 | 0;
287
+ result = imul(result, 31) + (this.maxSpeedMs_1 == null ? 0 : getNumberHashCode(this.maxSpeedMs_1)) | 0;
288
+ result = imul(result, 31) + (this.minAltitudeM_1 == null ? 0 : getNumberHashCode(this.minAltitudeM_1)) | 0;
289
+ result = imul(result, 31) + (this.maxAltitudeM_1 == null ? 0 : getNumberHashCode(this.maxAltitudeM_1)) | 0;
290
+ result = imul(result, 31) + (this.startLatitudeDeg_1 == null ? 0 : getNumberHashCode(this.startLatitudeDeg_1)) | 0;
291
+ result = imul(result, 31) + (this.startLongitudeDeg_1 == null ? 0 : getNumberHashCode(this.startLongitudeDeg_1)) | 0;
292
+ result = imul(result, 31) + (this.endLatitudeDeg_1 == null ? 0 : getNumberHashCode(this.endLatitudeDeg_1)) | 0;
293
+ result = imul(result, 31) + (this.endLongitudeDeg_1 == null ? 0 : getNumberHashCode(this.endLongitudeDeg_1)) | 0;
275
294
  return result;
276
295
  };
277
296
  protoOf(FitLap).equals = function (other) {
@@ -279,49 +298,270 @@
279
298
  return true;
280
299
  if (!(other instanceof FitLap))
281
300
  return false;
282
- if (!this.a1y_1.equals(other.a1y_1))
301
+ if (!this.startTime_1.equals(other.startTime_1))
283
302
  return false;
284
- if (!equals(this.b1y_1, other.b1y_1))
303
+ if (!equals(this.totalElapsedTimeS_1, other.totalElapsedTimeS_1))
285
304
  return false;
286
- if (!equals(this.c1y_1, other.c1y_1))
305
+ if (!equals(this.totalTimerTimeS_1, other.totalTimerTimeS_1))
287
306
  return false;
288
- if (!equals(this.d1y_1, other.d1y_1))
307
+ if (!equals(this.totalDistanceM_1, other.totalDistanceM_1))
289
308
  return false;
290
- if (!(this.e1y_1 === other.e1y_1))
309
+ if (!(this.totalAscentM_1 === other.totalAscentM_1))
291
310
  return false;
292
- if (!(this.f1y_1 === other.f1y_1))
311
+ if (!(this.totalDescentM_1 === other.totalDescentM_1))
293
312
  return false;
294
- if (!equals(this.g1y_1, other.g1y_1))
313
+ if (!equals(this.maxSpeedMs_1, other.maxSpeedMs_1))
295
314
  return false;
296
- if (!equals(this.h1y_1, other.h1y_1))
315
+ if (!equals(this.minAltitudeM_1, other.minAltitudeM_1))
297
316
  return false;
298
- if (!equals(this.i1y_1, other.i1y_1))
317
+ if (!equals(this.maxAltitudeM_1, other.maxAltitudeM_1))
299
318
  return false;
300
- if (!equals(this.j1y_1, other.j1y_1))
319
+ if (!equals(this.startLatitudeDeg_1, other.startLatitudeDeg_1))
301
320
  return false;
302
- if (!equals(this.k1y_1, other.k1y_1))
321
+ if (!equals(this.startLongitudeDeg_1, other.startLongitudeDeg_1))
303
322
  return false;
304
- if (!equals(this.l1y_1, other.l1y_1))
323
+ if (!equals(this.endLatitudeDeg_1, other.endLatitudeDeg_1))
305
324
  return false;
306
- if (!equals(this.m1y_1, other.m1y_1))
325
+ if (!equals(this.endLongitudeDeg_1, other.endLongitudeDeg_1))
307
326
  return false;
308
327
  return true;
309
328
  };
310
329
  function FitSport_CYCLING_getInstance() {
311
- FitSport_initEntries();
330
+ static_init();
312
331
  return FitSport_CYCLING_instance;
313
332
  }
333
+ function fileIdMesg($this, course) {
334
+ // Inline function 'kotlin.apply' call
335
+ var this_0 = FileIdMesg_init_$Create$();
336
+ this_0.set_type_p09upi_k$(File_COURSE_getInstance());
337
+ this_0.set_manufacturer_o24uie_k$(Manufacturer_DYNASTREAM_getInstance());
338
+ this_0.set_product_ocp49n_k$(_UShort___init__impl__jigrne(12345));
339
+ this_0.set_serialNumber_x7w2s6_k$(_UInt___init__impl__l7qpdl(12345));
340
+ // Inline function 'kotlin.toUShort' call
341
+ var this_1 = getStringHashCode(course.name_1) & 65535;
342
+ var tmp$ret$2 = _UShort___init__impl__jigrne(toShort(this_1));
343
+ this_0.set_number_htl6z3_k$(tmp$ret$2);
344
+ this_0.set_timeCreated_hwevrz_k$(course.startTime_1);
345
+ return this_0;
346
+ }
347
+ function courseMesg($this, course) {
348
+ // Inline function 'kotlin.apply' call
349
+ var this_0 = CourseMesg_init_$Create$();
350
+ this_0.set_name_wkmnld_k$(course.name_1);
351
+ this_0.set_sport_ql7rac_k$(toSdkSport(FitEncoder_getInstance(), course.sport_1));
352
+ return this_0;
353
+ }
354
+ function lapMesg($this, lap) {
355
+ // Inline function 'kotlin.apply' call
356
+ var this_0 = LapMesg_init_$Create$();
357
+ this_0.set_startTime_gpvleb_k$(lap.startTime_1);
358
+ this_0.set_timestamp_g7bday_k$(lap.startTime_1.plus_tegsqz_k$(secondsAsDuration(FitEncoder_getInstance(), lap.totalElapsedTimeS_1)));
359
+ this_0.set_totalElapsedTime_5may4p_k$(lap.totalElapsedTimeS_1);
360
+ this_0.set_totalTimerTime_is2q9s_k$(lap.totalTimerTimeS_1);
361
+ this_0.set_totalDistance_u680xd_k$(lap.totalDistanceM_1);
362
+ // Inline function 'kotlin.toUShort' call
363
+ var this_1 = lap.totalAscentM_1;
364
+ var tmp$ret$2 = _UShort___init__impl__jigrne(toShort(this_1));
365
+ this_0.set_totalAscent_h748uu_k$(tmp$ret$2);
366
+ // Inline function 'kotlin.toUShort' call
367
+ var this_2 = lap.totalDescentM_1;
368
+ var tmp$ret$3 = _UShort___init__impl__jigrne(toShort(this_2));
369
+ this_0.set_totalDescent_xazvo_k$(tmp$ret$3);
370
+ if (lap.totalTimerTimeS_1 > 0.0) {
371
+ this_0.set_avgSpeed_wl7p6h_k$(lap.totalDistanceM_1 / lap.totalTimerTimeS_1);
372
+ }
373
+ var tmp0_safe_receiver = lap.maxSpeedMs_1;
374
+ if (tmp0_safe_receiver == null)
375
+ null;
376
+ else {
377
+ // Inline function 'kotlin.let' call
378
+ this_0.set_maxSpeed_zf8xrp_k$(tmp0_safe_receiver);
379
+ }
380
+ var tmp1_safe_receiver = lap.minAltitudeM_1;
381
+ if (tmp1_safe_receiver == null)
382
+ null;
383
+ else {
384
+ // Inline function 'kotlin.let' call
385
+ this_0.set_minAltitude_th05po_k$(tmp1_safe_receiver);
386
+ }
387
+ var tmp2_safe_receiver = lap.maxAltitudeM_1;
388
+ if (tmp2_safe_receiver == null)
389
+ null;
390
+ else {
391
+ // Inline function 'kotlin.let' call
392
+ this_0.set_maxAltitude_o8im4i_k$(tmp2_safe_receiver);
393
+ }
394
+ var tmp3_safe_receiver = lap.startLatitudeDeg_1;
395
+ if (tmp3_safe_receiver == null)
396
+ null;
397
+ else {
398
+ // Inline function 'kotlin.let' call
399
+ this_0.set_startPositionLat_i4v4h6_k$(FitUnits_getInstance().degreesToSemicircles_1s9utv_k$(tmp3_safe_receiver));
400
+ }
401
+ var tmp4_safe_receiver = lap.startLongitudeDeg_1;
402
+ if (tmp4_safe_receiver == null)
403
+ null;
404
+ else {
405
+ // Inline function 'kotlin.let' call
406
+ this_0.set_startPositionLong_856b8x_k$(FitUnits_getInstance().degreesToSemicircles_1s9utv_k$(tmp4_safe_receiver));
407
+ }
408
+ var tmp5_safe_receiver = lap.endLatitudeDeg_1;
409
+ if (tmp5_safe_receiver == null)
410
+ null;
411
+ else {
412
+ // Inline function 'kotlin.let' call
413
+ this_0.set_endPositionLat_fik6v1_k$(FitUnits_getInstance().degreesToSemicircles_1s9utv_k$(tmp5_safe_receiver));
414
+ }
415
+ var tmp6_safe_receiver = lap.endLongitudeDeg_1;
416
+ if (tmp6_safe_receiver == null)
417
+ null;
418
+ else {
419
+ // Inline function 'kotlin.let' call
420
+ this_0.set_endPositionLong_ufoddk_k$(FitUnits_getInstance().degreesToSemicircles_1s9utv_k$(tmp6_safe_receiver));
421
+ }
422
+ return this_0;
423
+ }
424
+ function recordMesg($this, record) {
425
+ // Inline function 'kotlin.apply' call
426
+ var this_0 = RecordMesg_init_$Create$();
427
+ this_0.set_timestamp_g7bday_k$(record.timestamp_1);
428
+ this_0.set_positionLat_45irwe_k$(FitUnits_getInstance().degreesToSemicircles_1s9utv_k$(record.latitudeDeg_1));
429
+ this_0.set_positionLong_ribzbt_k$(FitUnits_getInstance().degreesToSemicircles_1s9utv_k$(record.longitudeDeg_1));
430
+ this_0.set_distance_unowtj_k$(record.distanceM_1);
431
+ var tmp0_safe_receiver = record.altitudeM_1;
432
+ if (tmp0_safe_receiver == null)
433
+ null;
434
+ else {
435
+ // Inline function 'kotlin.let' call
436
+ this_0.set_altitude_n5x9g4_k$(tmp0_safe_receiver);
437
+ }
438
+ var tmp1_safe_receiver = record.speedMs_1;
439
+ if (tmp1_safe_receiver == null)
440
+ null;
441
+ else {
442
+ // Inline function 'kotlin.let' call
443
+ this_0.set_speed_8oaspt_k$(tmp1_safe_receiver);
444
+ }
445
+ var tmp2_safe_receiver = record.powerW_1;
446
+ if (tmp2_safe_receiver == null)
447
+ null;
448
+ else {
449
+ // Inline function 'kotlin.let' call
450
+ // Inline function 'kotlin.toUShort' call
451
+ var tmp$ret$8 = _UShort___init__impl__jigrne(toShort(tmp2_safe_receiver));
452
+ this_0.set_power_jxusa9_k$(tmp$ret$8);
453
+ }
454
+ var tmp3_safe_receiver = record.heartRate_1;
455
+ if (tmp3_safe_receiver == null)
456
+ null;
457
+ else {
458
+ // Inline function 'kotlin.let' call
459
+ // Inline function 'kotlin.toUByte' call
460
+ var tmp$ret$11 = _UByte___init__impl__g9hnc4(toByte(tmp3_safe_receiver));
461
+ this_0.set_heartRate_7mkxew_k$(tmp$ret$11);
462
+ }
463
+ var tmp4_safe_receiver = record.cadence_1;
464
+ if (tmp4_safe_receiver == null)
465
+ null;
466
+ else {
467
+ // Inline function 'kotlin.let' call
468
+ // Inline function 'kotlin.toUByte' call
469
+ var tmp$ret$14 = _UByte___init__impl__g9hnc4(toByte(tmp4_safe_receiver));
470
+ this_0.set_cadence_i2hkh9_k$(tmp$ret$14);
471
+ }
472
+ var tmp5_safe_receiver = record.temperatureC_1;
473
+ if (tmp5_safe_receiver == null)
474
+ null;
475
+ else {
476
+ // Inline function 'kotlin.let' call
477
+ this_0.set_temperature_nnz6s4_k$(toByte(roundToInt(tmp5_safe_receiver)));
478
+ }
479
+ return this_0;
480
+ }
481
+ function timerEvent($this, at, type) {
482
+ // Inline function 'kotlin.apply' call
483
+ var this_0 = EventMesg_init_$Create$();
484
+ this_0.set_event_s3s3to_k$(Event_TIMER_getInstance());
485
+ this_0.set_eventType_1ujcik_k$(type);
486
+ this_0.set_eventGroup_4wrvtr_k$(_UByte___init__impl__g9hnc4(0));
487
+ this_0.set_timestamp_g7bday_k$(at);
488
+ return this_0;
489
+ }
490
+ function toSdkSport($this, $receiver) {
491
+ var tmp;
492
+ switch ($receiver.ordinal_1) {
493
+ case 0:
494
+ tmp = Sport_CYCLING_getInstance();
495
+ break;
496
+ case 1:
497
+ tmp = Sport_RUNNING_getInstance();
498
+ break;
499
+ case 2:
500
+ tmp = Sport_GENERIC_getInstance();
501
+ break;
502
+ default:
503
+ noWhenBranchMatchedException();
504
+ break;
505
+ }
506
+ return tmp;
507
+ }
508
+ function secondsAsDuration($this, $receiver) {
509
+ Companion_getInstance();
510
+ // Inline function 'kotlin.time.Companion.milliseconds' call
511
+ var this_0 = numberToLong($receiver * 1000.0);
512
+ return toDuration(this_0, DurationUnit_MILLISECONDS_getInstance());
513
+ }
514
+ function FitEncoder_0() {
515
+ FitEncoder_instance = this;
516
+ this.PRODUCT_ID_1 = _UShort___init__impl__jigrne(12345);
517
+ this.SERIAL_NUMBER_1 = _UInt___init__impl__l7qpdl(12345);
518
+ }
519
+ protoOf(FitEncoder_0).encode_5fozs1_k$ = function (course) {
520
+ // Inline function 'com.garmin.fit.encodeFit' call
521
+ var endianness = Endianness_LITTLE_getInstance();
522
+ // Inline function 'kotlin.apply' call
523
+ var this_0 = new FitEncoder(VOID, VOID, endianness);
524
+ this_0.write_h1oj8u_k$(fileIdMesg(FitEncoder_getInstance(), course));
525
+ this_0.write_h1oj8u_k$(courseMesg(FitEncoder_getInstance(), course));
526
+ var _iterator__ex2g4s = course.segments_1.iterator_jk1svi_k$();
527
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
528
+ var segment = _iterator__ex2g4s.next_20eer_k$();
529
+ this_0.write_h1oj8u_k$(lapMesg(FitEncoder_getInstance(), segment.lap_1));
530
+ }
531
+ var iterator = course.segments_1.iterator_jk1svi_k$();
532
+ var index = 0;
533
+ while (iterator.hasNext_bitz1p_k$()) {
534
+ var index_0 = index;
535
+ index = index + 1 | 0;
536
+ var segment_0 = iterator.next_20eer_k$();
537
+ var isLast = index_0 === get_lastIndex(course.segments_1);
538
+ this_0.write_h1oj8u_k$(timerEvent(FitEncoder_getInstance(), first(segment_0.records_1).timestamp_1, EventType_START_getInstance()));
539
+ var _iterator__ex2g4s_0 = segment_0.records_1.iterator_jk1svi_k$();
540
+ while (_iterator__ex2g4s_0.hasNext_bitz1p_k$()) {
541
+ var record = _iterator__ex2g4s_0.next_20eer_k$();
542
+ this_0.write_h1oj8u_k$(recordMesg(FitEncoder_getInstance(), record));
543
+ }
544
+ this_0.write_h1oj8u_k$(timerEvent(FitEncoder_getInstance(), last(segment_0.records_1).timestamp_1, isLast ? EventType_STOP_ALL_getInstance() : EventType_STOP_getInstance()));
545
+ }
546
+ return this_0.close_1keygo_k$();
547
+ };
548
+ var FitEncoder_instance;
549
+ function FitEncoder_getInstance() {
550
+ if (FitEncoder_instance == null)
551
+ new FitEncoder_0();
552
+ return FitEncoder_instance;
553
+ }
314
554
  function FitUnits() {
315
555
  FitUnits_instance = this;
316
- this.n1y_1 = new Long(-294592512, 146);
317
- this.o1y_1 = new Long(631065600, 0);
318
- this.p1y_1 = 1.1930464711111112E7;
319
- this.q1y_1 = 5.0;
320
- this.r1y_1 = 500.0;
321
- this.s1y_1 = 100.0;
322
- this.t1y_1 = 1000.0;
556
+ this.FIT_EPOCH_OFFSET_MS_1 = new Long(-294592512, 146);
557
+ this.FIT_EPOCH_OFFSET_S_1 = new Long(631065600, 0);
558
+ this.SEMICIRCLES_PER_DEGREE_1 = 1.1930464711111112E7;
559
+ this.ALTITUDE_SCALE_1 = 5.0;
560
+ this.ALTITUDE_OFFSET_M_1 = 500.0;
561
+ this.DISTANCE_SCALE_1 = 100.0;
562
+ this.SPEED_SCALE_1 = 1000.0;
323
563
  }
324
- protoOf(FitUnits).u1y = function (degrees) {
564
+ protoOf(FitUnits).degreesToSemicircles_1s9utv_k$ = function (degrees) {
325
565
  return roundToInt(degrees * 1.1930464711111112E7);
326
566
  };
327
567
  var FitUnits_instance;
@@ -332,12 +572,12 @@
332
572
  }
333
573
  function toFitBytes(_this__u8e3s4, name, startTime, sport) {
334
574
  sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
335
- return FitEncoder_instance.x1y(toFitCourse(_this__u8e3s4, name, startTime, sport));
575
+ return FitEncoder_getInstance().encode_5fozs1_k$(toFitCourse(_this__u8e3s4, name, startTime, sport));
336
576
  }
337
577
  function toFitBytes_0(_this__u8e3s4, name, startTime, sport, interPathGap) {
338
578
  sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
339
- interPathGap = interPathGap === VOID ? Companion_getInstance().dd_1 : interPathGap;
340
- return FitEncoder_instance.x1y(toFitCourse_0(_this__u8e3s4, name, startTime, sport, interPathGap));
579
+ interPathGap = interPathGap === VOID ? Companion_getInstance().ZERO_1 : interPathGap;
580
+ return FitEncoder_getInstance().encode_5fozs1_k$(toFitCourse_0(_this__u8e3s4, name, startTime, sport, interPathGap));
341
581
  }
342
582
  function toFitCourse(_this__u8e3s4, name, startTime, sport) {
343
583
  sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
@@ -345,10 +585,10 @@
345
585
  }
346
586
  function toFitCourse_0(_this__u8e3s4, name, startTime, sport, interPathGap) {
347
587
  sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
348
- interPathGap = interPathGap === VOID ? Companion_getInstance().dd_1 : interPathGap;
588
+ interPathGap = interPathGap === VOID ? Companion_getInstance().ZERO_1 : interPathGap;
349
589
  // Inline function 'kotlin.collections.isNotEmpty' call
350
590
  // Inline function 'kotlin.require' call
351
- if (!!_this__u8e3s4.n()) {
591
+ if (!!_this__u8e3s4.isEmpty_y1axqb_k$()) {
352
592
  var message = 'Cannot build a FIT course from an empty list of paths';
353
593
  throw IllegalArgumentException_init_$Create$(toString(message));
354
594
  }
@@ -357,7 +597,7 @@
357
597
  // Inline function 'kotlin.collections.all' call
358
598
  var tmp;
359
599
  if (isInterface(_this__u8e3s4, Collection)) {
360
- tmp = _this__u8e3s4.n();
600
+ tmp = _this__u8e3s4.isEmpty_y1axqb_k$();
361
601
  } else {
362
602
  tmp = false;
363
603
  }
@@ -365,10 +605,10 @@
365
605
  tmp$ret$3 = true;
366
606
  break $l$block_0;
367
607
  }
368
- var _iterator__ex2g4s = _this__u8e3s4.i();
369
- while (_iterator__ex2g4s.j()) {
370
- var element = _iterator__ex2g4s.k();
371
- if (!(element.f1r_1 > 0)) {
608
+ var _iterator__ex2g4s = _this__u8e3s4.iterator_jk1svi_k$();
609
+ while (_iterator__ex2g4s.hasNext_bitz1p_k$()) {
610
+ var element = _iterator__ex2g4s.next_20eer_k$();
611
+ if (!(element.size_1 > 0)) {
372
612
  tmp$ret$3 = false;
373
613
  break $l$block_0;
374
614
  }
@@ -384,34 +624,34 @@
384
624
  // Inline function 'kotlin.collections.map' call
385
625
  // Inline function 'kotlin.collections.mapTo' call
386
626
  var destination = ArrayList_init_$Create$(collectionSizeOrDefault(_this__u8e3s4, 10));
387
- var _iterator__ex2g4s_0 = _this__u8e3s4.i();
388
- while (_iterator__ex2g4s_0.j()) {
389
- var item = _iterator__ex2g4s_0.k();
627
+ var _iterator__ex2g4s_0 = _this__u8e3s4.iterator_jk1svi_k$();
628
+ while (_iterator__ex2g4s_0.hasNext_bitz1p_k$()) {
629
+ var item = _iterator__ex2g4s_0.next_20eer_k$();
390
630
  var segment = toFitSegment(item, segmentStart);
391
- segmentStart = last(segment.o1x_1).q1x_1.vd(interPathGap);
392
- destination.h(segment);
631
+ segmentStart = last(segment.records_1).timestamp_1.plus_tegsqz_k$(interPathGap);
632
+ destination.add_utx5q5_k$(segment);
393
633
  }
394
634
  var segments = destination;
395
635
  return new FitCourse(name, startTime, segments, sport);
396
636
  }
397
637
  function toFitSegment(_this__u8e3s4, startTime) {
398
- var t0 = _this__u8e3s4.k1r(0);
638
+ var t0 = _this__u8e3s4.time_ryc845_k$(0);
399
639
  var inductionVariable = 1;
400
- var last = _this__u8e3s4.f1r_1;
640
+ var last = _this__u8e3s4.size_1;
401
641
  if (inductionVariable < last)
402
642
  do {
403
643
  var i = inductionVariable;
404
644
  inductionVariable = inductionVariable + 1 | 0;
405
645
  // Inline function 'kotlin.require' call
406
- if (!(_this__u8e3s4.k1r(i) >= _this__u8e3s4.k1r(i - 1 | 0))) {
407
- var message = 'Path time must be monotonic to encode a FIT file, but time(' + i + ') = ' + _this__u8e3s4.k1r(i) + ' < time(' + (i - 1 | 0) + ') = ' + _this__u8e3s4.k1r(i - 1 | 0);
646
+ if (!(_this__u8e3s4.time_ryc845_k$(i) >= _this__u8e3s4.time_ryc845_k$(i - 1 | 0))) {
647
+ var message = 'Path time must be monotonic to encode a FIT file, but time(' + i + ') = ' + _this__u8e3s4.time_ryc845_k$(i) + ' < time(' + (i - 1 | 0) + ') = ' + _this__u8e3s4.time_ryc845_k$(i - 1 | 0);
408
648
  throw IllegalArgumentException_init_$Create$(toString(message));
409
649
  }
410
650
  }
411
651
  while (inductionVariable < last);
412
652
  // Inline function 'kotlin.collections.List' call
413
653
  // Inline function 'kotlin.collections.MutableList' call
414
- var size = _this__u8e3s4.f1r_1;
654
+ var size = _this__u8e3s4.size_1;
415
655
  var list = ArrayList_init_$Create$(size);
416
656
  // Inline function 'kotlin.repeat' call
417
657
  var inductionVariable_0 = 0;
@@ -421,13 +661,13 @@
421
661
  inductionVariable_0 = inductionVariable_0 + 1 | 0;
422
662
  Companion_getInstance();
423
663
  // Inline function 'kotlin.time.Companion.milliseconds' call
424
- var this_0 = numberToLong(_this__u8e3s4.k1r(index) - t0);
664
+ var this_0 = numberToLong(_this__u8e3s4.time_ryc845_k$(index) - t0);
425
665
  var tmp$ret$7 = toDuration(this_0, DurationUnit_MILLISECONDS_getInstance());
426
- var tmp = startTime.vd(tmp$ret$7);
427
- var tmp_0 = _this__u8e3s4.h1r(index) * 57.29577951308232;
428
- var tmp_1 = _this__u8e3s4.i1r(index) * 57.29577951308232;
666
+ var tmp = startTime.plus_tegsqz_k$(tmp$ret$7);
667
+ var tmp_0 = _this__u8e3s4.latitude_gb4iok_k$(index) * 57.29577951308232;
668
+ var tmp_1 = _this__u8e3s4.longitude_a9xl_k$(index) * 57.29577951308232;
429
669
  // Inline function 'kotlin.takeUnless' call
430
- var this_1 = _this__u8e3s4.j1r(index);
670
+ var this_1 = _this__u8e3s4.elevation_iziwkb_k$(index);
431
671
  var tmp_2;
432
672
  if (!isNaN_0(this_1)) {
433
673
  tmp_2 = this_1;
@@ -435,9 +675,9 @@
435
675
  tmp_2 = null;
436
676
  }
437
677
  var tmp_3 = tmp_2;
438
- var tmp_4 = _this__u8e3s4.w1u(index);
678
+ var tmp_4 = _this__u8e3s4.distance_5s4s77_k$(index);
439
679
  // Inline function 'kotlin.takeUnless' call
440
- var this_2 = _this__u8e3s4.x1v(index);
680
+ var this_2 = _this__u8e3s4.speed_npav2n_k$(index);
441
681
  var tmp_5;
442
682
  if (!isNaN_0(this_2)) {
443
683
  tmp_5 = this_2;
@@ -445,35 +685,35 @@
445
685
  tmp_5 = null;
446
686
  }
447
687
  var tmp_6 = tmp_5;
448
- var tmp0_safe_receiver = optionalComputed(_this__u8e3s4.p1r(index));
688
+ var tmp0_safe_receiver = optionalComputed(_this__u8e3s4.pComputedPower_g6dnn4_k$(index));
449
689
  var tmp_7 = tmp0_safe_receiver == null ? null : roundToInt(tmp0_safe_receiver);
450
- var tmp1_safe_receiver = optionalSensor(_this__u8e3s4.l1r(index));
690
+ var tmp1_safe_receiver = optionalSensor(_this__u8e3s4.heartRate_qiaqfm_k$(index));
451
691
  var tmp_8 = tmp1_safe_receiver == null ? null : roundToInt(tmp1_safe_receiver);
452
- var tmp2_safe_receiver = optionalSensor(_this__u8e3s4.m1r(index));
453
- var tmp$ret$6 = new FitRecord(tmp, tmp_0, tmp_1, tmp_3, tmp_4, tmp_6, tmp_7, tmp_8, tmp2_safe_receiver == null ? null : roundToInt(tmp2_safe_receiver), optionalSensor(_this__u8e3s4.n1r(index)));
454
- list.h(tmp$ret$6);
692
+ var tmp2_safe_receiver = optionalSensor(_this__u8e3s4.cadence_h3r7af_k$(index));
693
+ var tmp$ret$6 = new FitRecord(tmp, tmp_0, tmp_1, tmp_3, tmp_4, tmp_6, tmp_7, tmp_8, tmp2_safe_receiver == null ? null : roundToInt(tmp2_safe_receiver), optionalSensor(_this__u8e3s4.temperature_6yw0ik_k$(index)));
694
+ list.add_utx5q5_k$(tmp$ret$6);
455
695
  }
456
696
  while (inductionVariable_0 < size);
457
697
  var records = list;
458
- var tmp_9 = _this__u8e3s4.o1s_1 / 1000.0;
459
- var tmp_10 = _this__u8e3s4.o1s_1 / 1000.0;
460
- var tmp_11 = _this__u8e3s4.j1s_1;
461
- var tmp_12 = roundToIntOrZero(_this__u8e3s4.m1s_1);
462
- var tmp_13 = roundToIntOrZero(-_this__u8e3s4.n1s_1);
463
- var tmp0 = until(0, _this__u8e3s4.f1r_1);
698
+ var tmp_9 = _this__u8e3s4.durationMs_1 / 1000.0;
699
+ var tmp_10 = _this__u8e3s4.durationMs_1 / 1000.0;
700
+ var tmp_11 = _this__u8e3s4.totalDistance_1;
701
+ var tmp_12 = roundToIntOrZero(_this__u8e3s4.elevationGain_1);
702
+ var tmp_13 = roundToIntOrZero(-_this__u8e3s4.elevationLoss_1);
703
+ var tmp0 = until(0, _this__u8e3s4.size_1);
464
704
  var tmp$ret$12;
465
705
  $l$block: {
466
706
  // Inline function 'kotlin.collections.maxOfOrNull' call
467
- var iterator = tmp0.i();
468
- if (!iterator.j()) {
707
+ var iterator = tmp0.iterator_jk1svi_k$();
708
+ if (!iterator.hasNext_bitz1p_k$()) {
469
709
  tmp$ret$12 = null;
470
710
  break $l$block;
471
711
  }
472
- var it = iterator.k();
473
- var maxValue = _this__u8e3s4.x1v(it);
474
- while (iterator.j()) {
475
- var it_0 = iterator.k();
476
- var v = _this__u8e3s4.x1v(it_0);
712
+ var it = iterator.next_20eer_k$();
713
+ var maxValue = _this__u8e3s4.speed_npav2n_k$(it);
714
+ while (iterator.hasNext_bitz1p_k$()) {
715
+ var it_0 = iterator.next_20eer_k$();
716
+ var v = _this__u8e3s4.speed_npav2n_k$(it_0);
477
717
  // Inline function 'kotlin.comparisons.maxOf' call
478
718
  var a = maxValue;
479
719
  maxValue = Math.max(a, v);
@@ -495,20 +735,20 @@
495
735
  tmp_14 = tmp_15;
496
736
  }
497
737
  var tmp_16 = tmp_14;
498
- var tmp0_0 = until(0, _this__u8e3s4.f1r_1);
738
+ var tmp0_0 = until(0, _this__u8e3s4.size_1);
499
739
  var tmp$ret$18;
500
740
  $l$block_0: {
501
741
  // Inline function 'kotlin.collections.minOfOrNull' call
502
- var iterator_0 = tmp0_0.i();
503
- if (!iterator_0.j()) {
742
+ var iterator_0 = tmp0_0.iterator_jk1svi_k$();
743
+ if (!iterator_0.hasNext_bitz1p_k$()) {
504
744
  tmp$ret$18 = null;
505
745
  break $l$block_0;
506
746
  }
507
- var it_1 = iterator_0.k();
508
- var minValue = _this__u8e3s4.j1r(it_1);
509
- while (iterator_0.j()) {
510
- var it_2 = iterator_0.k();
511
- var v_0 = _this__u8e3s4.j1r(it_2);
747
+ var it_1 = iterator_0.next_20eer_k$();
748
+ var minValue = _this__u8e3s4.elevation_iziwkb_k$(it_1);
749
+ while (iterator_0.hasNext_bitz1p_k$()) {
750
+ var it_2 = iterator_0.next_20eer_k$();
751
+ var v_0 = _this__u8e3s4.elevation_iziwkb_k$(it_2);
512
752
  // Inline function 'kotlin.comparisons.minOf' call
513
753
  var a_0 = minValue;
514
754
  minValue = Math.min(a_0, v_0);
@@ -530,20 +770,20 @@
530
770
  tmp_17 = tmp_18;
531
771
  }
532
772
  var tmp_19 = tmp_17;
533
- var tmp0_1 = until(0, _this__u8e3s4.f1r_1);
773
+ var tmp0_1 = until(0, _this__u8e3s4.size_1);
534
774
  var tmp$ret$24;
535
775
  $l$block_1: {
536
776
  // Inline function 'kotlin.collections.maxOfOrNull' call
537
- var iterator_1 = tmp0_1.i();
538
- if (!iterator_1.j()) {
777
+ var iterator_1 = tmp0_1.iterator_jk1svi_k$();
778
+ if (!iterator_1.hasNext_bitz1p_k$()) {
539
779
  tmp$ret$24 = null;
540
780
  break $l$block_1;
541
781
  }
542
- var it_3 = iterator_1.k();
543
- var maxValue_0 = _this__u8e3s4.j1r(it_3);
544
- while (iterator_1.j()) {
545
- var it_4 = iterator_1.k();
546
- var v_1 = _this__u8e3s4.j1r(it_4);
782
+ var it_3 = iterator_1.next_20eer_k$();
783
+ var maxValue_0 = _this__u8e3s4.elevation_iziwkb_k$(it_3);
784
+ while (iterator_1.hasNext_bitz1p_k$()) {
785
+ var it_4 = iterator_1.next_20eer_k$();
786
+ var v_1 = _this__u8e3s4.elevation_iziwkb_k$(it_4);
547
787
  // Inline function 'kotlin.comparisons.maxOf' call
548
788
  var a_1 = maxValue_0;
549
789
  maxValue_0 = Math.max(a_1, v_1);
@@ -564,7 +804,7 @@
564
804
  }
565
805
  tmp_20 = tmp_21;
566
806
  }
567
- return new FitSegment(records, new FitLap(startTime, tmp_9, tmp_10, tmp_11, tmp_12, tmp_13, tmp_16, tmp_19, tmp_20, _this__u8e3s4.h1r(0) * 57.29577951308232, _this__u8e3s4.i1r(0) * 57.29577951308232, _this__u8e3s4.h1r(_this__u8e3s4.f1r_1 - 1 | 0) * 57.29577951308232, _this__u8e3s4.i1r(_this__u8e3s4.f1r_1 - 1 | 0) * 57.29577951308232));
807
+ return new FitSegment(records, new FitLap(startTime, tmp_9, tmp_10, tmp_11, tmp_12, tmp_13, tmp_16, tmp_19, tmp_20, _this__u8e3s4.latitude_gb4iok_k$(0) * 57.29577951308232, _this__u8e3s4.longitude_a9xl_k$(0) * 57.29577951308232, _this__u8e3s4.latitude_gb4iok_k$(_this__u8e3s4.size_1 - 1 | 0) * 57.29577951308232, _this__u8e3s4.longitude_a9xl_k$(_this__u8e3s4.size_1 - 1 | 0) * 57.29577951308232));
568
808
  }
569
809
  function optionalComputed(_this__u8e3s4) {
570
810
  // Inline function 'kotlin.takeUnless' call
@@ -589,216 +829,8 @@
589
829
  function roundToIntOrZero(_this__u8e3s4) {
590
830
  return isNaN_0(_this__u8e3s4) ? 0 : roundToInt(_this__u8e3s4);
591
831
  }
592
- function lapMesg($this, lap) {
593
- // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
594
- var o = {};
595
- o['mesgNum'] = 19;
596
- o['startTime'] = toJsDate(FitEncoder_instance, lap.a1y_1);
597
- o['timestamp'] = toJsDate(FitEncoder_instance, lap.a1y_1.vd(seconds(FitEncoder_instance, lap.b1y_1)));
598
- o['totalElapsedTime'] = lap.b1y_1;
599
- o['totalTimerTime'] = lap.c1y_1;
600
- o['totalDistance'] = lap.d1y_1;
601
- o['totalAscent'] = lap.e1y_1;
602
- o['totalDescent'] = lap.f1y_1;
603
- if (lap.c1y_1 > 0.0) {
604
- o['avgSpeed'] = lap.d1y_1 / lap.c1y_1;
605
- }
606
- var tmp0_safe_receiver = lap.g1y_1;
607
- if (tmp0_safe_receiver == null)
608
- null;
609
- else {
610
- // Inline function 'kotlin.let' call
611
- o['maxSpeed'] = tmp0_safe_receiver;
612
- }
613
- var tmp1_safe_receiver = lap.h1y_1;
614
- if (tmp1_safe_receiver == null)
615
- null;
616
- else {
617
- // Inline function 'kotlin.let' call
618
- o['minAltitude'] = tmp1_safe_receiver;
619
- }
620
- var tmp2_safe_receiver = lap.i1y_1;
621
- if (tmp2_safe_receiver == null)
622
- null;
623
- else {
624
- // Inline function 'kotlin.let' call
625
- o['maxAltitude'] = tmp2_safe_receiver;
626
- }
627
- var tmp3_safe_receiver = lap.j1y_1;
628
- if (tmp3_safe_receiver == null)
629
- null;
630
- else {
631
- // Inline function 'kotlin.let' call
632
- o['startPositionLat'] = FitUnits_getInstance().u1y(tmp3_safe_receiver);
633
- }
634
- var tmp4_safe_receiver = lap.k1y_1;
635
- if (tmp4_safe_receiver == null)
636
- null;
637
- else {
638
- // Inline function 'kotlin.let' call
639
- o['startPositionLong'] = FitUnits_getInstance().u1y(tmp4_safe_receiver);
640
- }
641
- var tmp5_safe_receiver = lap.l1y_1;
642
- if (tmp5_safe_receiver == null)
643
- null;
644
- else {
645
- // Inline function 'kotlin.let' call
646
- o['endPositionLat'] = FitUnits_getInstance().u1y(tmp5_safe_receiver);
647
- }
648
- var tmp6_safe_receiver = lap.m1y_1;
649
- if (tmp6_safe_receiver == null)
650
- null;
651
- else {
652
- // Inline function 'kotlin.let' call
653
- o['endPositionLong'] = FitUnits_getInstance().u1y(tmp6_safe_receiver);
654
- }
655
- return o;
656
- }
657
- function recordMesg($this, record) {
658
- // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
659
- var o = {};
660
- o['mesgNum'] = 20;
661
- o['timestamp'] = toJsDate(FitEncoder_instance, record.q1x_1);
662
- o['positionLat'] = FitUnits_getInstance().u1y(record.r1x_1);
663
- o['positionLong'] = FitUnits_getInstance().u1y(record.s1x_1);
664
- o['distance'] = record.u1x_1;
665
- var tmp0_safe_receiver = record.t1x_1;
666
- if (tmp0_safe_receiver == null)
667
- null;
668
- else {
669
- // Inline function 'kotlin.let' call
670
- o['altitude'] = tmp0_safe_receiver;
671
- }
672
- var tmp1_safe_receiver = record.v1x_1;
673
- if (tmp1_safe_receiver == null)
674
- null;
675
- else {
676
- // Inline function 'kotlin.let' call
677
- o['speed'] = tmp1_safe_receiver;
678
- }
679
- var tmp2_safe_receiver = record.w1x_1;
680
- if (tmp2_safe_receiver == null)
681
- null;
682
- else {
683
- // Inline function 'kotlin.let' call
684
- o['power'] = tmp2_safe_receiver;
685
- }
686
- var tmp3_safe_receiver = record.x1x_1;
687
- if (tmp3_safe_receiver == null)
688
- null;
689
- else {
690
- // Inline function 'kotlin.let' call
691
- o['heartRate'] = tmp3_safe_receiver;
692
- }
693
- var tmp4_safe_receiver = record.y1x_1;
694
- if (tmp4_safe_receiver == null)
695
- null;
696
- else {
697
- // Inline function 'kotlin.let' call
698
- o['cadence'] = tmp4_safe_receiver;
699
- }
700
- var tmp5_safe_receiver = record.z1x_1;
701
- if (tmp5_safe_receiver == null)
702
- null;
703
- else {
704
- // Inline function 'kotlin.let' call
705
- o['temperature'] = numberToInt(round(tmp5_safe_receiver));
706
- }
707
- return o;
708
- }
709
- function timerEvent($this, at, eventType) {
710
- // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
711
- var o = {};
712
- o['mesgNum'] = 21;
713
- o['event'] = 0;
714
- o['eventType'] = eventType;
715
- o['eventGroup'] = 0;
716
- o['timestamp'] = toJsDate(FitEncoder_instance, at);
717
- return o;
718
- }
719
- function toByteArray($this, $receiver) {
720
- var tmp = 0;
721
- var tmp_0 = $receiver.length;
722
- var tmp_1 = new Int8Array(tmp_0);
723
- while (tmp < tmp_0) {
724
- var tmp_2 = tmp;
725
- // Inline function 'org.khronos.webgl.get' call
726
- // Inline function 'kotlin.js.asDynamic' call
727
- tmp_1[tmp_2] = $receiver[tmp_2];
728
- tmp = tmp + 1 | 0;
729
- }
730
- return tmp_1;
731
- }
732
- function toJsDate($this, $receiver) {
733
- return new Date(toNumber($receiver.ud()));
734
- }
735
- function seconds($this, $receiver) {
736
- Companion_getInstance();
737
- // Inline function 'kotlin.time.Companion.milliseconds' call
738
- var this_0 = numberToLong($receiver * 1000.0);
739
- return toDuration(this_0, DurationUnit_MILLISECONDS_getInstance());
740
- }
741
- function FitEncoder() {
742
- this.v1y_1 = 12345;
743
- this.w1y_1 = 12345.0;
744
- }
745
- protoOf(FitEncoder).x1y = function (course) {
746
- var encoder = new FitSdk.Encoder();
747
- // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
748
- var o = {};
749
- o['mesgNum'] = 0;
750
- o['type'] = 6;
751
- o['manufacturer'] = 15;
752
- o['product'] = 12345;
753
- o['serialNumber'] = 12345.0;
754
- o['number'] = getStringHashCode(course.k1x_1) & 65535;
755
- o['timeCreated'] = toJsDate(FitEncoder_instance, course.l1x_1);
756
- encoder.writeMesg(o);
757
- // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
758
- var o_0 = {};
759
- o_0['mesgNum'] = 31;
760
- o_0['name'] = course.k1x_1;
761
- o_0['sport'] = course.n1x_1.j1x_1;
762
- encoder.writeMesg(o_0);
763
- // Inline function 'kotlin.collections.map' call
764
- var this_0 = course.m1x_1;
765
- // Inline function 'kotlin.collections.mapTo' call
766
- var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
767
- var _iterator__ex2g4s = this_0.i();
768
- while (_iterator__ex2g4s.j()) {
769
- var item = _iterator__ex2g4s.k();
770
- var tmp$ret$6 = item.p1x_1;
771
- destination.h(tmp$ret$6);
772
- }
773
- var _iterator__ex2g4s_0 = destination.i();
774
- while (_iterator__ex2g4s_0.j()) {
775
- var lap = _iterator__ex2g4s_0.k();
776
- encoder.writeMesg(lapMesg(this, lap));
777
- }
778
- var iterator = course.m1x_1.i();
779
- var index = 0;
780
- while (iterator.j()) {
781
- var index_0 = index;
782
- index = index + 1 | 0;
783
- var segment = iterator.k();
784
- var isLast = index_0 === get_lastIndex(course.m1x_1);
785
- encoder.writeMesg(timerEvent(this, first(segment.o1x_1).q1x_1, 0));
786
- var _iterator__ex2g4s_1 = segment.o1x_1.i();
787
- while (_iterator__ex2g4s_1.j()) {
788
- var record = _iterator__ex2g4s_1.k();
789
- encoder.writeMesg(recordMesg(this, record));
790
- }
791
- encoder.writeMesg(timerEvent(this, last(segment.o1x_1).q1x_1, isLast ? 4 : 1));
792
- }
793
- return toByteArray(this, encoder.close());
794
- };
795
- var FitEncoder_instance;
796
- function FitEncoder_getInstance() {
797
- return FitEncoder_instance;
798
- }
799
832
  //region block: init
800
833
  Companion_instance = new Companion();
801
- FitEncoder_instance = new FitEncoder();
802
834
  //endregion
803
835
  //region block: exports
804
836
  _.$_$ = _.$_$ || {};