{"version":3,"sources":["webpack://jrs-ui/../js-sdk/src/common/component/base/util/attachableComponentPositionUtil.ts","webpack://jrs-ui/../js-sdk/src/common/component/colorPicker/react/AttachableColorPicker.tsx","webpack://jrs-ui/../js-sdk/src/common/component/colorPicker/react/enum/colors.ts","webpack://jrs-ui/../js-sdk/src/common/util/datetime/RelativeTime.js","webpack://jrs-ui/../js-sdk/src/common/util/datetime/Time.js","webpack://jrs-ui/../js-sdk/src/common/util/parse/time.js"],"names":["getInitialPos","options","top","attachToOffset","attachToSize","height","padding","left","placeElementAboveAttachTo","elementSize","placeElementOnTheRightSideOfAttachTo","width","placeElementOnTheLeftSideOfAttachTo","alignElementVertically","alignElementHorizontally","alignElementByRightEdgeOfAttachTo","getPosition","attachTo","element","jQuery","query","$","body","$attachTo","$el","offset","attachToHeight","tagName","toLowerCase","outerHeight","attachToWidth","bodyHeight","bodyWidth","elementWidth","innerWidth","elementHeight","innerHeight","initialPos","verticallyAligned","elementIntersectsViewPortBottomBoundary","elementIntersectsViewportTopBoundary","elementIntersectsViewportRightBoundary","elementIntersectsViewportLeftBoundary","ColorPicker","doc","getPresetColors","showTransparentPreset","presetColors","concat","Colors","ColorPickerWithAbilityToAttach","props","divRef","boundOnDocumentMousedown","disableAlpha","state","React","onDocumentMousedown","bind","this","forceUpdate","removeEventListener","show","current","addEventListener","e","colorPickerEl","mouseDownTarget","target","contains","isEqualNode","onHide","color","onChangeComplete","position","positionUtil","style","zIndex","visibility","ref","AttachableColorPicker","SketchPicker","document","extendedProps","RelativeTime","RelativeDate","arguments","F","prototype","constructor","PATTERNS","MINUTE","HOUR","parse","relativeTimeString","isValid","pattern","result","exec","_","length","relativeTime","toString","test","Time","hours","minutes","seconds","milliseconds","total","format","replace","compare","time1","time2","total1","total2","value","timeFormat","timeRegexpPattern","RegExp","getTimeRegexpPattern","timeObj","components","timeFormatComponents","matches","match","componentOrders","h","m","s","l","i","charAt","getTimeFormatComponents","parseInt","ISO_8061_TIME_PATTERN","localeSettingsObject","jrsConfigs","isTime","time","Boolean","isRelativeTime","isIso8601Time","compareTimes","value1","value2","timeToIso8061Time","obj","iso8601TimeToTimeObject","val"],"mappings":"0IA0CMA,EAAgB,SAACC,GACnB,MAAO,CACHC,IAAKD,EAAQE,eAAeD,IAAMD,EAAQG,aAAaC,OAASJ,EAAQK,QAAQJ,IAChFK,KAAMN,EAAQE,eAAeI,OAI/BC,EAA4B,SAACP,GAC/B,OAAOA,EAAQE,eAAeD,IAAMD,EAAQQ,YAAYJ,OAASJ,EAAQK,QAAQJ,KAG/EQ,EAAuC,SAACT,GAC1C,OAAOA,EAAQE,eAAeI,KAAON,EAAQG,aAAaO,OAGxDC,EAAsC,SAACX,GACzC,OAAOA,EAAQE,eAAeI,KAAON,EAAQQ,YAAYE,OAGvDE,EAAyB,SAACZ,GAC5B,OAAOA,EAAQE,eAAeD,IAAMD,EAAQQ,YAAYJ,OAAS,EAAIJ,EAAQK,QAAQJ,KAGnFY,EAA2B,SAACb,GAC9B,OAAOA,EAAQE,eAAeI,KAAON,EAAQG,aAAaO,MAAQ,EAAIV,EAAQQ,YAAYE,MAAQ,GAGhGI,EAAoC,SAACd,GACvC,OAAOA,EAAQE,eAAeI,KAAON,EAAQG,aAAaO,MAAQV,EAAQQ,YAAYE,OAG1F,SACIK,YADW,SAEPC,GAI2B,IAH3BX,EAG2B,uDAHY,CAAEJ,IAAK,EAAGK,KAAM,GACvDW,EAE2B,uCAD3BC,EAC2B,uCACrBC,EAAQD,GAAUE,IAElBC,EAAOF,EAAM,QACbG,EAAYH,EAAMH,GAClBO,EAAMJ,EAAMF,GAEZf,EAAiBoB,EAAUE,UAAY,CAAEvB,IAAK,EAAGK,KAAM,GACvDmB,EAAiBH,EAAU,GAAGI,SAAkD,UAAvCJ,EAAU,GAAGI,QAAQC,cAC9DL,EAAUM,eAAiB,EAAIN,EAAUlB,UAAY,EACrDyB,EAAgBP,EAAUZ,SAAW,EAErCoB,EAAaT,EAAKjB,UAAY,EAC9B2B,EAAY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I,EAAQjB,MAAQ8B,SAASZ,EAAWC,EAAqBI,GAAI,IAC7DN,EAAQhB,QAAU6B,SAASZ,EAAWC,EAAqBK,GAAI,IAC/DP,EAAQf,QAAU4B,SAASZ,EAAWC,EAAqBM,GAAI,KAC/B,IAA5BN,EAAqBO,IACrBT,EAAQd,aAAe2B,SAASZ,EAAWC,EAAqBO,GAAI,KAGjET,IAEX,UCzEA,IAAIc,EAAwB,WAExBC,EAAuBC,mBAK3B,SAASC,EAAOtB,EAAOC,GACnB,IAAIsB,EAAOpC,QAAWa,EAAOC,GAA0BmB,EAAqBnB,YAC5E,OAAIsB,EAGOA,EAAK7C,WAMZuB,IAIJsB,EAAOpC,QAAWa,EAAOoB,EAAqBnB,WAAa,MACpDuB,QAAQD,GAAQA,EAAK7C,YAuBhC,SACI+C,eA3CJ,SAAwBzB,GACpB,OAAOjC,UAAqBiC,IA2C5BsB,OAAQA,EACRI,cAxBJ,SAAuB1B,GACnB,OAAOsB,EAAOtB,EAAOmB,IAwBrBQ,aAtBJ,SAAsBC,EAAQC,EAAQ5B,GAClC,IAAML,EAAQgC,aAAkBzC,EAAOyC,EAASzC,QAAWyC,EAAsB,MAAd3B,EAAqBA,EAAamB,EAAqBnB,YACtHJ,EAAQgC,aAAkB1C,EAAO0C,EAAS1C,QAAW0C,EAAsB,MAAd5B,EAAqBA,EAAamB,EAAqBnB,YACxH,QAAqB,IAAVL,QAA0C,IAAVC,EAG3C,OAAOV,UAAaS,EAAOC,IAiB3BiC,kBAfJ,SAA2B1C,EAAOC,EAASC,GACvC,IAAMyC,EAAM,IAAI5C,EAAKC,EAAOC,EAASC,GACrC,GAAIyC,EAAIrD,UACJ,OAAOqD,EAAItC,OAAO0B,IAatBa,wBATJ,SAAiCC,GAC7B,OAAO9C,QAAW8C,EAAKd","file":"_chunks/chunk.2786.js","sourcesContent":["/*\n * Copyright (C) 2005 - 2022 TIBCO Software Inc. All rights reserved.\n * http://www.jaspersoft.com.\n *\n * Unless you have purchased a commercial license agreement from Jaspersoft,\n * the following license terms apply:\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */\n\nimport $ from 'jquery';\n\ninterface PosFunctionOptions {\n attachToOffset: {\n top: number,\n left: number\n },\n attachToSize: {\n width: number,\n height: number\n },\n elementSize: {\n width: number,\n height: number\n },\n padding: {\n top: number,\n left: number\n }\n}\n\nconst getInitialPos = (options: PosFunctionOptions) => {\n return {\n top: options.attachToOffset.top + options.attachToSize.height + options.padding.top,\n left: options.attachToOffset.left\n }\n};\n\nconst placeElementAboveAttachTo = (options: PosFunctionOptions) => {\n return options.attachToOffset.top - options.elementSize.height - options.padding.top;\n};\n\nconst placeElementOnTheRightSideOfAttachTo = (options: PosFunctionOptions) => {\n return options.attachToOffset.left + options.attachToSize.width;\n};\n\nconst placeElementOnTheLeftSideOfAttachTo = (options: PosFunctionOptions) => {\n return options.attachToOffset.left - options.elementSize.width;\n};\n\nconst alignElementVertically = (options: PosFunctionOptions) => {\n return options.attachToOffset.top - options.elementSize.height / 2 - options.padding.top;\n};\n\nconst alignElementHorizontally = (options: PosFunctionOptions) => {\n return options.attachToOffset.left + options.attachToSize.width / 2 - options.elementSize.width / 2;\n};\n\nconst alignElementByRightEdgeOfAttachTo = (options: PosFunctionOptions) => {\n return options.attachToOffset.left + options.attachToSize.width - options.elementSize.width;\n};\n\nexport default {\n getPosition(\n attachTo: HTMLElement,\n padding: {top: number, left: number} = { top: 0, left: 0 },\n element: HTMLElement,\n jQuery?: (e: HTMLElement|string) => any\n ): {top: number, left: number} {\n const query = jQuery || $;\n\n const body = query('body');\n const $attachTo = query(attachTo);\n const $el = query(element);\n\n const attachToOffset = $attachTo.offset() || { top: 0, left: 0 };\n const attachToHeight = $attachTo[0].tagName && $attachTo[0].tagName.toLowerCase() === 'input'\n ? $attachTo.outerHeight() || 0 : $attachTo.height() || 0;\n const attachToWidth = $attachTo.width() || 0;\n\n const bodyHeight = body.height() || 0;\n const bodyWidth = body.width() || 0;\n const elementWidth = $el.innerWidth() || 0;\n const elementHeight = $el.innerHeight() || 0;\n\n const options = {\n attachToOffset,\n attachToSize: {\n width: attachToWidth,\n height: attachToHeight\n },\n elementSize: {\n width: elementWidth,\n height: elementHeight\n },\n padding\n };\n\n const initialPos = getInitialPos(options);\n\n let { top, left } = initialPos;\n\n let verticallyAligned = false;\n\n const elementIntersectsViewPortBottomBoundary = top + elementHeight > bodyHeight;\n\n if (elementIntersectsViewPortBottomBoundary) {\n top = placeElementAboveAttachTo(options);\n }\n\n const elementIntersectsViewportTopBoundary = top < 0;\n\n if (elementIntersectsViewportTopBoundary) {\n top = alignElementVertically(options);\n left = placeElementOnTheRightSideOfAttachTo(options);\n\n verticallyAligned = true;\n }\n\n const elementIntersectsViewportRightBoundary = left + elementWidth > bodyWidth;\n\n if (elementIntersectsViewportRightBoundary) {\n left = verticallyAligned\n ? placeElementOnTheLeftSideOfAttachTo(options)\n : alignElementByRightEdgeOfAttachTo(options);\n }\n\n const elementIntersectsViewportLeftBoundary = left < 0;\n\n if (elementIntersectsViewportLeftBoundary) {\n left = alignElementHorizontally(options);\n }\n\n // when viewport is still to small to fit the element\n if (top < 0) {\n top = 0;\n }\n\n if (left < 0) {\n left = 0;\n }\n\n return {\n top,\n left,\n };\n },\n};\n","/*\n * Copyright (C) 2005 - 2022 TIBCO Software Inc. All rights reserved.\n * http://www.jaspersoft.com.\n *\n * Unless you have purchased a commercial license agreement from Jaspersoft,\n * the following license terms apply:\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */\n\nimport React from 'react';\nimport { ColorResult, SketchPicker, SketchPickerProps } from 'react-color';\nimport positionUtil from '../../base/util/attachableComponentPositionUtil';\n\nimport Colors from './enum/colors';\n\nconst getPresetColors = (showTransparentPreset: boolean): string[] => {\n let presetColors = [\n '#D0021B',\n '#F5A623',\n '#F8E71C',\n '#8B572A',\n '#7ED321',\n '#417505',\n '#BD10E0',\n '#9013FE',\n '#4A90E2',\n '#50E3C2',\n '#B8E986',\n '#000000',\n '#4A4A4A',\n '#9B9B9B',\n '#FFFFFF'\n ];\n\n if (showTransparentPreset) {\n presetColors = presetColors.concat([Colors.TRANSPARENT]);\n }\n\n return presetColors;\n};\n\nexport interface ColorPickerProps {\n padding: { top: number, left: number },\n show: boolean,\n color: string,\n disableAlpha?: boolean,\n showTransparentPreset?: boolean,\n onChangeComplete(color: ColorResult): void,\n onHide(): void,\n attachTo: HTMLElement\n}\n\ninterface ColorPickerPropsExtended extends ColorPickerProps {\n ColorPicker: React.ComponentType,\n doc: Document\n}\n\ninterface ColorPickerState {\n disableAlpha: boolean,\n showTransparentPreset: boolean\n}\n\nclass ColorPickerWithAbilityToAttach extends\n React.Component {\n constructor(props: ColorPickerPropsExtended) {\n super(props);\n\n const {\n disableAlpha, showTransparentPreset\n } = props;\n\n this.state = {\n disableAlpha: typeof disableAlpha === 'undefined' ? true : disableAlpha,\n showTransparentPreset: typeof showTransparentPreset === 'undefined'\n ? true\n : showTransparentPreset,\n };\n\n this.divRef = React.createRef();\n\n this.boundOnDocumentMousedown = this.onDocumentMousedown.bind(this);\n }\n\n componentDidMount(): void {\n this.forceUpdate();\n }\n\n componentDidUpdate() {\n this.props.doc.removeEventListener('mousedown', this.boundOnDocumentMousedown);\n\n if (this.props.show && this.divRef.current) {\n this.props.doc.addEventListener('mousedown', this.boundOnDocumentMousedown);\n }\n }\n\n componentWillUnmount(): void {\n this.props.doc.removeEventListener('mousedown', this.boundOnDocumentMousedown);\n }\n\n onDocumentMousedown(e: Event) {\n const colorPickerEl = this.divRef.current;\n const mouseDownTarget = e.target as HTMLElement;\n const { attachTo } = this.props;\n\n if (colorPickerEl) {\n if (!colorPickerEl.contains(mouseDownTarget)\n && !colorPickerEl.isEqualNode(mouseDownTarget)\n && !attachTo.contains(mouseDownTarget)\n && !attachTo.isEqualNode(mouseDownTarget)\n ) {\n this.props.onHide();\n }\n }\n }\n\n private readonly divRef: React.RefObject;\n\n private readonly boundOnDocumentMousedown: (e: Event) => void;\n\n render() {\n const {\n show, color, attachTo, padding, onChangeComplete, ColorPicker\n } = this.props;\n\n const {\n disableAlpha, showTransparentPreset\n } = this.state;\n\n let position = {\n top: 0,\n left: 0\n };\n\n if (this.divRef.current) {\n position = positionUtil\n .getPosition(attachTo, padding, this.divRef.current);\n }\n\n const style: React.CSSProperties = {\n position: 'absolute',\n zIndex: 9000,\n top: `${position.top}px`,\n left: `${position.left}px`,\n visibility: show && this.divRef.current ? 'visible' : 'hidden',\n };\n\n return (\n \n \n
\n );\n }\n}\n\nconst withAbilityToAttach = (ColorPicker: React.ComponentType, doc: Document): React.ComponentType => {\n return (props: ColorPickerProps) => {\n const extendedProps = {\n ...props,\n ColorPicker,\n doc\n };\n\n return (\n \n );\n }\n};\n\nconst AttachableColorPicker = withAbilityToAttach(SketchPicker, document);\n\nexport { withAbilityToAttach, AttachableColorPicker };\n","/*\n * Copyright (C) 2005 - 2022 TIBCO Software Inc. All rights reserved.\n * http://www.jaspersoft.com.\n *\n * Unless you have purchased a commercial license agreement from Jaspersoft,\n * the following license terms apply:\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */\n\nenum Colors {\n TRANSPARENT = 'transparent'\n}\n\nexport default Colors;\n","/*\n * Copyright (C) 2005 - 2022 TIBCO Software Inc. All rights reserved.\n * http://www.jaspersoft.com.\n *\n * Unless you have purchased a commercial license agreement from Jaspersoft,\n * the following license terms apply:\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */\n\nimport RelativeDate from './RelativeDate';\nimport _ from 'underscore';\nvar RelativeTime = function () {\n RelativeDate.apply(this, arguments);\n};\nvar F = function () {\n};\nF.prototype = RelativeDate.prototype;\nRelativeTime.prototype = new F();\nRelativeTime.prototype.constructor = RelativeTime;\nRelativeTime.PATTERNS = {\n MINUTE: /^(MINUTE)(([+|\\-])(\\d{1,9}))?$/i,\n HOUR: /^(HOUR)(([+|\\-])(\\d{1,9}))?$/i\n};\nRelativeTime.parse = function (relativeTimeString) {\n if (RelativeTime.isValid(relativeTimeString)) {\n for (var pattern in RelativeTime.PATTERNS) {\n var result = RelativeTime.PATTERNS[pattern].exec(relativeTimeString);\n if (result !== null && _.isArray(result) && result.length === 5) {\n return new RelativeTime(result[1], result[3], result[4]);\n }\n }\n }\n return undefined;\n};\nRelativeTime.isValid = function (relativeTime) {\n if (relativeTime instanceof RelativeTime) {\n return relativeTime.toString() !== '';\n } else if (_.isString(relativeTime)) {\n for (var pattern in RelativeTime.PATTERNS) {\n if (RelativeTime.PATTERNS[pattern].test(relativeTime)) {\n return true;\n }\n }\n }\n return false;\n};\nexport default RelativeTime;","/*\n * Copyright (C) 2005 - 2022 TIBCO Software Inc. All rights reserved.\n * http://www.jaspersoft.com.\n *\n * Unless you have purchased a commercial license agreement from Jaspersoft,\n * the following license terms apply:\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */\n\nimport _ from 'underscore';\nfunction getTimeRegexpPattern(timeFormat) {\n const pattern = '^' + timeFormat\n .toLowerCase()\n .replace('hh', '([0-1][0-9]|2[0-3])')\n .replace('mm', '([0-5][0-9])')\n .replace('ss', '([0-5][0-9])')\n .replace('l', '([0-9][0-9][0-9])') + '$';\n return new RegExp(pattern);\n}\nfunction getTimeFormatComponents(timeFormat) {\n const matches = timeFormat.toLowerCase().match(/(hh|mm|ss|l)/g), componentOrders = {\n h: -1,\n m: -1,\n s: -1,\n l: -1\n };\n if (matches) {\n for (let i = 0; i < matches.length; i++) {\n if (componentOrders[matches[i].toString().charAt(0)] === -1) {\n componentOrders[matches[i].toString().charAt(0)] = i + 1;\n }\n }\n }\n return componentOrders;\n}\nfunction Time(hours, minutes, seconds, milliseconds) {\n this.hours = hours || 0;\n this.minutes = minutes || 0;\n this.seconds = seconds || 0;\n this.milliseconds = milliseconds || 0;\n}\nTime.prototype.total = function () {\n return this.hours * 3600 + this.minutes * 60 + this.seconds;\n};\nTime.prototype.isValid = function () {\n return this.hours >= 0 && this.hours <= 23\n && this.minutes >= 0 && this.minutes <= 59\n && this.seconds >= 0 && this.seconds <= 59\n && this.milliseconds >= 0 && this.milliseconds <= 999;\n};\nTime.prototype.format = function (pattern) {\n return pattern\n .toLowerCase()\n .replace('hh', this.hours < 10 ? '0' + this.hours : this.hours)\n .replace('mm', this.minutes < 10 ? '0' + this.minutes : this.minutes)\n .replace('ss', this.seconds < 10 ? '0' + this.seconds : this.seconds)\n .replace('l', this.milliseconds < 10 ? '00' + this.milliseconds : (this.milliseconds < 100 ? '0' + this.milliseconds : this.milliseconds));\n};\nTime.compare = function (time1, time2) {\n var total1 = time1.total(), total2 = time2.total();\n if (total1 < total2) {\n return -1;\n } else if (total1 > total2) {\n return 1;\n } else {\n return 0;\n }\n};\nTime.parse = function (value, timeFormat) {\n const timeRegexpPattern = getTimeRegexpPattern(timeFormat);\n if (!_.isString(value) || !timeRegexpPattern.test(value)) {\n return undefined;\n }\n\n const timeObj = new Time(),\n components = timeRegexpPattern.exec(value);\n const timeFormatComponents = getTimeFormatComponents(timeFormat);\n timeObj.hours = parseInt(components[timeFormatComponents.h], 10);\n timeObj.minutes = parseInt(components[timeFormatComponents.m], 10);\n timeObj.seconds = parseInt(components[timeFormatComponents.s], 10);\n if (timeFormatComponents.l !== -1) {\n timeObj.milliseconds = parseInt(components[timeFormatComponents.l], 10);\n }\n\n return timeObj;\n};\nexport default Time;\n","/*\n * Copyright (C) 2005 - 2022 TIBCO Software Inc. All rights reserved.\n * http://www.jaspersoft.com.\n *\n * Unless you have purchased a commercial license agreement from Jaspersoft,\n * the following license terms apply:\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */\n\nimport jrsConfigs from \"../../../jrs.configs\";\nimport RelativeTime from '../datetime/RelativeTime';\nimport Time from '../datetime/Time';\n\nvar ISO_8061_TIME_PATTERN = 'HH:mm:ss';\n\nlet localeSettingsObject = jrsConfigs.localeSettings;\n\nfunction isRelativeTime(value) {\n return RelativeTime.isValid(value);\n}\nfunction isTime(value, timeFormat) {\n let time = Time.parse(value, timeFormat ? timeFormat : localeSettingsObject.timeFormat);\n if (time) {\n // is we got into this IF that means the format matches the value, so now let's see if the value contains\n // correct time\n return time.isValid();\n }\n // if the format didn't match the value then, maybe, the value contains millisecnds, and to check this we need to\n // add a millisecond formatter to the format.\n // BUT: if the format was specified as an argument, then we don't need to guess if the value has the milliseconds\n // or not, we just follow the parse() result.\n if (timeFormat) {\n return false;\n }\n // ok, so, checking with milliseconds formatter:\n time = Time.parse(value, localeSettingsObject.timeFormat + '.l');\n return Boolean(time && time.isValid());\n}\nfunction isIso8601Time(value) {\n return isTime(value, ISO_8061_TIME_PATTERN);\n}\nfunction compareTimes(value1, value2, timeFormat) {\n const time1 = value1 instanceof Time ? value1 : Time.parse(value1, timeFormat != null ? timeFormat : localeSettingsObject.timeFormat),\n time2 = value2 instanceof Time ? value2 : Time.parse(value2, timeFormat != null ? timeFormat : localeSettingsObject.timeFormat);\n if (typeof time1 === 'undefined' || typeof time2 === 'undefined') {\n return;\n }\n return Time.compare(time1, time2);\n}\nfunction timeToIso8061Time(hours, minutes, seconds) {\n const obj = new Time(hours, minutes, seconds);\n if (obj.isValid()) {\n return obj.format(ISO_8061_TIME_PATTERN);\n }\n return undefined;\n}\nfunction iso8601TimeToTimeObject(val) {\n return Time.parse(val, ISO_8061_TIME_PATTERN);\n}\nexport default {\n isRelativeTime: isRelativeTime,\n isTime: isTime,\n isIso8601Time: isIso8601Time,\n compareTimes: compareTimes,\n timeToIso8061Time: timeToIso8061Time,\n iso8601TimeToTimeObject: iso8601TimeToTimeObject\n};\n"],"sourceRoot":""}