@yschimke/livery-a2ui 0.0.0-stage → 0.11.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.
Files changed (149) hide show
  1. package/README.md +194 -2
  2. package/dist/angular.d.ts +32 -0
  3. package/dist/angular.js +51 -0
  4. package/dist/api.d.ts +35 -0
  5. package/dist/api.js +35 -0
  6. package/dist/catalog.d.ts +18 -0
  7. package/dist/catalog.js +55 -0
  8. package/dist/cmp-player.d.ts +3 -0
  9. package/dist/cmp-player.js +125 -0
  10. package/dist/controller.d.ts +61 -0
  11. package/dist/controller.js +330 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.js +4 -0
  14. package/dist/livery-web/livery-livery-web.d.mts +75 -0
  15. package/dist/livery-web/livery-livery-web.import-object.mjs +370 -0
  16. package/dist/livery-web/livery-livery-web.js-builtins.mjs +52 -0
  17. package/dist/livery-web/livery-livery-web.mjs +104 -0
  18. package/dist/livery-web/livery-livery-web.wasm +0 -0
  19. package/dist/livery-web-compose/fonts/NotoSansSymbols2-OFL.txt +117 -0
  20. package/dist/livery-web-compose/fonts/NotoSansSymbols2-Regular.ttf +0 -0
  21. package/dist/livery-web-compose/fonts/README.md +8 -0
  22. package/dist/livery-web-compose/fonts/RobotoFlex-OFL.txt +93 -0
  23. package/dist/livery-web-compose/fonts/RobotoFlex.ttf +0 -0
  24. package/dist/livery-web-compose/livery-livery-web-compose.d.mts +60 -0
  25. package/dist/livery-web-compose/livery-livery-web-compose.import-object.mjs +653 -0
  26. package/dist/livery-web-compose/livery-livery-web-compose.js-builtins.mjs +52 -0
  27. package/dist/livery-web-compose/livery-livery-web-compose.mjs +89 -0
  28. package/dist/livery-web-compose/livery-livery-web-compose.wasm +0 -0
  29. package/dist/livery-web-compose/skiko.mjs +1118 -0
  30. package/dist/livery-web-compose/skiko.wasm +0 -0
  31. package/dist/livery.d.ts +165 -0
  32. package/dist/livery.js +87 -0
  33. package/dist/player.d.ts +2 -0
  34. package/dist/player.js +2 -0
  35. package/dist/react.d.ts +24 -0
  36. package/dist/react.js +36 -0
  37. package/node_modules/@js-joda/core/CHANGELOG.md +363 -0
  38. package/node_modules/@js-joda/core/CheatSheet.md +947 -0
  39. package/node_modules/@js-joda/core/LICENSE +34 -0
  40. package/node_modules/@js-joda/core/README.md +155 -0
  41. package/node_modules/@js-joda/core/bower.json +21 -0
  42. package/node_modules/@js-joda/core/dist/js-joda.d.ts +2452 -0
  43. package/node_modules/@js-joda/core/dist/js-joda.esm.js +13564 -0
  44. package/node_modules/@js-joda/core/dist/js-joda.flow.js +949 -0
  45. package/node_modules/@js-joda/core/dist/js-joda.js +13630 -0
  46. package/node_modules/@js-joda/core/dist/js-joda.js.map +1 -0
  47. package/node_modules/@js-joda/core/dist/js-joda.min.js +5 -0
  48. package/node_modules/@js-joda/core/package.json +76 -0
  49. package/node_modules/@js-joda/core/src/Clock.js +330 -0
  50. package/node_modules/@js-joda/core/src/DayOfWeek.js +451 -0
  51. package/node_modules/@js-joda/core/src/Duration.js +1205 -0
  52. package/node_modules/@js-joda/core/src/Enum.js +30 -0
  53. package/node_modules/@js-joda/core/src/Instant.js +1012 -0
  54. package/node_modules/@js-joda/core/src/LocalDate.js +1703 -0
  55. package/node_modules/@js-joda/core/src/LocalDateTime.js +1686 -0
  56. package/node_modules/@js-joda/core/src/LocalTime.js +1415 -0
  57. package/node_modules/@js-joda/core/src/MathUtil.js +236 -0
  58. package/node_modules/@js-joda/core/src/Month.js +600 -0
  59. package/node_modules/@js-joda/core/src/MonthDay.js +730 -0
  60. package/node_modules/@js-joda/core/src/OffsetDateTime.js +757 -0
  61. package/node_modules/@js-joda/core/src/OffsetTime.js +621 -0
  62. package/node_modules/@js-joda/core/src/Period.js +933 -0
  63. package/node_modules/@js-joda/core/src/StringUtil.js +43 -0
  64. package/node_modules/@js-joda/core/src/Year.js +1015 -0
  65. package/node_modules/@js-joda/core/src/YearConstants.js +21 -0
  66. package/node_modules/@js-joda/core/src/YearMonth.js +1096 -0
  67. package/node_modules/@js-joda/core/src/ZoneId.js +236 -0
  68. package/node_modules/@js-joda/core/src/ZoneIdFactory.js +201 -0
  69. package/node_modules/@js-joda/core/src/ZoneOffset.js +486 -0
  70. package/node_modules/@js-joda/core/src/ZoneRegion.js +72 -0
  71. package/node_modules/@js-joda/core/src/ZonedDateTime.js +2007 -0
  72. package/node_modules/@js-joda/core/src/_init.js +68 -0
  73. package/node_modules/@js-joda/core/src/assert.js +33 -0
  74. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDate.js +230 -0
  75. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDateTime.js +130 -0
  76. package/node_modules/@js-joda/core/src/chrono/ChronoZonedDateTime.js +194 -0
  77. package/node_modules/@js-joda/core/src/chrono/IsoChronology.js +235 -0
  78. package/node_modules/@js-joda/core/src/convert.js +83 -0
  79. package/node_modules/@js-joda/core/src/errors.js +54 -0
  80. package/node_modules/@js-joda/core/src/format/DateTimeBuilder.js +535 -0
  81. package/node_modules/@js-joda/core/src/format/DateTimeFormatter.js +728 -0
  82. package/node_modules/@js-joda/core/src/format/DateTimeFormatterBuilder.js +1545 -0
  83. package/node_modules/@js-joda/core/src/format/DateTimeParseContext.js +297 -0
  84. package/node_modules/@js-joda/core/src/format/DateTimePrintContext.js +138 -0
  85. package/node_modules/@js-joda/core/src/format/DecimalStyle.js +113 -0
  86. package/node_modules/@js-joda/core/src/format/EnumMap.js +70 -0
  87. package/node_modules/@js-joda/core/src/format/ParsePosition.js +31 -0
  88. package/node_modules/@js-joda/core/src/format/ResolverStyle.js +93 -0
  89. package/node_modules/@js-joda/core/src/format/SignStyle.js +38 -0
  90. package/node_modules/@js-joda/core/src/format/StringBuilder.js +47 -0
  91. package/node_modules/@js-joda/core/src/format/TextStyle.js +114 -0
  92. package/node_modules/@js-joda/core/src/format/parser/CharLiteralPrinterParser.js +46 -0
  93. package/node_modules/@js-joda/core/src/format/parser/CompositePrinterParser.js +89 -0
  94. package/node_modules/@js-joda/core/src/format/parser/FractionPrinterParser.js +162 -0
  95. package/node_modules/@js-joda/core/src/format/parser/NumberPrinterParser.js +367 -0
  96. package/node_modules/@js-joda/core/src/format/parser/OffsetIdPrinterParser.js +177 -0
  97. package/node_modules/@js-joda/core/src/format/parser/PadPrinterParserDecorator.js +81 -0
  98. package/node_modules/@js-joda/core/src/format/parser/SettingsParser.js +44 -0
  99. package/node_modules/@js-joda/core/src/format/parser/StringLiteralPrinterParser.js +39 -0
  100. package/node_modules/@js-joda/core/src/format/parser/ZoneIdPrinterParser.js +218 -0
  101. package/node_modules/@js-joda/core/src/js-joda.js +210 -0
  102. package/node_modules/@js-joda/core/src/license-preamble.js +3 -0
  103. package/node_modules/@js-joda/core/src/temporal/ChronoField.js +470 -0
  104. package/node_modules/@js-joda/core/src/temporal/ChronoUnit.js +310 -0
  105. package/node_modules/@js-joda/core/src/temporal/DefaultInterfaceTemporal.js +118 -0
  106. package/node_modules/@js-joda/core/src/temporal/IsoFields.js +859 -0
  107. package/node_modules/@js-joda/core/src/temporal/NativeJsTemporal.js +105 -0
  108. package/node_modules/@js-joda/core/src/temporal/Temporal.js +346 -0
  109. package/node_modules/@js-joda/core/src/temporal/TemporalAccessor.js +125 -0
  110. package/node_modules/@js-joda/core/src/temporal/TemporalAdjuster.js +92 -0
  111. package/node_modules/@js-joda/core/src/temporal/TemporalAdjusters.js +464 -0
  112. package/node_modules/@js-joda/core/src/temporal/TemporalAmount.js +166 -0
  113. package/node_modules/@js-joda/core/src/temporal/TemporalField.js +248 -0
  114. package/node_modules/@js-joda/core/src/temporal/TemporalQueries.js +223 -0
  115. package/node_modules/@js-joda/core/src/temporal/TemporalQueriesFactory.js +77 -0
  116. package/node_modules/@js-joda/core/src/temporal/TemporalQuery.js +107 -0
  117. package/node_modules/@js-joda/core/src/temporal/TemporalUnit.js +179 -0
  118. package/node_modules/@js-joda/core/src/temporal/ValueRange.js +257 -0
  119. package/node_modules/@js-joda/core/src/use.js +20 -0
  120. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneId.js +31 -0
  121. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneRules.js +162 -0
  122. package/node_modules/@js-joda/core/src/zone/ZoneOffsetTransition.js +289 -0
  123. package/node_modules/@js-joda/core/src/zone/ZoneRules.js +464 -0
  124. package/node_modules/@js-joda/core/src/zone/ZoneRulesProvider.js +36 -0
  125. package/node_modules/@yschimke/livery-web/README.md +112 -0
  126. package/node_modules/@yschimke/livery-web/dist/descriptor.d.ts +24 -0
  127. package/node_modules/@yschimke/livery-web/dist/descriptor.js +32 -0
  128. package/node_modules/@yschimke/livery-web/dist/index.d.ts +9 -0
  129. package/node_modules/@yschimke/livery-web/dist/index.js +5 -0
  130. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.d.mts +63 -0
  131. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.import-object.mjs +333 -0
  132. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.js-builtins.mjs +52 -0
  133. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.mjs +92 -0
  134. package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.wasm +0 -0
  135. package/node_modules/@yschimke/livery-web/dist/player.d.ts +65 -0
  136. package/node_modules/@yschimke/livery-web/dist/player.js +117 -0
  137. package/node_modules/@yschimke/livery-web/dist/preview.d.ts +57 -0
  138. package/node_modules/@yschimke/livery-web/dist/preview.js +214 -0
  139. package/node_modules/@yschimke/livery-web/dist/publication.d.ts +7 -0
  140. package/node_modules/@yschimke/livery-web/dist/publication.js +103 -0
  141. package/node_modules/@yschimke/livery-web/dist/session.d.ts +71 -0
  142. package/node_modules/@yschimke/livery-web/dist/session.js +55 -0
  143. package/node_modules/@yschimke/livery-web/dist/viewer.d.ts +1 -0
  144. package/node_modules/@yschimke/livery-web/dist/viewer.js +18 -0
  145. package/node_modules/@yschimke/livery-web/package.json +39 -0
  146. package/node_modules/@yschimke/livery-web/vendor/PROVENANCE.md +18 -0
  147. package/node_modules/@yschimke/livery-web/vendor/remote-compose-player.d.mts +30 -0
  148. package/node_modules/@yschimke/livery-web/vendor/remote-compose-player.mjs +86 -0
  149. package/package.json +102 -4
