@glandais/vcyclist-engine 2.0.0 → 3.0.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.
package/vcyclist-fit.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (factory) {
2
2
  if (typeof define === 'function' && define.amd)
3
- define(['exports', '@garmin/fitsdk', './kotlin-kotlin-stdlib.js', './vcyclist-elevation.js'], factory);
3
+ define(['exports', '@garmin/fitsdk', './kotlin-kotlin-stdlib.js'], factory);
4
4
  else if (typeof exports === 'object')
5
- factory(module.exports, require('@garmin/fitsdk'), require('./kotlin-kotlin-stdlib.js'), require('./vcyclist-elevation.js'));
5
+ factory(module.exports, require('@garmin/fitsdk'), require('./kotlin-kotlin-stdlib.js'));
6
6
  else {
7
7
  if (typeof FitSdk === 'undefined') {
8
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'.");
@@ -10,46 +10,50 @@
10
10
  if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
11
11
  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
12
  }
13
- if (typeof globalThis['vcyclist-elevation'] === 'undefined') {
14
- throw new Error("Error loading module 'vcyclist-fit'. Its dependency 'vcyclist-elevation' was not found. Please, check whether 'vcyclist-elevation' is loaded prior to 'vcyclist-fit'.");
15
- }
16
- globalThis['vcyclist-fit'] = factory(typeof globalThis['vcyclist-fit'] === 'undefined' ? {} : globalThis['vcyclist-fit'], FitSdk, globalThis['kotlin-kotlin-stdlib'], globalThis['vcyclist-elevation']);
13
+ globalThis['vcyclist-fit'] = factory(typeof globalThis['vcyclist-fit'] === 'undefined' ? {} : globalThis['vcyclist-fit'], FitSdk, globalThis['kotlin-kotlin-stdlib']);
17
14
  }
18
- }(function (_, FitSdk, kotlin_kotlin, kotlin_io_github_glandais_elevation) {
15
+ }(function (_, FitSdk, kotlin_kotlin) {
19
16
  'use strict';
20
17
  //region block: imports
21
18
  var imul = Math.imul;
22
19
  var Unit_instance = kotlin_kotlin.$_$.t;
23
- var Enum = kotlin_kotlin.$_$.x7;
24
- var protoOf = kotlin_kotlin.$_$.y5;
25
- var initMetadataForClass = kotlin_kotlin.$_$.j5;
20
+ var Enum = kotlin_kotlin.$_$.z7;
21
+ var protoOf = kotlin_kotlin.$_$.a6;
22
+ var initMetadataForClass = kotlin_kotlin.$_$.l5;
26
23
  var VOID = kotlin_kotlin.$_$.a;
27
- var toString = kotlin_kotlin.$_$.a6;
24
+ var initMetadataForCompanion = kotlin_kotlin.$_$.m5;
25
+ var toString = kotlin_kotlin.$_$.c6;
28
26
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.m1;
29
- var getStringHashCode = kotlin_kotlin.$_$.h5;
30
- var hashCode = kotlin_kotlin.$_$.i5;
31
- var equals = kotlin_kotlin.$_$.d5;
32
- var getNumberHashCode = kotlin_kotlin.$_$.f5;
33
- var Long = kotlin_kotlin.$_$.b8;
34
- var roundToInt = kotlin_kotlin.$_$.b6;
35
- var initMetadataForObject = kotlin_kotlin.$_$.p5;
36
- var ArrayList_init_$Create$ = kotlin_kotlin.$_$.w;
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;
37
36
  var Companion_getInstance = kotlin_kotlin.$_$.q;
38
- var numberToLong = kotlin_kotlin.$_$.q4;
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;
39
42
  var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.u;
40
- var toDuration = kotlin_kotlin.$_$.u7;
41
- var MathConstants_getInstance = kotlin_io_github_glandais_elevation.$_$.d;
42
- var isNaN_0 = kotlin_kotlin.$_$.n8;
43
- var until = kotlin_kotlin.$_$.l6;
44
- var toNumber = kotlin_kotlin.$_$.s4;
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;
45
50
  var first = kotlin_kotlin.$_$.s2;
46
- var round = kotlin_kotlin.$_$.d6;
47
- var numberToInt = kotlin_kotlin.$_$.w5;
48
- var last = kotlin_kotlin.$_$.y2;
49
51
  //endregion
50
52
  //region block: pre-declaration
51
53
  initMetadataForClass(FitSport, 'FitSport', VOID, Enum);
54
+ initMetadataForCompanion(Companion);
52
55
  initMetadataForClass(FitCourse, 'FitCourse');
56
+ initMetadataForClass(FitSegment, 'FitSegment');
53
57
  initMetadataForClass(FitRecord, 'FitRecord');
54
58
  initMetadataForClass(FitLap, 'FitLap');
55
59
  initMetadataForObject(FitUnits, 'FitUnits');
@@ -69,31 +73,65 @@
69
73
  }
70
74
  function FitSport(name, ordinal, value) {
71
75
  Enum.call(this, name, ordinal);
72
- this.y1w_1 = value;
76
+ this.j1x_1 = value;
77
+ }
78
+ function Companion() {
73
79
  }
74
- function FitCourse(name, startTime, records, lap, sport) {
80
+ var Companion_instance;
81
+ function Companion_getInstance_0() {
82
+ return Companion_instance;
83
+ }
84
+ function FitCourse(name, startTime, segments, sport) {
75
85
  sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
76
- this.z1w_1 = name;
77
- this.a1x_1 = startTime;
78
- this.b1x_1 = records;
79
- this.c1x_1 = lap;
80
- this.d1x_1 = sport;
86
+ this.k1x_1 = name;
87
+ this.l1x_1 = startTime;
88
+ this.m1x_1 = segments;
89
+ this.n1x_1 = sport;
81
90
  // Inline function 'kotlin.collections.isNotEmpty' call
82
91
  // Inline function 'kotlin.require' call
83
- if (!!this.b1x_1.n()) {
84
- var message = 'A FIT course needs at least one record';
92
+ if (!!this.m1x_1.n()) {
93
+ var message = 'A FIT course needs at least one segment';
85
94
  throw IllegalArgumentException_init_$Create$(toString(message));
86
95
  }
96
+ var tmp0 = this.m1x_1;
97
+ var tmp$ret$3;
98
+ $l$block_0: {
99
+ // Inline function 'kotlin.collections.all' call
100
+ var tmp;
101
+ if (isInterface(tmp0, Collection)) {
102
+ tmp = tmp0.n();
103
+ } else {
104
+ tmp = false;
105
+ }
106
+ if (tmp) {
107
+ tmp$ret$3 = true;
108
+ break $l$block_0;
109
+ }
110
+ var _iterator__ex2g4s = tmp0.i();
111
+ while (_iterator__ex2g4s.j()) {
112
+ var element = _iterator__ex2g4s.k();
113
+ // Inline function 'kotlin.collections.isNotEmpty' call
114
+ if (!!element.o1x_1.n()) {
115
+ tmp$ret$3 = false;
116
+ break $l$block_0;
117
+ }
118
+ }
119
+ tmp$ret$3 = true;
120
+ }
121
+ // Inline function 'kotlin.require' call
122
+ if (!tmp$ret$3) {
123
+ var message_0 = 'A FIT course segment needs at least one record';
124
+ throw IllegalArgumentException_init_$Create$(toString(message_0));
125
+ }
87
126
  }
88
127
  protoOf(FitCourse).toString = function () {
89
- return 'FitCourse(name=' + this.z1w_1 + ', startTime=' + this.a1x_1.toString() + ', records=' + toString(this.b1x_1) + ', lap=' + this.c1x_1.toString() + ', sport=' + this.d1x_1.toString() + ')';
128
+ return 'FitCourse(name=' + this.k1x_1 + ', startTime=' + this.l1x_1.toString() + ', segments=' + toString(this.m1x_1) + ', sport=' + this.n1x_1.toString() + ')';
90
129
  };
91
130
  protoOf(FitCourse).hashCode = function () {
92
- var result = getStringHashCode(this.z1w_1);
93
- result = imul(result, 31) + this.a1x_1.hashCode() | 0;
94
- result = imul(result, 31) + hashCode(this.b1x_1) | 0;
95
- result = imul(result, 31) + this.c1x_1.hashCode() | 0;
96
- result = imul(result, 31) + this.d1x_1.hashCode() | 0;
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;
97
135
  return result;
98
136
  };
99
137
  protoOf(FitCourse).equals = function (other) {
@@ -101,15 +139,36 @@
101
139
  return true;
102
140
  if (!(other instanceof FitCourse))
103
141
  return false;
104
- if (!(this.z1w_1 === other.z1w_1))
142
+ if (!(this.k1x_1 === other.k1x_1))
105
143
  return false;
106
- if (!this.a1x_1.equals(other.a1x_1))
144
+ if (!this.l1x_1.equals(other.l1x_1))
107
145
  return false;
108
- if (!equals(this.b1x_1, other.b1x_1))
146
+ if (!equals(this.m1x_1, other.m1x_1))
109
147
  return false;
110
- if (!this.c1x_1.equals(other.c1x_1))
148
+ if (!this.n1x_1.equals(other.n1x_1))
111
149
  return false;
112
- if (!this.d1x_1.equals(other.d1x_1))
150
+ return true;
151
+ };
152
+ function FitSegment(records, lap) {
153
+ this.o1x_1 = records;
154
+ this.p1x_1 = lap;
155
+ }
156
+ protoOf(FitSegment).toString = function () {
157
+ return 'FitSegment(records=' + toString(this.o1x_1) + ', lap=' + this.p1x_1.toString() + ')';
158
+ };
159
+ protoOf(FitSegment).hashCode = function () {
160
+ var result = hashCode(this.o1x_1);
161
+ result = imul(result, 31) + this.p1x_1.hashCode() | 0;
162
+ return result;
163
+ };
164
+ protoOf(FitSegment).equals = function (other) {
165
+ if (this === other)
166
+ return true;
167
+ if (!(other instanceof FitSegment))
168
+ return false;
169
+ if (!equals(this.o1x_1, other.o1x_1))
170
+ return false;
171
+ if (!this.p1x_1.equals(other.p1x_1))
113
172
  return false;
114
173
  return true;
115
174
  };
@@ -120,31 +179,31 @@
120
179
  heartRate = heartRate === VOID ? null : heartRate;
121
180
  cadence = cadence === VOID ? null : cadence;
122
181
  temperatureC = temperatureC === VOID ? null : temperatureC;
123
- this.e1x_1 = timestamp;
124
- this.f1x_1 = latitudeDeg;
125
- this.g1x_1 = longitudeDeg;
126
- this.h1x_1 = altitudeM;
127
- this.i1x_1 = distanceM;
128
- this.j1x_1 = speedMs;
129
- this.k1x_1 = powerW;
130
- this.l1x_1 = heartRate;
131
- this.m1x_1 = cadence;
132
- this.n1x_1 = 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;
133
192
  }
134
193
  protoOf(FitRecord).toString = function () {
135
- return 'FitRecord(timestamp=' + this.e1x_1.toString() + ', latitudeDeg=' + this.f1x_1 + ', longitudeDeg=' + this.g1x_1 + ', altitudeM=' + this.h1x_1 + ', distanceM=' + this.i1x_1 + ', speedMs=' + this.j1x_1 + ', powerW=' + this.k1x_1 + ', heartRate=' + this.l1x_1 + ', cadence=' + this.m1x_1 + ', temperatureC=' + this.n1x_1 + ')';
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 + ')';
136
195
  };
137
196
  protoOf(FitRecord).hashCode = function () {
138
- var result = this.e1x_1.hashCode();
139
- result = imul(result, 31) + getNumberHashCode(this.f1x_1) | 0;
140
- result = imul(result, 31) + getNumberHashCode(this.g1x_1) | 0;
141
- result = imul(result, 31) + (this.h1x_1 == null ? 0 : getNumberHashCode(this.h1x_1)) | 0;
142
- result = imul(result, 31) + getNumberHashCode(this.i1x_1) | 0;
143
- result = imul(result, 31) + (this.j1x_1 == null ? 0 : getNumberHashCode(this.j1x_1)) | 0;
144
- result = imul(result, 31) + (this.k1x_1 == null ? 0 : this.k1x_1) | 0;
145
- result = imul(result, 31) + (this.l1x_1 == null ? 0 : this.l1x_1) | 0;
146
- result = imul(result, 31) + (this.m1x_1 == null ? 0 : this.m1x_1) | 0;
147
- result = imul(result, 31) + (this.n1x_1 == null ? 0 : getNumberHashCode(this.n1x_1)) | 0;
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;
148
207
  return result;
149
208
  };
150
209
  protoOf(FitRecord).equals = function (other) {
@@ -152,25 +211,25 @@
152
211
  return true;
153
212
  if (!(other instanceof FitRecord))
154
213
  return false;
155
- if (!this.e1x_1.equals(other.e1x_1))
214
+ if (!this.q1x_1.equals(other.q1x_1))
156
215
  return false;
157
- if (!equals(this.f1x_1, other.f1x_1))
216
+ if (!equals(this.r1x_1, other.r1x_1))
158
217
  return false;
159
- if (!equals(this.g1x_1, other.g1x_1))
218
+ if (!equals(this.s1x_1, other.s1x_1))
160
219
  return false;
161
- if (!equals(this.h1x_1, other.h1x_1))
220
+ if (!equals(this.t1x_1, other.t1x_1))
162
221
  return false;
163
- if (!equals(this.i1x_1, other.i1x_1))
222
+ if (!equals(this.u1x_1, other.u1x_1))
164
223
  return false;
165
- if (!equals(this.j1x_1, other.j1x_1))
224
+ if (!equals(this.v1x_1, other.v1x_1))
166
225
  return false;
167
- if (!(this.k1x_1 == other.k1x_1))
226
+ if (!(this.w1x_1 == other.w1x_1))
168
227
  return false;
169
- if (!(this.l1x_1 == other.l1x_1))
228
+ if (!(this.x1x_1 == other.x1x_1))
170
229
  return false;
171
- if (!(this.m1x_1 == other.m1x_1))
230
+ if (!(this.y1x_1 == other.y1x_1))
172
231
  return false;
173
- if (!equals(this.n1x_1, other.n1x_1))
232
+ if (!equals(this.z1x_1, other.z1x_1))
174
233
  return false;
175
234
  return true;
176
235
  };
@@ -182,37 +241,37 @@
182
241
  startLongitudeDeg = startLongitudeDeg === VOID ? null : startLongitudeDeg;
183
242
  endLatitudeDeg = endLatitudeDeg === VOID ? null : endLatitudeDeg;
184
243
  endLongitudeDeg = endLongitudeDeg === VOID ? null : endLongitudeDeg;
185
- this.o1x_1 = startTime;
186
- this.p1x_1 = totalElapsedTimeS;
187
- this.q1x_1 = totalTimerTimeS;
188
- this.r1x_1 = totalDistanceM;
189
- this.s1x_1 = totalAscentM;
190
- this.t1x_1 = totalDescentM;
191
- this.u1x_1 = maxSpeedMs;
192
- this.v1x_1 = minAltitudeM;
193
- this.w1x_1 = maxAltitudeM;
194
- this.x1x_1 = startLatitudeDeg;
195
- this.y1x_1 = startLongitudeDeg;
196
- this.z1x_1 = endLatitudeDeg;
197
- this.a1y_1 = 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;
198
257
  }
199
258
  protoOf(FitLap).toString = function () {
200
- return 'FitLap(startTime=' + this.o1x_1.toString() + ', totalElapsedTimeS=' + this.p1x_1 + ', totalTimerTimeS=' + this.q1x_1 + ', totalDistanceM=' + this.r1x_1 + ', totalAscentM=' + this.s1x_1 + ', totalDescentM=' + this.t1x_1 + ', maxSpeedMs=' + this.u1x_1 + ', minAltitudeM=' + this.v1x_1 + ', maxAltitudeM=' + this.w1x_1 + ', startLatitudeDeg=' + this.x1x_1 + ', startLongitudeDeg=' + this.y1x_1 + ', endLatitudeDeg=' + this.z1x_1 + ', endLongitudeDeg=' + this.a1y_1 + ')';
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 + ')';
201
260
  };
202
261
  protoOf(FitLap).hashCode = function () {
203
- var result = this.o1x_1.hashCode();
204
- result = imul(result, 31) + getNumberHashCode(this.p1x_1) | 0;
205
- result = imul(result, 31) + getNumberHashCode(this.q1x_1) | 0;
206
- result = imul(result, 31) + getNumberHashCode(this.r1x_1) | 0;
207
- result = imul(result, 31) + this.s1x_1 | 0;
208
- result = imul(result, 31) + this.t1x_1 | 0;
209
- result = imul(result, 31) + (this.u1x_1 == null ? 0 : getNumberHashCode(this.u1x_1)) | 0;
210
- result = imul(result, 31) + (this.v1x_1 == null ? 0 : getNumberHashCode(this.v1x_1)) | 0;
211
- result = imul(result, 31) + (this.w1x_1 == null ? 0 : getNumberHashCode(this.w1x_1)) | 0;
212
- result = imul(result, 31) + (this.x1x_1 == null ? 0 : getNumberHashCode(this.x1x_1)) | 0;
213
- result = imul(result, 31) + (this.y1x_1 == null ? 0 : getNumberHashCode(this.y1x_1)) | 0;
214
- result = imul(result, 31) + (this.z1x_1 == null ? 0 : getNumberHashCode(this.z1x_1)) | 0;
215
- result = imul(result, 31) + (this.a1y_1 == null ? 0 : getNumberHashCode(this.a1y_1)) | 0;
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;
216
275
  return result;
217
276
  };
218
277
  protoOf(FitLap).equals = function (other) {
@@ -220,31 +279,31 @@
220
279
  return true;
221
280
  if (!(other instanceof FitLap))
222
281
  return false;
223
- if (!this.o1x_1.equals(other.o1x_1))
282
+ if (!this.a1y_1.equals(other.a1y_1))
224
283
  return false;
225
- if (!equals(this.p1x_1, other.p1x_1))
284
+ if (!equals(this.b1y_1, other.b1y_1))
226
285
  return false;
227
- if (!equals(this.q1x_1, other.q1x_1))
286
+ if (!equals(this.c1y_1, other.c1y_1))
228
287
  return false;
229
- if (!equals(this.r1x_1, other.r1x_1))
288
+ if (!equals(this.d1y_1, other.d1y_1))
230
289
  return false;
231
- if (!(this.s1x_1 === other.s1x_1))
290
+ if (!(this.e1y_1 === other.e1y_1))
232
291
  return false;
233
- if (!(this.t1x_1 === other.t1x_1))
292
+ if (!(this.f1y_1 === other.f1y_1))
234
293
  return false;
235
- if (!equals(this.u1x_1, other.u1x_1))
294
+ if (!equals(this.g1y_1, other.g1y_1))
236
295
  return false;
237
- if (!equals(this.v1x_1, other.v1x_1))
296
+ if (!equals(this.h1y_1, other.h1y_1))
238
297
  return false;
239
- if (!equals(this.w1x_1, other.w1x_1))
298
+ if (!equals(this.i1y_1, other.i1y_1))
240
299
  return false;
241
- if (!equals(this.x1x_1, other.x1x_1))
300
+ if (!equals(this.j1y_1, other.j1y_1))
242
301
  return false;
243
- if (!equals(this.y1x_1, other.y1x_1))
302
+ if (!equals(this.k1y_1, other.k1y_1))
244
303
  return false;
245
- if (!equals(this.z1x_1, other.z1x_1))
304
+ if (!equals(this.l1y_1, other.l1y_1))
246
305
  return false;
247
- if (!equals(this.a1y_1, other.a1y_1))
306
+ if (!equals(this.m1y_1, other.m1y_1))
248
307
  return false;
249
308
  return true;
250
309
  };
@@ -254,15 +313,15 @@
254
313
  }
255
314
  function FitUnits() {
256
315
  FitUnits_instance = this;
257
- this.b1y_1 = new Long(-294592512, 146);
258
- this.c1y_1 = new Long(631065600, 0);
259
- this.d1y_1 = 1.1930464711111112E7;
260
- this.e1y_1 = 5.0;
261
- this.f1y_1 = 500.0;
262
- this.g1y_1 = 100.0;
263
- this.h1y_1 = 1000.0;
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;
264
323
  }
265
- protoOf(FitUnits).i1y = function (degrees) {
324
+ protoOf(FitUnits).u1y = function (degrees) {
266
325
  return roundToInt(degrees * 1.1930464711111112E7);
267
326
  };
268
327
  var FitUnits_instance;
@@ -273,34 +332,102 @@
273
332
  }
274
333
  function toFitBytes(_this__u8e3s4, name, startTime, sport) {
275
334
  sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
276
- return FitEncoder_instance.l1y(toFitCourse(_this__u8e3s4, name, startTime, sport));
335
+ return FitEncoder_instance.x1y(toFitCourse(_this__u8e3s4, name, startTime, sport));
336
+ }
337
+ function toFitBytes_0(_this__u8e3s4, name, startTime, sport, interPathGap) {
338
+ 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));
277
341
  }
