{"version":3,"file":"npm.htmlparser2.js","mappings":";;;;;;;;;AAAa;AACb;AACA;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD;AACA;AACA,mCAAmC,oCAAoC,gBAAgB;AACvF,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA,0CAA0C,4BAA4B;AACtE,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB,GAAG,mBAAmB;AACvC,mCAAmC,mBAAO,CAAC,0DAAY;AACvD,4BAA4B,mBAAO,CAAC,sDAAU;AAC9C,eAAe,mBAAO,CAAC,0DAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,kDAAkD;AACnD;AACA;AACA;AACA;AACA;AACA,CAAC,0DAA0D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA,iBAAiB;;;;;;;;;;;ACxOJ;AACb;AACA,6CAA6C;AAC7C;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,cAAc;AACd,kCAAkC,mBAAO,CAAC,gEAAa;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,OAAO;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,cAAc;;;;;;;;;;;AC1XD;AACb;AACA,6CAA6C;AAC7C;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,yCAAyC,mBAAO,CAAC,sFAA+B;AAChF,sCAAsC,mBAAO,CAAC,uFAAiC;AAC/E,oCAAoC,mBAAO,CAAC,mFAA+B;AAC3E,iCAAiC,mBAAO,CAAC,6EAA4B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,kBAAe;;;;;;;;;;;ACj4BF;AACb;AACA;AACA,mCAAmC,oCAAoC,gBAAgB;AACvF,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA,0CAA0C,4BAA4B;AACtE,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kBAAkB,GAAG,sBAAsB,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,GAAG,uBAAuB,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,cAAc;AAC3L,eAAe,mBAAO,CAAC,0DAAU;AACjC,0CAAyC,EAAE,qCAAqC,2BAA2B,EAAC;AAC5G,mBAAmB,mBAAO,CAAC,0DAAY;AACvC,8CAA6C,EAAE,qCAAqC,mCAAmC,EAAC;AACxH,kDAAiD,EAAE,qCAAqC,mCAAmC,EAAC;AAC5H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,kBAAkB,mBAAO,CAAC,gEAAa;AACvC,6CAA4C,EAAE,qCAAqC,gDAAgD,EAAC;AACpI,+BAA+B,mBAAO,CAAC,kEAAgB;AACvD,mBAAmB;AACnB;AACA;AACA;AACA;AACA,aAAa,mBAAO,CAAC,oEAAe;AACpC,gBAAgB,gBAAgB,mBAAO,CAAC,sDAAU;AAClD,oBAAoB,mBAAO,CAAC,oEAAe;AAC3C,8CAA6C,EAAE,qCAAqC,qCAAqC,EAAC","sources":["webpack://giveeasy.cloud/./node_modules/htmlparser2/lib/FeedHandler.js","webpack://giveeasy.cloud/./node_modules/htmlparser2/lib/Parser.js","webpack://giveeasy.cloud/./node_modules/htmlparser2/lib/Tokenizer.js","webpack://giveeasy.cloud/./node_modules/htmlparser2/lib/index.js"],"sourcesContent":["\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseFeed = exports.FeedHandler = void 0;\nvar domhandler_1 = __importDefault(require(\"domhandler\"));\nvar DomUtils = __importStar(require(\"domutils\"));\nvar Parser_1 = require(\"./Parser\");\nvar FeedItemMediaMedium;\n(function (FeedItemMediaMedium) {\n FeedItemMediaMedium[FeedItemMediaMedium[\"image\"] = 0] = \"image\";\n FeedItemMediaMedium[FeedItemMediaMedium[\"audio\"] = 1] = \"audio\";\n FeedItemMediaMedium[FeedItemMediaMedium[\"video\"] = 2] = \"video\";\n FeedItemMediaMedium[FeedItemMediaMedium[\"document\"] = 3] = \"document\";\n FeedItemMediaMedium[FeedItemMediaMedium[\"executable\"] = 4] = \"executable\";\n})(FeedItemMediaMedium || (FeedItemMediaMedium = {}));\nvar FeedItemMediaExpression;\n(function (FeedItemMediaExpression) {\n FeedItemMediaExpression[FeedItemMediaExpression[\"sample\"] = 0] = \"sample\";\n FeedItemMediaExpression[FeedItemMediaExpression[\"full\"] = 1] = \"full\";\n FeedItemMediaExpression[FeedItemMediaExpression[\"nonstop\"] = 2] = \"nonstop\";\n})(FeedItemMediaExpression || (FeedItemMediaExpression = {}));\n// TODO: Consume data as it is coming in\nvar FeedHandler = /** @class */ (function (_super) {\n __extends(FeedHandler, _super);\n /**\n *\n * @param callback\n * @param options\n */\n function FeedHandler(callback, options) {\n var _this = this;\n if (typeof callback === \"object\") {\n callback = undefined;\n options = callback;\n }\n _this = _super.call(this, callback, options) || this;\n return _this;\n }\n FeedHandler.prototype.onend = function () {\n var _a, _b;\n var feed = {};\n var feedRoot = getOneElement(isValidFeed, this.dom);\n if (feedRoot) {\n if (feedRoot.name === \"feed\") {\n var childs = feedRoot.children;\n feed.type = \"atom\";\n addConditionally(feed, \"id\", \"id\", childs);\n addConditionally(feed, \"title\", \"title\", childs);\n var href = getAttribute(\"href\", getOneElement(\"link\", childs));\n if (href) {\n feed.link = href;\n }\n addConditionally(feed, \"description\", \"subtitle\", childs);\n var updated = fetch(\"updated\", childs);\n if (updated) {\n feed.updated = new Date(updated);\n }\n addConditionally(feed, \"author\", \"email\", childs, true);\n feed.items = getElements(\"entry\", childs).map(function (item) {\n var entry = {};\n var children = item.children;\n addConditionally(entry, \"id\", \"id\", children);\n addConditionally(entry, \"title\", \"title\", children);\n var href = getAttribute(\"href\", getOneElement(\"link\", children));\n if (href) {\n entry.link = href;\n }\n var description = fetch(\"summary\", children) ||\n fetch(\"content\", children);\n if (description) {\n entry.description = description;\n }\n var pubDate = fetch(\"updated\", children);\n if (pubDate) {\n entry.pubDate = new Date(pubDate);\n }\n entry.media = getMediaElements(children);\n return entry;\n });\n }\n else {\n var childs = (_b = (_a = getOneElement(\"channel\", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];\n feed.type = feedRoot.name.substr(0, 3);\n feed.id = \"\";\n addConditionally(feed, \"title\", \"title\", childs);\n addConditionally(feed, \"link\", \"link\", childs);\n addConditionally(feed, \"description\", \"description\", childs);\n var updated = fetch(\"lastBuildDate\", childs);\n if (updated) {\n feed.updated = new Date(updated);\n }\n addConditionally(feed, \"author\", \"managingEditor\", childs, true);\n feed.items = getElements(\"item\", feedRoot.children).map(function (item) {\n var entry = {};\n var children = item.children;\n addConditionally(entry, \"id\", \"guid\", children);\n addConditionally(entry, \"title\", \"title\", children);\n addConditionally(entry, \"link\", \"link\", children);\n addConditionally(entry, \"description\", \"description\", children);\n var pubDate = fetch(\"pubDate\", children);\n if (pubDate)\n entry.pubDate = new Date(pubDate);\n entry.media = getMediaElements(children);\n return entry;\n });\n }\n }\n this.feed = feed;\n this.handleCallback(feedRoot ? null : Error(\"couldn't find root of feed\"));\n };\n return FeedHandler;\n}(domhandler_1.default));\nexports.FeedHandler = FeedHandler;\nfunction getMediaElements(where) {\n return getElements(\"media:content\", where).map(function (elem) {\n var media = {\n medium: elem.attribs.medium,\n isDefault: !!elem.attribs.isDefault,\n };\n if (elem.attribs.url) {\n media.url = elem.attribs.url;\n }\n if (elem.attribs.fileSize) {\n media.fileSize = parseInt(elem.attribs.fileSize, 10);\n }\n if (elem.attribs.type) {\n media.type = elem.attribs.type;\n }\n if (elem.attribs.expression) {\n media.expression = elem.attribs\n .expression;\n }\n if (elem.attribs.bitrate) {\n media.bitrate = parseInt(elem.attribs.bitrate, 10);\n }\n if (elem.attribs.framerate) {\n media.framerate = parseInt(elem.attribs.framerate, 10);\n }\n if (elem.attribs.samplingrate) {\n media.samplingrate = parseInt(elem.attribs.samplingrate, 10);\n }\n if (elem.attribs.channels) {\n media.channels = parseInt(elem.attribs.channels, 10);\n }\n if (elem.attribs.duration) {\n media.duration = parseInt(elem.attribs.duration, 10);\n }\n if (elem.attribs.height) {\n media.height = parseInt(elem.attribs.height, 10);\n }\n if (elem.attribs.width) {\n media.width = parseInt(elem.attribs.width, 10);\n }\n if (elem.attribs.lang) {\n media.lang = elem.attribs.lang;\n }\n return media;\n });\n}\nfunction getElements(tagName, where) {\n return DomUtils.getElementsByTagName(tagName, where, true);\n}\nfunction getOneElement(tagName, node) {\n return DomUtils.getElementsByTagName(tagName, node, true, 1)[0];\n}\nfunction fetch(tagName, where, recurse) {\n if (recurse === void 0) { recurse = false; }\n return DomUtils.getText(DomUtils.getElementsByTagName(tagName, where, recurse, 1)).trim();\n}\nfunction getAttribute(name, elem) {\n if (!elem) {\n return null;\n }\n var attribs = elem.attribs;\n return attribs[name];\n}\nfunction addConditionally(obj, prop, what, where, recurse) {\n if (recurse === void 0) { recurse = false; }\n var tmp = fetch(what, where, recurse);\n if (tmp)\n obj[prop] = tmp;\n}\nfunction isValidFeed(value) {\n return value === \"rss\" || value === \"feed\" || value === \"rdf:RDF\";\n}\nvar defaultOptions = { xmlMode: true };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this option, you probably want to set `xmlMode` to `true`.\n */\nfunction parseFeed(feed, options) {\n if (options === void 0) { options = defaultOptions; }\n var handler = new FeedHandler(options);\n new Parser_1.Parser(handler, options).end(feed);\n return handler.feed;\n}\nexports.parseFeed = parseFeed;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Parser = void 0;\nvar Tokenizer_1 = __importDefault(require(\"./Tokenizer\"));\nvar formTags = new Set([\n \"input\",\n \"option\",\n \"optgroup\",\n \"select\",\n \"button\",\n \"datalist\",\n \"textarea\",\n]);\nvar pTag = new Set([\"p\"]);\nvar openImpliesClose = {\n tr: new Set([\"tr\", \"th\", \"td\"]),\n th: new Set([\"th\"]),\n td: new Set([\"thead\", \"th\", \"td\"]),\n body: new Set([\"head\", \"link\", \"script\"]),\n li: new Set([\"li\"]),\n p: pTag,\n h1: pTag,\n h2: pTag,\n h3: pTag,\n h4: pTag,\n h5: pTag,\n h6: pTag,\n select: formTags,\n input: formTags,\n output: formTags,\n button: formTags,\n datalist: formTags,\n textarea: formTags,\n option: new Set([\"option\"]),\n optgroup: new Set([\"optgroup\", \"option\"]),\n dd: new Set([\"dt\", \"dd\"]),\n dt: new Set([\"dt\", \"dd\"]),\n address: pTag,\n article: pTag,\n aside: pTag,\n blockquote: pTag,\n details: pTag,\n div: pTag,\n dl: pTag,\n fieldset: pTag,\n figcaption: pTag,\n figure: pTag,\n footer: pTag,\n form: pTag,\n header: pTag,\n hr: pTag,\n main: pTag,\n nav: pTag,\n ol: pTag,\n pre: pTag,\n section: pTag,\n table: pTag,\n ul: pTag,\n rt: new Set([\"rt\", \"rp\"]),\n rp: new Set([\"rt\", \"rp\"]),\n tbody: new Set([\"thead\", \"tbody\"]),\n tfoot: new Set([\"thead\", \"tbody\"]),\n};\nvar voidElements = new Set([\n \"area\",\n \"base\",\n \"basefont\",\n \"br\",\n \"col\",\n \"command\",\n \"embed\",\n \"frame\",\n \"hr\",\n \"img\",\n \"input\",\n \"isindex\",\n \"keygen\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\nvar foreignContextElements = new Set([\"math\", \"svg\"]);\nvar htmlIntegrationElements = new Set([\n \"mi\",\n \"mo\",\n \"mn\",\n \"ms\",\n \"mtext\",\n \"annotation-xml\",\n \"foreignObject\",\n \"desc\",\n \"title\",\n]);\nvar reNameEnd = /\\s|\\//;\nvar Parser = /** @class */ (function () {\n function Parser(cbs, options) {\n if (options === void 0) { options = {}; }\n var _a, _b, _c, _d, _e;\n /** The start index of the last event. */\n this.startIndex = 0;\n /** The end index of the last event. */\n this.endIndex = null;\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribvalue = \"\";\n this.attribs = null;\n this.stack = [];\n this.foreignContext = [];\n this.options = options;\n this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};\n this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode;\n this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode;\n this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer_1.default)(this.options, this);\n (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this);\n }\n Parser.prototype.updatePosition = function (initialOffset) {\n if (this.endIndex === null) {\n if (this.tokenizer.sectionStart <= initialOffset) {\n this.startIndex = 0;\n }\n else {\n this.startIndex = this.tokenizer.sectionStart - initialOffset;\n }\n }\n else {\n this.startIndex = this.endIndex + 1;\n }\n this.endIndex = this.tokenizer.getAbsoluteIndex();\n };\n // Tokenizer event handlers\n Parser.prototype.ontext = function (data) {\n var _a, _b;\n this.updatePosition(1);\n this.endIndex--;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data);\n };\n Parser.prototype.onopentagname = function (name) {\n var _a, _b;\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n this.tagname = name;\n if (!this.options.xmlMode &&\n Object.prototype.hasOwnProperty.call(openImpliesClose, name)) {\n var el = void 0;\n while (this.stack.length > 0 &&\n openImpliesClose[name].has((el = this.stack[this.stack.length - 1]))) {\n this.onclosetag(el);\n }\n }\n if (this.options.xmlMode || !voidElements.has(name)) {\n this.stack.push(name);\n if (foreignContextElements.has(name)) {\n this.foreignContext.push(true);\n }\n else if (htmlIntegrationElements.has(name)) {\n this.foreignContext.push(false);\n }\n }\n (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, name);\n if (this.cbs.onopentag)\n this.attribs = {};\n };\n Parser.prototype.onopentagend = function () {\n var _a, _b;\n this.updatePosition(1);\n if (this.attribs) {\n (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs);\n this.attribs = null;\n }\n if (!this.options.xmlMode &&\n this.cbs.onclosetag &&\n voidElements.has(this.tagname)) {\n this.cbs.onclosetag(this.tagname);\n }\n this.tagname = \"\";\n };\n Parser.prototype.onclosetag = function (name) {\n this.updatePosition(1);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n if (foreignContextElements.has(name) ||\n htmlIntegrationElements.has(name)) {\n this.foreignContext.pop();\n }\n if (this.stack.length &&\n (this.options.xmlMode || !voidElements.has(name))) {\n var pos = this.stack.lastIndexOf(name);\n if (pos !== -1) {\n if (this.cbs.onclosetag) {\n pos = this.stack.length - pos;\n while (pos--) {\n // We know the stack has sufficient elements.\n this.cbs.onclosetag(this.stack.pop());\n }\n }\n else\n this.stack.length = pos;\n }\n else if (name === \"p\" && !this.options.xmlMode) {\n this.onopentagname(name);\n this.closeCurrentTag();\n }\n }\n else if (!this.options.xmlMode && (name === \"br\" || name === \"p\")) {\n this.onopentagname(name);\n this.closeCurrentTag();\n }\n };\n Parser.prototype.onselfclosingtag = function () {\n if (this.options.xmlMode ||\n this.options.recognizeSelfClosing ||\n this.foreignContext[this.foreignContext.length - 1]) {\n this.closeCurrentTag();\n }\n else {\n this.onopentagend();\n }\n };\n Parser.prototype.closeCurrentTag = function () {\n var _a, _b;\n var name = this.tagname;\n this.onopentagend();\n /*\n * Self-closing tags will be on the top of the stack\n * (cheaper check than in onclosetag)\n */\n if (this.stack[this.stack.length - 1] === name) {\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name);\n this.stack.pop();\n }\n };\n Parser.prototype.onattribname = function (name) {\n if (this.lowerCaseAttributeNames) {\n name = name.toLowerCase();\n }\n this.attribname = name;\n };\n Parser.prototype.onattribdata = function (value) {\n this.attribvalue += value;\n };\n Parser.prototype.onattribend = function (quote) {\n var _a, _b;\n (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote);\n if (this.attribs &&\n !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {\n this.attribs[this.attribname] = this.attribvalue;\n }\n this.attribname = \"\";\n this.attribvalue = \"\";\n };\n Parser.prototype.getInstructionName = function (value) {\n var idx = value.search(reNameEnd);\n var name = idx < 0 ? value : value.substr(0, idx);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n return name;\n };\n Parser.prototype.ondeclaration = function (value) {\n if (this.cbs.onprocessinginstruction) {\n var name_1 = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(\"!\" + name_1, \"!\" + value);\n }\n };\n Parser.prototype.onprocessinginstruction = function (value) {\n if (this.cbs.onprocessinginstruction) {\n var name_2 = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(\"?\" + name_2, \"?\" + value);\n }\n };\n Parser.prototype.oncomment = function (value) {\n var _a, _b, _c, _d;\n this.updatePosition(4);\n (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, value);\n (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);\n };\n Parser.prototype.oncdata = function (value) {\n var _a, _b, _c, _d, _e, _f;\n this.updatePosition(1);\n if (this.options.xmlMode || this.options.recognizeCDATA) {\n (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);\n (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);\n (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);\n }\n else {\n this.oncomment(\"[CDATA[\" + value + \"]]\");\n }\n };\n Parser.prototype.onerror = function (err) {\n var _a, _b;\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, err);\n };\n Parser.prototype.onend = function () {\n var _a, _b;\n if (this.cbs.onclosetag) {\n for (var i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i]))\n ;\n }\n (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a);\n };\n /**\n * Resets the parser to a blank state, ready to parse a new HTML document\n */\n Parser.prototype.reset = function () {\n var _a, _b, _c, _d;\n (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a);\n this.tokenizer.reset();\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribs = null;\n this.stack = [];\n (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);\n };\n /**\n * Parses a complete document and pushes it to the handler.\n *\n * @param data Document to parse.\n */\n Parser.prototype.parseComplete = function (data) {\n this.reset();\n this.end(data);\n };\n /**\n * Parses a chunk of data and calls the corresponding callbacks.\n *\n * @param chunk Chunk to parse.\n */\n Parser.prototype.write = function (chunk) {\n this.tokenizer.write(chunk);\n };\n /**\n * Parses the end of the buffer and clears the stack, calls onend.\n *\n * @param chunk Optional final chunk to parse.\n */\n Parser.prototype.end = function (chunk) {\n this.tokenizer.end(chunk);\n };\n /**\n * Pauses parsing. The parser won't emit events until `resume` is called.\n */\n Parser.prototype.pause = function () {\n this.tokenizer.pause();\n };\n /**\n * Resumes parsing after `pause` was called.\n */\n Parser.prototype.resume = function () {\n this.tokenizer.resume();\n };\n /**\n * Alias of `write`, for backwards compatibility.\n *\n * @param chunk Chunk to parse.\n * @deprecated\n */\n Parser.prototype.parseChunk = function (chunk) {\n this.write(chunk);\n };\n /**\n * Alias of `end`, for backwards compatibility.\n *\n * @param chunk Optional final chunk to parse.\n * @deprecated\n */\n Parser.prototype.done = function (chunk) {\n this.end(chunk);\n };\n return Parser;\n}());\nexports.Parser = Parser;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar decode_codepoint_1 = __importDefault(require(\"entities/lib/decode_codepoint\"));\nvar entities_json_1 = __importDefault(require(\"entities/lib/maps/entities.json\"));\nvar legacy_json_1 = __importDefault(require(\"entities/lib/maps/legacy.json\"));\nvar xml_json_1 = __importDefault(require(\"entities/lib/maps/xml.json\"));\nfunction whitespace(c) {\n return c === \" \" || c === \"\\n\" || c === \"\\t\" || c === \"\\f\" || c === \"\\r\";\n}\nfunction isASCIIAlpha(c) {\n return (c >= \"a\" && c <= \"z\") || (c >= \"A\" && c <= \"Z\");\n}\nfunction ifElseState(upper, SUCCESS, FAILURE) {\n var lower = upper.toLowerCase();\n if (upper === lower) {\n return function (t, c) {\n if (c === lower) {\n t._state = SUCCESS;\n }\n else {\n t._state = FAILURE;\n t._index--;\n }\n };\n }\n return function (t, c) {\n if (c === lower || c === upper) {\n t._state = SUCCESS;\n }\n else {\n t._state = FAILURE;\n t._index--;\n }\n };\n}\nfunction consumeSpecialNameChar(upper, NEXT_STATE) {\n var lower = upper.toLowerCase();\n return function (t, c) {\n if (c === lower || c === upper) {\n t._state = NEXT_STATE;\n }\n else {\n t._state = 3 /* InTagName */;\n t._index--; // Consume the token again\n }\n };\n}\nvar stateBeforeCdata1 = ifElseState(\"C\", 24 /* BeforeCdata2 */, 16 /* InDeclaration */);\nvar stateBeforeCdata2 = ifElseState(\"D\", 25 /* BeforeCdata3 */, 16 /* InDeclaration */);\nvar stateBeforeCdata3 = ifElseState(\"A\", 26 /* BeforeCdata4 */, 16 /* InDeclaration */);\nvar stateBeforeCdata4 = ifElseState(\"T\", 27 /* BeforeCdata5 */, 16 /* InDeclaration */);\nvar stateBeforeCdata5 = ifElseState(\"A\", 28 /* BeforeCdata6 */, 16 /* InDeclaration */);\nvar stateBeforeScript1 = consumeSpecialNameChar(\"R\", 35 /* BeforeScript2 */);\nvar stateBeforeScript2 = consumeSpecialNameChar(\"I\", 36 /* BeforeScript3 */);\nvar stateBeforeScript3 = consumeSpecialNameChar(\"P\", 37 /* BeforeScript4 */);\nvar stateBeforeScript4 = consumeSpecialNameChar(\"T\", 38 /* BeforeScript5 */);\nvar stateAfterScript1 = ifElseState(\"R\", 40 /* AfterScript2 */, 1 /* Text */);\nvar stateAfterScript2 = ifElseState(\"I\", 41 /* AfterScript3 */, 1 /* Text */);\nvar stateAfterScript3 = ifElseState(\"P\", 42 /* AfterScript4 */, 1 /* Text */);\nvar stateAfterScript4 = ifElseState(\"T\", 43 /* AfterScript5 */, 1 /* Text */);\nvar stateBeforeStyle1 = consumeSpecialNameChar(\"Y\", 45 /* BeforeStyle2 */);\nvar stateBeforeStyle2 = consumeSpecialNameChar(\"L\", 46 /* BeforeStyle3 */);\nvar stateBeforeStyle3 = consumeSpecialNameChar(\"E\", 47 /* BeforeStyle4 */);\nvar stateAfterStyle1 = ifElseState(\"Y\", 49 /* AfterStyle2 */, 1 /* Text */);\nvar stateAfterStyle2 = ifElseState(\"L\", 50 /* AfterStyle3 */, 1 /* Text */);\nvar stateAfterStyle3 = ifElseState(\"E\", 51 /* AfterStyle4 */, 1 /* Text */);\nvar stateBeforeSpecialT = consumeSpecialNameChar(\"I\", 54 /* BeforeTitle1 */);\nvar stateBeforeTitle1 = consumeSpecialNameChar(\"T\", 55 /* BeforeTitle2 */);\nvar stateBeforeTitle2 = consumeSpecialNameChar(\"L\", 56 /* BeforeTitle3 */);\nvar stateBeforeTitle3 = consumeSpecialNameChar(\"E\", 57 /* BeforeTitle4 */);\nvar stateAfterSpecialTEnd = ifElseState(\"I\", 58 /* AfterTitle1 */, 1 /* Text */);\nvar stateAfterTitle1 = ifElseState(\"T\", 59 /* AfterTitle2 */, 1 /* Text */);\nvar stateAfterTitle2 = ifElseState(\"L\", 60 /* AfterTitle3 */, 1 /* Text */);\nvar stateAfterTitle3 = ifElseState(\"E\", 61 /* AfterTitle4 */, 1 /* Text */);\nvar stateBeforeEntity = ifElseState(\"#\", 63 /* BeforeNumericEntity */, 64 /* InNamedEntity */);\nvar stateBeforeNumericEntity = ifElseState(\"X\", 66 /* InHexEntity */, 65 /* InNumericEntity */);\nvar Tokenizer = /** @class */ (function () {\n function Tokenizer(options, cbs) {\n var _a;\n /** The current state the tokenizer is in. */\n this._state = 1 /* Text */;\n /** The read buffer. */\n this.buffer = \"\";\n /** The beginning of the section that is currently being read. */\n this.sectionStart = 0;\n /** The index within the buffer that we are currently looking at. */\n this._index = 0;\n /**\n * Data that has already been processed will be removed from the buffer occasionally.\n * `_bufferOffset` keeps track of how many characters have been removed, to make sure position information is accurate.\n */\n this.bufferOffset = 0;\n /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */\n this.baseState = 1 /* Text */;\n /** For special parsing behavior inside of script and style tags. */\n this.special = 1 /* None */;\n /** Indicates whether the tokenizer has been paused. */\n this.running = true;\n /** Indicates whether the tokenizer has finished running / `.end` has been called. */\n this.ended = false;\n this.cbs = cbs;\n this.xmlMode = !!(options === null || options === void 0 ? void 0 : options.xmlMode);\n this.decodeEntities = (_a = options === null || options === void 0 ? void 0 : options.decodeEntities) !== null && _a !== void 0 ? _a : true;\n }\n Tokenizer.prototype.reset = function () {\n this._state = 1 /* Text */;\n this.buffer = \"\";\n this.sectionStart = 0;\n this._index = 0;\n this.bufferOffset = 0;\n this.baseState = 1 /* Text */;\n this.special = 1 /* None */;\n this.running = true;\n this.ended = false;\n };\n Tokenizer.prototype.write = function (chunk) {\n if (this.ended)\n this.cbs.onerror(Error(\".write() after done!\"));\n this.buffer += chunk;\n this.parse();\n };\n Tokenizer.prototype.end = function (chunk) {\n if (this.ended)\n this.cbs.onerror(Error(\".end() after done!\"));\n if (chunk)\n this.write(chunk);\n this.ended = true;\n if (this.running)\n this.finish();\n };\n Tokenizer.prototype.pause = function () {\n this.running = false;\n };\n Tokenizer.prototype.resume = function () {\n this.running = true;\n if (this._index < this.buffer.length) {\n this.parse();\n }\n if (this.ended) {\n this.finish();\n }\n };\n /**\n * The current index within all of the written data.\n */\n Tokenizer.prototype.getAbsoluteIndex = function () {\n return this.bufferOffset + this._index;\n };\n Tokenizer.prototype.stateText = function (c) {\n if (c === \"<\") {\n if (this._index > this.sectionStart) {\n this.cbs.ontext(this.getSection());\n }\n this._state = 2 /* BeforeTagName */;\n this.sectionStart = this._index;\n }\n else if (this.decodeEntities &&\n c === \"&\" &&\n (this.special === 1 /* None */ || this.special === 4 /* Title */)) {\n if (this._index > this.sectionStart) {\n this.cbs.ontext(this.getSection());\n }\n this.baseState = 1 /* Text */;\n this._state = 62 /* BeforeEntity */;\n this.sectionStart = this._index;\n }\n };\n Tokenizer.prototype.stateBeforeTagName = function (c) {\n if (c === \"/\") {\n this._state = 5 /* BeforeClosingTagName */;\n }\n else if (c === \"<\") {\n this.cbs.ontext(this.getSection());\n this.sectionStart = this._index;\n }\n else if (c === \">\" ||\n this.special !== 1 /* None */ ||\n whitespace(c)) {\n this._state = 1 /* Text */;\n }\n else if (c === \"!\") {\n this._state = 15 /* BeforeDeclaration */;\n this.sectionStart = this._index + 1;\n }\n else if (c === \"?\") {\n this._state = 17 /* InProcessingInstruction */;\n this.sectionStart = this._index + 1;\n }\n else if (!isASCIIAlpha(c)) {\n this._state = 1 /* Text */;\n }\n else {\n this._state =\n !this.xmlMode && (c === \"s\" || c === \"S\")\n ? 32 /* BeforeSpecialS */\n : !this.xmlMode && (c === \"t\" || c === \"T\")\n ? 52 /* BeforeSpecialT */\n : 3 /* InTagName */;\n this.sectionStart = this._index;\n }\n };\n Tokenizer.prototype.stateInTagName = function (c) {\n if (c === \"/\" || c === \">\" || whitespace(c)) {\n this.emitToken(\"onopentagname\");\n this._state = 8 /* BeforeAttributeName */;\n this._index--;\n }\n };\n Tokenizer.prototype.stateBeforeClosingTagName = function (c) {\n if (whitespace(c)) {\n // Ignore\n }\n else if (c === \">\") {\n this._state = 1 /* Text */;\n }\n else if (this.special !== 1 /* None */) {\n if (c === \"s\" || c === \"S\") {\n this._state = 33 /* BeforeSpecialSEnd */;\n }\n else if (c === \"t\" || c === \"T\") {\n this._state = 53 /* BeforeSpecialTEnd */;\n }\n else {\n this._state = 1 /* Text */;\n this._index--;\n }\n }\n else if (!isASCIIAlpha(c)) {\n this._state = 20 /* InSpecialComment */;\n this.sectionStart = this._index;\n }\n else {\n this._state = 6 /* InClosingTagName */;\n this.sectionStart = this._index;\n }\n };\n Tokenizer.prototype.stateInClosingTagName = function (c) {\n if (c === \">\" || whitespace(c)) {\n this.emitToken(\"onclosetag\");\n this._state = 7 /* AfterClosingTagName */;\n this._index--;\n }\n };\n Tokenizer.prototype.stateAfterClosingTagName = function (c) {\n // Skip everything until \">\"\n if (c === \">\") {\n this._state = 1 /* Text */;\n this.sectionStart = this._index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeName = function (c) {\n if (c === \">\") {\n this.cbs.onopentagend();\n this._state = 1 /* Text */;\n this.sectionStart = this._index + 1;\n }\n else if (c === \"/\") {\n this._state = 4 /* InSelfClosingTag */;\n }\n else if (!whitespace(c)) {\n this._state = 9 /* InAttributeName */;\n this.sectionStart = this._index;\n }\n };\n Tokenizer.prototype.stateInSelfClosingTag = function (c) {\n if (c === \">\") {\n this.cbs.onselfclosingtag();\n this._state = 1 /* Text */;\n this.sectionStart = this._index + 1;\n this.special = 1 /* None */; // Reset special state, in case of self-closing special tags\n }\n else if (!whitespace(c)) {\n this._state = 8 /* BeforeAttributeName */;\n this._index--;\n }\n };\n Tokenizer.prototype.stateInAttributeName = function (c) {\n if (c === \"=\" || c === \"/\" || c === \">\" || whitespace(c)) {\n this.cbs.onattribname(this.getSection());\n this.sectionStart = -1;\n this._state = 10 /* AfterAttributeName */;\n this._index--;\n }\n };\n Tokenizer.prototype.stateAfterAttributeName = function (c) {\n if (c === \"=\") {\n this._state = 11 /* BeforeAttributeValue */;\n }\n else if (c === \"/\" || c === \">\") {\n this.cbs.onattribend(undefined);\n this._state = 8 /* BeforeAttributeName */;\n this._index--;\n }\n else if (!whitespace(c)) {\n this.cbs.onattribend(undefined);\n this._state = 9 /* InAttributeName */;\n this.sectionStart = this._index;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeValue = function (c) {\n if (c === '\"') {\n this._state = 12 /* InAttributeValueDq */;\n this.sectionStart = this._index + 1;\n }\n else if (c === \"'\") {\n this._state = 13 /* InAttributeValueSq */;\n this.sectionStart = this._index + 1;\n }\n else if (!whitespace(c)) {\n this._state = 14 /* InAttributeValueNq */;\n this.sectionStart = this._index;\n this._index--; // Reconsume token\n }\n };\n Tokenizer.prototype.handleInAttributeValue = function (c, quote) {\n if (c === quote) {\n this.emitToken(\"onattribdata\");\n this.cbs.onattribend(quote);\n this._state = 8 /* BeforeAttributeName */;\n }\n else if (this.decodeEntities && c === \"&\") {\n this.emitToken(\"onattribdata\");\n this.baseState = this._state;\n this._state = 62 /* BeforeEntity */;\n this.sectionStart = this._index;\n }\n };\n Tokenizer.prototype.stateInAttributeValueDoubleQuotes = function (c) {\n this.handleInAttributeValue(c, '\"');\n };\n Tokenizer.prototype.stateInAttributeValueSingleQuotes = function (c) {\n this.handleInAttributeValue(c, \"'\");\n };\n Tokenizer.prototype.stateInAttributeValueNoQuotes = function (c) {\n if (whitespace(c) || c === \">\") {\n this.emitToken(\"onattribdata\");\n this.cbs.onattribend(null);\n this._state = 8 /* BeforeAttributeName */;\n this._index--;\n }\n else if (this.decodeEntities && c === \"&\") {\n this.emitToken(\"onattribdata\");\n this.baseState = this._state;\n this._state = 62 /* BeforeEntity */;\n this.sectionStart = this._index;\n }\n };\n Tokenizer.prototype.stateBeforeDeclaration = function (c) {\n this._state =\n c === \"[\"\n ? 23 /* BeforeCdata1 */\n : c === \"-\"\n ? 18 /* BeforeComment */\n : 16 /* InDeclaration */;\n };\n Tokenizer.prototype.stateInDeclaration = function (c) {\n if (c === \">\") {\n this.cbs.ondeclaration(this.getSection());\n this._state = 1 /* Text */;\n this.sectionStart = this._index + 1;\n }\n };\n Tokenizer.prototype.stateInProcessingInstruction = function (c) {\n if (c === \">\") {\n this.cbs.onprocessinginstruction(this.getSection());\n this._state = 1 /* Text */;\n this.sectionStart = this._index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeComment = function (c) {\n if (c === \"-\") {\n this._state = 19 /* InComment */;\n this.sectionStart = this._index + 1;\n }\n else {\n this._state = 16 /* InDeclaration */;\n }\n };\n Tokenizer.prototype.stateInComment = function (c) {\n if (c === \"-\")\n this._state = 21 /* AfterComment1 */;\n };\n Tokenizer.prototype.stateInSpecialComment = function (c) {\n if (c === \">\") {\n this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index));\n this._state = 1 /* Text */;\n this.sectionStart = this._index + 1;\n }\n };\n Tokenizer.prototype.stateAfterComment1 = function (c) {\n if (c === \"-\") {\n this._state = 22 /* AfterComment2 */;\n }\n else {\n this._state = 19 /* InComment */;\n }\n };\n Tokenizer.prototype.stateAfterComment2 = function (c) {\n if (c === \">\") {\n // Remove 2 trailing chars\n this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index - 2));\n this._state = 1 /* Text */;\n this.sectionStart = this._index + 1;\n }\n else if (c !== \"-\") {\n this._state = 19 /* InComment */;\n }\n // Else: stay in AFTER_COMMENT_2 (`--->`)\n };\n Tokenizer.prototype.stateBeforeCdata6 = function (c) {\n if (c === \"[\") {\n this._state = 29 /* InCdata */;\n this.sectionStart = this._index + 1;\n }\n else {\n this._state = 16 /* InDeclaration */;\n this._index--;\n }\n };\n Tokenizer.prototype.stateInCdata = function (c) {\n if (c === \"]\")\n this._state = 30 /* AfterCdata1 */;\n };\n Tokenizer.prototype.stateAfterCdata1 = function (c) {\n if (c === \"]\")\n this._state = 31 /* AfterCdata2 */;\n else\n this._state = 29 /* InCdata */;\n };\n Tokenizer.prototype.stateAfterCdata2 = function (c) {\n if (c === \">\") {\n // Remove 2 trailing chars\n this.cbs.oncdata(this.buffer.substring(this.sectionStart, this._index - 2));\n this._state = 1 /* Text */;\n this.sectionStart = this._index + 1;\n }\n else if (c !== \"]\") {\n this._state = 29 /* InCdata */;\n }\n // Else: stay in AFTER_CDATA_2 (`]]]>`)\n };\n Tokenizer.prototype.stateBeforeSpecialS = function (c) {\n if (c === \"c\" || c === \"C\") {\n this._state = 34 /* BeforeScript1 */;\n }\n else if (c === \"t\" || c === \"T\") {\n this._state = 44 /* BeforeStyle1 */;\n }\n else {\n this._state = 3 /* InTagName */;\n this._index--; // Consume the token again\n }\n };\n Tokenizer.prototype.stateBeforeSpecialSEnd = function (c) {\n if (this.special === 2 /* Script */ && (c === \"c\" || c === \"C\")) {\n this._state = 39 /* AfterScript1 */;\n }\n else if (this.special === 3 /* Style */ && (c === \"t\" || c === \"T\")) {\n this._state = 48 /* AfterStyle1 */;\n }\n else\n this._state = 1 /* Text */;\n };\n Tokenizer.prototype.stateBeforeSpecialLast = function (c, special) {\n if (c === \"/\" || c === \">\" || whitespace(c)) {\n this.special = special;\n }\n this._state = 3 /* InTagName */;\n this._index--; // Consume the token again\n };\n Tokenizer.prototype.stateAfterSpecialLast = function (c, sectionStartOffset) {\n if (c === \">\" || whitespace(c)) {\n this.special = 1 /* None */;\n this._state = 6 /* InClosingTagName */;\n this.sectionStart = this._index - sectionStartOffset;\n this._index--; // Reconsume the token\n }\n else\n this._state = 1 /* Text */;\n };\n // For entities terminated with a semicolon\n Tokenizer.prototype.parseFixedEntity = function (map) {\n if (map === void 0) { map = this.xmlMode ? xml_json_1.default : entities_json_1.default; }\n // Offset = 1\n if (this.sectionStart + 1 < this._index) {\n var entity = this.buffer.substring(this.sectionStart + 1, this._index);\n if (Object.prototype.hasOwnProperty.call(map, entity)) {\n this.emitPartial(map[entity]);\n this.sectionStart = this._index + 1;\n }\n }\n };\n // Parses legacy entities (without trailing semicolon)\n Tokenizer.prototype.parseLegacyEntity = function () {\n var start = this.sectionStart + 1;\n // The max length of legacy entities is 6\n var limit = Math.min(this._index - start, 6);\n while (limit >= 2) {\n // The min length of legacy entities is 2\n var entity = this.buffer.substr(start, limit);\n if (Object.prototype.hasOwnProperty.call(legacy_json_1.default, entity)) {\n this.emitPartial(legacy_json_1.default[entity]);\n this.sectionStart += limit + 1;\n return;\n }\n limit--;\n }\n };\n Tokenizer.prototype.stateInNamedEntity = function (c) {\n if (c === \";\") {\n this.parseFixedEntity();\n // Retry as legacy entity if entity wasn't parsed\n if (this.baseState === 1 /* Text */ &&\n this.sectionStart + 1 < this._index &&\n !this.xmlMode) {\n this.parseLegacyEntity();\n }\n this._state = this.baseState;\n }\n else if ((c < \"0\" || c > \"9\") && !isASCIIAlpha(c)) {\n if (this.xmlMode || this.sectionStart + 1 === this._index) {\n // Ignore\n }\n else if (this.baseState !== 1 /* Text */) {\n if (c !== \"=\") {\n // Parse as legacy entity, without allowing additional characters.\n this.parseFixedEntity(legacy_json_1.default);\n }\n }\n else {\n this.parseLegacyEntity();\n }\n this._state = this.baseState;\n this._index--;\n }\n };\n Tokenizer.prototype.decodeNumericEntity = function (offset, base, strict) {\n var sectionStart = this.sectionStart + offset;\n if (sectionStart !== this._index) {\n // Parse entity\n var entity = this.buffer.substring(sectionStart, this._index);\n var parsed = parseInt(entity, base);\n this.emitPartial(decode_codepoint_1.default(parsed));\n this.sectionStart = strict ? this._index + 1 : this._index;\n }\n this._state = this.baseState;\n };\n Tokenizer.prototype.stateInNumericEntity = function (c) {\n if (c === \";\") {\n this.decodeNumericEntity(2, 10, true);\n }\n else if (c < \"0\" || c > \"9\") {\n if (!this.xmlMode) {\n this.decodeNumericEntity(2, 10, false);\n }\n else {\n this._state = this.baseState;\n }\n this._index--;\n }\n };\n Tokenizer.prototype.stateInHexEntity = function (c) {\n if (c === \";\") {\n this.decodeNumericEntity(3, 16, true);\n }\n else if ((c < \"a\" || c > \"f\") &&\n (c < \"A\" || c > \"F\") &&\n (c < \"0\" || c > \"9\")) {\n if (!this.xmlMode) {\n this.decodeNumericEntity(3, 16, false);\n }\n else {\n this._state = this.baseState;\n }\n this._index--;\n }\n };\n Tokenizer.prototype.cleanup = function () {\n if (this.sectionStart < 0) {\n this.buffer = \"\";\n this.bufferOffset += this._index;\n this._index = 0;\n }\n else if (this.running) {\n if (this._state === 1 /* Text */) {\n if (this.sectionStart !== this._index) {\n this.cbs.ontext(this.buffer.substr(this.sectionStart));\n }\n this.buffer = \"\";\n this.bufferOffset += this._index;\n this._index = 0;\n }\n else if (this.sectionStart === this._index) {\n // The section just started\n this.buffer = \"\";\n this.bufferOffset += this._index;\n this._index = 0;\n }\n else {\n // Remove everything unnecessary\n this.buffer = this.buffer.substr(this.sectionStart);\n this._index -= this.sectionStart;\n this.bufferOffset += this.sectionStart;\n }\n this.sectionStart = 0;\n }\n };\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n Tokenizer.prototype.parse = function () {\n while (this._index < this.buffer.length && this.running) {\n var c = this.buffer.charAt(this._index);\n if (this._state === 1 /* Text */) {\n this.stateText(c);\n }\n else if (this._state === 12 /* InAttributeValueDq */) {\n this.stateInAttributeValueDoubleQuotes(c);\n }\n else if (this._state === 9 /* InAttributeName */) {\n this.stateInAttributeName(c);\n }\n else if (this._state === 19 /* InComment */) {\n this.stateInComment(c);\n }\n else if (this._state === 20 /* InSpecialComment */) {\n this.stateInSpecialComment(c);\n }\n else if (this._state === 8 /* BeforeAttributeName */) {\n this.stateBeforeAttributeName(c);\n }\n else if (this._state === 3 /* InTagName */) {\n this.stateInTagName(c);\n }\n else if (this._state === 6 /* InClosingTagName */) {\n this.stateInClosingTagName(c);\n }\n else if (this._state === 2 /* BeforeTagName */) {\n this.stateBeforeTagName(c);\n }\n else if (this._state === 10 /* AfterAttributeName */) {\n this.stateAfterAttributeName(c);\n }\n else if (this._state === 13 /* InAttributeValueSq */) {\n this.stateInAttributeValueSingleQuotes(c);\n }\n else if (this._state === 11 /* BeforeAttributeValue */) {\n this.stateBeforeAttributeValue(c);\n }\n else if (this._state === 5 /* BeforeClosingTagName */) {\n this.stateBeforeClosingTagName(c);\n }\n else if (this._state === 7 /* AfterClosingTagName */) {\n this.stateAfterClosingTagName(c);\n }\n else if (this._state === 32 /* BeforeSpecialS */) {\n this.stateBeforeSpecialS(c);\n }\n else if (this._state === 21 /* AfterComment1 */) {\n this.stateAfterComment1(c);\n }\n else if (this._state === 14 /* InAttributeValueNq */) {\n this.stateInAttributeValueNoQuotes(c);\n }\n else if (this._state === 4 /* InSelfClosingTag */) {\n this.stateInSelfClosingTag(c);\n }\n else if (this._state === 16 /* InDeclaration */) {\n this.stateInDeclaration(c);\n }\n else if (this._state === 15 /* BeforeDeclaration */) {\n this.stateBeforeDeclaration(c);\n }\n else if (this._state === 22 /* AfterComment2 */) {\n this.stateAfterComment2(c);\n }\n else if (this._state === 18 /* BeforeComment */) {\n this.stateBeforeComment(c);\n }\n else if (this._state === 33 /* BeforeSpecialSEnd */) {\n this.stateBeforeSpecialSEnd(c);\n }\n else if (this._state === 53 /* BeforeSpecialTEnd */) {\n stateAfterSpecialTEnd(this, c);\n }\n else if (this._state === 39 /* AfterScript1 */) {\n stateAfterScript1(this, c);\n }\n else if (this._state === 40 /* AfterScript2 */) {\n stateAfterScript2(this, c);\n }\n else if (this._state === 41 /* AfterScript3 */) {\n stateAfterScript3(this, c);\n }\n else if (this._state === 34 /* BeforeScript1 */) {\n stateBeforeScript1(this, c);\n }\n else if (this._state === 35 /* BeforeScript2 */) {\n stateBeforeScript2(this, c);\n }\n else if (this._state === 36 /* BeforeScript3 */) {\n stateBeforeScript3(this, c);\n }\n else if (this._state === 37 /* BeforeScript4 */) {\n stateBeforeScript4(this, c);\n }\n else if (this._state === 38 /* BeforeScript5 */) {\n this.stateBeforeSpecialLast(c, 2 /* Script */);\n }\n else if (this._state === 42 /* AfterScript4 */) {\n stateAfterScript4(this, c);\n }\n else if (this._state === 43 /* AfterScript5 */) {\n this.stateAfterSpecialLast(c, 6);\n }\n else if (this._state === 44 /* BeforeStyle1 */) {\n stateBeforeStyle1(this, c);\n }\n else if (this._state === 29 /* InCdata */) {\n this.stateInCdata(c);\n }\n else if (this._state === 45 /* BeforeStyle2 */) {\n stateBeforeStyle2(this, c);\n }\n else if (this._state === 46 /* BeforeStyle3 */) {\n stateBeforeStyle3(this, c);\n }\n else if (this._state === 47 /* BeforeStyle4 */) {\n this.stateBeforeSpecialLast(c, 3 /* Style */);\n }\n else if (this._state === 48 /* AfterStyle1 */) {\n stateAfterStyle1(this, c);\n }\n else if (this._state === 49 /* AfterStyle2 */) {\n stateAfterStyle2(this, c);\n }\n else if (this._state === 50 /* AfterStyle3 */) {\n stateAfterStyle3(this, c);\n }\n else if (this._state === 51 /* AfterStyle4 */) {\n this.stateAfterSpecialLast(c, 5);\n }\n else if (this._state === 52 /* BeforeSpecialT */) {\n stateBeforeSpecialT(this, c);\n }\n else if (this._state === 54 /* BeforeTitle1 */) {\n stateBeforeTitle1(this, c);\n }\n else if (this._state === 55 /* BeforeTitle2 */) {\n stateBeforeTitle2(this, c);\n }\n else if (this._state === 56 /* BeforeTitle3 */) {\n stateBeforeTitle3(this, c);\n }\n else if (this._state === 57 /* BeforeTitle4 */) {\n this.stateBeforeSpecialLast(c, 4 /* Title */);\n }\n else if (this._state === 58 /* AfterTitle1 */) {\n stateAfterTitle1(this, c);\n }\n else if (this._state === 59 /* AfterTitle2 */) {\n stateAfterTitle2(this, c);\n }\n else if (this._state === 60 /* AfterTitle3 */) {\n stateAfterTitle3(this, c);\n }\n else if (this._state === 61 /* AfterTitle4 */) {\n this.stateAfterSpecialLast(c, 5);\n }\n else if (this._state === 17 /* InProcessingInstruction */) {\n this.stateInProcessingInstruction(c);\n }\n else if (this._state === 64 /* InNamedEntity */) {\n this.stateInNamedEntity(c);\n }\n else if (this._state === 23 /* BeforeCdata1 */) {\n stateBeforeCdata1(this, c);\n }\n else if (this._state === 62 /* BeforeEntity */) {\n stateBeforeEntity(this, c);\n }\n else if (this._state === 24 /* BeforeCdata2 */) {\n stateBeforeCdata2(this, c);\n }\n else if (this._state === 25 /* BeforeCdata3 */) {\n stateBeforeCdata3(this, c);\n }\n else if (this._state === 30 /* AfterCdata1 */) {\n this.stateAfterCdata1(c);\n }\n else if (this._state === 31 /* AfterCdata2 */) {\n this.stateAfterCdata2(c);\n }\n else if (this._state === 26 /* BeforeCdata4 */) {\n stateBeforeCdata4(this, c);\n }\n else if (this._state === 27 /* BeforeCdata5 */) {\n stateBeforeCdata5(this, c);\n }\n else if (this._state === 28 /* BeforeCdata6 */) {\n this.stateBeforeCdata6(c);\n }\n else if (this._state === 66 /* InHexEntity */) {\n this.stateInHexEntity(c);\n }\n else if (this._state === 65 /* InNumericEntity */) {\n this.stateInNumericEntity(c);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n }\n else if (this._state === 63 /* BeforeNumericEntity */) {\n stateBeforeNumericEntity(this, c);\n }\n else {\n this.cbs.onerror(Error(\"unknown _state\"), this._state);\n }\n this._index++;\n }\n this.cleanup();\n };\n Tokenizer.prototype.finish = function () {\n // If there is remaining data, emit it in a reasonable way\n if (this.sectionStart < this._index) {\n this.handleTrailingData();\n }\n this.cbs.onend();\n };\n Tokenizer.prototype.handleTrailingData = function () {\n var data = this.buffer.substr(this.sectionStart);\n if (this._state === 29 /* InCdata */ ||\n this._state === 30 /* AfterCdata1 */ ||\n this._state === 31 /* AfterCdata2 */) {\n this.cbs.oncdata(data);\n }\n else if (this._state === 19 /* InComment */ ||\n this._state === 21 /* AfterComment1 */ ||\n this._state === 22 /* AfterComment2 */) {\n this.cbs.oncomment(data);\n }\n else if (this._state === 64 /* InNamedEntity */ && !this.xmlMode) {\n this.parseLegacyEntity();\n if (this.sectionStart < this._index) {\n this._state = this.baseState;\n this.handleTrailingData();\n }\n }\n else if (this._state === 65 /* InNumericEntity */ && !this.xmlMode) {\n this.decodeNumericEntity(2, 10, false);\n if (this.sectionStart < this._index) {\n this._state = this.baseState;\n this.handleTrailingData();\n }\n }\n else if (this._state === 66 /* InHexEntity */ && !this.xmlMode) {\n this.decodeNumericEntity(3, 16, false);\n if (this.sectionStart < this._index) {\n this._state = this.baseState;\n this.handleTrailingData();\n }\n }\n else if (this._state !== 3 /* InTagName */ &&\n this._state !== 8 /* BeforeAttributeName */ &&\n this._state !== 11 /* BeforeAttributeValue */ &&\n this._state !== 10 /* AfterAttributeName */ &&\n this._state !== 9 /* InAttributeName */ &&\n this._state !== 13 /* InAttributeValueSq */ &&\n this._state !== 12 /* InAttributeValueDq */ &&\n this._state !== 14 /* InAttributeValueNq */ &&\n this._state !== 6 /* InClosingTagName */) {\n this.cbs.ontext(data);\n }\n /*\n * Else, ignore remaining data\n * TODO add a way to remove current tag\n */\n };\n Tokenizer.prototype.getSection = function () {\n return this.buffer.substring(this.sectionStart, this._index);\n };\n Tokenizer.prototype.emitToken = function (name) {\n this.cbs[name](this.getSection());\n this.sectionStart = -1;\n };\n Tokenizer.prototype.emitPartial = function (value) {\n if (this.baseState !== 1 /* Text */) {\n this.cbs.onattribdata(value); // TODO implement the new event\n }\n else {\n this.cbs.ontext(value);\n }\n };\n return Tokenizer;\n}());\nexports.default = Tokenizer;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RssHandler = exports.DefaultHandler = exports.DomUtils = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.DomHandler = exports.Parser = void 0;\nvar Parser_1 = require(\"./Parser\");\nObject.defineProperty(exports, \"Parser\", { enumerable: true, get: function () { return Parser_1.Parser; } });\nvar domhandler_1 = require(\"domhandler\");\nObject.defineProperty(exports, \"DomHandler\", { enumerable: true, get: function () { return domhandler_1.DomHandler; } });\nObject.defineProperty(exports, \"DefaultHandler\", { enumerable: true, get: function () { return domhandler_1.DomHandler; } });\n// Helper methods\n/**\n * Parses data, returns the resulting DOM.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n */\nfunction parseDOM(data, options) {\n var handler = new domhandler_1.DomHandler(void 0, options);\n new Parser_1.Parser(handler, options).end(data);\n return handler.dom;\n}\nexports.parseDOM = parseDOM;\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param cb A callback that will be called once parsing has been completed.\n * @param options Optional options for the parser and DOM builder.\n * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nfunction createDomStream(cb, options, elementCb) {\n var handler = new domhandler_1.DomHandler(cb, options, elementCb);\n return new Parser_1.Parser(handler, options);\n}\nexports.createDomStream = createDomStream;\nvar Tokenizer_1 = require(\"./Tokenizer\");\nObject.defineProperty(exports, \"Tokenizer\", { enumerable: true, get: function () { return __importDefault(Tokenizer_1).default; } });\nvar ElementType = __importStar(require(\"domelementtype\"));\nexports.ElementType = ElementType;\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\n__exportStar(require(\"./FeedHandler\"), exports);\nexports.DomUtils = __importStar(require(\"domutils\"));\nvar FeedHandler_1 = require(\"./FeedHandler\");\nObject.defineProperty(exports, \"RssHandler\", { enumerable: true, get: function () { return FeedHandler_1.FeedHandler; } });\n"],"names":[],"sourceRoot":""}