@electerm/electerm-react 2.5.16 → 2.7.6
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/client/common/constants.js +1 -1
- package/client/common/create-title.jsx +2 -2
- package/client/common/download.jsx +14 -14
- package/client/components/bookmark-form/common/encodes.js +1 -0
- package/client/components/bookmark-form/config/common-fields.js +29 -2
- package/client/components/common/zoom-control.jsx +58 -0
- package/client/components/rdp/rdp-session.jsx +264 -198
- package/client/components/sftp/sftp.styl +1 -1
- package/client/components/shortcuts/shortcut-handler.js +84 -0
- package/client/components/sys-menu/zoom.jsx +4 -31
- package/client/components/terminal/terminal.jsx +51 -45
- package/client/components/web/address-bar.jsx +35 -6
- package/client/components/web/web-auth-modal.jsx +69 -0
- package/client/components/web/web-session.jsx +60 -4
- package/client/views/index.pug +0 -2
- package/package.json +1 -1
- package/client/entry/rle.js +0 -2
- package/client/entry/rle.wasm +0 -0
|
@@ -1,38 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
Space
|
|
4
|
-
} from 'antd'
|
|
5
|
-
import {
|
|
6
|
-
MinusCircleOutlined,
|
|
7
|
-
PlusCircleOutlined
|
|
8
|
-
} from '@ant-design/icons'
|
|
1
|
+
import ZoomControl from '../common/zoom-control'
|
|
9
2
|
|
|
10
3
|
export default function ZoomMenu (props) {
|
|
11
4
|
const { store } = window
|
|
12
|
-
const handleChange = (v) => {
|
|
13
|
-
store.zoom(v / 100)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
5
|
return (
|
|
17
|
-
<
|
|
18
|
-
value={
|
|
19
|
-
onChange={
|
|
20
|
-
step={1}
|
|
21
|
-
min={25}
|
|
22
|
-
max={500}
|
|
23
|
-
suffix='%'
|
|
24
|
-
addonBefore={
|
|
25
|
-
<Space.Addon>
|
|
26
|
-
<PlusCircleOutlined
|
|
27
|
-
onClick={() => store.zoom(0.25, true)}
|
|
28
|
-
className='mg1r pointer font16'
|
|
29
|
-
/>
|
|
30
|
-
<MinusCircleOutlined
|
|
31
|
-
onClick={() => store.zoom(-0.25, true)}
|
|
32
|
-
className='pointer font16'
|
|
33
|
-
/>
|
|
34
|
-
</Space.Addon>
|
|
35
|
-
}
|
|
6
|
+
<ZoomControl
|
|
7
|
+
value={props.config.zoom}
|
|
8
|
+
onChange={(v) => store.zoom(v)}
|
|
36
9
|
/>
|
|
37
10
|
)
|
|
38
11
|
}
|
|
@@ -971,64 +971,70 @@ class Term extends Component {
|
|
|
971
971
|
?.openSuggestions(cursorPos, data)
|
|
972
972
|
}
|
|
973
973
|
|
|
974
|
+
/**
|
|
975
|
+
* Read current input directly from terminal buffer
|
|
976
|
+
* This is more reliable than tracking character-by-character
|
|
977
|
+
*/
|
|
974
978
|
getCurrentInput = () => {
|
|
975
|
-
|
|
979
|
+
if (!this.term) return ''
|
|
980
|
+
|
|
981
|
+
const buffer = this.term.buffer.active
|
|
982
|
+
const cursorY = buffer.cursorY
|
|
983
|
+
const cursorX = buffer.cursorX
|
|
984
|
+
|
|
985
|
+
// Get the current line from buffer (baseY + cursorY gives absolute position)
|
|
986
|
+
const absoluteY = buffer.baseY + cursorY
|
|
987
|
+
const line = buffer.getLine(absoluteY)
|
|
988
|
+
if (!line) return ''
|
|
989
|
+
|
|
990
|
+
// Get text from start of line up to cursor position
|
|
991
|
+
const lineText = line.translateToString(true, 0, cursorX)
|
|
992
|
+
|
|
993
|
+
// Try to extract command after prompt
|
|
994
|
+
// Common prompt endings with trailing space
|
|
995
|
+
const promptEndings = ['$ ', '# ', '> ', '% ', '] ', ') ']
|
|
996
|
+
|
|
997
|
+
let commandStart = 0
|
|
998
|
+
for (const ending of promptEndings) {
|
|
999
|
+
const idx = lineText.lastIndexOf(ending)
|
|
1000
|
+
if (idx !== -1 && idx + ending.length > commandStart) {
|
|
1001
|
+
commandStart = idx + ending.length
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
return lineText.slice(commandStart)
|
|
976
1006
|
}
|
|
977
1007
|
|
|
978
1008
|
setCurrentInput = (value) => {
|
|
979
1009
|
this.currentInput = value
|
|
980
1010
|
}
|
|
981
1011
|
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
// Handle Ctrl+U (clear line)
|
|
989
|
-
if (d === '\x15') {
|
|
990
|
-
this.currentInput = ''
|
|
991
|
-
return
|
|
992
|
-
}
|
|
993
|
-
// Handle Ctrl+W (delete word)
|
|
994
|
-
if (d === '\x17') {
|
|
995
|
-
this.currentInput = this.currentInput.replace(/\S*\s*$/, '')
|
|
996
|
-
return
|
|
997
|
-
}
|
|
998
|
-
// Handle Ctrl+C (cancel)
|
|
999
|
-
if (d === '\x03') {
|
|
1000
|
-
this.currentInput = ''
|
|
1001
|
-
return
|
|
1002
|
-
}
|
|
1003
|
-
// Handle Enter
|
|
1012
|
+
/**
|
|
1013
|
+
* Handle special input events for command history tracking
|
|
1014
|
+
* The actual input reading is done via getCurrentInput from buffer
|
|
1015
|
+
*/
|
|
1016
|
+
handleInputEvent = (d) => {
|
|
1017
|
+
// Handle Enter - add command to history
|
|
1004
1018
|
if (d === '\r' || d === '\n') {
|
|
1005
|
-
|
|
1006
|
-
if (
|
|
1007
|
-
this.manualCommandHistory.add(
|
|
1008
|
-
|
|
1009
|
-
window.store.addCmdHistory(this.currentInput.trim())
|
|
1019
|
+
const currentCmd = this.getCurrentInput()
|
|
1020
|
+
if (currentCmd && currentCmd.trim() && this.shouldUseManualHistory()) {
|
|
1021
|
+
this.manualCommandHistory.add(currentCmd.trim())
|
|
1022
|
+
window.store.addCmdHistory(currentCmd.trim())
|
|
1010
1023
|
}
|
|
1011
|
-
this.
|
|
1012
|
-
return
|
|
1013
|
-
}
|
|
1014
|
-
// Handle Escape and other control characters
|
|
1015
|
-
if (d.charCodeAt(0) < 32 && d !== '\t') {
|
|
1016
|
-
return
|
|
1017
|
-
}
|
|
1018
|
-
// Handle arrow keys and other escape sequences
|
|
1019
|
-
if (d.startsWith('\x1b')) {
|
|
1020
|
-
return
|
|
1024
|
+
this.closeSuggestions()
|
|
1021
1025
|
}
|
|
1022
|
-
// Regular character input - append to buffer
|
|
1023
|
-
this.currentInput += d
|
|
1024
1026
|
}
|
|
1025
1027
|
|
|
1026
1028
|
onData = (d) => {
|
|
1027
|
-
this.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1029
|
+
this.handleInputEvent(d)
|
|
1030
|
+
if (this.props.config.showCmdSuggestions) {
|
|
1031
|
+
const data = this.getCurrentInput()
|
|
1032
|
+
if (data && d !== '\r' && d !== '\n') {
|
|
1033
|
+
const cursorPos = this.getCursorPosition()
|
|
1034
|
+
this.openSuggestions(cursorPos, data)
|
|
1035
|
+
} else {
|
|
1036
|
+
this.closeSuggestions()
|
|
1037
|
+
}
|
|
1032
1038
|
} else {
|
|
1033
1039
|
this.closeSuggestions()
|
|
1034
1040
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Input,
|
|
3
|
-
Tooltip
|
|
3
|
+
Tooltip,
|
|
4
|
+
Dropdown,
|
|
5
|
+
Space
|
|
4
6
|
} from 'antd'
|
|
5
7
|
import { copy } from '../../common/clipboard'
|
|
6
8
|
import {
|
|
7
9
|
ReloadOutlined,
|
|
8
|
-
GlobalOutlined
|
|
10
|
+
GlobalOutlined,
|
|
11
|
+
EllipsisOutlined
|
|
9
12
|
} from '@ant-design/icons'
|
|
13
|
+
import ZoomControl from '../common/zoom-control'
|
|
10
14
|
|
|
11
15
|
export default function AddressBar (props) {
|
|
12
16
|
const {
|
|
@@ -14,7 +18,9 @@ export default function AddressBar (props) {
|
|
|
14
18
|
onReload,
|
|
15
19
|
onOpen,
|
|
16
20
|
title,
|
|
17
|
-
description
|
|
21
|
+
description,
|
|
22
|
+
zoom,
|
|
23
|
+
onZoom
|
|
18
24
|
} = props
|
|
19
25
|
const content = (
|
|
20
26
|
<>
|
|
@@ -25,6 +31,19 @@ export default function AddressBar (props) {
|
|
|
25
31
|
function handleClick () {
|
|
26
32
|
copy(url)
|
|
27
33
|
}
|
|
34
|
+
const items = [
|
|
35
|
+
{
|
|
36
|
+
key: 'zoom',
|
|
37
|
+
label: (
|
|
38
|
+
<div onClick={e => e.stopPropagation()}>
|
|
39
|
+
<ZoomControl
|
|
40
|
+
value={zoom}
|
|
41
|
+
onChange={onZoom}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
]
|
|
28
47
|
return (
|
|
29
48
|
<div className='web-address-bar pd1'>
|
|
30
49
|
<Tooltip
|
|
@@ -39,9 +58,19 @@ export default function AddressBar (props) {
|
|
|
39
58
|
/>
|
|
40
59
|
}
|
|
41
60
|
suffix={
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
<Space>
|
|
62
|
+
<GlobalOutlined
|
|
63
|
+
className='pointer'
|
|
64
|
+
onClick={onOpen}
|
|
65
|
+
title={window.translate('openInDefaultBrowser')}
|
|
66
|
+
/>
|
|
67
|
+
<Dropdown
|
|
68
|
+
menu={{ items }}
|
|
69
|
+
trigger={['click']}
|
|
70
|
+
>
|
|
71
|
+
<EllipsisOutlined className='pointer' />
|
|
72
|
+
</Dropdown>
|
|
73
|
+
</Space>
|
|
45
74
|
}
|
|
46
75
|
/>
|
|
47
76
|
</Tooltip>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { useState, useCallback } from 'react'
|
|
2
|
+
import { Input, Button } from 'antd'
|
|
3
|
+
import Modal from '../common/modal'
|
|
4
|
+
|
|
5
|
+
export default function WebAuthModal ({ authRequest, onAuthSubmit, onAuthCancel }) {
|
|
6
|
+
const [username, setUsername] = useState('')
|
|
7
|
+
const [password, setPassword] = useState('')
|
|
8
|
+
|
|
9
|
+
const handleSubmit = useCallback(() => {
|
|
10
|
+
onAuthSubmit(username, password)
|
|
11
|
+
setUsername('')
|
|
12
|
+
setPassword('')
|
|
13
|
+
}, [onAuthSubmit, username, password])
|
|
14
|
+
|
|
15
|
+
const handleCancel = useCallback(() => {
|
|
16
|
+
onAuthCancel()
|
|
17
|
+
setUsername('')
|
|
18
|
+
setPassword('')
|
|
19
|
+
}, [onAuthCancel])
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Modal
|
|
23
|
+
open={!!authRequest}
|
|
24
|
+
title='Authentication Required'
|
|
25
|
+
width={400}
|
|
26
|
+
onCancel={handleCancel}
|
|
27
|
+
footer={null}
|
|
28
|
+
>
|
|
29
|
+
<div className='pd1y'>
|
|
30
|
+
<p>
|
|
31
|
+
<b>{authRequest?.host}</b> requires authentication
|
|
32
|
+
{authRequest?.realm ? ` (${authRequest.realm})` : ''}
|
|
33
|
+
</p>
|
|
34
|
+
<div className='pd1b'>
|
|
35
|
+
<div className='pd1b'>Username</div>
|
|
36
|
+
<Input
|
|
37
|
+
value={username}
|
|
38
|
+
onChange={e => setUsername(e.target.value)}
|
|
39
|
+
placeholder='Username'
|
|
40
|
+
autoFocus
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
<div className='pd1b'>
|
|
44
|
+
<div className='pd1b'>Password</div>
|
|
45
|
+
<Input.Password
|
|
46
|
+
value={password}
|
|
47
|
+
onChange={e => setPassword(e.target.value)}
|
|
48
|
+
placeholder='Password'
|
|
49
|
+
onPressEnter={handleSubmit}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
<div className='pd1t alignright'>
|
|
53
|
+
<Button
|
|
54
|
+
className='mg1r'
|
|
55
|
+
onClick={handleCancel}
|
|
56
|
+
>
|
|
57
|
+
Cancel
|
|
58
|
+
</Button>
|
|
59
|
+
<Button
|
|
60
|
+
type='primary'
|
|
61
|
+
onClick={handleSubmit}
|
|
62
|
+
>
|
|
63
|
+
Login
|
|
64
|
+
</Button>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</Modal>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import AddressBar from './address-bar'
|
|
2
|
-
|
|
2
|
+
import WebAuthModal from './web-auth-modal'
|
|
3
|
+
import React, { useState, useRef, useEffect, useCallback } from 'react'
|
|
3
4
|
|
|
4
5
|
export default function WebSession (props) {
|
|
5
6
|
const {
|
|
@@ -8,6 +9,9 @@ export default function WebSession (props) {
|
|
|
8
9
|
height,
|
|
9
10
|
reloadTab
|
|
10
11
|
} = props
|
|
12
|
+
const [zoom, setZoom] = useState(1.0)
|
|
13
|
+
const [authRequest, setAuthRequest] = useState(null)
|
|
14
|
+
const webviewRef = useRef(null)
|
|
11
15
|
const urlRegex = /^[a-z\d.+-]+:\/\/[^\s/$.?#].[^\s]*$/i
|
|
12
16
|
|
|
13
17
|
const { url = '' } = tab
|
|
@@ -15,6 +19,8 @@ export default function WebSession (props) {
|
|
|
15
19
|
url,
|
|
16
20
|
title: tab.title,
|
|
17
21
|
description: tab.description,
|
|
22
|
+
zoom,
|
|
23
|
+
onZoom: handleZoom,
|
|
18
24
|
onOpen: () => {
|
|
19
25
|
window.openLink(tab.url)
|
|
20
26
|
},
|
|
@@ -25,6 +31,50 @@ export default function WebSession (props) {
|
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
|
|
34
|
+
function handleZoom (v) {
|
|
35
|
+
setZoom(v)
|
|
36
|
+
const el = webviewRef.current
|
|
37
|
+
if (!el) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
if (el.setZoomFactor) {
|
|
41
|
+
el.setZoomFactor(v)
|
|
42
|
+
} else {
|
|
43
|
+
el.style.zoom = v
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Handle HTTP Basic Auth requests from webview
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!window.api || !window.api.onWebviewAuthRequest) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
const removeListener = window.api.onWebviewAuthRequest((data) => {
|
|
53
|
+
setAuthRequest(data)
|
|
54
|
+
})
|
|
55
|
+
return removeListener
|
|
56
|
+
}, [])
|
|
57
|
+
|
|
58
|
+
const handleAuthSubmit = useCallback((username, password) => {
|
|
59
|
+
if (!authRequest) return
|
|
60
|
+
window.api.sendWebviewAuthResponse({
|
|
61
|
+
id: authRequest.id,
|
|
62
|
+
username,
|
|
63
|
+
password
|
|
64
|
+
})
|
|
65
|
+
setAuthRequest(null)
|
|
66
|
+
}, [authRequest])
|
|
67
|
+
|
|
68
|
+
const handleAuthCancel = useCallback(() => {
|
|
69
|
+
if (!authRequest) return
|
|
70
|
+
window.api.sendWebviewAuthResponse({
|
|
71
|
+
id: authRequest.id,
|
|
72
|
+
username: '',
|
|
73
|
+
password: ''
|
|
74
|
+
})
|
|
75
|
+
setAuthRequest(null)
|
|
76
|
+
}, [authRequest])
|
|
77
|
+
|
|
28
78
|
// TODO: 支持自定义Header和Cookie
|
|
29
79
|
// useEffect(() => {
|
|
30
80
|
// const webview = document.querySelector('webview')
|
|
@@ -64,14 +114,15 @@ export default function WebSession (props) {
|
|
|
64
114
|
}
|
|
65
115
|
}
|
|
66
116
|
return (
|
|
67
|
-
<iframe {...iframeProps} />
|
|
117
|
+
<iframe {...iframeProps} ref={webviewRef} />
|
|
68
118
|
)
|
|
69
119
|
}
|
|
70
120
|
const viewProps = {
|
|
71
121
|
src: url,
|
|
72
122
|
style: {
|
|
73
123
|
width: (width - 10) + 'px',
|
|
74
|
-
height: (height + hOffset) + 'px'
|
|
124
|
+
height: (height + hOffset) + 'px',
|
|
125
|
+
background: '#fff'
|
|
75
126
|
},
|
|
76
127
|
disableblinkfeatures: 'true',
|
|
77
128
|
disablewebsecurity: 'true',
|
|
@@ -79,7 +130,7 @@ export default function WebSession (props) {
|
|
|
79
130
|
useragent: tab.useragent || 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
|
|
80
131
|
}
|
|
81
132
|
return (
|
|
82
|
-
<webview {...viewProps} />
|
|
133
|
+
<webview {...viewProps} ref={webviewRef} />
|
|
83
134
|
)
|
|
84
135
|
}
|
|
85
136
|
|
|
@@ -91,6 +142,11 @@ export default function WebSession (props) {
|
|
|
91
142
|
<div className='pd1'>
|
|
92
143
|
{renderView()}
|
|
93
144
|
</div>
|
|
145
|
+
<WebAuthModal
|
|
146
|
+
authRequest={authRequest}
|
|
147
|
+
onAuthSubmit={handleAuthSubmit}
|
|
148
|
+
onAuthCancel={handleAuthCancel}
|
|
149
|
+
/>
|
|
94
150
|
</div>
|
|
95
151
|
)
|
|
96
152
|
}
|
package/client/views/index.pug
CHANGED
|
@@ -47,7 +47,6 @@ html
|
|
|
47
47
|
img.iblock.logo-filter(src='images/electerm.png', alt='', height=80)
|
|
48
48
|
script.
|
|
49
49
|
window.et = !{JSON.stringify(_global)}
|
|
50
|
-
- var url1 = '/src/client/entry/rle.js'
|
|
51
50
|
- var url = '/src/client/entry/basic.js'
|
|
52
51
|
- if (isDev)
|
|
53
52
|
//- script(src='/external/react.development.js?' + version)
|
|
@@ -65,7 +64,6 @@ html
|
|
|
65
64
|
//- script(src='/external/react.production.min.js?' + version)
|
|
66
65
|
//- script(src='/external/react-dom.production.min.js?' + version)
|
|
67
66
|
- var url = src='/js/basic-' + version + '.js'
|
|
68
|
-
- var url1 = src='/js/rle-' + version + '.js'
|
|
69
67
|
script(src=url1, type='module')
|
|
70
68
|
script(src=url, type='module')
|
|
71
69
|
|
package/package.json
CHANGED
package/client/entry/rle.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// This file and rle.wasm is generated by [**Emscripten**](https://github.com/kripken/emscripten) from [rle.c](https://raw.githubusercontent.com/citronneur/mstsc.js/master/obj/rle.c)
|
|
2
|
-
var Module=typeof Module!="undefined"?Module:{};window.Module=Module;var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);if(typeof module!="undefined"){module["exports"]=Module}process.on("uncaughtException",ex=>{if(ex!=="unwind"&&!(ex instanceof ExitStatus)&&!(ex.context instanceof ExitStatus)){throw ex}});quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function findWasmBinary(){var f="rle.wasm";if(!isDataURI(f)){return locateFile(f)}return f}var wasmBinaryFile;function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(binaryFile)){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(!response["ok"]){throw`failed to load wasm binary file at '${binaryFile}'`}return response["arrayBuffer"]()}).catch(()=>getBinarySync(binaryFile))}else if(readAsync){return new Promise((resolve,reject)=>{readAsync(binaryFile,response=>resolve(new Uint8Array(response)),reject)})}}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function getWasmImports(){return{"a":wasmImports}}function createWasm(){var info=getWasmImports();function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["b"];updateMemoryViews();addOnInit(wasmExports["c"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);return false}}if(!wasmBinaryFile)wasmBinaryFile=findWasmBinary();instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult);return{}}function ExitStatus(status){this.name="ExitStatus";this.message=`Program terminated with exit(${status})`;this.status=status}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var abortOnCannotGrowMemory=requestedSize=>{abort("OOM")};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;abortOnCannotGrowMemory(requestedSize)};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;var UTF8ArrayToString=(heapOrArray,idx,maxBytesToRead)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},"array":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var wasmImports={a:_emscripten_resize_heap};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["c"])();var _bitmap_decompress_15=Module["_bitmap_decompress_15"]=(a0,a1,a2,a3,a4,a5,a6)=>(_bitmap_decompress_15=Module["_bitmap_decompress_15"]=wasmExports["d"])(a0,a1,a2,a3,a4,a5,a6);var _malloc=Module["_malloc"]=a0=>(_malloc=Module["_malloc"]=wasmExports["e"])(a0);var _free=Module["_free"]=a0=>(_free=Module["_free"]=wasmExports["f"])(a0);var _bitmap_decompress_16=Module["_bitmap_decompress_16"]=(a0,a1,a2,a3,a4,a5,a6)=>(_bitmap_decompress_16=Module["_bitmap_decompress_16"]=wasmExports["g"])(a0,a1,a2,a3,a4,a5,a6);var _bitmap_decompress_24=Module["_bitmap_decompress_24"]=(a0,a1,a2,a3,a4,a5,a6)=>(_bitmap_decompress_24=Module["_bitmap_decompress_24"]=wasmExports["h"])(a0,a1,a2,a3,a4,a5,a6);var _bitmap_decompress_32=Module["_bitmap_decompress_32"]=(a0,a1,a2,a3,a4,a5,a6)=>(_bitmap_decompress_32=Module["_bitmap_decompress_32"]=wasmExports["i"])(a0,a1,a2,a3,a4,a5,a6);var __emscripten_stack_restore=a0=>(__emscripten_stack_restore=wasmExports["k"])(a0);var __emscripten_stack_alloc=a0=>(__emscripten_stack_alloc=wasmExports["l"])(a0);var _emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports["m"])();Module["ccall"]=ccall;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();
|
package/client/entry/rle.wasm
DELETED
|
Binary file
|