278
342
  function toFitCourse(_this__u8e3s4, name, startTime, sport) {
279
343
  sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
344
+ return toFitCourse_0(listOf(_this__u8e3s4), name, startTime, sport);
345
+ }
346
+ function toFitCourse_0(_this__u8e3s4, name, startTime, sport, interPathGap) {
347
+ sport = sport === VOID ? FitSport_CYCLING_getInstance() : sport;
348
+ interPathGap = interPathGap === VOID ? Companion_getInstance().dd_1 : interPathGap;
349
+ // Inline function 'kotlin.collections.isNotEmpty' call
280
350
  // Inline function 'kotlin.require' call
281
- if (!(_this__u8e3s4.u1q_1 > 0)) {
282
- var message = 'Cannot build a FIT course from an empty Path';
351
+ if (!!_this__u8e3s4.n()) {
352
+ var message = 'Cannot build a FIT course from an empty list of paths';
283
353
  throw IllegalArgumentException_init_$Create$(toString(message));
284
354
  }
355
+ var tmp$ret$3;
356
+ $l$block_0: {
357
+ // Inline function 'kotlin.collections.all' call
358
+ var tmp;
359
+ if (isInterface(_this__u8e3s4, Collection)) {
360
+ tmp = _this__u8e3s4.n();
361
+ } else {
362
+ tmp = false;
363
+ }
364
+ if (tmp) {
365
+ tmp$ret$3 = true;
366
+ break $l$block_0;
367
+ }
368
+ var _iterator__ex2g4s = _this__u8e3s4.i();
369
+ while (_iterator__ex2g4s.j()) {
370
+ var element = _iterator__ex2g4s.k();
371
+ if (!(element.f1r_1 > 0)) {
372
+ tmp$ret$3 = false;
373
+ break $l$block_0;
374
+ }
375
+ }
376
+ tmp$ret$3 = true;
377
+ }
378
+ // Inline function 'kotlin.require' call
379
+ if (!tmp$ret$3) {
380
+ var message_0 = 'Cannot build a FIT course from an empty Path';
381
+ throw IllegalArgumentException_init_$Create$(toString(message_0));
382
+ }
383
+ var segmentStart = startTime;
384
+ // Inline function 'kotlin.collections.map' call
385
+ // Inline function 'kotlin.collections.mapTo' call
386
+ 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();
390
+ var segment = toFitSegment(item, segmentStart);
391
+ segmentStart = last(segment.o1x_1).q1x_1.vd(interPathGap);
392
+ destination.h(segment);
393
+ }
394
+ var segments = destination;
395
+ return new FitCourse(name, startTime, segments, sport);
396
+ }
397
+ function toFitSegment(_this__u8e3s4, startTime) {
398
+ var t0 = _this__u8e3s4.k1r(0);
399
+ var inductionVariable = 1;
400
+ var last = _this__u8e3s4.f1r_1;
401
+ if (inductionVariable < last)
402
+ do {
403
+ var i = inductionVariable;
404
+ inductionVariable = inductionVariable + 1 | 0;
405
+ // 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);
408
+ throw IllegalArgumentException_init_$Create$(toString(message));
409
+ }
410
+ }
411
+ while (inductionVariable < last);
285
412
  // Inline function 'kotlin.collections.List' call
