/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/xmltv-parser@1.0.0/src/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var moment=require("moment"),SaxoParser=require("saxo-parser"),Channel=function(t){this.id=t,this.names=[]};Channel.prototype.addName=function(t){this.names.push(t)},Channel.prototype.getNames=function(){return this.names};var Prog=function(t){this.chan=t,this.cat=[],this.credits=[]};Prog.prototype.setMoment=function(t,e){this.start=t,this.end=e},Prog.prototype.addCategory=function(t){this.cat.push(t)},Prog.prototype.addPerson=function(t,e){this.credits.push({name:t,role:e})};var XmltvParser=function(t){t=t||{},this.options={timeFmt:t.timeFmt||"YYYYMMDDHHmmss Z",strictTime:void 0!==t.strictTime&&t.strictTime}};XmltvParser.prototype.createConfiguration=function(){var t=this,e=/^([^\(\)]+)/;return{channel:{_open:function(t){t.channel=new Channel(t.attributes.id)},"display-name":function(t){t.parent.channel.addName(t.text)},_close:function(e){t.onChannel&&t.onChannel.call(t,e.channel)}},programme:{_open:function(e){e.prog=new Prog(e.attributes.channel),e.prog.setMoment(t._parseDateTime(e.attributes.start),t._parseDateTime(e.attributes.stop))},_close:function(e){t.onProgramme&&t.onProgramme.call(t,e.prog)},title:function(t){t.parent.prog.title=t.text},"sub-title":function(t){t.parent.prog.subTitle=t.text},desc:function(t){t.parent.prog.desc=t.text},category:function(t){t.parent.prog.addCategory(t.text)},credits:{"*":function(t){var n=t.name,r=t.parent.parent.prog;e.exec(t.text)[0].split(",").forEach((function(t){r.addPerson(t.trim(),n)}))}}}}},XmltvParser.prototype._parseDateTime=function(t){var e=moment(t,this.options.timeFmt,this.options.strictTime);return e.isValid()?e.toDate():null},XmltvParser.prototype.parseFile=function(t,e){new SaxoParser(this.createConfiguration()).parseFile(t,e)},module.exports=XmltvParser;
//# sourceMappingURL=/sm/ae3f53e5dc512a045da7f26d07ef441d8c047753f06c6f4fa9fd4f7fc434b4b8.map