{"ast":null,"code":"var _classCallCheck = require(\"C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/classCallCheck\");\n\nvar _createClass = require(\"C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/createClass\");\n\nvar _inherits = require(\"C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/inherits\");\n\nvar _createSuper = require(\"C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/createSuper\");\n\nvar Transport = require(\"../transport\");\n\nvar parseqs = require(\"parseqs\");\n\nvar parser = require(\"engine.io-parser\");\n\nvar yeast = require(\"yeast\");\n\nvar debug = require(\"debug\")(\"engine.io-client:polling\");\n\nvar Polling = /*#__PURE__*/function (_Transport) {\n  \"use strict\";\n\n  _inherits(Polling, _Transport);\n\n  var _super = _createSuper(Polling);\n\n  function Polling() {\n    _classCallCheck(this, Polling);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(Polling, [{\n    key: \"name\",\n    get:\n    /**\n     * Transport name.\n     */\n    function get() {\n      return \"polling\";\n    }\n    /**\n     * Opens the socket (triggers polling). We write a PING message to determine\n     * when the transport is open.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"doOpen\",\n    value: function doOpen() {\n      this.poll();\n    }\n    /**\n     * Pauses polling.\n     *\n     * @param {Function} callback upon buffers are flushed and transport is paused\n     * @api private\n     */\n\n  }, {\n    key: \"pause\",\n    value: function pause(onPause) {\n      var self = this;\n      this.readyState = \"pausing\";\n\n      function pause() {\n        debug(\"paused\");\n        self.readyState = \"paused\";\n        onPause();\n      }\n\n      if (this.polling || !this.writable) {\n        var total = 0;\n\n        if (this.polling) {\n          debug(\"we are currently polling - waiting to pause\");\n          total++;\n          this.once(\"pollComplete\", function () {\n            debug(\"pre-pause polling complete\");\n            --total || pause();\n          });\n        }\n\n        if (!this.writable) {\n          debug(\"we are currently writing - waiting to pause\");\n          total++;\n          this.once(\"drain\", function () {\n            debug(\"pre-pause writing complete\");\n            --total || pause();\n          });\n        }\n      } else {\n        pause();\n      }\n    }\n    /**\n     * Starts polling cycle.\n     *\n     * @api public\n     */\n\n  }, {\n    key: \"poll\",\n    value: function poll() {\n      debug(\"polling\");\n      this.polling = true;\n      this.doPoll();\n      this.emit(\"poll\");\n    }\n    /**\n     * Overloads onData to detect payloads.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"onData\",\n    value: function onData(data) {\n      var self = this;\n      debug(\"polling got data %s\", data);\n\n      var callback = function callback(packet, index, total) {\n        // if its the first message we consider the transport open\n        if (\"opening\" === self.readyState && packet.type === \"open\") {\n          self.onOpen();\n        } // if its a close packet, we close the ongoing requests\n\n\n        if (\"close\" === packet.type) {\n          self.onClose();\n          return false;\n        } // otherwise bypass onData and handle the message\n\n\n        self.onPacket(packet);\n      }; // decode payload\n\n\n      parser.decodePayload(data, this.socket.binaryType).forEach(callback); // if an event did not trigger closing\n\n      if (\"closed\" !== this.readyState) {\n        // if we got data we're not polling\n        this.polling = false;\n        this.emit(\"pollComplete\");\n\n        if (\"open\" === this.readyState) {\n          this.poll();\n        } else {\n          debug('ignoring poll - transport state \"%s\"', this.readyState);\n        }\n      }\n    }\n    /**\n     * For polling, send a close packet.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"doClose\",\n    value: function doClose() {\n      var self = this;\n\n      function close() {\n        debug(\"writing close packet\");\n        self.write([{\n          type: \"close\"\n        }]);\n      }\n\n      if (\"open\" === this.readyState) {\n        debug(\"transport open - closing\");\n        close();\n      } else {\n        // in case we're trying to close while\n        // handshaking is in progress (GH-164)\n        debug(\"transport not open - deferring close\");\n        this.once(\"open\", close);\n      }\n    }\n    /**\n     * Writes a packets payload.\n     *\n     * @param {Array} data packets\n     * @param {Function} drain callback\n     * @api private\n     */\n\n  }, {\n    key: \"write\",\n    value: function write(packets) {\n      var _this = this;\n\n      this.writable = false;\n      parser.encodePayload(packets, function (data) {\n        _this.doWrite(data, function () {\n          _this.writable = true;\n\n          _this.emit(\"drain\");\n        });\n      });\n    }\n    /**\n     * Generates uri for connection.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"uri\",\n    value: function uri() {\n      var query = this.query || {};\n      var schema = this.opts.secure ? \"https\" : \"http\";\n      var port = \"\"; // cache busting is forced\n\n      if (false !== this.opts.timestampRequests) {\n        query[this.opts.timestampParam] = yeast();\n      }\n\n      if (!this.supportsBinary && !query.sid) {\n        query.b64 = 1;\n      }\n\n      query = parseqs.encode(query); // avoid port if default for schema\n\n      if (this.opts.port && (\"https\" === schema && Number(this.opts.port) !== 443 || \"http\" === schema && Number(this.opts.port) !== 80)) {\n        port = \":\" + this.opts.port;\n      } // prepend ? to query\n\n\n      if (query.length) {\n        query = \"?\" + query;\n      }\n\n      var ipv6 = this.opts.hostname.indexOf(\":\") !== -1;\n      return schema + \"://\" + (ipv6 ? \"[\" + this.opts.hostname + \"]\" : this.opts.hostname) + port + this.opts.path + query;\n    }\n  }]);\n\n  return Polling;\n}(Transport);\n\nmodule.exports = Polling;","map":{"version":3,"sources":["C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/node_modules/engine.io-client/lib/transports/polling.js"],"names":["Transport","require","parseqs","parser","yeast","debug","Polling","poll","onPause","self","readyState","pause","polling","writable","total","once","doPoll","emit","data","callback","packet","index","type","onOpen","onClose","onPacket","decodePayload","socket","binaryType","forEach","close","write","packets","encodePayload","doWrite","query","schema","opts","secure","port","timestampRequests","timestampParam","supportsBinary","sid","b64","encode","Number","length","ipv6","hostname","indexOf","path","module","exports"],"mappings":";;;;;;;;AAAA,IAAMA,SAAS,GAAGC,OAAO,CAAC,cAAD,CAAzB;;AACA,IAAMC,OAAO,GAAGD,OAAO,CAAC,SAAD,CAAvB;;AACA,IAAME,MAAM,GAAGF,OAAO,CAAC,kBAAD,CAAtB;;AACA,IA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X,CAAN,KAA2B,GAAlD,IACE,WAAWH,MAAX,IAAqBU,MAAM,CAAC,KAAKT,IAAL,CAAUE,IAAX,CAAN,KAA2B,EAFnD,CADF,EAIE;AACAA,QAAAA,IAAI,GAAG,MAAM,KAAKF,IAAL,CAAUE,IAAvB;AACD,OAvBG,CAyBJ;;;AACA,UAAIJ,KAAK,CAACY,MAAV,EAAkB;AAChBZ,QAAAA,KAAK,GAAG,MAAMA,KAAd;AACD;;AAED,UAAMa,IAAI,GAAG,KAAKX,IAAL,CAAUY,QAAV,CAAmBC,OAAnB,CAA2B,GAA3B,MAAoC,CAAC,CAAlD;AACA,aACEd,MAAM,GACN,KADA,IAECY,IAAI,GAAG,MAAM,KAAKX,IAAL,CAAUY,QAAhB,GAA2B,GAA9B,GAAoC,KAAKZ,IAAL,CAAUY,QAFnD,IAGAV,IAHA,GAIA,KAAKF,IAAL,CAAUc,IAJV,GAKAhB,KANF;AAQD;;;;EAvMmBnC,S;;AA0MtBoD,MAAM,CAACC,OAAP,GAAiB/C,OAAjB","sourcesContent":["const Transport = require(\"../transport\");\nconst parseqs = require(\"parseqs\");\nconst parser = require(\"engine.io-parser\");\nconst yeast = require(\"yeast\");\n\nconst debug = require(\"debug\")(\"engine.io-client:polling\");\n\nclass Polling extends Transport {\n  /**\n   * Transport name.\n   */\n  get name() {\n    return \"polling\";\n  }\n\n  /**\n   * Opens the socket (triggers polling). We write a PING message to determine\n   * when the transport is open.\n   *\n   * @api private\n   */\n  doOpen() {\n    this.poll();\n  }\n\n  /**\n   * Pauses polling.\n   *\n   * @param {Function} callback upon buffers are flushed and transport is paused\n   * @api private\n   */\n  pause(onPause) {\n    const self = this;\n\n    this.readyState = \"pausing\";\n\n    function pause() {\n      debug(\"paused\");\n      self.readyState = \"paused\";\n      onPause();\n    }\n\n    if (this.polling || !this.writable) {\n      let total = 0;\n\n      if (this.polling) {\n        debug(\"we are currently polling - waiting to pause\");\n        total++;\n        this.once(\"pollComplete\", function() {\n          debug(\"pre-pause polling complete\");\n          --total || pause();\n        });\n      }\n\n      if (!this.writable) {\n        debug(\"we are currently writing - waiting to pause\");\n        total++;\n        this.once(\"drain\", function() {\n          debug(\"pre-pause writing complete\");\n          --total || pause();\n        });\n      }\n    } else {\n      pause();\n    }\n  }\n\n  /**\n   * Starts polling cycle.\n   *\n   * @api public\n   */\n  poll() {\n    debug(\"polling\");\n    this.polling = true;\n    this.doPoll();\n    this.emit(\"poll\");\n  }\n\n  /**\n   * Overloads onData to detect payloads.\n   *\n   * @api private\n   */\n  onData(data) {\n    const self = this;\n    debug(\"polling got data %s\", data);\n    const callback = function(packet, index, total) {\n      // if its the first message we consider the transport open\n      if (\"opening\" === self.readyState && packet.type === \"open\") {\n        self.onOpen();\n      }\n\n      // if its a close packet, we close the ongoing requests\n      if (\"close\" === packet.type) {\n        self.onClose();\n        return false;\n      }\n\n      // otherwise bypass onData and handle the message\n      self.onPacket(packet);\n    };\n\n    // decode payload\n    parser.decodePayload(data, this.socket.binaryType).forEach(callback);\n\n    // if an event did not trigger closing\n    if (\"closed\" !== this.readyState) {\n      // if we got data we're not polling\n      this.polling = false;\n      this.emit(\"pollComplete\");\n\n      if (\"open\" === this.readyState) {\n        this.poll();\n      } else {\n        debug('ignoring poll - transport state \"%s\"', this.readyState);\n      }\n    }\n  }\n\n  /**\n   * For polling, send a close packet.\n   *\n   * @api private\n   */\n  doClose() {\n    const self = this;\n\n    function close() {\n      debug(\"writing close packet\");\n      self.write([{ type: \"close\" }]);\n    }\n\n    if (\"open\" === this.readyState) {\n      debug(\"transport open - closing\");\n      close();\n    } else {\n      // in case we're trying to close while\n      // handshaking is in progress (GH-164)\n      debug(\"transport not open - deferring close\");\n      this.once(\"open\", close);\n    }\n  }\n\n  /**\n   * Writes a packets payload.\n   *\n   * @param {Array} data packets\n   * @param {Function} drain callback\n   * @api private\n   */\n  write(packets) {\n    this.writable = false;\n\n    parser.encodePayload(packets, data => {\n      this.doWrite(data, () => {\n        this.writable = true;\n        this.emit(\"drain\");\n      });\n    });\n  }\n\n  /**\n   * Generates uri for connection.\n   *\n   * @api private\n   */\n  uri() {\n    let query = this.query || {};\n    const schema = this.opts.secure ? \"https\" : \"http\";\n    let port = \"\";\n\n    // cache busting is forced\n    if (false !== this.opts.timestampRequests) {\n      query[this.opts.timestampParam] = yeast();\n    }\n\n    if (!this.supportsBinary && !query.sid) {\n      query.b64 = 1;\n    }\n\n    query = parseqs.encode(query);\n\n    // avoid port if default for schema\n    if (\n      this.opts.port &&\n      ((\"https\" === schema && Number(this.opts.port) !== 443) ||\n        (\"http\" === schema && Number(this.opts.port) !== 80))\n    ) {\n      port = \":\" + this.opts.port;\n    }\n\n    // prepend ? to query\n    if (query.length) {\n      query = \"?\" + query;\n    }\n\n    const ipv6 = this.opts.hostname.indexOf(\":\") !== -1;\n    return (\n      schema +\n      \"://\" +\n      (ipv6 ? \"[\" + this.opts.hostname + \"]\" : this.opts.hostname) +\n      port +\n      this.opts.path +\n      query\n    );\n  }\n}\n\nmodule.exports = Polling;\n"]},"metadata":{},"sourceType":"script"}