286
413
  // Inline function 'kotlin.collections.MutableList' call
287
- var size = _this__u8e3s4.u1q_1;
414
+ var size = _this__u8e3s4.f1r_1;
288
415
  var list = ArrayList_init_$Create$(size);
289
416
  // Inline function 'kotlin.repeat' call
290
- var inductionVariable = 0;
291
- if (inductionVariable < size)
417
+ var inductionVariable_0 = 0;
418
+ if (inductionVariable_0 < size)
292
419
  do {
293
- var index = inductionVariable;
294
- inductionVariable = inductionVariable + 1 | 0;
420
+ var index = inductionVariable_0;
421
+ inductionVariable_0 = inductionVariable_0 + 1 | 0;
295
422
  Companion_getInstance();
296
423
  // Inline function 'kotlin.time.Companion.milliseconds' call
297
- var this_0 = numberToLong(_this__u8e3s4.z1q(index));
424
+ var this_0 = numberToLong(_this__u8e3s4.k1r(index) - t0);
298
425
  var tmp$ret$7 = toDuration(this_0, DurationUnit_MILLISECONDS_getInstance());
299
426
  var tmp = startTime.vd(tmp$ret$7);
300
- var tmp_0 = _this__u8e3s4.w1q(index) * MathConstants_getInstance().uw_1;
301
- var tmp_1 = _this__u8e3s4.x1q(index) * MathConstants_getInstance().uw_1;
427
+ var tmp_0 = _this__u8e3s4.h1r(index) * 57.29577951308232;
428
+ var tmp_1 = _this__u8e3s4.i1r(index) * 57.29577951308232;
302
429
  // Inline function 'kotlin.takeUnless' call
303
- var this_1 = _this__u8e3s4.y1q(index);
430
+ var this_1 = _this__u8e3s4.j1r(index);
304
431
  var tmp_2;
305
432
  if (!isNaN_0(this_1)) {
306
433
  tmp_2 = this_1;
@@ -308,9 +435,9 @@
308
435
  tmp_2 = null;
309
436
  }
310
437
  var tmp_3 = tmp_2;
311
- var tmp_4 = _this__u8e3s4.k1u(index);
438
+ var tmp_4 = _this__u8e3s4.w1u(index);
312
439
  // Inline function 'kotlin.takeUnless' call
313
- var this_2 = _this__u8e3s4.m1v(index);
440
+ var this_2 = _this__u8e3s4.x1v(index);
314
441
  var tmp_5;
315
442
  if (!isNaN_0(this_2)) {
316
443
  tmp_5 = this_2;
@@ -318,22 +445,22 @@
318
445
  tmp_5 = null;
319
446
  }
320
447
  var tmp_6 = tmp_5;
321
- var tmp0_safe_receiver = optionalComputed(_this__u8e3s4.k1v(index));
448
+ var tmp0_safe_receiver = optionalComputed(_this__u8e3s4.p1r(index));
322
449
  var tmp_7 = tmp0_safe_receiver == null ? null : roundToInt(tmp0_safe_receiver);
323
- var tmp1_safe_receiver = optionalSensor(_this__u8e3s4.a1r(index));
450
+ var tmp1_safe_receiver = optionalSensor(_this__u8e3s4.l1r(index));
324
451
  var tmp_8 = tmp1_safe_receiver == null ? null : roundToInt(tmp1_safe_receiver);
325
- var tmp2_safe_receiver = optionalSensor(_this__u8e3s4.b1r(index));
326
- 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.c1r(index)));
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)));
327
454
  list.h(tmp$ret$6);
