{"version":3,"sources":["jsdelivr-header.js","/npm/onvif-nvt@0.3.3/dist/onvif-nvt.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,KAAO,QAAQ,gBAErB,MAAM,aACJ,WAAA,GACE,KAAK,UAAY,KACjB,KAAK,QAAU,CAAC,CAClB,CAEA,GAAA,CAAI,GACF,GACO,cADC,EAQJ,MAAM,IAAI,MAAM,sFAAsF,OAPxG,CACE,MAAM,EAAY,QAAQ,uBAE1B,KAAK,UAAY,IAAI,CAChB,CAKX,CAEA,OAAA,CAAQ,EAAS,EAAM,EAAU,EAAU,EAAa,GACtD,MAAM,EAAU,IAAI,SAAQ,CAAC,EAAS,KACpC,IAAI,EAAS,GAEb,GAAI,EAAS,KAAK,eAAe,EAAS,UAExC,YADA,EAAO,IAAI,MAAM,kDAAoD,IAIvE,MAAM,EAAW,GAAG,KAAW,IACzB,EAAI,KAAK,QAAQ,GAEvB,GAAI,EAEF,YADA,EAAQ,GAIV,EAAO,GAAQ,GAEf,MAEM,EAAS,IAFA,QAAQ,aAGvB,OAAO,EAAO,QAAQ,EAAS,EAAM,EAAU,EAAU,GAAa,MAAK,IACzE,KAAK,QAAQ,GAAY,EACzB,EAAQ,EAAO,IACd,OAAM,IACP,QAAQ,MAAM,GACd,EAAO,EAAM,GACb,IAGJ,IAAI,KAAK,gBAAgB,GAOvB,OAAO,EANP,EAAQ,MAAK,IACX,EAAS,KAAM,EAAQ,IACtB,OAAM,IACP,EAAS,EAAM,GAKrB,EAIF,OAAO,QAAU,IAAI","file":"/npm/onvif-nvt@0.3.3/dist/onvif-nvt.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/onvif-nvt@0.3.3/dist/onvif-nvt.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const Util = require('./utils/util');\n\nclass OnvifManager {\n  constructor() {\n    this.discovery = null;\n    this.cameras = {};\n  }\n\n  add(name) {\n    switch (name) {\n      case 'discovery':\n        const Discovery = require('./modules/discovery');\n\n        this.discovery = new Discovery();\n        break;\n\n      default:\n        throw new Error(`The only acceptable module that can be added to OnvifManager is \"discovery\" - not \"${name}\".`);\n    }\n  }\n\n  connect(address, port, username, password, servicePath, callback) {\n    const promise = new Promise((resolve, reject) => {\n      let errMsg = '';\n\n      if (errMsg = Util.isInvalidValue(address, 'string')) {\n        reject(new Error('The \"address\" argument for connect is invalid: ' + errMsg));\n        return;\n      }\n\n      const cacheKey = `${address}:${port}`;\n      const c = this.cameras[cacheKey];\n\n      if (c) {\n        resolve(c);\n        return;\n      }\n\n      port = port || 80;\n\n      const Camera = require('./camera');\n\n      const camera = new Camera();\n      return camera.connect(address, port, username, password, servicePath).then(results => {\n        this.cameras[cacheKey] = camera;\n        resolve(camera);\n      }).catch(error => {\n        console.error(error);\n        reject(error);\n      });\n    });\n\n    if (Util.isValidCallback(callback)) {\n      promise.then(results => {\n        callback(null, results);\n      }).catch(error => {\n        callback(error);\n      });\n    } else {\n      return promise;\n    }\n  }\n\n}\n\nmodule.exports = new OnvifManager();"]}