{"version":3,"file":"constants.mjs","sources":["../../../../lib/web/websocket/constants.js"],"sourcesContent":["'use strict'\n\n/**\n * This is a Globally Unique Identifier unique used to validate that the\n * endpoint accepts websocket connections.\n * @see https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3\n * @type {'258EAFA5-E914-47DA-95CA-C5AB0DC85B11'}\n */\nconst uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'\n\n/**\n * @type {PropertyDescriptor}\n */\nconst staticPropertyDescriptors = {\n  enumerable: true,\n  writable: false,\n  configurable: false\n}\n\n/**\n * The states of the WebSocket connection.\n *\n * @readonly\n * @enum\n * @property {0} CONNECTING\n * @property {1} OPEN\n * @property {2} CLOSING\n * @property {3} CLOSED\n */\nconst states = {\n  CONNECTING: 0,\n  OPEN: 1,\n  CLOSING: 2,\n  CLOSED: 3\n}\n\n/**\n * @readonly\n * @enum\n * @property {0} NOT_SENT\n * @property {1} PROCESSING\n * @property {2} SENT\n */\nconst sentCloseFrameState = {\n  SENT: 1,\n  RECEIVED: 2\n}\n\n/**\n * The WebSocket opcodes.\n *\n * @readonly\n * @enum\n * @property {0x0} CONTINUATION\n * @property {0x1} TEXT\n * @property {0x2} BINARY\n * @property {0x8} CLOSE\n * @property {0x9} PING\n * @property {0xA} PONG\n * @see https://datatracker.ietf.org/doc/html/rfc6455#section-5.2\n */\nconst opcodes = {\n  CONTINUATION: 0x0,\n  TEXT: 0x1,\n  BINARY: 0x2,\n  CLOSE: 0x8,\n  PING: 0x9,\n  PONG: 0xA\n}\n\n/**\n * The maximum value for an unsigned 16-bit integer.\n *\n * @type {65535} 2 ** 16 - 1\n */\nconst maxUnsigned16Bit = 65535\n\n/**\n * The states of the parser.\n *\n * @readonly\n * @enum\n * @property {0} INFO\n * @property {2} PAYLOADLENGTH_16\n * @property {3} PAYLOADLENGTH_64\n * @property {4} READ_DATA\n */\nconst parserStates = {\n  INFO: 0,\n  PAYLOADLENGTH_16: 2,\n  PAYLOADLENGTH_64: 3,\n  READ_DATA: 4\n}\n\n/**\n * An empty buffer.\n *\n * @type {Buffer}\n */\nconst emptyBuffer = Buffer.allocUnsafe(0)\n\n/**\n * @readonly\n * @property {1} text\n * @property {2} typedArray\n * @property {3} arrayBuffer\n * @property {4} blob\n */\nconst sendHints = {\n  text: 1,\n  typedArray: 2,\n  arrayBuffer: 3,\n  blob: 4\n}\n\nmodule.exports = {\n  uid,\n  sentCloseFrameState,\n  staticPropertyDescriptors,\n  states,\n  opcodes,\n  maxUnsigned16Bit,\n  parserStates,\n  emptyBuffer,\n  sendHints\n}\n"],"names":["emptyBuffer","Buffer","allocUnsafe","constants","uid","sentCloseFrameState","SENT","RECEIVED","staticPropertyDescriptors","enumerable","writable","configurable","states","CONNECTING","OPEN","CLOSING","CLOSED","opcodes","CONTINUATION","TEXT","BINARY","CLOSE","PING","PONG","maxUnsigned16Bit","parserStates","INFO","PAYLOADLENGTH_16","PAYLOADLENGTH_64","READ_DATA","sendHints","text","typedArray","arrayBuffer","blob"],"mappings":";;;;;;;AAQA,MA2FMA,YAAcC,OAAOC,YAAY;;;WAgBvCC,UAAiB,CACfC,IA5GU,uCA6GVC,oBA1E0B,CAC1BC,KAAM,EACNC,SAAU,GAyEVC,0BAzGgC,CAChCC,YAAY,EACZC,UAAU,EACVC,cAAc,GAuGdC,OA1Fa,CACbC,WAAY,EACZC,KAAM,EACNC,QAAS,EACTC,OAAQ,GAuFRC,QA3Dc,CACdC,aAAc,EACdC,KAAM,EACNC,OAAQ,EACRC,MAAO,EACPC,KAAM,EACNC,KAAM,IAsDNC,iBA9CuB,MA+CvBC,aAnCmB,CACnBC,KAAM,EACNC,iBAAkB,EAClBC,iBAAkB,EAClBC,UAAW,GAgCX7B,YACA8B,UAhBgB,CAChBC,KAAM,EACNC,WAAY,EACZC,YAAa,EACbC,KAAM"}