328
455
  }
329
- while (inductionVariable < size);
456
+ while (inductionVariable_0 < size);
330
457
  var records = list;
331
- var tmp_9 = _this__u8e3s4.c1s_1 / 1000.0;
332
- var tmp_10 = _this__u8e3s4.c1s_1 / 1000.0;
333
- var tmp_11 = _this__u8e3s4.x1r_1;
334
- var tmp_12 = roundToIntOrZero(_this__u8e3s4.a1s_1);
335
- var tmp_13 = roundToIntOrZero(-_this__u8e3s4.b1s_1);
336
- var tmp0 = until(0, _this__u8e3s4.u1q_1);
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);
337
464
  var tmp$ret$12;
338
465
  $l$block: {
339
466
  // Inline function 'kotlin.collections.maxOfOrNull' call
@@ -343,10 +470,10 @@
343
470
  break $l$block;
344
471
  }
345
472
  var it = iterator.k();
346
- var maxValue = _this__u8e3s4.m1v(it);
473
+ var maxValue = _this__u8e3s4.x1v(it);
347
474
  while (iterator.j()) {
348
475
  var it_0 = iterator.k();
349
- var v = _this__u8e3s4.m1v(it_0);
476
+ var v = _this__u8e3s4.x1v(it_0);
350
477
  // Inline function 'kotlin.comparisons.maxOf' call
351
478
  var a = maxValue;
352
479
  maxValue = Math.max(a, v);
@@ -368,7 +495,7 @@
368
495
  tmp_14 = tmp_15;
369
496
  }
