Node-Red configuration
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. // https://d3js.org/d3-time/ v3.1.0 Copyright 2010-2022 Mike Bostock
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array')) :
  4. typeof define === 'function' && define.amd ? define(['exports', 'd3-array'], factory) :
  5. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}, global.d3));
  6. })(this, (function (exports, d3Array) { 'use strict';
  7. const t0 = new Date, t1 = new Date;
  8. function timeInterval(floori, offseti, count, field) {
  9. function interval(date) {
  10. return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
  11. }
  12. interval.floor = (date) => {
  13. return floori(date = new Date(+date)), date;
  14. };
  15. interval.ceil = (date) => {
  16. return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
  17. };
  18. interval.round = (date) => {
  19. const d0 = interval(date), d1 = interval.ceil(date);
  20. return date - d0 < d1 - date ? d0 : d1;
  21. };
  22. interval.offset = (date, step) => {
  23. return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
  24. };
  25. interval.range = (start, stop, step) => {
  26. const range = [];
  27. start = interval.ceil(start);
  28. step = step == null ? 1 : Math.floor(step);
  29. if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
  30. let previous;
  31. do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
  32. while (previous < start && start < stop);
  33. return range;
  34. };
  35. interval.filter = (test) => {
  36. return timeInterval((date) => {
  37. if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
  38. }, (date, step) => {
  39. if (date >= date) {
  40. if (step < 0) while (++step <= 0) {
  41. while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
  42. } else while (--step >= 0) {
  43. while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
  44. }
  45. }
  46. });
  47. };
  48. if (count) {
  49. interval.count = (start, end) => {
  50. t0.setTime(+start), t1.setTime(+end);
  51. floori(t0), floori(t1);
  52. return Math.floor(count(t0, t1));
  53. };
  54. interval.every = (step) => {
  55. step = Math.floor(step);
  56. return !isFinite(step) || !(step > 0) ? null
  57. : !(step > 1) ? interval
  58. : interval.filter(field
  59. ? (d) => field(d) % step === 0
  60. : (d) => interval.count(0, d) % step === 0);
  61. };
  62. }
  63. return interval;
  64. }
  65. const millisecond = timeInterval(() => {
  66. // noop
  67. }, (date, step) => {
  68. date.setTime(+date + step);
  69. }, (start, end) => {
  70. return end - start;
  71. });
  72. // An optimized implementation for this simple case.
  73. millisecond.every = (k) => {
  74. k = Math.floor(k);
  75. if (!isFinite(k) || !(k > 0)) return null;
  76. if (!(k > 1)) return millisecond;
  77. return timeInterval((date) => {
  78. date.setTime(Math.floor(date / k) * k);
  79. }, (date, step) => {
  80. date.setTime(+date + step * k);
  81. }, (start, end) => {
  82. return (end - start) / k;
  83. });
  84. };
  85. const milliseconds = millisecond.range;
  86. const durationSecond = 1000;
  87. const durationMinute = durationSecond * 60;
  88. const durationHour = durationMinute * 60;
  89. const durationDay = durationHour * 24;
  90. const durationWeek = durationDay * 7;
  91. const durationMonth = durationDay * 30;
  92. const durationYear = durationDay * 365;
  93. const second = timeInterval((date) => {
  94. date.setTime(date - date.getMilliseconds());
  95. }, (date, step) => {
  96. date.setTime(+date + step * durationSecond);
  97. }, (start, end) => {
  98. return (end - start) / durationSecond;
  99. }, (date) => {
  100. return date.getUTCSeconds();
  101. });
  102. const seconds = second.range;
  103. const timeMinute = timeInterval((date) => {
  104. date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
  105. }, (date, step) => {
  106. date.setTime(+date + step * durationMinute);
  107. }, (start, end) => {
  108. return (end - start) / durationMinute;
  109. }, (date) => {
  110. return date.getMinutes();
  111. });
  112. const timeMinutes = timeMinute.range;
  113. const utcMinute = timeInterval((date) => {
  114. date.setUTCSeconds(0, 0);
  115. }, (date, step) => {
  116. date.setTime(+date + step * durationMinute);
  117. }, (start, end) => {
  118. return (end - start) / durationMinute;
  119. }, (date) => {
  120. return date.getUTCMinutes();
  121. });
  122. const utcMinutes = utcMinute.range;
  123. const timeHour = timeInterval((date) => {
  124. date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
  125. }, (date, step) => {
  126. date.setTime(+date + step * durationHour);
  127. }, (start, end) => {
  128. return (end - start) / durationHour;
  129. }, (date) => {
  130. return date.getHours();
  131. });
  132. const timeHours = timeHour.range;
  133. const utcHour = timeInterval((date) => {
  134. date.setUTCMinutes(0, 0, 0);
  135. }, (date, step) => {
  136. date.setTime(+date + step * durationHour);
  137. }, (start, end) => {
  138. return (end - start) / durationHour;
  139. }, (date) => {
  140. return date.getUTCHours();
  141. });
  142. const utcHours = utcHour.range;
  143. const timeDay = timeInterval(
  144. date => date.setHours(0, 0, 0, 0),
  145. (date, step) => date.setDate(date.getDate() + step),
  146. (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
  147. date => date.getDate() - 1
  148. );
  149. const timeDays = timeDay.range;
  150. const utcDay = timeInterval((date) => {
  151. date.setUTCHours(0, 0, 0, 0);
  152. }, (date, step) => {
  153. date.setUTCDate(date.getUTCDate() + step);
  154. }, (start, end) => {
  155. return (end - start) / durationDay;
  156. }, (date) => {
  157. return date.getUTCDate() - 1;
  158. });
  159. const utcDays = utcDay.range;
  160. const unixDay = timeInterval((date) => {
  161. date.setUTCHours(0, 0, 0, 0);
  162. }, (date, step) => {
  163. date.setUTCDate(date.getUTCDate() + step);
  164. }, (start, end) => {
  165. return (end - start) / durationDay;
  166. }, (date) => {
  167. return Math.floor(date / durationDay);
  168. });
  169. const unixDays = unixDay.range;
  170. function timeWeekday(i) {
  171. return timeInterval((date) => {
  172. date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
  173. date.setHours(0, 0, 0, 0);
  174. }, (date, step) => {
  175. date.setDate(date.getDate() + step * 7);
  176. }, (start, end) => {
  177. return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
  178. });
  179. }
  180. const timeSunday = timeWeekday(0);
  181. const timeMonday = timeWeekday(1);
  182. const timeTuesday = timeWeekday(2);
  183. const timeWednesday = timeWeekday(3);
  184. const timeThursday = timeWeekday(4);
  185. const timeFriday = timeWeekday(5);
  186. const timeSaturday = timeWeekday(6);
  187. const timeSundays = timeSunday.range;
  188. const timeMondays = timeMonday.range;
  189. const timeTuesdays = timeTuesday.range;
  190. const timeWednesdays = timeWednesday.range;
  191. const timeThursdays = timeThursday.range;
  192. const timeFridays = timeFriday.range;
  193. const timeSaturdays = timeSaturday.range;
  194. function utcWeekday(i) {
  195. return timeInterval((date) => {
  196. date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
  197. date.setUTCHours(0, 0, 0, 0);
  198. }, (date, step) => {
  199. date.setUTCDate(date.getUTCDate() + step * 7);
  200. }, (start, end) => {
  201. return (end - start) / durationWeek;
  202. });
  203. }
  204. const utcSunday = utcWeekday(0);
  205. const utcMonday = utcWeekday(1);
  206. const utcTuesday = utcWeekday(2);
  207. const utcWednesday = utcWeekday(3);
  208. const utcThursday = utcWeekday(4);
  209. const utcFriday = utcWeekday(5);
  210. const utcSaturday = utcWeekday(6);
  211. const utcSundays = utcSunday.range;
  212. const utcMondays = utcMonday.range;
  213. const utcTuesdays = utcTuesday.range;
  214. const utcWednesdays = utcWednesday.range;
  215. const utcThursdays = utcThursday.range;
  216. const utcFridays = utcFriday.range;
  217. const utcSaturdays = utcSaturday.range;
  218. const timeMonth = timeInterval((date) => {
  219. date.setDate(1);
  220. date.setHours(0, 0, 0, 0);
  221. }, (date, step) => {
  222. date.setMonth(date.getMonth() + step);
  223. }, (start, end) => {
  224. return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
  225. }, (date) => {
  226. return date.getMonth();
  227. });
  228. const timeMonths = timeMonth.range;
  229. const utcMonth = timeInterval((date) => {
  230. date.setUTCDate(1);
  231. date.setUTCHours(0, 0, 0, 0);
  232. }, (date, step) => {
  233. date.setUTCMonth(date.getUTCMonth() + step);
  234. }, (start, end) => {
  235. return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
  236. }, (date) => {
  237. return date.getUTCMonth();
  238. });
  239. const utcMonths = utcMonth.range;
  240. const timeYear = timeInterval((date) => {
  241. date.setMonth(0, 1);
  242. date.setHours(0, 0, 0, 0);
  243. }, (date, step) => {
  244. date.setFullYear(date.getFullYear() + step);
  245. }, (start, end) => {
  246. return end.getFullYear() - start.getFullYear();
  247. }, (date) => {
  248. return date.getFullYear();
  249. });
  250. // An optimized implementation for this simple case.
  251. timeYear.every = (k) => {
  252. return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
  253. date.setFullYear(Math.floor(date.getFullYear() / k) * k);
  254. date.setMonth(0, 1);
  255. date.setHours(0, 0, 0, 0);
  256. }, (date, step) => {
  257. date.setFullYear(date.getFullYear() + step * k);
  258. });
  259. };
  260. const timeYears = timeYear.range;
  261. const utcYear = timeInterval((date) => {
  262. date.setUTCMonth(0, 1);
  263. date.setUTCHours(0, 0, 0, 0);
  264. }, (date, step) => {
  265. date.setUTCFullYear(date.getUTCFullYear() + step);
  266. }, (start, end) => {
  267. return end.getUTCFullYear() - start.getUTCFullYear();
  268. }, (date) => {
  269. return date.getUTCFullYear();
  270. });
  271. // An optimized implementation for this simple case.
  272. utcYear.every = (k) => {
  273. return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
  274. date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
  275. date.setUTCMonth(0, 1);
  276. date.setUTCHours(0, 0, 0, 0);
  277. }, (date, step) => {
  278. date.setUTCFullYear(date.getUTCFullYear() + step * k);
  279. });
  280. };
  281. const utcYears = utcYear.range;
  282. function ticker(year, month, week, day, hour, minute) {
  283. const tickIntervals = [
  284. [second, 1, durationSecond],
  285. [second, 5, 5 * durationSecond],
  286. [second, 15, 15 * durationSecond],
  287. [second, 30, 30 * durationSecond],
  288. [minute, 1, durationMinute],
  289. [minute, 5, 5 * durationMinute],
  290. [minute, 15, 15 * durationMinute],
  291. [minute, 30, 30 * durationMinute],
  292. [ hour, 1, durationHour ],
  293. [ hour, 3, 3 * durationHour ],
  294. [ hour, 6, 6 * durationHour ],
  295. [ hour, 12, 12 * durationHour ],
  296. [ day, 1, durationDay ],
  297. [ day, 2, 2 * durationDay ],
  298. [ week, 1, durationWeek ],
  299. [ month, 1, durationMonth ],
  300. [ month, 3, 3 * durationMonth ],
  301. [ year, 1, durationYear ]
  302. ];
  303. function ticks(start, stop, count) {
  304. const reverse = stop < start;
  305. if (reverse) [start, stop] = [stop, start];
  306. const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count);
  307. const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop
  308. return reverse ? ticks.reverse() : ticks;
  309. }
  310. function tickInterval(start, stop, count) {
  311. const target = Math.abs(stop - start) / count;
  312. const i = d3Array.bisector(([,, step]) => step).right(tickIntervals, target);
  313. if (i === tickIntervals.length) return year.every(d3Array.tickStep(start / durationYear, stop / durationYear, count));
  314. if (i === 0) return millisecond.every(Math.max(d3Array.tickStep(start, stop, count), 1));
  315. const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
  316. return t.every(step);
  317. }
  318. return [ticks, tickInterval];
  319. }
  320. const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);
  321. const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);
  322. exports.timeDay = timeDay;
  323. exports.timeDays = timeDays;
  324. exports.timeFriday = timeFriday;
  325. exports.timeFridays = timeFridays;
  326. exports.timeHour = timeHour;
  327. exports.timeHours = timeHours;
  328. exports.timeInterval = timeInterval;
  329. exports.timeMillisecond = millisecond;
  330. exports.timeMilliseconds = milliseconds;
  331. exports.timeMinute = timeMinute;
  332. exports.timeMinutes = timeMinutes;
  333. exports.timeMonday = timeMonday;
  334. exports.timeMondays = timeMondays;
  335. exports.timeMonth = timeMonth;
  336. exports.timeMonths = timeMonths;
  337. exports.timeSaturday = timeSaturday;
  338. exports.timeSaturdays = timeSaturdays;
  339. exports.timeSecond = second;
  340. exports.timeSeconds = seconds;
  341. exports.timeSunday = timeSunday;
  342. exports.timeSundays = timeSundays;
  343. exports.timeThursday = timeThursday;
  344. exports.timeThursdays = timeThursdays;
  345. exports.timeTickInterval = timeTickInterval;
  346. exports.timeTicks = timeTicks;
  347. exports.timeTuesday = timeTuesday;
  348. exports.timeTuesdays = timeTuesdays;
  349. exports.timeWednesday = timeWednesday;
  350. exports.timeWednesdays = timeWednesdays;
  351. exports.timeWeek = timeSunday;
  352. exports.timeWeeks = timeSundays;
  353. exports.timeYear = timeYear;
  354. exports.timeYears = timeYears;
  355. exports.unixDay = unixDay;
  356. exports.unixDays = unixDays;
  357. exports.utcDay = utcDay;
  358. exports.utcDays = utcDays;
  359. exports.utcFriday = utcFriday;
  360. exports.utcFridays = utcFridays;
  361. exports.utcHour = utcHour;
  362. exports.utcHours = utcHours;
  363. exports.utcMillisecond = millisecond;
  364. exports.utcMilliseconds = milliseconds;
  365. exports.utcMinute = utcMinute;
  366. exports.utcMinutes = utcMinutes;
  367. exports.utcMonday = utcMonday;
  368. exports.utcMondays = utcMondays;
  369. exports.utcMonth = utcMonth;
  370. exports.utcMonths = utcMonths;
  371. exports.utcSaturday = utcSaturday;
  372. exports.utcSaturdays = utcSaturdays;
  373. exports.utcSecond = second;
  374. exports.utcSeconds = seconds;
  375. exports.utcSunday = utcSunday;
  376. exports.utcSundays = utcSundays;
  377. exports.utcThursday = utcThursday;
  378. exports.utcThursdays = utcThursdays;
  379. exports.utcTickInterval = utcTickInterval;
  380. exports.utcTicks = utcTicks;
  381. exports.utcTuesday = utcTuesday;
  382. exports.utcTuesdays = utcTuesdays;
  383. exports.utcWednesday = utcWednesday;
  384. exports.utcWednesdays = utcWednesdays;
  385. exports.utcWeek = utcSunday;
  386. exports.utcWeeks = utcSundays;
  387. exports.utcYear = utcYear;
  388. exports.utcYears = utcYears;
  389. }));