@opentiny/fluent-editor 4.0.0-alpha.7 → 4.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/modules/collaborative-editing/awareness/awareness.es.js +6 -6
- package/es/modules/collaborative-editing/awareness/awareness.es.js.map +1 -1
- package/es/modules/collaborative-editing/awareness/y-indexeddb.es.js +1 -1
- package/es/modules/collaborative-editing/collaborative-editing.es.js +6 -6
- package/es/modules/collaborative-editing/collaborative-editing.es.js.map +1 -1
- package/es/modules/collaborative-editing/provider/webrtc.es.js +3 -3
- package/es/modules/collaborative-editing/provider/webrtc.es.js.map +1 -1
- package/es/modules/collaborative-editing/provider/websocket.es.js +4 -4
- package/es/modules/collaborative-editing/provider/websocket.es.js.map +1 -1
- package/es/modules/emoji.es.js +13 -9
- package/es/modules/emoji.es.js.map +1 -1
- package/lib/modules/collaborative-editing/awareness/awareness.cjs.js +23 -6
- package/lib/modules/collaborative-editing/awareness/awareness.cjs.js.map +1 -1
- package/lib/modules/collaborative-editing/awareness/y-indexeddb.cjs.js +1 -1
- package/lib/modules/collaborative-editing/collaborative-editing.cjs.js +24 -7
- package/lib/modules/collaborative-editing/collaborative-editing.cjs.js.map +1 -1
- package/lib/modules/collaborative-editing/provider/webrtc.cjs.js +20 -3
- package/lib/modules/collaborative-editing/provider/webrtc.cjs.js.map +1 -1
- package/lib/modules/collaborative-editing/provider/websocket.cjs.js +21 -4
- package/lib/modules/collaborative-editing/provider/websocket.cjs.js.map +1 -1
- package/lib/modules/emoji.cjs.js +13 -9
- package/lib/modules/emoji.cjs.js.map +1 -1
- package/package.json +1 -1
- package/types/modules/emoji.d.ts +6 -0
- package/es/_virtual/_commonjs-dynamic-modules.es.js +0 -7
- package/es/_virtual/_commonjs-dynamic-modules.es.js.map +0 -1
- package/es/_virtual/_commonjsHelpers.es.js +0 -42
- package/es/_virtual/_commonjsHelpers.es.js.map +0 -1
- package/es/_virtual/quill-cursors.es.js +0 -5
- package/es/_virtual/quill-cursors.es.js.map +0 -1
- package/es/_virtual/simplepeer.min.es.js +0 -5
- package/es/_virtual/simplepeer.min.es.js.map +0 -1
- package/es/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.es.js +0 -40145
- package/es/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.es.js.map +0 -1
- package/es/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.es.js +0 -938
- package/es/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.es.js.map +0 -1
- package/es/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.es.js +0 -624
- package/es/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.es.js.map +0 -1
- package/es/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.es.js +0 -174
- package/es/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.es.js.map +0 -1
- package/es/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.es.js +0 -159
- package/es/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.es.js.map +0 -1
- package/es/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.es.js +0 -2849
- package/es/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/array.es.js +0 -112
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/array.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/binary.es.js +0 -133
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/binary.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/broadcastchannel.es.js +0 -59
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/broadcastchannel.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/buffer.es.js +0 -75
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/buffer.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/conditions.es.js +0 -5
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/conditions.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/decoding.es.js +0 -422
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/decoding.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/dom.es.js +0 -142
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/dom.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/encoding.es.js +0 -484
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/encoding.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/environment.es.js +0 -79
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/environment.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/error.es.js +0 -13
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/error.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/eventloop.es.js +0 -69
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/eventloop.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/function.es.js +0 -124
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/function.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/indexeddb.es.js +0 -92
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/indexeddb.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/iterator.es.js +0 -38
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/iterator.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/json.es.js +0 -7
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/json.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/logging.common.es.js +0 -99
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/logging.common.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/logging.es.js +0 -288
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/logging.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/map.es.js +0 -47
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/map.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/math.es.js +0 -37
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/math.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/metric.es.js +0 -64
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/metric.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/mutex.es.js +0 -19
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/mutex.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/number.es.js +0 -31
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/number.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/object.es.js +0 -72
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/object.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/observable.es.js +0 -128
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/observable.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/pair.es.js +0 -22
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/pair.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/promise.es.js +0 -50
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/promise.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/random.es.js +0 -24
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/random.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/set.es.js +0 -11
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/set.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/storage.es.js +0 -44
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/storage.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/string.es.js +0 -95
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/string.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/symbol.es.js +0 -7
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/symbol.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/time.es.js +0 -28
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/time.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/traits.es.js +0 -5
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/traits.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/url.es.js +0 -20
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/url.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/webcrypto.es.js +0 -7
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/webcrypto.es.js.map +0 -1
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/websocket.es.js +0 -113
- package/es/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/websocket.es.js.map +0 -1
- package/es/node_modules/.pnpm/quill-cursors@4.0.4/node_modules/quill-cursors/dist/quill-cursors.es.js +0 -1796
- package/es/node_modules/.pnpm/quill-cursors@4.0.4/node_modules/quill-cursors/dist/quill-cursors.es.js.map +0 -1
- package/es/node_modules/.pnpm/simple-peer@9.11.1/node_modules/simple-peer/simplepeer.min.es.js +0 -2620
- package/es/node_modules/.pnpm/simple-peer@9.11.1/node_modules/simple-peer/simplepeer.min.es.js.map +0 -1
- package/es/node_modules/.pnpm/y-indexeddb@9.0.12_yjs@13.6.27/node_modules/y-indexeddb/src/y-indexeddb.es.js +0 -155
- package/es/node_modules/.pnpm/y-indexeddb@9.0.12_yjs@13.6.27/node_modules/y-indexeddb/src/y-indexeddb.es.js.map +0 -1
- package/es/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/auth.es.js +0 -20
- package/es/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/auth.es.js.map +0 -1
- package/es/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/awareness.es.js +0 -232
- package/es/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/awareness.es.js.map +0 -1
- package/es/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/sync.es.js +0 -58
- package/es/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/sync.es.js.map +0 -1
- package/es/node_modules/.pnpm/y-quill@1.0.0_quill-cursors@4.0.4_quill@2.0.3_patch_hash_dnirvjhpzdmsvdidsclwslxxji__yjs@13.6.27/node_modules/y-quill/src/y-quill.es.js +0 -157
- package/es/node_modules/.pnpm/y-quill@1.0.0_quill-cursors@4.0.4_quill@2.0.3_patch_hash_dnirvjhpzdmsvdidsclwslxxji__yjs@13.6.27/node_modules/y-quill/src/y-quill.es.js.map +0 -1
- package/es/node_modules/.pnpm/y-webrtc@10.3.0_yjs@13.6.27/node_modules/y-webrtc/src/crypto.es.js +0 -94
- package/es/node_modules/.pnpm/y-webrtc@10.3.0_yjs@13.6.27/node_modules/y-webrtc/src/crypto.es.js.map +0 -1
- package/es/node_modules/.pnpm/y-webrtc@10.3.0_yjs@13.6.27/node_modules/y-webrtc/src/y-webrtc.es.js +0 -537
- package/es/node_modules/.pnpm/y-webrtc@10.3.0_yjs@13.6.27/node_modules/y-webrtc/src/y-webrtc.es.js.map +0 -1
- package/es/node_modules/.pnpm/y-websocket@3.0.0_yjs@13.6.27/node_modules/y-websocket/src/y-websocket.es.js +0 -380
- package/es/node_modules/.pnpm/y-websocket@3.0.0_yjs@13.6.27/node_modules/y-websocket/src/y-websocket.es.js.map +0 -1
- package/es/node_modules/.pnpm/yjs@13.6.27/node_modules/yjs/dist/yjs.es.js +0 -7653
- package/es/node_modules/.pnpm/yjs@13.6.27/node_modules/yjs/dist/yjs.es.js.map +0 -1
- package/lib/_virtual/_commonjs-dynamic-modules.cjs.js +0 -7
- package/lib/_virtual/_commonjs-dynamic-modules.cjs.js.map +0 -1
- package/lib/_virtual/_commonjsHelpers.cjs.js +0 -42
- package/lib/_virtual/_commonjsHelpers.cjs.js.map +0 -1
- package/lib/_virtual/quill-cursors.cjs.js +0 -5
- package/lib/_virtual/quill-cursors.cjs.js.map +0 -1
- package/lib/_virtual/simplepeer.min.cjs.js +0 -5
- package/lib/_virtual/simplepeer.min.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.cjs.js +0 -40145
- package/lib/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.cjs.js +0 -938
- package/lib/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs.js +0 -624
- package/lib/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs.js +0 -159
- package/lib/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs.js +0 -174
- package/lib/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.cjs.js +0 -2847
- package/lib/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/array.cjs.js +0 -112
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/array.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/binary.cjs.js +0 -133
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/binary.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/broadcastchannel.cjs.js +0 -59
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/broadcastchannel.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/buffer.cjs.js +0 -75
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/buffer.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/conditions.cjs.js +0 -5
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/conditions.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/decoding.cjs.js +0 -422
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/decoding.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/dom.cjs.js +0 -142
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/dom.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/encoding.cjs.js +0 -484
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/encoding.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/environment.cjs.js +0 -79
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/environment.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/error.cjs.js +0 -13
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/error.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/eventloop.cjs.js +0 -69
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/eventloop.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/function.cjs.js +0 -124
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/function.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/indexeddb.cjs.js +0 -92
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/indexeddb.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/iterator.cjs.js +0 -38
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/iterator.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/json.cjs.js +0 -7
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/json.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/logging.cjs.js +0 -288
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/logging.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/logging.common.cjs.js +0 -99
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/logging.common.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/map.cjs.js +0 -47
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/map.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/math.cjs.js +0 -37
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/math.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/metric.cjs.js +0 -64
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/metric.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/mutex.cjs.js +0 -19
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/mutex.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/number.cjs.js +0 -31
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/number.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/object.cjs.js +0 -72
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/object.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/observable.cjs.js +0 -128
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/observable.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/pair.cjs.js +0 -22
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/pair.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/promise.cjs.js +0 -50
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/promise.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/random.cjs.js +0 -24
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/random.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/set.cjs.js +0 -11
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/set.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/storage.cjs.js +0 -44
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/storage.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/string.cjs.js +0 -94
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/string.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/symbol.cjs.js +0 -7
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/symbol.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/time.cjs.js +0 -28
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/time.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/traits.cjs.js +0 -5
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/traits.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/url.cjs.js +0 -20
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/url.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/webcrypto.cjs.js +0 -7
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/webcrypto.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/websocket.cjs.js +0 -113
- package/lib/node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/websocket.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/quill-cursors@4.0.4/node_modules/quill-cursors/dist/quill-cursors.cjs.js +0 -1796
- package/lib/node_modules/.pnpm/quill-cursors@4.0.4/node_modules/quill-cursors/dist/quill-cursors.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/simple-peer@9.11.1/node_modules/simple-peer/simplepeer.min.cjs.js +0 -2620
- package/lib/node_modules/.pnpm/simple-peer@9.11.1/node_modules/simple-peer/simplepeer.min.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/y-indexeddb@9.0.12_yjs@13.6.27/node_modules/y-indexeddb/src/y-indexeddb.cjs.js +0 -155
- package/lib/node_modules/.pnpm/y-indexeddb@9.0.12_yjs@13.6.27/node_modules/y-indexeddb/src/y-indexeddb.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/auth.cjs.js +0 -20
- package/lib/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/auth.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/awareness.cjs.js +0 -232
- package/lib/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/awareness.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/sync.cjs.js +0 -58
- package/lib/node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.27/node_modules/y-protocols/sync.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/y-quill@1.0.0_quill-cursors@4.0.4_quill@2.0.3_patch_hash_dnirvjhpzdmsvdidsclwslxxji__yjs@13.6.27/node_modules/y-quill/src/y-quill.cjs.js +0 -157
- package/lib/node_modules/.pnpm/y-quill@1.0.0_quill-cursors@4.0.4_quill@2.0.3_patch_hash_dnirvjhpzdmsvdidsclwslxxji__yjs@13.6.27/node_modules/y-quill/src/y-quill.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/y-webrtc@10.3.0_yjs@13.6.27/node_modules/y-webrtc/src/crypto.cjs.js +0 -94
- package/lib/node_modules/.pnpm/y-webrtc@10.3.0_yjs@13.6.27/node_modules/y-webrtc/src/crypto.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/y-webrtc@10.3.0_yjs@13.6.27/node_modules/y-webrtc/src/y-webrtc.cjs.js +0 -537
- package/lib/node_modules/.pnpm/y-webrtc@10.3.0_yjs@13.6.27/node_modules/y-webrtc/src/y-webrtc.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/y-websocket@3.0.0_yjs@13.6.27/node_modules/y-websocket/src/y-websocket.cjs.js +0 -380
- package/lib/node_modules/.pnpm/y-websocket@3.0.0_yjs@13.6.27/node_modules/y-websocket/src/y-websocket.cjs.js.map +0 -1
- package/lib/node_modules/.pnpm/yjs@13.6.27/node_modules/yjs/dist/yjs.cjs.js +0 -7653
- package/lib/node_modules/.pnpm/yjs@13.6.27/node_modules/yjs/dist/yjs.cjs.js.map +0 -1
|
@@ -1,484 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const math = require("./math.cjs.js");
|
|
4
|
-
const number = require("./number.cjs.js");
|
|
5
|
-
const binary = require("./binary.cjs.js");
|
|
6
|
-
const string = require("./string.cjs.js");
|
|
7
|
-
const array = require("./array.cjs.js");
|
|
8
|
-
class Encoder {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.cpos = 0;
|
|
11
|
-
this.cbuf = new Uint8Array(100);
|
|
12
|
-
this.bufs = [];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const createEncoder = () => new Encoder();
|
|
16
|
-
const encode = (f) => {
|
|
17
|
-
const encoder = createEncoder();
|
|
18
|
-
f(encoder);
|
|
19
|
-
return toUint8Array(encoder);
|
|
20
|
-
};
|
|
21
|
-
const length = (encoder) => {
|
|
22
|
-
let len = encoder.cpos;
|
|
23
|
-
for (let i = 0; i < encoder.bufs.length; i++) {
|
|
24
|
-
len += encoder.bufs[i].length;
|
|
25
|
-
}
|
|
26
|
-
return len;
|
|
27
|
-
};
|
|
28
|
-
const hasContent = (encoder) => encoder.cpos > 0 || encoder.bufs.length > 0;
|
|
29
|
-
const toUint8Array = (encoder) => {
|
|
30
|
-
const uint8arr = new Uint8Array(length(encoder));
|
|
31
|
-
let curPos = 0;
|
|
32
|
-
for (let i = 0; i < encoder.bufs.length; i++) {
|
|
33
|
-
const d = encoder.bufs[i];
|
|
34
|
-
uint8arr.set(d, curPos);
|
|
35
|
-
curPos += d.length;
|
|
36
|
-
}
|
|
37
|
-
uint8arr.set(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos), curPos);
|
|
38
|
-
return uint8arr;
|
|
39
|
-
};
|
|
40
|
-
const verifyLen = (encoder, len) => {
|
|
41
|
-
const bufferLen = encoder.cbuf.length;
|
|
42
|
-
if (bufferLen - encoder.cpos < len) {
|
|
43
|
-
encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos));
|
|
44
|
-
encoder.cbuf = new Uint8Array(math.max(bufferLen, len) * 2);
|
|
45
|
-
encoder.cpos = 0;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const write = (encoder, num) => {
|
|
49
|
-
const bufferLen = encoder.cbuf.length;
|
|
50
|
-
if (encoder.cpos === bufferLen) {
|
|
51
|
-
encoder.bufs.push(encoder.cbuf);
|
|
52
|
-
encoder.cbuf = new Uint8Array(bufferLen * 2);
|
|
53
|
-
encoder.cpos = 0;
|
|
54
|
-
}
|
|
55
|
-
encoder.cbuf[encoder.cpos++] = num;
|
|
56
|
-
};
|
|
57
|
-
const set = (encoder, pos, num) => {
|
|
58
|
-
let buffer = null;
|
|
59
|
-
for (let i = 0; i < encoder.bufs.length && buffer === null; i++) {
|
|
60
|
-
const b = encoder.bufs[i];
|
|
61
|
-
if (pos < b.length) {
|
|
62
|
-
buffer = b;
|
|
63
|
-
} else {
|
|
64
|
-
pos -= b.length;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (buffer === null) {
|
|
68
|
-
buffer = encoder.cbuf;
|
|
69
|
-
}
|
|
70
|
-
buffer[pos] = num;
|
|
71
|
-
};
|
|
72
|
-
const writeUint8 = write;
|
|
73
|
-
const setUint8 = set;
|
|
74
|
-
const writeUint16 = (encoder, num) => {
|
|
75
|
-
write(encoder, num & binary.BITS8);
|
|
76
|
-
write(encoder, num >>> 8 & binary.BITS8);
|
|
77
|
-
};
|
|
78
|
-
const setUint16 = (encoder, pos, num) => {
|
|
79
|
-
set(encoder, pos, num & binary.BITS8);
|
|
80
|
-
set(encoder, pos + 1, num >>> 8 & binary.BITS8);
|
|
81
|
-
};
|
|
82
|
-
const writeUint32 = (encoder, num) => {
|
|
83
|
-
for (let i = 0; i < 4; i++) {
|
|
84
|
-
write(encoder, num & binary.BITS8);
|
|
85
|
-
num >>>= 8;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const writeUint32BigEndian = (encoder, num) => {
|
|
89
|
-
for (let i = 3; i >= 0; i--) {
|
|
90
|
-
write(encoder, num >>> 8 * i & binary.BITS8);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const setUint32 = (encoder, pos, num) => {
|
|
94
|
-
for (let i = 0; i < 4; i++) {
|
|
95
|
-
set(encoder, pos + i, num & binary.BITS8);
|
|
96
|
-
num >>>= 8;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const writeVarUint = (encoder, num) => {
|
|
100
|
-
while (num > binary.BITS7) {
|
|
101
|
-
write(encoder, binary.BIT8 | binary.BITS7 & num);
|
|
102
|
-
num = math.floor(num / 128);
|
|
103
|
-
}
|
|
104
|
-
write(encoder, binary.BITS7 & num);
|
|
105
|
-
};
|
|
106
|
-
const writeVarInt = (encoder, num) => {
|
|
107
|
-
const isNegative = math.isNegativeZero(num);
|
|
108
|
-
if (isNegative) {
|
|
109
|
-
num = -num;
|
|
110
|
-
}
|
|
111
|
-
write(encoder, (num > binary.BITS6 ? binary.BIT8 : 0) | (isNegative ? binary.BIT7 : 0) | binary.BITS6 & num);
|
|
112
|
-
num = math.floor(num / 64);
|
|
113
|
-
while (num > 0) {
|
|
114
|
-
write(encoder, (num > binary.BITS7 ? binary.BIT8 : 0) | binary.BITS7 & num);
|
|
115
|
-
num = math.floor(num / 128);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const _strBuffer = new Uint8Array(3e4);
|
|
119
|
-
const _maxStrBSize = _strBuffer.length / 3;
|
|
120
|
-
const _writeVarStringNative = (encoder, str) => {
|
|
121
|
-
if (str.length < _maxStrBSize) {
|
|
122
|
-
const written = string.utf8TextEncoder.encodeInto(str, _strBuffer).written || 0;
|
|
123
|
-
writeVarUint(encoder, written);
|
|
124
|
-
for (let i = 0; i < written; i++) {
|
|
125
|
-
write(encoder, _strBuffer[i]);
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
writeVarUint8Array(encoder, string.encodeUtf8(str));
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
const _writeVarStringPolyfill = (encoder, str) => {
|
|
132
|
-
const encodedString = unescape(encodeURIComponent(str));
|
|
133
|
-
const len = encodedString.length;
|
|
134
|
-
writeVarUint(encoder, len);
|
|
135
|
-
for (let i = 0; i < len; i++) {
|
|
136
|
-
write(
|
|
137
|
-
encoder,
|
|
138
|
-
/** @type {number} */
|
|
139
|
-
encodedString.codePointAt(i)
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
const writeVarString = string.utf8TextEncoder && /** @type {any} */
|
|
144
|
-
string.utf8TextEncoder.encodeInto ? _writeVarStringNative : _writeVarStringPolyfill;
|
|
145
|
-
const writeTerminatedString = (encoder, str) => writeTerminatedUint8Array(encoder, string.encodeUtf8(str));
|
|
146
|
-
const writeTerminatedUint8Array = (encoder, buf) => {
|
|
147
|
-
for (let i = 0; i < buf.length; i++) {
|
|
148
|
-
const b = buf[i];
|
|
149
|
-
if (b === 0 || b === 1) {
|
|
150
|
-
write(encoder, 1);
|
|
151
|
-
}
|
|
152
|
-
write(encoder, buf[i]);
|
|
153
|
-
}
|
|
154
|
-
write(encoder, 0);
|
|
155
|
-
};
|
|
156
|
-
const writeBinaryEncoder = (encoder, append) => writeUint8Array(encoder, toUint8Array(append));
|
|
157
|
-
const writeUint8Array = (encoder, uint8Array) => {
|
|
158
|
-
const bufferLen = encoder.cbuf.length;
|
|
159
|
-
const cpos = encoder.cpos;
|
|
160
|
-
const leftCopyLen = math.min(bufferLen - cpos, uint8Array.length);
|
|
161
|
-
const rightCopyLen = uint8Array.length - leftCopyLen;
|
|
162
|
-
encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos);
|
|
163
|
-
encoder.cpos += leftCopyLen;
|
|
164
|
-
if (rightCopyLen > 0) {
|
|
165
|
-
encoder.bufs.push(encoder.cbuf);
|
|
166
|
-
encoder.cbuf = new Uint8Array(math.max(bufferLen * 2, rightCopyLen));
|
|
167
|
-
encoder.cbuf.set(uint8Array.subarray(leftCopyLen));
|
|
168
|
-
encoder.cpos = rightCopyLen;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
const writeVarUint8Array = (encoder, uint8Array) => {
|
|
172
|
-
writeVarUint(encoder, uint8Array.byteLength);
|
|
173
|
-
writeUint8Array(encoder, uint8Array);
|
|
174
|
-
};
|
|
175
|
-
const writeOnDataView = (encoder, len) => {
|
|
176
|
-
verifyLen(encoder, len);
|
|
177
|
-
const dview = new DataView(encoder.cbuf.buffer, encoder.cpos, len);
|
|
178
|
-
encoder.cpos += len;
|
|
179
|
-
return dview;
|
|
180
|
-
};
|
|
181
|
-
const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false);
|
|
182
|
-
const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false);
|
|
183
|
-
const writeBigInt64 = (encoder, num) => (
|
|
184
|
-
/** @type {any} */
|
|
185
|
-
writeOnDataView(encoder, 8).setBigInt64(0, num, false)
|
|
186
|
-
);
|
|
187
|
-
const writeBigUint64 = (encoder, num) => (
|
|
188
|
-
/** @type {any} */
|
|
189
|
-
writeOnDataView(encoder, 8).setBigUint64(0, num, false)
|
|
190
|
-
);
|
|
191
|
-
const floatTestBed = new DataView(new ArrayBuffer(4));
|
|
192
|
-
const isFloat32 = (num) => {
|
|
193
|
-
floatTestBed.setFloat32(0, num);
|
|
194
|
-
return floatTestBed.getFloat32(0) === num;
|
|
195
|
-
};
|
|
196
|
-
const writeAny = (encoder, data) => {
|
|
197
|
-
switch (typeof data) {
|
|
198
|
-
case "string":
|
|
199
|
-
write(encoder, 119);
|
|
200
|
-
writeVarString(encoder, data);
|
|
201
|
-
break;
|
|
202
|
-
case "number":
|
|
203
|
-
if (number.isInteger(data) && math.abs(data) <= binary.BITS31) {
|
|
204
|
-
write(encoder, 125);
|
|
205
|
-
writeVarInt(encoder, data);
|
|
206
|
-
} else if (isFloat32(data)) {
|
|
207
|
-
write(encoder, 124);
|
|
208
|
-
writeFloat32(encoder, data);
|
|
209
|
-
} else {
|
|
210
|
-
write(encoder, 123);
|
|
211
|
-
writeFloat64(encoder, data);
|
|
212
|
-
}
|
|
213
|
-
break;
|
|
214
|
-
case "bigint":
|
|
215
|
-
write(encoder, 122);
|
|
216
|
-
writeBigInt64(encoder, data);
|
|
217
|
-
break;
|
|
218
|
-
case "object":
|
|
219
|
-
if (data === null) {
|
|
220
|
-
write(encoder, 126);
|
|
221
|
-
} else if (array.isArray(data)) {
|
|
222
|
-
write(encoder, 117);
|
|
223
|
-
writeVarUint(encoder, data.length);
|
|
224
|
-
for (let i = 0; i < data.length; i++) {
|
|
225
|
-
writeAny(encoder, data[i]);
|
|
226
|
-
}
|
|
227
|
-
} else if (data instanceof Uint8Array) {
|
|
228
|
-
write(encoder, 116);
|
|
229
|
-
writeVarUint8Array(encoder, data);
|
|
230
|
-
} else {
|
|
231
|
-
write(encoder, 118);
|
|
232
|
-
const keys = Object.keys(data);
|
|
233
|
-
writeVarUint(encoder, keys.length);
|
|
234
|
-
for (let i = 0; i < keys.length; i++) {
|
|
235
|
-
const key = keys[i];
|
|
236
|
-
writeVarString(encoder, key);
|
|
237
|
-
writeAny(encoder, data[key]);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
break;
|
|
241
|
-
case "boolean":
|
|
242
|
-
write(encoder, data ? 120 : 121);
|
|
243
|
-
break;
|
|
244
|
-
default:
|
|
245
|
-
write(encoder, 127);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
class RleEncoder extends Encoder {
|
|
249
|
-
/**
|
|
250
|
-
* @param {function(Encoder, T):void} writer
|
|
251
|
-
*/
|
|
252
|
-
constructor(writer) {
|
|
253
|
-
super();
|
|
254
|
-
this.w = writer;
|
|
255
|
-
this.s = null;
|
|
256
|
-
this.count = 0;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* @param {T} v
|
|
260
|
-
*/
|
|
261
|
-
write(v) {
|
|
262
|
-
if (this.s === v) {
|
|
263
|
-
this.count++;
|
|
264
|
-
} else {
|
|
265
|
-
if (this.count > 0) {
|
|
266
|
-
writeVarUint(this, this.count - 1);
|
|
267
|
-
}
|
|
268
|
-
this.count = 1;
|
|
269
|
-
this.w(this, v);
|
|
270
|
-
this.s = v;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
class IntDiffEncoder extends Encoder {
|
|
275
|
-
/**
|
|
276
|
-
* @param {number} start
|
|
277
|
-
*/
|
|
278
|
-
constructor(start) {
|
|
279
|
-
super();
|
|
280
|
-
this.s = start;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* @param {number} v
|
|
284
|
-
*/
|
|
285
|
-
write(v) {
|
|
286
|
-
writeVarInt(this, v - this.s);
|
|
287
|
-
this.s = v;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
class RleIntDiffEncoder extends Encoder {
|
|
291
|
-
/**
|
|
292
|
-
* @param {number} start
|
|
293
|
-
*/
|
|
294
|
-
constructor(start) {
|
|
295
|
-
super();
|
|
296
|
-
this.s = start;
|
|
297
|
-
this.count = 0;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* @param {number} v
|
|
301
|
-
*/
|
|
302
|
-
write(v) {
|
|
303
|
-
if (this.s === v && this.count > 0) {
|
|
304
|
-
this.count++;
|
|
305
|
-
} else {
|
|
306
|
-
if (this.count > 0) {
|
|
307
|
-
writeVarUint(this, this.count - 1);
|
|
308
|
-
}
|
|
309
|
-
this.count = 1;
|
|
310
|
-
writeVarInt(this, v - this.s);
|
|
311
|
-
this.s = v;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
const flushUintOptRleEncoder = (encoder) => {
|
|
316
|
-
if (encoder.count > 0) {
|
|
317
|
-
writeVarInt(encoder.encoder, encoder.count === 1 ? encoder.s : -encoder.s);
|
|
318
|
-
if (encoder.count > 1) {
|
|
319
|
-
writeVarUint(encoder.encoder, encoder.count - 2);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
class UintOptRleEncoder {
|
|
324
|
-
constructor() {
|
|
325
|
-
this.encoder = new Encoder();
|
|
326
|
-
this.s = 0;
|
|
327
|
-
this.count = 0;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* @param {number} v
|
|
331
|
-
*/
|
|
332
|
-
write(v) {
|
|
333
|
-
if (this.s === v) {
|
|
334
|
-
this.count++;
|
|
335
|
-
} else {
|
|
336
|
-
flushUintOptRleEncoder(this);
|
|
337
|
-
this.count = 1;
|
|
338
|
-
this.s = v;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Flush the encoded state and transform this to a Uint8Array.
|
|
343
|
-
*
|
|
344
|
-
* Note that this should only be called once.
|
|
345
|
-
*/
|
|
346
|
-
toUint8Array() {
|
|
347
|
-
flushUintOptRleEncoder(this);
|
|
348
|
-
return toUint8Array(this.encoder);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
class IncUintOptRleEncoder {
|
|
352
|
-
constructor() {
|
|
353
|
-
this.encoder = new Encoder();
|
|
354
|
-
this.s = 0;
|
|
355
|
-
this.count = 0;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* @param {number} v
|
|
359
|
-
*/
|
|
360
|
-
write(v) {
|
|
361
|
-
if (this.s + this.count === v) {
|
|
362
|
-
this.count++;
|
|
363
|
-
} else {
|
|
364
|
-
flushUintOptRleEncoder(this);
|
|
365
|
-
this.count = 1;
|
|
366
|
-
this.s = v;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Flush the encoded state and transform this to a Uint8Array.
|
|
371
|
-
*
|
|
372
|
-
* Note that this should only be called once.
|
|
373
|
-
*/
|
|
374
|
-
toUint8Array() {
|
|
375
|
-
flushUintOptRleEncoder(this);
|
|
376
|
-
return toUint8Array(this.encoder);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
const flushIntDiffOptRleEncoder = (encoder) => {
|
|
380
|
-
if (encoder.count > 0) {
|
|
381
|
-
const encodedDiff = encoder.diff * 2 + (encoder.count === 1 ? 0 : 1);
|
|
382
|
-
writeVarInt(encoder.encoder, encodedDiff);
|
|
383
|
-
if (encoder.count > 1) {
|
|
384
|
-
writeVarUint(encoder.encoder, encoder.count - 2);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
class IntDiffOptRleEncoder {
|
|
389
|
-
constructor() {
|
|
390
|
-
this.encoder = new Encoder();
|
|
391
|
-
this.s = 0;
|
|
392
|
-
this.count = 0;
|
|
393
|
-
this.diff = 0;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* @param {number} v
|
|
397
|
-
*/
|
|
398
|
-
write(v) {
|
|
399
|
-
if (this.diff === v - this.s) {
|
|
400
|
-
this.s = v;
|
|
401
|
-
this.count++;
|
|
402
|
-
} else {
|
|
403
|
-
flushIntDiffOptRleEncoder(this);
|
|
404
|
-
this.count = 1;
|
|
405
|
-
this.diff = v - this.s;
|
|
406
|
-
this.s = v;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Flush the encoded state and transform this to a Uint8Array.
|
|
411
|
-
*
|
|
412
|
-
* Note that this should only be called once.
|
|
413
|
-
*/
|
|
414
|
-
toUint8Array() {
|
|
415
|
-
flushIntDiffOptRleEncoder(this);
|
|
416
|
-
return toUint8Array(this.encoder);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
class StringEncoder {
|
|
420
|
-
constructor() {
|
|
421
|
-
this.sarr = [];
|
|
422
|
-
this.s = "";
|
|
423
|
-
this.lensE = new UintOptRleEncoder();
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* @param {string} string
|
|
427
|
-
*/
|
|
428
|
-
write(string2) {
|
|
429
|
-
this.s += string2;
|
|
430
|
-
if (this.s.length > 19) {
|
|
431
|
-
this.sarr.push(this.s);
|
|
432
|
-
this.s = "";
|
|
433
|
-
}
|
|
434
|
-
this.lensE.write(string2.length);
|
|
435
|
-
}
|
|
436
|
-
toUint8Array() {
|
|
437
|
-
const encoder = new Encoder();
|
|
438
|
-
this.sarr.push(this.s);
|
|
439
|
-
this.s = "";
|
|
440
|
-
writeVarString(encoder, this.sarr.join(""));
|
|
441
|
-
writeUint8Array(encoder, this.lensE.toUint8Array());
|
|
442
|
-
return toUint8Array(encoder);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
exports.Encoder = Encoder;
|
|
446
|
-
exports.IncUintOptRleEncoder = IncUintOptRleEncoder;
|
|
447
|
-
exports.IntDiffEncoder = IntDiffEncoder;
|
|
448
|
-
exports.IntDiffOptRleEncoder = IntDiffOptRleEncoder;
|
|
449
|
-
exports.RleEncoder = RleEncoder;
|
|
450
|
-
exports.RleIntDiffEncoder = RleIntDiffEncoder;
|
|
451
|
-
exports.StringEncoder = StringEncoder;
|
|
452
|
-
exports.UintOptRleEncoder = UintOptRleEncoder;
|
|
453
|
-
exports._writeVarStringNative = _writeVarStringNative;
|
|
454
|
-
exports._writeVarStringPolyfill = _writeVarStringPolyfill;
|
|
455
|
-
exports.createEncoder = createEncoder;
|
|
456
|
-
exports.encode = encode;
|
|
457
|
-
exports.hasContent = hasContent;
|
|
458
|
-
exports.length = length;
|
|
459
|
-
exports.set = set;
|
|
460
|
-
exports.setUint16 = setUint16;
|
|
461
|
-
exports.setUint32 = setUint32;
|
|
462
|
-
exports.setUint8 = setUint8;
|
|
463
|
-
exports.toUint8Array = toUint8Array;
|
|
464
|
-
exports.verifyLen = verifyLen;
|
|
465
|
-
exports.write = write;
|
|
466
|
-
exports.writeAny = writeAny;
|
|
467
|
-
exports.writeBigInt64 = writeBigInt64;
|
|
468
|
-
exports.writeBigUint64 = writeBigUint64;
|
|
469
|
-
exports.writeBinaryEncoder = writeBinaryEncoder;
|
|
470
|
-
exports.writeFloat32 = writeFloat32;
|
|
471
|
-
exports.writeFloat64 = writeFloat64;
|
|
472
|
-
exports.writeOnDataView = writeOnDataView;
|
|
473
|
-
exports.writeTerminatedString = writeTerminatedString;
|
|
474
|
-
exports.writeTerminatedUint8Array = writeTerminatedUint8Array;
|
|
475
|
-
exports.writeUint16 = writeUint16;
|
|
476
|
-
exports.writeUint32 = writeUint32;
|
|
477
|
-
exports.writeUint32BigEndian = writeUint32BigEndian;
|
|
478
|
-
exports.writeUint8 = writeUint8;
|
|
479
|
-
exports.writeUint8Array = writeUint8Array;
|
|
480
|
-
exports.writeVarInt = writeVarInt;
|
|
481
|
-
exports.writeVarString = writeVarString;
|
|
482
|
-
exports.writeVarUint = writeVarUint;
|
|
483
|
-
exports.writeVarUint8Array = writeVarUint8Array;
|
|
484
|
-
//# sourceMappingURL=encoding.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.cjs.js","sources":["../../../../../../../../../node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/encoding.js"],"sourcesContent":["/**\n * Efficient schema-less binary encoding with support for variable length encoding.\n *\n * Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function.\n *\n * Encodes numbers in little-endian order (least to most significant byte order)\n * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)\n * which is also used in Protocol Buffers.\n *\n * ```js\n * // encoding step\n * const encoder = encoding.createEncoder()\n * encoding.writeVarUint(encoder, 256)\n * encoding.writeVarString(encoder, 'Hello world!')\n * const buf = encoding.toUint8Array(encoder)\n * ```\n *\n * ```js\n * // decoding step\n * const decoder = decoding.createDecoder(buf)\n * decoding.readVarUint(decoder) // => 256\n * decoding.readVarString(decoder) // => 'Hello world!'\n * decoding.hasContent(decoder) // => false - all data is read\n * ```\n *\n * @module encoding\n */\n\nimport * as math from './math.js'\nimport * as number from './number.js'\nimport * as binary from './binary.js'\nimport * as string from './string.js'\nimport * as array from './array.js'\n\n/**\n * A BinaryEncoder handles the encoding to an Uint8Array.\n */\nexport class Encoder {\n constructor () {\n this.cpos = 0\n this.cbuf = new Uint8Array(100)\n /**\n * @type {Array<Uint8Array>}\n */\n this.bufs = []\n }\n}\n\n/**\n * @function\n * @return {Encoder}\n */\nexport const createEncoder = () => new Encoder()\n\n/**\n * @param {function(Encoder):void} f\n */\nexport const encode = (f) => {\n const encoder = createEncoder()\n f(encoder)\n return toUint8Array(encoder)\n}\n\n/**\n * The current length of the encoded data.\n *\n * @function\n * @param {Encoder} encoder\n * @return {number}\n */\nexport const length = encoder => {\n let len = encoder.cpos\n for (let i = 0; i < encoder.bufs.length; i++) {\n len += encoder.bufs[i].length\n }\n return len\n}\n\n/**\n * Check whether encoder is empty.\n *\n * @function\n * @param {Encoder} encoder\n * @return {boolean}\n */\nexport const hasContent = encoder => encoder.cpos > 0 || encoder.bufs.length > 0\n\n/**\n * Transform to Uint8Array.\n *\n * @function\n * @param {Encoder} encoder\n * @return {Uint8Array} The created ArrayBuffer.\n */\nexport const toUint8Array = encoder => {\n const uint8arr = new Uint8Array(length(encoder))\n let curPos = 0\n for (let i = 0; i < encoder.bufs.length; i++) {\n const d = encoder.bufs[i]\n uint8arr.set(d, curPos)\n curPos += d.length\n }\n uint8arr.set(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos), curPos)\n return uint8arr\n}\n\n/**\n * Verify that it is possible to write `len` bytes wtihout checking. If\n * necessary, a new Buffer with the required length is attached.\n *\n * @param {Encoder} encoder\n * @param {number} len\n */\nexport const verifyLen = (encoder, len) => {\n const bufferLen = encoder.cbuf.length\n if (bufferLen - encoder.cpos < len) {\n encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos))\n encoder.cbuf = new Uint8Array(math.max(bufferLen, len) * 2)\n encoder.cpos = 0\n }\n}\n\n/**\n * Write one byte to the encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The byte that is to be encoded.\n */\nexport const write = (encoder, num) => {\n const bufferLen = encoder.cbuf.length\n if (encoder.cpos === bufferLen) {\n encoder.bufs.push(encoder.cbuf)\n encoder.cbuf = new Uint8Array(bufferLen * 2)\n encoder.cpos = 0\n }\n encoder.cbuf[encoder.cpos++] = num\n}\n\n/**\n * Write one byte at a specific position.\n * Position must already be written (i.e. encoder.length > pos)\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos Position to which to write data\n * @param {number} num Unsigned 8-bit integer\n */\nexport const set = (encoder, pos, num) => {\n let buffer = null\n // iterate all buffers and adjust position\n for (let i = 0; i < encoder.bufs.length && buffer === null; i++) {\n const b = encoder.bufs[i]\n if (pos < b.length) {\n buffer = b // found buffer\n } else {\n pos -= b.length\n }\n }\n if (buffer === null) {\n // use current buffer\n buffer = encoder.cbuf\n }\n buffer[pos] = num\n}\n\n/**\n * Write one byte as an unsigned integer.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint8 = write\n\n/**\n * Write one byte as an unsigned Integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint8 = set\n\n/**\n * Write two bytes as an unsigned integer.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint16 = (encoder, num) => {\n write(encoder, num & binary.BITS8)\n write(encoder, (num >>> 8) & binary.BITS8)\n}\n/**\n * Write two bytes as an unsigned integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint16 = (encoder, pos, num) => {\n set(encoder, pos, num & binary.BITS8)\n set(encoder, pos + 1, (num >>> 8) & binary.BITS8)\n}\n\n/**\n * Write two bytes as an unsigned integer\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint32 = (encoder, num) => {\n for (let i = 0; i < 4; i++) {\n write(encoder, num & binary.BITS8)\n num >>>= 8\n }\n}\n\n/**\n * Write two bytes as an unsigned integer in big endian order.\n * (most significant byte first)\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeUint32BigEndian = (encoder, num) => {\n for (let i = 3; i >= 0; i--) {\n write(encoder, (num >>> (8 * i)) & binary.BITS8)\n }\n}\n\n/**\n * Write two bytes as an unsigned integer at a specific location.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} pos The location where the data will be written.\n * @param {number} num The number that is to be encoded.\n */\nexport const setUint32 = (encoder, pos, num) => {\n for (let i = 0; i < 4; i++) {\n set(encoder, pos + i, num & binary.BITS8)\n num >>>= 8\n }\n}\n\n/**\n * Write a variable length unsigned integer. Max encodable integer is 2^53.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeVarUint = (encoder, num) => {\n while (num > binary.BITS7) {\n write(encoder, binary.BIT8 | (binary.BITS7 & num))\n num = math.floor(num / 128) // shift >>> 7\n }\n write(encoder, binary.BITS7 & num)\n}\n\n/**\n * Write a variable length integer.\n *\n * We use the 7th bit instead for signaling that this is a negative number.\n *\n * @function\n * @param {Encoder} encoder\n * @param {number} num The number that is to be encoded.\n */\nexport const writeVarInt = (encoder, num) => {\n const isNegative = math.isNegativeZero(num)\n if (isNegative) {\n num = -num\n }\n // |- whether to continue reading |- whether is negative |- number\n write(encoder, (num > binary.BITS6 ? binary.BIT8 : 0) | (isNegative ? binary.BIT7 : 0) | (binary.BITS6 & num))\n num = math.floor(num / 64) // shift >>> 6\n // We don't need to consider the case of num === 0 so we can use a different\n // pattern here than above.\n while (num > 0) {\n write(encoder, (num > binary.BITS7 ? binary.BIT8 : 0) | (binary.BITS7 & num))\n num = math.floor(num / 128) // shift >>> 7\n }\n}\n\n/**\n * A cache to store strings temporarily\n */\nconst _strBuffer = new Uint8Array(30000)\nconst _maxStrBSize = _strBuffer.length / 3\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const _writeVarStringNative = (encoder, str) => {\n if (str.length < _maxStrBSize) {\n // We can encode the string into the existing buffer\n /* c8 ignore next */\n const written = string.utf8TextEncoder.encodeInto(str, _strBuffer).written || 0\n writeVarUint(encoder, written)\n for (let i = 0; i < written; i++) {\n write(encoder, _strBuffer[i])\n }\n } else {\n writeVarUint8Array(encoder, string.encodeUtf8(str))\n }\n}\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const _writeVarStringPolyfill = (encoder, str) => {\n const encodedString = unescape(encodeURIComponent(str))\n const len = encodedString.length\n writeVarUint(encoder, len)\n for (let i = 0; i < len; i++) {\n write(encoder, /** @type {number} */ (encodedString.codePointAt(i)))\n }\n}\n\n/**\n * Write a variable length string.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\n/* c8 ignore next */\nexport const writeVarString = (string.utf8TextEncoder && /** @type {any} */ (string.utf8TextEncoder).encodeInto) ? _writeVarStringNative : _writeVarStringPolyfill\n\n/**\n * Write a string terminated by a special byte sequence. This is not very performant and is\n * generally discouraged. However, the resulting byte arrays are lexiographically ordered which\n * makes this a nice feature for databases.\n *\n * The string will be encoded using utf8 and then terminated and escaped using writeTerminatingUint8Array.\n *\n * @function\n * @param {Encoder} encoder\n * @param {String} str The string that is to be encoded.\n */\nexport const writeTerminatedString = (encoder, str) =>\n writeTerminatedUint8Array(encoder, string.encodeUtf8(str))\n\n/**\n * Write a terminating Uint8Array. Note that this is not performant and is generally\n * discouraged. There are few situations when this is needed.\n *\n * We use 0x0 as a terminating character. 0x1 serves as an escape character for 0x0 and 0x1.\n *\n * Example: [0,1,2] is encoded to [1,0,1,1,2,0]. 0x0, and 0x1 needed to be escaped using 0x1. Then\n * the result is terminated using the 0x0 character.\n *\n * This is basically how many systems implement null terminated strings. However, we use an escape\n * character 0x1 to avoid issues and potenial attacks on our database (if this is used as a key\n * encoder for NoSql databases).\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} buf The string that is to be encoded.\n */\nexport const writeTerminatedUint8Array = (encoder, buf) => {\n for (let i = 0; i < buf.length; i++) {\n const b = buf[i]\n if (b === 0 || b === 1) {\n write(encoder, 1)\n }\n write(encoder, buf[i])\n }\n write(encoder, 0)\n}\n\n/**\n * Write the content of another Encoder.\n *\n * @TODO: can be improved!\n * - Note: Should consider that when appending a lot of small Encoders, we should rather clone than referencing the old structure.\n * Encoders start with a rather big initial buffer.\n *\n * @function\n * @param {Encoder} encoder The enUint8Arr\n * @param {Encoder} append The BinaryEncoder to be written.\n */\nexport const writeBinaryEncoder = (encoder, append) => writeUint8Array(encoder, toUint8Array(append))\n\n/**\n * Append fixed-length Uint8Array to the encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} uint8Array\n */\nexport const writeUint8Array = (encoder, uint8Array) => {\n const bufferLen = encoder.cbuf.length\n const cpos = encoder.cpos\n const leftCopyLen = math.min(bufferLen - cpos, uint8Array.length)\n const rightCopyLen = uint8Array.length - leftCopyLen\n encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos)\n encoder.cpos += leftCopyLen\n if (rightCopyLen > 0) {\n // Still something to write, write right half..\n // Append new buffer\n encoder.bufs.push(encoder.cbuf)\n // must have at least size of remaining buffer\n encoder.cbuf = new Uint8Array(math.max(bufferLen * 2, rightCopyLen))\n // copy array\n encoder.cbuf.set(uint8Array.subarray(leftCopyLen))\n encoder.cpos = rightCopyLen\n }\n}\n\n/**\n * Append an Uint8Array to Encoder.\n *\n * @function\n * @param {Encoder} encoder\n * @param {Uint8Array} uint8Array\n */\nexport const writeVarUint8Array = (encoder, uint8Array) => {\n writeVarUint(encoder, uint8Array.byteLength)\n writeUint8Array(encoder, uint8Array)\n}\n\n/**\n * Create an DataView of the next `len` bytes. Use it to write data after\n * calling this function.\n *\n * ```js\n * // write float32 using DataView\n * const dv = writeOnDataView(encoder, 4)\n * dv.setFloat32(0, 1.1)\n * // read float32 using DataView\n * const dv = readFromDataView(encoder, 4)\n * dv.getFloat32(0) // => 1.100000023841858 (leaving it to the reader to find out why this is the correct result)\n * ```\n *\n * @param {Encoder} encoder\n * @param {number} len\n * @return {DataView}\n */\nexport const writeOnDataView = (encoder, len) => {\n verifyLen(encoder, len)\n const dview = new DataView(encoder.cbuf.buffer, encoder.cpos, len)\n encoder.cpos += len\n return dview\n}\n\n/**\n * @param {Encoder} encoder\n * @param {number} num\n */\nexport const writeFloat32 = (encoder, num) => writeOnDataView(encoder, 4).setFloat32(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {number} num\n */\nexport const writeFloat64 = (encoder, num) => writeOnDataView(encoder, 8).setFloat64(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {bigint} num\n */\nexport const writeBigInt64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigInt64(0, num, false)\n\n/**\n * @param {Encoder} encoder\n * @param {bigint} num\n */\nexport const writeBigUint64 = (encoder, num) => /** @type {any} */ (writeOnDataView(encoder, 8)).setBigUint64(0, num, false)\n\nconst floatTestBed = new DataView(new ArrayBuffer(4))\n/**\n * Check if a number can be encoded as a 32 bit float.\n *\n * @param {number} num\n * @return {boolean}\n */\nconst isFloat32 = num => {\n floatTestBed.setFloat32(0, num)\n return floatTestBed.getFloat32(0) === num\n}\n\n/**\n * Encode data with efficient binary format.\n *\n * Differences to JSON:\n * • Transforms data to a binary format (not to a string)\n * • Encodes undefined, NaN, and ArrayBuffer (these can't be represented in JSON)\n * • Numbers are efficiently encoded either as a variable length integer, as a\n * 32 bit float, as a 64 bit float, or as a 64 bit bigint.\n *\n * Encoding table:\n *\n * | Data Type | Prefix | Encoding Method | Comment |\n * | ------------------- | -------- | ------------------ | ------- |\n * | undefined | 127 | | Functions, symbol, and everything that cannot be identified is encoded as undefined |\n * | null | 126 | | |\n * | integer | 125 | writeVarInt | Only encodes 32 bit signed integers |\n * | float32 | 124 | writeFloat32 | |\n * | float64 | 123 | writeFloat64 | |\n * | bigint | 122 | writeBigInt64 | |\n * | boolean (false) | 121 | | True and false are different data types so we save the following byte |\n * | boolean (true) | 120 | | - 0b01111000 so the last bit determines whether true or false |\n * | string | 119 | writeVarString | |\n * | object<string,any> | 118 | custom | Writes {length} then {length} key-value pairs |\n * | array<any> | 117 | custom | Writes {length} then {length} json values |\n * | Uint8Array | 116 | writeVarUint8Array | We use Uint8Array for any kind of binary data |\n *\n * Reasons for the decreasing prefix:\n * We need the first bit for extendability (later we may want to encode the\n * prefix with writeVarUint). The remaining 7 bits are divided as follows:\n * [0-30] the beginning of the data range is used for custom purposes\n * (defined by the function that uses this library)\n * [31-127] the end of the data range is used for data encoding by\n * lib0/encoding.js\n *\n * @param {Encoder} encoder\n * @param {undefined|null|number|bigint|boolean|string|Object<string,any>|Array<any>|Uint8Array} data\n */\nexport const writeAny = (encoder, data) => {\n switch (typeof data) {\n case 'string':\n // TYPE 119: STRING\n write(encoder, 119)\n writeVarString(encoder, data)\n break\n case 'number':\n if (number.isInteger(data) && math.abs(data) <= binary.BITS31) {\n // TYPE 125: INTEGER\n write(encoder, 125)\n writeVarInt(encoder, data)\n } else if (isFloat32(data)) {\n // TYPE 124: FLOAT32\n write(encoder, 124)\n writeFloat32(encoder, data)\n } else {\n // TYPE 123: FLOAT64\n write(encoder, 123)\n writeFloat64(encoder, data)\n }\n break\n case 'bigint':\n // TYPE 122: BigInt\n write(encoder, 122)\n writeBigInt64(encoder, data)\n break\n case 'object':\n if (data === null) {\n // TYPE 126: null\n write(encoder, 126)\n } else if (array.isArray(data)) {\n // TYPE 117: Array\n write(encoder, 117)\n writeVarUint(encoder, data.length)\n for (let i = 0; i < data.length; i++) {\n writeAny(encoder, data[i])\n }\n } else if (data instanceof Uint8Array) {\n // TYPE 116: ArrayBuffer\n write(encoder, 116)\n writeVarUint8Array(encoder, data)\n } else {\n // TYPE 118: Object\n write(encoder, 118)\n const keys = Object.keys(data)\n writeVarUint(encoder, keys.length)\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]\n writeVarString(encoder, key)\n writeAny(encoder, data[key])\n }\n }\n break\n case 'boolean':\n // TYPE 120/121: boolean (true/false)\n write(encoder, data ? 120 : 121)\n break\n default:\n // TYPE 127: undefined\n write(encoder, 127)\n }\n}\n\n/**\n * Now come a few stateful encoder that have their own classes.\n */\n\n/**\n * Basic Run Length Encoder - a basic compression implementation.\n *\n * Encodes [1,1,1,7] to [1,3,7,1] (3 times 1, 1 time 7). This encoder might do more harm than good if there are a lot of values that are not repeated.\n *\n * It was originally used for image compression. Cool .. article http://csbruce.com/cbm/transactor/pdfs/trans_v7_i06.pdf\n *\n * @note T must not be null!\n *\n * @template T\n */\nexport class RleEncoder extends Encoder {\n /**\n * @param {function(Encoder, T):void} writer\n */\n constructor (writer) {\n super()\n /**\n * The writer\n */\n this.w = writer\n /**\n * Current state\n * @type {T|null}\n */\n this.s = null\n this.count = 0\n }\n\n /**\n * @param {T} v\n */\n write (v) {\n if (this.s === v) {\n this.count++\n } else {\n if (this.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n writeVarUint(this, this.count - 1) // since count is always > 0, we can decrement by one. non-standard encoding ftw\n }\n this.count = 1\n // write first value\n this.w(this, v)\n this.s = v\n }\n }\n}\n\n/**\n * Basic diff decoder using variable length encoding.\n *\n * Encodes the values [3, 1100, 1101, 1050, 0] to [3, 1097, 1, -51, -1050] using writeVarInt.\n */\nexport class IntDiffEncoder extends Encoder {\n /**\n * @param {number} start\n */\n constructor (start) {\n super()\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n writeVarInt(this, v - this.s)\n this.s = v\n }\n}\n\n/**\n * A combination of IntDiffEncoder and RleEncoder.\n *\n * Basically first writes the IntDiffEncoder and then counts duplicate diffs using RleEncoding.\n *\n * Encodes the values [1,1,1,2,3,4,5,6] as [1,1,0,2,1,5] (RLE([1,0,0,1,1,1,1,1]) ⇒ RleIntDiff[1,1,0,2,1,5])\n */\nexport class RleIntDiffEncoder extends Encoder {\n /**\n * @param {number} start\n */\n constructor (start) {\n super()\n /**\n * Current state\n * @type {number}\n */\n this.s = start\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s === v && this.count > 0) {\n this.count++\n } else {\n if (this.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n writeVarUint(this, this.count - 1) // since count is always > 0, we can decrement by one. non-standard encoding ftw\n }\n this.count = 1\n // write first value\n writeVarInt(this, v - this.s)\n this.s = v\n }\n }\n}\n\n/**\n * @param {UintOptRleEncoder} encoder\n */\nconst flushUintOptRleEncoder = encoder => {\n if (encoder.count > 0) {\n // flush counter, unless this is the first value (count = 0)\n // case 1: just a single value. set sign to positive\n // case 2: write several values. set sign to negative to indicate that there is a length coming\n writeVarInt(encoder.encoder, encoder.count === 1 ? encoder.s : -encoder.s)\n if (encoder.count > 1) {\n writeVarUint(encoder.encoder, encoder.count - 2) // since count is always > 1, we can decrement by one. non-standard encoding ftw\n }\n }\n}\n\n/**\n * Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder.\n *\n * Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write\n * write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count.\n *\n * Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3)\n */\nexport class UintOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s === v) {\n this.count++\n } else {\n flushUintOptRleEncoder(this)\n this.count = 1\n this.s = v\n }\n }\n\n /**\n * Flush the encoded state and transform this to a Uint8Array.\n *\n * Note that this should only be called once.\n */\n toUint8Array () {\n flushUintOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * Increasing Uint Optimized RLE Encoder\n *\n * The RLE encoder counts the number of same occurences of the same value.\n * The IncUintOptRle encoder counts if the value increases.\n * I.e. 7, 8, 9, 10 will be encoded as [-7, 4]. 1, 3, 5 will be encoded\n * as [1, 3, 5].\n */\nexport class IncUintOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.s + this.count === v) {\n this.count++\n } else {\n flushUintOptRleEncoder(this)\n this.count = 1\n this.s = v\n }\n }\n\n /**\n * Flush the encoded state and transform this to a Uint8Array.\n *\n * Note that this should only be called once.\n */\n toUint8Array () {\n flushUintOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * @param {IntDiffOptRleEncoder} encoder\n */\nconst flushIntDiffOptRleEncoder = encoder => {\n if (encoder.count > 0) {\n // 31 bit making up the diff | wether to write the counter\n // const encodedDiff = encoder.diff << 1 | (encoder.count === 1 ? 0 : 1)\n const encodedDiff = encoder.diff * 2 + (encoder.count === 1 ? 0 : 1)\n // flush counter, unless this is the first value (count = 0)\n // case 1: just a single value. set first bit to positive\n // case 2: write several values. set first bit to negative to indicate that there is a length coming\n writeVarInt(encoder.encoder, encodedDiff)\n if (encoder.count > 1) {\n writeVarUint(encoder.encoder, encoder.count - 2) // since count is always > 1, we can decrement by one. non-standard encoding ftw\n }\n }\n}\n\n/**\n * A combination of the IntDiffEncoder and the UintOptRleEncoder.\n *\n * The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes\n * in the LSB whether a count is to be read. Therefore this Encoder only supports 31 bit integers!\n *\n * Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1])\n *\n * Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains:\n * * 1 bit that denotes whether the next value is a count (LSB)\n * * 1 bit that denotes whether this value is negative (MSB - 1)\n * * 1 bit that denotes whether to continue reading the variable length integer (MSB)\n *\n * Therefore, only five bits remain to encode diff ranges.\n *\n * Use this Encoder only when appropriate. In most cases, this is probably a bad idea.\n */\nexport class IntDiffOptRleEncoder {\n constructor () {\n this.encoder = new Encoder()\n /**\n * @type {number}\n */\n this.s = 0\n this.count = 0\n this.diff = 0\n }\n\n /**\n * @param {number} v\n */\n write (v) {\n if (this.diff === v - this.s) {\n this.s = v\n this.count++\n } else {\n flushIntDiffOptRleEncoder(this)\n this.count = 1\n this.diff = v - this.s\n this.s = v\n }\n }\n\n /**\n * Flush the encoded state and transform this to a Uint8Array.\n *\n * Note that this should only be called once.\n */\n toUint8Array () {\n flushIntDiffOptRleEncoder(this)\n return toUint8Array(this.encoder)\n }\n}\n\n/**\n * Optimized String Encoder.\n *\n * Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted.\n * In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?).\n *\n * This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call.\n *\n * The lengths are encoded using a UintOptRleEncoder.\n */\nexport class StringEncoder {\n constructor () {\n /**\n * @type {Array<string>}\n */\n this.sarr = []\n this.s = ''\n this.lensE = new UintOptRleEncoder()\n }\n\n /**\n * @param {string} string\n */\n write (string) {\n this.s += string\n if (this.s.length > 19) {\n this.sarr.push(this.s)\n this.s = ''\n }\n this.lensE.write(string.length)\n }\n\n toUint8Array () {\n const encoder = new Encoder()\n this.sarr.push(this.s)\n this.s = ''\n writeVarString(encoder, this.sarr.join(''))\n writeUint8Array(encoder, this.lensE.toUint8Array())\n return toUint8Array(encoder)\n }\n}\n"],"names":["math.max","binary.BITS8","binary.BITS7","binary.BIT8","math.floor","math.isNegativeZero","binary.BITS6","binary.BIT7","string.utf8TextEncoder","string.encodeUtf8","math.min","number.isInteger","math.abs","binary.BITS31","array.isArray","string"],"mappings":";;;;;;;AAqCO,MAAM,QAAQ;AAAA,EACnB,cAAe;AACb,SAAK,OAAO;AACZ,SAAK,OAAO,IAAI,WAAW,GAAG;AAI9B,SAAK,OAAO,CAAA;AAAA,EAChB;AACA;AAMY,MAAC,gBAAgB,MAAM,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,KAAK,EAAE,SAAS,IAAI;AACtB,WAAK,KAAK,KAAK,KAAK,CAAC;AACrB,WAAK,IAAI;AAAA,IACf;AACI,SAAK,MAAM,MAAMA,QAAO,MAAM;AAAA,EAClC;AAAA,EAEE,eAAgB;AACd,UAAM,UAAU,IAAI,QAAO;AAC3B,SAAK,KAAK,KAAK,KAAK,CAAC;AACrB,SAAK,IAAI;AACT,mBAAe,SAAS,KAAK,KAAK,KAAK,EAAE,CAAC;AAC1C,oBAAgB,SAAS,KAAK,MAAM,aAAc,CAAA;AAClD,WAAO,aAAa,OAAO;AAAA,EAC/B;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const map = require("./map.cjs.js");
|
|
4
|
-
const string = require("./string.cjs.js");
|
|
5
|
-
const conditions = require("./conditions.cjs.js");
|
|
6
|
-
const storage = require("./storage.cjs.js");
|
|
7
|
-
const _function = require("./function.cjs.js");
|
|
8
|
-
var define_process_env_default = {};
|
|
9
|
-
const isNode = typeof process !== "undefined" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
|
|
10
|
-
const isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && !isNode;
|
|
11
|
-
const isMac = typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
|
|
12
|
-
let params;
|
|
13
|
-
const args = [];
|
|
14
|
-
const computeParams = () => {
|
|
15
|
-
if (params === void 0) {
|
|
16
|
-
if (isNode) {
|
|
17
|
-
params = map.create();
|
|
18
|
-
const pargs = process.argv;
|
|
19
|
-
let currParamName = null;
|
|
20
|
-
for (let i = 0; i < pargs.length; i++) {
|
|
21
|
-
const parg = pargs[i];
|
|
22
|
-
if (parg[0] === "-") {
|
|
23
|
-
if (currParamName !== null) {
|
|
24
|
-
params.set(currParamName, "");
|
|
25
|
-
}
|
|
26
|
-
currParamName = parg;
|
|
27
|
-
} else {
|
|
28
|
-
if (currParamName !== null) {
|
|
29
|
-
params.set(currParamName, parg);
|
|
30
|
-
currParamName = null;
|
|
31
|
-
} else {
|
|
32
|
-
args.push(parg);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (currParamName !== null) {
|
|
37
|
-
params.set(currParamName, "");
|
|
38
|
-
}
|
|
39
|
-
} else if (typeof location === "object") {
|
|
40
|
-
params = map.create();
|
|
41
|
-
(location.search || "?").slice(1).split("&").forEach((kv) => {
|
|
42
|
-
if (kv.length !== 0) {
|
|
43
|
-
const [key, value] = kv.split("=");
|
|
44
|
-
params.set(`--${string.fromCamelCase(key, "-")}`, value);
|
|
45
|
-
params.set(`-${string.fromCamelCase(key, "-")}`, value);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
} else {
|
|
49
|
-
params = map.create();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return params;
|
|
53
|
-
};
|
|
54
|
-
const hasParam = (name) => computeParams().has(name);
|
|
55
|
-
const getParam = (name, defaultVal) => computeParams().get(name) || defaultVal;
|
|
56
|
-
const getVariable = (name) => isNode ? conditions.undefinedToNull(define_process_env_default[name.toUpperCase().replaceAll("-", "_")]) : conditions.undefinedToNull(storage.varStorage.getItem(name));
|
|
57
|
-
const getConf = (name) => computeParams().get("--" + name) || getVariable(name);
|
|
58
|
-
const ensureConf = (name) => {
|
|
59
|
-
const c = getConf(name);
|
|
60
|
-
if (c == null) throw new Error(`Expected configuration "${name.toUpperCase().replaceAll("-", "_")}"`);
|
|
61
|
-
return c;
|
|
62
|
-
};
|
|
63
|
-
const hasConf = (name) => hasParam("--" + name) || getVariable(name) !== null;
|
|
64
|
-
const production = hasConf("production");
|
|
65
|
-
const forceColor = isNode && _function.isOneOf(define_process_env_default.FORCE_COLOR, ["true", "1", "2"]);
|
|
66
|
-
const supportsColor = forceColor || !hasParam("--no-colors") && // @todo deprecate --no-colors
|
|
67
|
-
!hasConf("no-color") && (!isNode || process.stdout.isTTY) && (!isNode || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
|
|
68
|
-
exports.ensureConf = ensureConf;
|
|
69
|
-
exports.getConf = getConf;
|
|
70
|
-
exports.getParam = getParam;
|
|
71
|
-
exports.getVariable = getVariable;
|
|
72
|
-
exports.hasConf = hasConf;
|
|
73
|
-
exports.hasParam = hasParam;
|
|
74
|
-
exports.isBrowser = isBrowser;
|
|
75
|
-
exports.isMac = isMac;
|
|
76
|
-
exports.isNode = isNode;
|
|
77
|
-
exports.production = production;
|
|
78
|
-
exports.supportsColor = supportsColor;
|
|
79
|
-
//# sourceMappingURL=environment.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment.cjs.js","sources":["../../../../../../../../../node_modules/.pnpm/lib0@0.2.114/node_modules/lib0/environment.js"],"sourcesContent":["/**\n * Isomorphic module to work access the environment (query params, env variables).\n *\n * @module environment\n */\n\nimport * as map from './map.js'\nimport * as string from './string.js'\nimport * as conditions from './conditions.js'\nimport * as storage from './storage.js'\nimport * as f from './function.js'\n\n/* c8 ignore next 2 */\n// @ts-ignore\nexport const isNode = typeof process !== 'undefined' && process.release && /node|io\\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'\n\n/* c8 ignore next */\nexport const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && !isNode\n/* c8 ignore next 3 */\nexport const isMac = typeof navigator !== 'undefined'\n ? /Mac/.test(navigator.platform)\n : false\n\n/**\n * @type {Map<string,string>}\n */\nlet params\nconst args = []\n\n/* c8 ignore start */\nconst computeParams = () => {\n if (params === undefined) {\n if (isNode) {\n params = map.create()\n const pargs = process.argv\n let currParamName = null\n for (let i = 0; i < pargs.length; i++) {\n const parg = pargs[i]\n if (parg[0] === '-') {\n if (currParamName !== null) {\n params.set(currParamName, '')\n }\n currParamName = parg\n } else {\n if (currParamName !== null) {\n params.set(currParamName, parg)\n currParamName = null\n } else {\n args.push(parg)\n }\n }\n }\n if (currParamName !== null) {\n params.set(currParamName, '')\n }\n // in ReactNative for example this would not be true (unless connected to the Remote Debugger)\n } else if (typeof location === 'object') {\n params = map.create(); // eslint-disable-next-line no-undef\n (location.search || '?').slice(1).split('&').forEach((kv) => {\n if (kv.length !== 0) {\n const [key, value] = kv.split('=')\n params.set(`--${string.fromCamelCase(key, '-')}`, value)\n params.set(`-${string.fromCamelCase(key, '-')}`, value)\n }\n })\n } else {\n params = map.create()\n }\n }\n return params\n}\n/* c8 ignore stop */\n\n/**\n * @param {string} name\n * @return {boolean}\n */\n/* c8 ignore next */\nexport const hasParam = (name) => computeParams().has(name)\n\n/**\n * @param {string} name\n * @param {string} defaultVal\n * @return {string}\n */\n/* c8 ignore next 2 */\nexport const getParam = (name, defaultVal) =>\n computeParams().get(name) || defaultVal\n\n/**\n * @param {string} name\n * @return {string|null}\n */\n/* c8 ignore next 4 */\nexport const getVariable = (name) =>\n isNode\n ? conditions.undefinedToNull(process.env[name.toUpperCase().replaceAll('-', '_')])\n : conditions.undefinedToNull(storage.varStorage.getItem(name))\n\n/**\n * @param {string} name\n * @return {string|null}\n */\n/* c8 ignore next 2 */\nexport const getConf = (name) =>\n computeParams().get('--' + name) || getVariable(name)\n\n/**\n * @param {string} name\n * @return {string}\n */\n/* c8 ignore next 5 */\nexport const ensureConf = (name) => {\n const c = getConf(name)\n if (c == null) throw new Error(`Expected configuration \"${name.toUpperCase().replaceAll('-', '_')}\"`)\n return c\n}\n\n/**\n * @param {string} name\n * @return {boolean}\n */\n/* c8 ignore next 2 */\nexport const hasConf = (name) =>\n hasParam('--' + name) || getVariable(name) !== null\n\n/* c8 ignore next */\nexport const production = hasConf('production')\n\n/* c8 ignore next 2 */\nconst forceColor = isNode &&\n f.isOneOf(process.env.FORCE_COLOR, ['true', '1', '2'])\n\n/* c8 ignore start */\n/**\n * Color is enabled by default if the terminal supports it.\n *\n * Explicitly enable color using `--color` parameter\n * Disable color using `--no-color` parameter or using `NO_COLOR=1` environment variable.\n * `FORCE_COLOR=1` enables color and takes precedence over all.\n */\nexport const supportsColor = forceColor || (\n !hasParam('--no-colors') && // @todo deprecate --no-colors\n !hasConf('no-color') &&\n (!isNode || process.stdout.isTTY) && (\n !isNode ||\n hasParam('--color') ||\n getVariable('COLORTERM') !== null ||\n (getVariable('TERM') || '').includes('color')\n )\n)\n/* c8 ignore stop */\n"],"names":["map.create","string.fromCamelCase","conditions.undefinedToNull","storage.varStorage","f.isOneOf"],"mappings":";;;;;;;;AAca,MAAA,SAAS,OAAO,YAAY,eAAe,QAAQ,WAAW,cAAc,KAAK,QAAQ,QAAQ,IAAI,KAAK,OAAO,UAAU,SAAS,KAAK,OAAO,YAAY,cAAc,UAAU,CAAC,MAAM;AAGjM,MAAM,YAAY,OAAO,WAAW,eAAe,OAAO,aAAa,eAAe,CAAC;AAEjF,MAAA,QAAQ,OAAO,cAAc,cACtC,MAAM,KAAK,UAAU,QAAQ,IAC7B;AAKJ,IAAI;AACJ,MAAM,OAAO,CAAC;AAGd,MAAM,gBAAgB,MAAM;AAC1B,MAAI,WAAW,QAAW;AACxB,QAAI,QAAQ;AACV,eAASA,IAAAA,OAAW;AACpB,YAAM,QAAQ,QAAQ;AACtB,UAAI,gBAAgB;AACpB,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AAC/B,cAAA,OAAO,MAAM,CAAC;AAChB,YAAA,KAAK,CAAC,MAAM,KAAK;AACnB,cAAI,kBAAkB,MAAM;AACnB,mBAAA,IAAI,eAAe,EAAE;AAAA,UAAA;AAEd,0BAAA;AAAA,QAAA,OACX;AACL,cAAI,kBAAkB,MAAM;AACnB,mBAAA,IAAI,eAAe,IAAI;AACd,4BAAA;AAAA,UAAA,OACX;AACL,iBAAK,KAAK,IAAI;AAAA,UAAA;AAAA,QAChB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jBC,UAAAA,QAAU,2BAAY,aAAa,CAAC,QAAQ,KAAK,GAAG,CAAC;AAUhD,MAAM,gBAAgB,cAC3B,CAAC,SAAS,aAAa;AACvB,CAAC,QAAQ,UAAU,MAClB,CAAC,UAAU,QAAQ,OAAO,WACzB,CAAC,UACD,SAAS,SAAS,KAClB,YAAY,WAAW,MAAM,SAC5B,YAAY,MAAM,KAAK,IAAI,SAAS,OAAO;;;;;;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const create = (s) => new Error(s);
|
|
4
|
-
const methodUnimplemented = () => {
|
|
5
|
-
throw create("Method unimplemented");
|
|
6
|
-
};
|
|
7
|
-
const unexpectedCase = () => {
|
|
8
|
-
throw create("Unexpected case");
|
|
9
|
-
};
|
|
10
|
-
exports.create = create;
|
|
11
|
-
exports.methodUnimplemented = methodUnimplemented;
|
|
12
|
-
exports.unexpectedCase = unexpectedCase;
|
|
13
|
-
//# sourceMappingURL=error.cjs.js.map
|