370
497
  var tmp_16 = tmp_14;
371
- var tmp0_0 = until(0, _this__u8e3s4.u1q_1);
498
+ var tmp0_0 = until(0, _this__u8e3s4.f1r_1);
372
499
  var tmp$ret$18;
373
500
  $l$block_0: {
374
501
  // Inline function 'kotlin.collections.minOfOrNull' call
@@ -378,10 +505,10 @@
378
505
  break $l$block_0;
379
506
  }
380
507
  var it_1 = iterator_0.k();
381
- var minValue = _this__u8e3s4.y1q(it_1);
508
+ var minValue = _this__u8e3s4.j1r(it_1);
382
509
  while (iterator_0.j()) {
383
510
  var it_2 = iterator_0.k();
384
- var v_0 = _this__u8e3s4.y1q(it_2);
511
+ var v_0 = _this__u8e3s4.j1r(it_2);
385
512
  // Inline function 'kotlin.comparisons.minOf' call
386
513
  var a_0 = minValue;
387
514
  minValue = Math.min(a_0, v_0);
@@ -403,7 +530,7 @@
403
530
  tmp_17 = tmp_18;
404
531
  }
405
532
  var tmp_19 = tmp_17;
406
- var tmp0_1 = until(0, _this__u8e3s4.u1q_1);
533
+ var tmp0_1 = until(0, _this__u8e3s4.f1r_1);
407
534
  var tmp$ret$24;
