{"version":3,"file":"vts-voffice-ng-vts-core-pipe.mjs","sources":["../../components/core/pipe/time-range.pipe.ts","../../components/core/pipe/vts-pipe.module.ts","../../components/core/pipe/public-api.ts","../../components/core/pipe/vts-voffice-ng-vts-core-pipe.ts"],"sourcesContent":["/**\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\r\n */\r\n\r\nimport { Pipe, PipeTransform } from '@angular/core';\r\nimport { timeUnits } from '@vts-voffice/ng-vts/core/time';\r\nimport { padStart } from '@vts-voffice/ng-vts/core/util';\r\n\r\n@Pipe({\r\n  name: 'vtsTimeRange',\r\n  pure: true\r\n})\r\nexport class VtsTimeRangePipe implements PipeTransform {\r\n  transform(value: string | number, format: string = 'HH:mm:ss'): string {\r\n    let duration = Number(value || 0);\r\n\r\n    return timeUnits.reduce((current, [name, unit]) => {\r\n      if (current.indexOf(name) !== -1) {\r\n        const v = Math.floor(duration / unit);\r\n        duration -= v * unit;\r\n        return current.replace(new RegExp(`${name}+`, 'g'), (match: string) => {\r\n          return padStart(v.toString(), match.length, '0');\r\n        });\r\n      }\r\n      return current;\r\n    }, format);\r\n  }\r\n}\r\n","/**\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\r\n */\r\n\r\nimport { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\n\r\nimport { VtsTimeRangePipe } from './time-range.pipe';\r\n\r\n@NgModule({\r\n  imports: [CommonModule],\r\n  exports: [VtsTimeRangePipe],\r\n  declarations: [VtsTimeRangePipe]\r\n})\r\nexport class VtsPipesModule {}\r\n","/**\r\n * Use of this source code is governed by an MIT-style license that can be\r\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\r\n */\r\n\r\nexport * from './vts-pipe.module';\r\nexport * from './time-range.pipe';\r\n","/**\n * Generated bund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