@@ -0,0 +1,535 @@
1
+ /*
2
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
+ */
6
+
7
+ import {requireNonNull} from '../assert';
8
+ import {DateTimeException} from '../errors';
9
+ import {MathUtil} from '../MathUtil';
10
+
11
+ import {EnumMap} from './EnumMap';
12
+ import {ResolverStyle} from './ResolverStyle';
13
+
14
+ import {IsoChronology} from '../chrono/IsoChronology';
15
+ import {ChronoLocalDate} from '../chrono/ChronoLocalDate';
16
+ import {ChronoField} from '../temporal/ChronoField';
17
+ import {TemporalAccessor} from '../temporal/TemporalAccessor';
18
+ import {TemporalQueries} from '../temporal/TemporalQueries';
19
+
20
+ import {LocalTime} from '../LocalTime';
21
+ import {LocalDate} from '../LocalDate';
22
+ import {Period} from '../Period';
23
+
24
+ import {ZoneOffset} from '../ZoneOffset';
25
+
26
+ /**
27
+ * Builder that can holds date and time fields and related date and time objects.
28
+ *
29
+ * The builder is used to hold onto different elements of date and time.
30
+ * It is designed as two separate maps:
31
+ *
32
+ * * from {@link TemporalField} to `long` value, where the value may be
33
+ * outside the valid range for the field
34
+ * * from {@link Class} to {@link TemporalAccessor}, holding larger scale objects
35
+ * like {@link LocalDateTime}.
36
+ *
37
+ * @private
38
+ */
39
+ export class DateTimeBuilder extends TemporalAccessor {
40
+
41
+ /**
42
+ * Creates a new instance of the builder with a single field-value.
43
+ *
44
+ * This is equivalent to using {@link addFieldValue} on an empty builder.
45
+ *
46
+ * @param {TemporalField} field - the field to add, not null
47
+ * @param {number} value - the value to add, not null
48
+ * @return {DateTimeBuilder}
49
+ */
50
+ static create(field, value) {
51
+ const dtb = new DateTimeBuilder();
52
+ dtb._addFieldValue(field, value);
53
+ return dtb;
54
+ }
55
+
56
+
57
+ constructor(){
58
+ super();
59
+
60
+ /**
61
+ * The map of other fields.
62
+ */
63
+ this.fieldValues = new EnumMap();
64
+ /**
65
+ * The chronology.
66
+ */
67
+ this.chrono = null;
68
+ /**
69
+ * The zone.
70
+ */
71
+ this.zone = null;
72
+ /**
73
+ * The date.
74
+ */
75
+ this.date = null;
76
+ /**
77
+ * The time.
78
+ */
79
+ this.time = null;
80
+ /**
81
+ * The leap second flag.
82
+ */
83
+ this.leapSecond = false;
84
+ /**
85
+ * The excess days.
86
+ */
87
+ this.excessDays = null;
88
+ }
89
+
90
+ /**
91
+ *
92
+ * @param {TemporalField} field
93
+ * @return {Number} field value
94
+ */
95
+ getFieldValue0(field) {
96
+ return this.fieldValues.get(field);
97
+ }
98
+
99
+ /**
100
+ * Adds a field-value pair to the builder.
101
+ *
102
+ * This adds a field to the builder.
103
+ * If the field is not already present, then the field-value pair is added to the map.
104
+ * If the field is already present and it has the same value as that specified, no action occurs.
105
+ * If the field is already present and it has a different value to that specified, then
106
+ * an exception is thrown.
107
+ *
108
+ * @param {TemporalField} field - the field to add, not null
109
+ * @param {Number} value - the value to add, not null
110
+ * @return {DateTimeBuilder}, this for method chaining
111
+ * @throws DateTimeException if the field is already present with a different value
112
+ */
113
+ _addFieldValue(field, value) {
114
+ requireNonNull(field, 'field');
115
+ const old = this.getFieldValue0(field); // check first for better error message
116
+ if (old != null && old !== value) {
117
+ throw new DateTimeException('Conflict found: ' + field + ' ' + old + ' differs from ' + field + ' ' + value + ': ' + this);
118
+ }
119
+ return this._putFieldValue0(field, value);
120
+ }
121
+
122
+ /**
123
+ * @param {TemporalField} field
124
+ * @param {Number} value
125
+ * @return {DateTimeBuilder}, this for method chaining
126
+ */
127
+ _putFieldValue0(field, value) {
128
+ this.fieldValues.put(field, value);
129
+ return this;
130
+ }
131
+
132
+ /**
133
+ * Resolves the builder, evaluating the date and time.
134
+ *
135
+ * This examines the contents of the build.er and resolves it to produce the best
136
+ * available date and time, throwing an exception if a problem occurs.
137
+ * Calling this method changes the state of the builder.
138
+ *
139
+ * @param {ResolverStyle} resolverStyle - how to resolve
140
+ * @param {TemporalField[]} resolverFields
141
+ * @return {DateTimeBuilder} this, for method chaining
142
+ */
143
+ resolve(resolverStyle, resolverFields) {
144
+ if (resolverFields != null) {
145
+ this.fieldValues.retainAll(resolverFields);
146
+ }
147
+ // handle standard fields
148
+ // this._mergeInstantFields();
149
+ this._mergeDate(resolverStyle);
150
+ this._mergeTime(resolverStyle);
151
+ //if (resolveFields(resolverStyle)) {
152
+ // mergeInstantFields();
153
+ // mergeDate(resolverStyle);
154
+ // mergeTime(resolverStyle);
155
+ //}
156
+ this._resolveTimeInferZeroes(resolverStyle);
157
+ //this._crossCheck();
158
+ if (this.excessDays != null && this.excessDays.isZero() === false && this.date != null && this.time != null) {
159
+ this.date = this.date.plus(this.excessDays);
160
+ this.excessDays = Period.ZERO;
161
+ }
162
+ //resolveFractional();
163
+ this._resolveInstant();
164
+ return this;
165
+ }
166
+
167
+ /**
168
+ *
169
+ * @param {ResolverStyle} resolverStyle
170
+ * @private
171
+ */
172
+ _mergeDate(resolverStyle) {
173
+ //if (this.chrono instanceof IsoChronology) {
174
+ this._checkDate(IsoChronology.INSTANCE.resolveDate(this.fieldValues, resolverStyle));
175
+ //} else {
176
+ // if (this.fieldValues.containsKey(ChronoField.EPOCH_DAY)) {
177
+ // this._checkDate(LocalDate.ofEpochDay(this.fieldValues.remove(ChronoField.EPOCH_DAY)));
178
+ // return;
179
+ // }
180
+ //}
181
+ }
182
+
183
+ /**
184
+ *
185
+ * @param {LocalDate} date
186
+ * @private
187
+ */
188
+ _checkDate(date) {
189
+ if (date != null) {
190
+ this._addObject(date);
191
+ for (const fieldName in this.fieldValues.keySet()) {
192
+ const field = ChronoField.byName(fieldName);
193
+ if (field) {
194
+ if (this.fieldValues.get(field) !== undefined) { // undefined if "removed" in EnumMap
195
+ if (field.isDateBased()) {
196
+ let val1;
197
+ try {
198
+ val1 = date.getLong(field);
199
+ } catch (ex) {
200
+ if (ex instanceof DateTimeException) {
201
+ continue;
202
+ } else {
203
+ throw ex;
204
+ }
205
+ }
206
+ const val2 = this.fieldValues.get(field);
207
+ if (val1 !== val2) {
208
+ throw new DateTimeException('Conflict found: Field ' + field + ' ' + val1 + ' differs from ' + field + ' ' + val2 + ' derived from ' + date);
209
+ }
210
+ }
211
+ }
212
+ }
213
+ }
214
+ }
215
+ }
216
+
217
+ /**
218
+ *
219
+ * @param {ResolverStyle} resolverStyle
220
+ * @private
221
+ */
222
+ _mergeTime(resolverStyle) {
223
+ if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_DAY)) {
224
+ const ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_DAY);
225
+ if (resolverStyle !== ResolverStyle.LENIENT) {
226
+ if (resolverStyle === ResolverStyle.SMART && ch === 0) {
227
+ // ok
228
+ } else {
229
+ ChronoField.CLOCK_HOUR_OF_DAY.checkValidValue(ch);
230
+ }
231
+ }
232
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, ch === 24 ? 0 : ch);
233
+ }
234
+ if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_AMPM)) {
235
+ const ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_AMPM);
236
+ if (resolverStyle !== ResolverStyle.LENIENT) {
237
+ if (resolverStyle === ResolverStyle.SMART && ch === 0) {
238
+ // ok
239
+ } else {
240
+ ChronoField.CLOCK_HOUR_OF_AMPM.checkValidValue(ch);
241
+ }
242
+ }
243
+ this._addFieldValue(ChronoField.HOUR_OF_AMPM, ch === 12 ? 0 : ch);
244
+ }
245
+ if (resolverStyle !== ResolverStyle.LENIENT) {
246
+ if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY)) {
247
+ ChronoField.AMPM_OF_DAY.checkValidValue(this.fieldValues.get(ChronoField.AMPM_OF_DAY));
248
+ }
249
+ if (this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
250
+ ChronoField.HOUR_OF_AMPM.checkValidValue(this.fieldValues.get(ChronoField.HOUR_OF_AMPM));
251
+ }
252
+ }
253
+ if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY) && this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
254
+ const ap = this.fieldValues.remove(ChronoField.AMPM_OF_DAY);
255
+ const hap = this.fieldValues.remove(ChronoField.HOUR_OF_AMPM);
256
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, ap * 12 + hap);
257
+ }
258
+ // if (timeFields.containsKey(HOUR_OF_DAY) && timeFields.containsKey(MINUTE_OF_HOUR)) {
259
+ // const hod = timeFields.remove(HOUR_OF_DAY);
260
+ // const moh = timeFields.remove(MINUTE_OF_HOUR);
261
+ // this._addFieldValue(MINUTE_OF_DAY, hod * 60 + moh);
262
+ // }
263
+ // if (timeFields.containsKey(MINUTE_OF_DAY) && timeFields.containsKey(SECOND_OF_MINUTE)) {
264
+ // const mod = timeFields.remove(MINUTE_OF_DAY);
265
+ // const som = timeFields.remove(SECOND_OF_MINUTE);
266
+ // this._addFieldValue(SECOND_OF_DAY, mod * 60 + som);
267
+ // }
268
+ if (this.fieldValues.containsKey(ChronoField.NANO_OF_DAY)) {
269
+ const nod = this.fieldValues.remove(ChronoField.NANO_OF_DAY);
270
+ if (resolverStyle !== ResolverStyle.LENIENT) {
271
+ ChronoField.NANO_OF_DAY.checkValidValue(nod);
272
+ }
273
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(nod, 1000000000));
274
+ this._addFieldValue(ChronoField.NANO_OF_SECOND, MathUtil.intMod(nod, 1000000000));
275
+ }
276
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_DAY)) {
277
+ const cod = this.fieldValues.remove(ChronoField.MICRO_OF_DAY);
278
+ if (resolverStyle !== ResolverStyle.LENIENT) {
279
+ ChronoField.MICRO_OF_DAY.checkValidValue(cod);
280
+ }
281
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(cod, 1000000));
282
+ this._addFieldValue(ChronoField.MICRO_OF_SECOND, MathUtil.intMod(cod, 1000000));
283
+ }
284
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_DAY)) {
285
+ const lod = this.fieldValues.remove(ChronoField.MILLI_OF_DAY);
286
+ if (resolverStyle !== ResolverStyle.LENIENT) {
287
+ ChronoField.MILLI_OF_DAY.checkValidValue(lod);
288
+ }
289
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(lod, 1000));
290
+ this._addFieldValue(ChronoField.MILLI_OF_SECOND, MathUtil.intMod(lod, 1000));
291
+ }
292
+ if (this.fieldValues.containsKey(ChronoField.SECOND_OF_DAY)) {
293
+ const sod = this.fieldValues.remove(ChronoField.SECOND_OF_DAY);
294
+ if (resolverStyle !== ResolverStyle.LENIENT) {
295
+ ChronoField.SECOND_OF_DAY.checkValidValue(sod);
296
+ }
297
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(sod, 3600));
298
+ this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(MathUtil.intDiv(sod, 60), 60));
299
+ this._addFieldValue(ChronoField.SECOND_OF_MINUTE, MathUtil.intMod(sod, 60));
300
+ }
301
+ if (this.fieldValues.containsKey(ChronoField.MINUTE_OF_DAY)) {
302
+ const mod = this.fieldValues.remove(ChronoField.MINUTE_OF_DAY);
303
+ if (resolverStyle !== ResolverStyle.LENIENT) {
304
+ ChronoField.MINUTE_OF_DAY.checkValidValue(mod);
305
+ }
306
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(mod, 60));
307
+ this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(mod, 60));
308
+ }
309
+
310
+ // const sod = MathUtil.intDiv(nod, 1000000000L);
311
+ // this._addFieldValue(HOUR_OF_DAY, MathUtil.intDiv(sod, 3600));
312
+ // this._addFieldValue(MINUTE_OF_HOUR, MathUtil.intMod(MathUtil.intDiv(sod, 60), 60));
313
+ // this._addFieldValue(SECOND_OF_MINUTE, MathUtil.intMod(sod, 60));
314
+ // this._addFieldValue(NANO_OF_SECOND, MathUtil.intMod(nod, 1000000000L));
315
+ if (resolverStyle !== ResolverStyle.LENIENT) {
316
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
317
+ ChronoField.MILLI_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MILLI_OF_SECOND));
318
+ }
319
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
320
+ ChronoField.MICRO_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MICRO_OF_SECOND));
321
+ }
322
+ }
323
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
324
+ const los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
325
+ const cos = this.fieldValues.get(ChronoField.MICRO_OF_SECOND);
326
+ this._putFieldValue0(ChronoField.MICRO_OF_SECOND, los * 1000 + (MathUtil.intMod(cos, 1000)));
327
+ }
328
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
329
+ const nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
330
+ this._putFieldValue0(ChronoField.MICRO_OF_SECOND, MathUtil.intDiv(nos, 1000));
331
+ this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
332
+ }
333
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
334
+ const nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
335
+ this._putFieldValue0(ChronoField.MILLI_OF_SECOND, MathUtil.intDiv(nos, 1000000));
336
+ this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
337
+ }
338
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
339
+ const cos = this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
340
+ this._putFieldValue0(ChronoField.NANO_OF_SECOND, cos * 1000);
341
+ } else if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
342
+ const los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
343
+ this._putFieldValue0(ChronoField.NANO_OF_SECOND, los * 1000000);
344
+ }
345
+ }
346
+
347
+ /**
348
+ *
349
+ * @param {ResolverStyle} resolverStyle
350
+ * @private
351
+ */
352
+ _resolveTimeInferZeroes(resolverStyle) {
353
+ let hod = this.fieldValues.get(ChronoField.HOUR_OF_DAY);
354
+ const moh = this.fieldValues.get(ChronoField.MINUTE_OF_HOUR);
355
+ const som = this.fieldValues.get(ChronoField.SECOND_OF_MINUTE);
356
+ let nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
357
+ if (hod == null) {
358
+ return;
359
+ }
360
+ if (moh == null && (som != null || nos != null)) {
361
+ return;
362
+ }
363
+ if (moh != null && som == null && nos != null) {
364
+ return;
365
+ }
366
+ if (resolverStyle !== ResolverStyle.LENIENT) {
367
+ if (hod != null) {
368
+ if (resolverStyle === ResolverStyle.SMART &&
369
+ hod === 24 &&
370
+ (moh == null || moh === 0) &&
371
+ (som == null || som === 0) &&
372
+ (nos == null || nos === 0)) {
373
+ hod = 0;
374
+ this.excessDays = Period.ofDays(1);
375
+ }
376
+ const hodVal = ChronoField.HOUR_OF_DAY.checkValidIntValue(hod);
377
+ if (moh != null) {
378
+ const mohVal = ChronoField.MINUTE_OF_HOUR.checkValidIntValue(moh);
379
+ if (som != null) {
380
+ const somVal = ChronoField.SECOND_OF_MINUTE.checkValidIntValue(som);
381
+ if (nos != null) {
382
+ const nosVal = ChronoField.NANO_OF_SECOND.checkValidIntValue(nos);
383
+ this._addObject(LocalTime.of(hodVal, mohVal, somVal, nosVal));
384
+ } else {
385
+ this._addObject(LocalTime.of(hodVal, mohVal, somVal));
386
+ }
387
+ } else {
388
+ if (nos == null) {
389
+ this._addObject(LocalTime.of(hodVal, mohVal));
390
+ }
391
+ }
392
+ } else {
393
+ if (som == null && nos == null) {
394
+ this._addObject(LocalTime.of(hodVal, 0));
395
+ }
396
+ }
397
+ }
398
+ } else {
399
+ if (hod != null) {
400
+ let hodVal = hod;
401
+ if (moh != null) {
402
+ if (som != null) {
403
+ if (nos == null) {
404
+ nos = 0;
405
+ }
406
+ let totalNanos = MathUtil.safeMultiply(hodVal, 3600000000000);
407
+ totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(moh, 60000000000));
408
+ totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(som, 1000000000));
409
+ totalNanos = MathUtil.safeAdd(totalNanos, nos);
410
+ const excessDays = MathUtil.floorDiv(totalNanos, 86400000000000); // safe int cast
411
+ const nod = MathUtil.floorMod(totalNanos, 86400000000000);
412
+ this._addObject(LocalTime.ofNanoOfDay(nod));
413
+ this.excessDays = Period.ofDays(excessDays);
414
+ } else {
415
+ let totalSecs = MathUtil.safeMultiply(hodVal, 3600);
416
+ totalSecs = MathUtil.safeAdd(totalSecs, MathUtil.safeMultiply(moh, 60));
417
+ const excessDays = MathUtil.floorDiv(totalSecs, 86400); // safe int cast
418
+ const sod = MathUtil.floorMod(totalSecs, 86400);
419
+ this._addObject(LocalTime.ofSecondOfDay(sod));
420
+ this.excessDays = Period.ofDays(excessDays);
421
+ }
422
+ } else {
423
+ const excessDays = MathUtil.safeToInt(MathUtil.floorDiv(hodVal, 24));
424
+ hodVal = MathUtil.floorMod(hodVal, 24);
425
+ this._addObject(LocalTime.of(hodVal, 0));
426
+ this.excessDays = Period.ofDays(excessDays);
427
+ }
428
+ }
429
+ }
430
+ this.fieldValues.remove(ChronoField.HOUR_OF_DAY);
431
+ this.fieldValues.remove(ChronoField.MINUTE_OF_HOUR);
432
+ this.fieldValues.remove(ChronoField.SECOND_OF_MINUTE);
433
+ this.fieldValues.remove(ChronoField.NANO_OF_SECOND);
434
+ }
435
+
436
+ /**
437
+ *
438
+ * @param {ChronoLocalDate|LocalTime} dateOrTime
439
+ * @private
440
+ */
441
+ _addObject(dateOrTime) {
442
+ if (dateOrTime instanceof ChronoLocalDate){
443
+ this.date = dateOrTime;
444
+ } else if (dateOrTime instanceof LocalTime){
445
+ this.time = dateOrTime;
446
+ }
447
+ }
448
+
449
+ _resolveInstant() {
450
+ if (this.date != null && this.time != null) {
451
+ const offsetSecs = this.fieldValues.get(ChronoField.OFFSET_SECONDS);
452
+ if (offsetSecs != null) {
453
+ const offset = ZoneOffset.ofTotalSeconds(offsetSecs);
454
+ const instant = this.date.atTime(this.time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS);
455
+ this.fieldValues.put(ChronoField.INSTANT_SECONDS, instant);
456
+ } else if (this.zone != null) {
457
+ const instant = this.date.atTime(this.time).atZone(this.zone).getLong(ChronoField.INSTANT_SECONDS);
458
+ this.fieldValues.put(ChronoField.INSTANT_SECONDS, instant);
459
+ }
460
+ }
461
+ }
462
+
463
+ /**
464
+ * Builds the specified type from the values in this builder.
465
+ *
466
+ * This attempts to build the specified type from this builder.
467
+ * If the builder cannot return the type, an exception is thrown.
468
+ *
469
+ * @param {!TemporalQuery} type - the type to invoke `from` on, not null
470
+ * @return {*} the extracted value, not null
471
+ * @throws DateTimeException if an error occurs
472
+ */
473
+ build(type) {
474
+ return type.queryFrom(this);
475
+ }
476
+
477
+ /**
478
+ *
479
+ * @param {TemporalField} field
480
+ * @returns {number}
481
+ */
482
+ isSupported(field) {
483
+ if (field == null) {
484
+ return false;
485
+ }
486
+ return (this.fieldValues.containsKey(field) && this.fieldValues.get(field) !== undefined) ||
487
+ (this.date != null && this.date.isSupported(field)) ||
488
+ (this.time != null && this.time.isSupported(field));
489
+ }
490
+
491
+ /**
492
+ *
493
+ * @param {TemporalField} field
494
+ * @returns {number}
495
+ */
496
+ getLong(field) {
497
+ requireNonNull(field, 'field');
498
+ const value = this.getFieldValue0(field);
499
+ if (value == null) {
500
+ if (this.date != null && this.date.isSupported(field)) {
501
+ return this.date.getLong(field);
502
+ }
503
+ if (this.time != null && this.time.isSupported(field)) {
504
+ return this.time.getLong(field);
505
+ }
506
+ throw new DateTimeException('Field not found: ' + field);
507
+ }
508
+ return value;
509
+ }
510
+
511
+ /**
512
+ *
513
+ * @param {!TemporalQuery} query
514
+ * @returns {*}
515
+ */
516
+ query(query) {
517
+ if (query === TemporalQueries.zoneId()) {
518
+ return this.zone;
519
+ } else if (query === TemporalQueries.chronology()) {
520
+ return this.chrono;
521
+ } else if (query === TemporalQueries.localDate()) {
522
+ return this.date != null ? LocalDate.from(this.date) : null;
523
+ } else if (query === TemporalQueries.localTime()) {
524
+ return this.time;
525
+ } else if (query === TemporalQueries.zone() || query === TemporalQueries.offset()) {
526
+ return query.queryFrom(this);
527
+ } else if (query === TemporalQueries.precision()) {
528
+ return null; // not a complete date/time
529
+ }
530
+ // inline TemporalAccessor.super.query(query) as an optimization
531
+ // non-JDK classes are not permitted to make this optimization
532
+ return query.queryFrom(this);
533
+ }
534
+
535
+ }