408
535
  $l$block_1: {
409
536
  // Inline function 'kotlin.collections.maxOfOrNull' call
@@ -413,10 +540,10 @@
413
540
  break $l$block_1;
414
541
  }
415
542
  var it_3 = iterator_1.k();
416
- var maxValue_0 = _this__u8e3s4.y1q(it_3);
543
+ var maxValue_0 = _this__u8e3s4.j1r(it_3);
417
544
  while (iterator_1.j()) {
418
545
  var it_4 = iterator_1.k();
419
- var v_1 = _this__u8e3s4.y1q(it_4);
546
+ var v_1 = _this__u8e3s4.j1r(it_4);
420
547
  // Inline function 'kotlin.comparisons.maxOf' call
421
548
  var a_1 = maxValue_0;
422
549
  maxValue_0 = Math.max(a_1, v_1);
@@ -437,8 +564,7 @@
437
564
  }
438
565
  tmp_20 = tmp_21;
439
566
  }
440
- var tmp3_lap = new FitLap(startTime, tmp_9, tmp_10, tmp_11, tmp_12, tmp_13, tmp_16, tmp_19, tmp_20, _this__u8e3s4.w1q(0) * MathConstants_getInstance().uw_1, _this__u8e3s4.x1q(0) * MathConstants_getInstance().uw_1, _this__u8e3s4.w1q(_this__u8e3s4.u1q_1 - 1 | 0) * MathConstants_getInstance().uw_1, _this__u8e3s4.x1q(_this__u8e3s4.u1q_1 - 1 | 0) * MathConstants_getInstance().uw_1);
441
- return new FitCourse(name, startTime, records, tmp3_lap, sport);
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));
442
568
  }
443
569
  function optionalComputed(_this__u8e3s4) {
444
570
  // Inline function 'kotlin.takeUnless' call
@@ -463,6 +589,123 @@
463
589
  function roundToIntOrZero(_this__u8e3s4) {
464
590
  return isNaN_0(_this__u8e3s4) ? 0 : roundToInt(_this__u8e3s4);
465
591
  }
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
+ }
466
709
  function timerEvent($this, at, eventType) {
467
710
  // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
468
711
  var o = {};
@@ -496,10 +739,10 @@
496
739
  return toDuration(this_0, DurationUnit_MILLISECONDS_getInstance());
497
740
  }
498
741
  function FitEncoder() {
499
- this.j1y_1 = 12345;
500
- this.k1y_1 = 12345.0;
742
+ this.v1y_1 = 12345;
743
+ this.w1y_1 = 12345.0;
501
744
  }
502
- protoOf(FitEncoder).l1y = function (course) {
745
+ protoOf(FitEncoder).x1y = function (course) {
503
746
  var encoder = new FitSdk.Encoder();
504
747
  // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
505
748
  var o = {};
@@ -508,135 +751,45 @@
508
751
  o['manufacturer'] = 15;
509
752
  o['product'] = 12345;
510
753
  o['serialNumber'] = 12345.0;
511
- o['number'] = getStringHashCode(course.z1w_1) & 65535;
512
- o['timeCreated'] = toJsDate(FitEncoder_instance, course.a1x_1);
754
+ o['number'] = getStringHashCode(course.k1x_1) & 65535;
755
+ o['timeCreated'] = toJsDate(FitEncoder_instance, course.l1x_1);
513
756
  encoder.writeMesg(o);
514
757
  // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
515
758
  var o_0 = {};
516
759
  o_0['mesgNum'] = 31;
517
- o_0['name'] = course.z1w_1;
518
- o_0['sport'] = course.d1x_1.y1w_1;
760
+ o_0['name'] = course.k1x_1;
761
+ o_0['sport'] = course.n1x_1.j1x_1;
519
762
  encoder.writeMesg(o_0);
520
- var lap = course.c1x_1;
521
- // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
522
- var o_1 = {};
523
- o_1['mesgNum'] = 19;
524
- o_1['startTime'] = toJsDate(FitEncoder_instance, lap.o1x_1);
525
- o_1['timestamp'] = toJsDate(FitEncoder_instance, lap.o1x_1.vd(seconds(FitEncoder_instance, lap.p1x_1)));
526
- o_1['totalElapsedTime'] = lap.p1x_1;
527
- o_1['totalTimerTime'] = lap.q1x_1;
528
- o_1['totalDistance'] = lap.r1x_1;
529
- o_1['totalAscent'] = lap.s1x_1;
530
- o_1['totalDescent'] = lap.t1x_1;
531
- if (lap.q1x_1 > 0.0) {
532
- o_1['avgSpeed'] = lap.r1x_1 / lap.q1x_1;
533
- }
534
- var tmp0_safe_receiver = lap.u1x_1;
535
- if (tmp0_safe_receiver == null)
536
- null;
537
- else {
538
- // Inline function 'kotlin.let' call
539
- o_1['maxSpeed'] = tmp0_safe_receiver;
540
- }
541
- var tmp1_safe_receiver = lap.v1x_1;
542
- if (tmp1_safe_receiver == null)
543
- null;
544
- else {
545
- // Inline function 'kotlin.let' call
546
- o_1['minAltitude'] = tmp1_safe_receiver;
547
- }
548
- var tmp2_safe_receiver = lap.w1x_1;
549
- if (tmp2_safe_receiver == null)
550
- null;
551
- else {
552
- // Inline function 'kotlin.let' call
553
- o_1['maxAltitude'] = tmp2_safe_receiver;
554
- }
555
- var tmp3_safe_receiver = lap.x1x_1;
556
- if (tmp3_safe_receiver == null)
557
- null;
558
- else {
559
- // Inline function 'kotlin.let' call
560
- o_1['startPositionLat'] = FitUnits_getInstance().i1y(tmp3_safe_receiver);
561
- }
562
- var tmp4_safe_receiver = lap.y1x_1;
563
- if (tmp4_safe_receiver == null)
564
- null;
565
- else {
566
- // Inline function 'kotlin.let' call
567
- o_1['startPositionLong'] = FitUnits_getInstance().i1y(tmp4_safe_receiver);
568
- }
569
- var tmp5_safe_receiver = lap.z1x_1;
570
- if (tmp5_safe_receiver == null)
571
- null;
572
- else {
573
- // Inline function 'kotlin.let' call
574
- o_1['endPositionLat'] = FitUnits_getInstance().i1y(tmp5_safe_receiver);
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);
575
772
  }
576
- var tmp6_safe_receiver = lap.a1y_1;
577
- if (tmp6_safe_receiver == null)
578
- null;
579
- else {
580
- // Inline function 'kotlin.let' call
581
- o_1['endPositionLong'] = FitUnits_getInstance().i1y(tmp6_safe_receiver);
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));
582
777
  }
583
- encoder.writeMesg(o_1);
584
- encoder.writeMesg(timerEvent(this, first(course.b1x_1).e1x_1, 0));
585
- var _iterator__ex2g4s = course.b1x_1.i();
586
- while (_iterator__ex2g4s.j()) {
587
- var record = _iterator__ex2g4s.k();
588
- // Inline function 'io.github.glandais.fit.FitEncoder.mesg' call
589
- var o_2 = {};
590
- o_2['mesgNum'] = 20;
591
- o_2['timestamp'] = toJsDate(FitEncoder_instance, record.e1x_1);
592
- o_2['positionLat'] = FitUnits_getInstance().i1y(record.f1x_1);
593
- o_2['positionLong'] = FitUnits_getInstance().i1y(record.g1x_1);
594
- o_2['distance'] = record.i1x_1;
595
- var tmp0_safe_receiver_0 = record.h1x_1;
596
- if (tmp0_safe_receiver_0 == null)
597
- null;
598
- else {
599
- // Inline function 'kotlin.let' call
600
- o_2['altitude'] = tmp0_safe_receiver_0;
601
- }
602
- var tmp1_safe_receiver_0 = record.j1x_1;
603
- if (tmp1_safe_receiver_0 == null)
604
- null;
605
- else {
606
- // Inline function 'kotlin.let' call
607
- o_2['speed'] = tmp1_safe_receiver_0;
608
- }
609
- var tmp2_safe_receiver_0 = record.k1x_1;
610
- if (tmp2_safe_receiver_0 == null)
611
- null;
612
- else {
613
- // Inline function 'kotlin.let' call
614
- o_2['power'] = tmp2_safe_receiver_0;
615
- }
616
- var tmp3_safe_receiver_0 = record.l1x_1;
617
- if (tmp3_safe_receiver_0 == null)
618
- null;
619
- else {
620
- // Inline function 'kotlin.let' call
621
- o_2['heartRate'] = tmp3_safe_receiver_0;
622
- }
623
- var tmp4_safe_receiver_0 = record.m1x_1;
624
- if (tmp4_safe_receiver_0 == null)
625
- null;
626
- else {
627
- // Inline function 'kotlin.let' call
628
- o_2['cadence'] = tmp4_safe_receiver_0;
629
- }
630
- var tmp5_safe_receiver_0 = record.n1x_1;
631
- if (tmp5_safe_receiver_0 == null)
632
- null;
633
- else {
634
- // Inline function 'kotlin.let' call
635
- o_2['temperature'] = numberToInt(round(tmp5_safe_receiver_0));
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));
636
790
  }
637
- encoder.writeMesg(o_2);
791
+ encoder.writeMesg(timerEvent(this, last(segment.o1x_1).q1x_1, isLast ? 4 : 1));
638
792
  }
639
- encoder.writeMesg(timerEvent(this, last(course.b1x_1).e1x_1, 4));
640
793
  return toByteArray(this, encoder.close());
641
794
  };
642
795
  var FitEncoder_instance;
@@ -644,11 +797,13 @@
644
797
  return FitEncoder_instance;
645
798
  }
646
799
  //region block: init
800
+ Companion_instance = new Companion();
647
801
  FitEncoder_instance = new FitEncoder();
648
802
  //endregion
649
803
  //region block: exports
650
804
  _.$_$ = _.$_$ || {};
651
805
  _.$_$.a = toFitBytes;
806
+ _.$_$.b = toFitBytes_0;
652
807
  //endregion
653
808
  return _;
654
809
  }));