@vunk/form 2.18.1 → 2.19.0
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/components/_plugin-vue_export-helper.cjs +1 -11
- package/components/api-tables-select/index.cjs +1 -467
- package/components/api-tables-select/index.mjs +56 -413
- package/components/api-tables-select/src/ctx.d.ts +152 -172
- package/components/api-tables-select/src/index.vue.d.ts +394 -983
- package/components/button/index.cjs +1 -112
- package/components/button/index.mjs +57 -85
- package/components/button/src/ctx.d.ts +28 -113
- package/components/button/src/index.vue.d.ts +317 -625
- package/components/card-input-collection/index.cjs +1 -352
- package/components/card-input-collection/index.mjs +177 -261
- package/components/card-input-collection/src/core.vue.d.ts +54 -950
- package/components/card-input-collection/src/ctx.d.ts +19 -49
- package/components/card-input-collection/src/index.vue.d.ts +46 -110
- package/components/cascader/index.cjs +1 -150
- package/components/cascader/index.mjs +88 -116
- package/components/cascader/src/ctx.d.ts +140 -207
- package/components/cascader/src/index.vue.d.ts +315 -522
- package/components/cascader/src/use.d.ts +1 -1
- package/components/checkbox/index.cjs +1 -152
- package/components/checkbox/index.mjs +75 -119
- package/components/checkbox/src/ctx.d.ts +46 -69
- package/components/checkbox/src/index.vue.d.ts +448 -1016
- package/components/cloneDeep.cjs +1 -2106
- package/components/color-picker/index.cjs +1 -80
- package/components/color-picker/index.mjs +46 -69
- package/components/color-picker/src/ctx.d.ts +130 -107
- package/components/color-picker/src/index.vue.d.ts +285 -255
- package/components/date-picker/index.cjs +1 -119
- package/components/date-picker/index.mjs +63 -97
- package/components/date-picker/src/ctx.d.ts +123 -206
- package/components/date-picker/src/index.vue.d.ts +269 -1358
- package/components/date-picker/src/types.d.ts +7 -7
- package/components/date-picker-range/index.cjs +1 -177
- package/components/date-picker-range/index.mjs +62 -113
- package/components/date-picker-range/src/ctx.d.ts +130 -206
- package/components/date-picker-range/src/index.vue.d.ts +861 -448
- package/components/debounce.cjs +1 -0
- package/components/dialog/index.cjs +1 -126
- package/components/dialog/index.mjs +65 -99
- package/components/dialog/src/ctx.d.ts +17 -108
- package/components/dialog/src/index.vue.d.ts +77 -1072
- package/components/dialog-input-collection/index.cjs +1 -624
- package/components/dialog-input-collection/index.mjs +276 -498
- package/components/dialog-input-collection/src/ctx.d.ts +21 -52
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +29 -6371
- package/components/dialog-input-collection/src/index.vue.d.ts +65 -7630
- package/components/dialog-input-collection/src/layout.vue.d.ts +13 -73
- package/components/download-plus/index.cjs +1 -456
- package/components/download-plus/index.mjs +215 -358
- package/components/download-plus/src/api.d.ts +1 -1
- package/components/download-plus/src/ctx.d.ts +21 -52
- package/components/download-plus/src/index.vue.d.ts +437 -1177
- package/components/editable-text/index.cjs +1 -295
- package/components/editable-text/index.mjs +113 -239
- package/components/editable-text/src/ctx.d.ts +24 -50
- package/components/editable-text/src/index.vue.d.ts +59 -3258
- package/components/el-slider/index.cjs +1 -0
- package/components/el-slider/index.d.ts +5 -0
- package/components/el-slider/index.mjs +475 -0
- package/components/el-slider/src/button.d.ts +36 -0
- package/components/el-slider/src/button.vue.d.ts +41 -0
- package/components/el-slider/src/composables/index.cjs +1 -0
- package/components/el-slider/src/composables/index.d.ts +6 -0
- package/components/el-slider/src/composables/index.mjs +9 -0
- package/components/el-slider/src/composables/use-lifecycle.d.ts +4 -0
- package/components/el-slider/src/composables/use-marks.d.ts +7 -0
- package/components/el-slider/src/composables/use-slide.d.ts +23 -0
- package/components/el-slider/src/composables/use-slider-button.d.ts +18 -0
- package/components/el-slider/src/composables/use-stops.d.ts +8 -0
- package/components/el-slider/src/composables/use-watch.d.ts +4 -0
- package/components/el-slider/src/constants.d.ts +14 -0
- package/components/el-slider/src/marker.d.ts +37 -0
- package/components/el-slider/src/slider-core.vue.d.ts +218 -0
- package/components/el-slider/src/slider.d.ts +174 -0
- package/components/esri-input-geojson/index.cjs +2 -1604
- package/components/esri-input-geojson/index.mjs +682 -1290
- package/components/esri-input-geojson/src/append.vue.d.ts +239 -1099
- package/components/esri-input-geojson/src/const.d.ts +1 -1
- package/components/esri-input-geojson/src/ctx.d.ts +66 -161
- package/components/esri-input-geojson/src/default-view.vue.d.ts +8 -132
- package/components/esri-input-geojson/src/index.vue.d.ts +982 -708
- package/components/esri-input-geojson/src/types.d.ts +1 -0
- package/components/esri-input-geojson/src/viewer.vue.d.ts +53 -282
- package/components/fieldset/index.cjs +1 -110
- package/components/fieldset/index.mjs +63 -76
- package/components/fieldset/src/ctx.d.ts +4 -4
- package/components/fieldset/src/index.vue.d.ts +7 -7
- package/components/form/index.cjs +1 -248
- package/components/form/index.mjs +107 -161
- package/components/form/src/ctx.d.ts +15 -64
- package/components/form/src/index.vue.d.ts +374 -2431
- package/components/form-item/index.cjs +1 -294
- package/components/form-item/index.mjs +140 -229
- package/components/form-item/src/core.vue.d.ts +32 -1854
- package/components/form-item/src/ctx.d.ts +19 -51
- package/components/form-item/src/index.vue.d.ts +38 -101
- package/components/form-item-renderer/index.cjs +1 -193
- package/components/form-item-renderer/index.mjs +103 -162
- package/components/form-item-renderer/src/core.vue.d.ts +9 -9
- package/components/form-item-renderer/src/ctx.d.ts +3 -3
- package/components/form-item-renderer/src/index.vue.d.ts +24 -74
- package/components/form-item-renderer-template/index.cjs +1 -47
- package/components/form-item-renderer-template/index.mjs +20 -33
- package/components/form-item-renderer-template/src/index.vue.d.ts +1 -1
- package/components/forms-provider/index.cjs +1 -99
- package/components/forms-provider/index.mjs +44 -73
- package/components/forms-provider/src/core.d.ts +3 -2
- package/components/forms-provider/src/segment.vue.d.ts +8 -8
- package/components/forms-provider/src/view.vue.d.ts +14 -4
- package/components/index.cjs +1 -399
- package/components/index2.cjs +1 -17
- package/components/information/index.cjs +1 -65
- package/components/information/index.mjs +28 -38
- package/components/information/src/ctx.d.ts +2 -2
- package/components/information/src/index.vue.d.ts +4 -4
- package/components/information-collection/index.cjs +1 -81
- package/components/information-collection/index.mjs +44 -48
- package/components/information-collection/src/ctx.d.ts +29 -65
- package/components/information-collection/src/index.vue.d.ts +64 -136
- package/components/information-renderer/index.cjs +1 -16
- package/components/information-renderer/index.d.ts +9 -9
- package/components/information-renderer/index.mjs +9 -10
- package/components/information-tag/index.cjs +1 -101
- package/components/information-tag/index.mjs +44 -54
- package/components/information-tag/src/ctx.d.ts +6 -21
- package/components/information-tag/src/index.vue.d.ts +23 -51
- package/components/information-templates-default/index.cjs +1 -101
- package/components/information-templates-default/index.mjs +63 -73
- package/components/information-templates-default/src/index.vue.d.ts +1 -1
- package/components/input/index.cjs +1 -115
- package/components/input/index.mjs +60 -83
- package/components/input/src/ctx.d.ts +51 -152
- package/components/input/src/index.vue.d.ts +392 -951
- package/components/input-array/index.cjs +1 -297
- package/components/input-array/index.mjs +115 -232
- package/components/input-array/src/ctx.d.ts +19 -49
- package/components/input-array/src/form-template.vue.d.ts +1 -900
- package/components/input-array/src/index.vue.d.ts +43 -729
- package/components/input-collection/index.cjs +1 -444
- package/components/input-collection/index.mjs +195 -347
- package/components/input-collection/src/core.vue.d.ts +64 -1026
- package/components/input-collection/src/ctx.d.ts +21 -51
- package/components/input-collection/src/index.vue.d.ts +50 -114
- package/components/input-file/index.cjs +1 -142
- package/components/input-file/index.mjs +68 -100
- package/components/input-file/src/ctx.d.ts +8 -29
- package/components/input-file/src/index.vue.d.ts +444 -74
- package/components/input-file/src/template.vue.d.ts +1 -124
- package/components/input-link/index.cjs +1 -167
- package/components/input-link/index.mjs +60 -83
- package/components/input-link/src/ctx.d.ts +52 -137
- package/components/input-link/src/index.vue.d.ts +833 -311
- package/components/input-number/index.cjs +1 -119
- package/components/input-number/index.mjs +73 -87
- package/components/input-number/src/ctx.d.ts +38 -131
- package/components/input-number/src/index.vue.d.ts +321 -683
- package/components/input-tag/index.cjs +1 -100
- package/components/input-tag/index.mjs +51 -78
- package/components/input-tag/src/ctx.d.ts +43 -145
- package/components/input-tag/src/index.vue.d.ts +324 -778
- package/components/isObject.cjs +1 -165
- package/components/monaco-editor/index.cjs +1 -83
- package/components/monaco-editor/index.mjs +40 -59
- package/components/monaco-editor/src/ctx.d.ts +19 -44
- package/components/monaco-editor/src/index.vue.d.ts +209 -109
- package/components/radio/index.cjs +1 -267
- package/components/radio/index.mjs +110 -209
- package/components/radio/src/ctx.d.ts +27 -91
- package/components/radio/src/index.vue.d.ts +298 -1279
- package/components/radio/src/option.vue.d.ts +29 -881
- package/components/radio/src/wraper.vue.d.ts +64 -196
- package/components/renderer-data/index.cjs +1 -41
- package/components/renderer-data/index.mjs +19 -26
- package/components/renderer-data/src/ctx.d.ts +1 -1
- package/components/renderer-data/src/index.vue.d.ts +2 -2
- package/components/select/index.cjs +1 -311
- package/components/select/index.mjs +156 -214
- package/components/select/src/core.vue.d.ts +638 -1080
- package/components/select/src/ctx.d.ts +140 -223
- package/components/select/src/index.vue.d.ts +334 -610
- package/components/select/src/options.vue.d.ts +1 -1
- package/components/slider/index.cjs +1 -88
- package/components/slider/index.mjs +41 -70
- package/components/slider/src/ctx.d.ts +63 -174
- package/components/slider/src/index.vue.d.ts +151 -420
- package/components/style.css +1 -0
- package/components/switch/index.cjs +1 -88
- package/components/switch/index.mjs +37 -69
- package/components/switch/src/ctx.d.ts +34 -113
- package/components/switch/src/index.vue.d.ts +88 -699
- package/components/switch/src/types.d.ts +2 -2
- package/components/tables-select/index.cjs +1 -263
- package/components/tables-select/index.mjs +102 -172
- package/components/tables-select/src/ctx.d.ts +76 -91
- package/components/tables-select/src/index.vue.d.ts +228 -4969
- package/components/template-instances-provider/index.cjs +1 -31
- package/components/template-instances-provider/index.mjs +18 -22
- package/components/template-instances-provider/src/index.vue.d.ts +2 -2
- package/components/templates-default/index.cjs +1 -235
- package/components/templates-default/index.mjs +152 -211
- package/components/templates-default/src/ctx.d.ts +5 -3
- package/components/templates-default/src/index.vue.d.ts +7298 -157
- package/components/templates-element-plus/index.cjs +1 -112
- package/components/templates-element-plus/index.mjs +49 -91
- package/components/templates-element-plus/src/ctx.d.ts +1 -1
- package/components/templates-element-plus/src/index.vue.d.ts +65 -258
- package/components/templates-esri/index.cjs +1 -65
- package/components/templates-esri/index.mjs +29 -39
- package/components/templates-esri/src/ctx.d.ts +1 -1
- package/components/templates-esri/src/index.vue.d.ts +1776 -24
- package/components/templates-layout/index.cjs +1 -137
- package/components/templates-layout/index.mjs +78 -116
- package/components/templates-layout/src/ctx.d.ts +1 -1
- package/components/templates-layout/src/index.vue.d.ts +79 -411
- package/components/templates-variant/index.cjs +1 -70
- package/components/templates-variant/index.mjs +33 -43
- package/components/templates-variant/src/ctx.d.ts +1 -1
- package/components/templates-variant/src/index.vue.d.ts +1238 -24
- package/components/time-picker/index.cjs +1 -104
- package/components/time-picker/index.mjs +57 -87
- package/components/time-picker/src/ctx.d.ts +121 -211
- package/components/time-picker/src/index.vue.d.ts +263 -1368
- package/components/upload/index.cjs +1 -663
- package/components/upload/index.mjs +343 -537
- package/components/upload/src/ctx.d.ts +108 -195
- package/components/upload/src/file.vue.d.ts +197 -776
- package/components/upload/src/index.vue.d.ts +689 -1931
- package/components/upload/src/types.d.ts +1 -1
- package/components/upload/src/wraper.vue.d.ts +232 -407
- package/components/upload-plus/index.cjs +21 -18673
- package/components/upload-plus/index.mjs +4598 -18372
- package/components/upload-plus/src/api.d.ts +2 -2
- package/components/upload-plus/src/ctx.d.ts +24 -51
- package/components/upload-plus/src/index.vue.d.ts +51 -1656
- package/components/use-watch.cjs +1 -0
- package/components/van-cascader/index.cjs +1 -125
- package/components/van-cascader/index.mjs +51 -96
- package/components/van-cascader/src/ctx.d.ts +135 -203
- package/components/van-cascader/src/index.vue.d.ts +312 -985
- package/components/var-datetime-picker/index.cjs +1 -333
- package/components/var-datetime-picker/index.mjs +175 -254
- package/components/var-datetime-picker/src/ctx.d.ts +19 -50
- package/components/var-datetime-picker/src/index.vue.d.ts +688 -1115
- package/components/vditor/index.cjs +1 -86
- package/components/vditor/index.mjs +40 -66
- package/components/vditor/src/ctx.d.ts +16 -45
- package/components/vditor/src/index.vue.d.ts +195 -120
- package/composables/element-plus/index.cjs +1 -23
- package/composables/element-plus/index.mjs +14 -18
- package/composables/index.cjs +1 -161
- package/composables/index.d.ts +1 -0
- package/composables/index.mjs +102 -135
- package/composables/useForm.d.ts +2 -2
- package/composables/useRtl.d.ts +18 -0
- package/composables/useSourceManager.d.ts +2 -2
- package/composables/useTemplateInstances.d.ts +3 -3
- package/index.css +1 -562
- package/index.d.ts +0 -3
- package/index.esm.js +23 -48
- package/locale/index.cjs +1 -110
- package/locale/index.mjs +37 -45
- package/locale/lang/en.d.ts +2 -6
- package/locale/lang/index.cjs +1 -2
- package/locale/lang/index.d.ts +1 -0
- package/locale/lang/zh-cn.d.ts +2 -6
- package/package.json +14 -85
- package/shared/const/index.cjs +1 -59
- package/shared/const/index.d.ts +1 -1
- package/shared/const/index.mjs +18 -20
- package/shared/element-plus/ctx.d.ts +40 -37
- package/shared/element-plus/index.cjs +1 -211
- package/shared/element-plus/index.mjs +93 -161
- package/shared/element-plus/instances.d.ts +207 -321
- package/shared/form/index.cjs +1 -33
- package/shared/form/index.mjs +23 -25
- package/shared/helper/index.cjs +1 -11
- package/shared/helper/index.mjs +7 -8
- package/shared/index.cjs +1 -8
- package/shared/index.mjs +5 -1
- package/shared/infer-prop/index.cjs +1 -36
- package/shared/infer-prop/index.mjs +22 -28
- package/shared/progress-it/index.cjs +1 -42
- package/shared/progress-it/index.mjs +15 -31
- package/shared/rules/index.cjs +1 -56
- package/shared/rules/index.mjs +19 -18
- package/shared/types/form/index.cjs +1 -2
- package/shared/types/index.cjs +1 -2
- package/shared/types/source/index.cjs +1 -2
- package/shared/types/source-manager/index.cjs +1 -2
- package/shared/upload/index.cjs +1 -774
- package/shared/upload/index.mjs +180 -764
- package/component.d.ts +0 -3
- package/components/_plugin-vue_export-helper.mjs +0 -9
- package/components/card-input-collection/index.css +0 -21
- package/components/cascader/index.css +0 -9
- package/components/checkbox/index.css +0 -30
- package/components/cloneDeep.mjs +0 -2104
- package/components/date-picker-range/index.css +0 -18
- package/components/dialog-input-collection/index.css +0 -21
- package/components/download-plus/index.css +0 -68
- package/components/editable-text/index.css +0 -9
- package/components/esri-input-geojson/index.css +0 -32
- package/components/fieldset/index.css +0 -5
- package/components/form-item/index.css +0 -35
- package/components/index.mjs +0 -378
- package/components/index2.mjs +0 -14
- package/components/information-tag/index.css +0 -6
- package/components/information-templates-default/index.css +0 -16
- package/components/input-array/index.css +0 -14
- package/components/input-collection/index.css +0 -20
- package/components/input-link/index.css +0 -4
- package/components/input-number/index.css +0 -13
- package/components/isObject.mjs +0 -158
- package/components/monaco-editor/index.css +0 -4
- package/components/radio/index.css +0 -40
- package/components/select/index.css +0 -15
- package/components/switch/index.css +0 -10
- package/components/tables-select/index.css +0 -3
- package/components/templates-layout/index.css +0 -3
- package/components/upload/index.css +0 -34
- package/components/upload-plus/index.css +0 -84
- package/components/van-cascader/index.css +0 -6
- package/components/var-datetime-picker/index.css +0 -17
- package/defaults.d.ts +0 -5
package/shared/upload/index.mjs
CHANGED
|
@@ -1,771 +1,187 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function I(u) {
|
|
2
|
+
return u && u.__esModule && Object.prototype.hasOwnProperty.call(u, "default") ? u.default : u;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
c = (c << 15 | c >>> 17) + d | 0;
|
|
165
|
-
b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
|
|
166
|
-
b = (b << 21 | b >>> 11) + c | 0;
|
|
167
|
-
|
|
168
|
-
x[0] = a + x[0] | 0;
|
|
169
|
-
x[1] = b + x[1] | 0;
|
|
170
|
-
x[2] = c + x[2] | 0;
|
|
171
|
-
x[3] = d + x[3] | 0;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function md5blk(s) {
|
|
175
|
-
var md5blks = [],
|
|
176
|
-
i; /* Andy King said do it this way. */
|
|
177
|
-
|
|
178
|
-
for (i = 0; i < 64; i += 4) {
|
|
179
|
-
md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
|
|
180
|
-
}
|
|
181
|
-
return md5blks;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function md5blk_array(a) {
|
|
185
|
-
var md5blks = [],
|
|
186
|
-
i; /* Andy King said do it this way. */
|
|
187
|
-
|
|
188
|
-
for (i = 0; i < 64; i += 4) {
|
|
189
|
-
md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
|
|
190
|
-
}
|
|
191
|
-
return md5blks;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function md51(s) {
|
|
195
|
-
var n = s.length,
|
|
196
|
-
state = [1732584193, -271733879, -1732584194, 271733878],
|
|
197
|
-
i,
|
|
198
|
-
length,
|
|
199
|
-
tail,
|
|
200
|
-
tmp,
|
|
201
|
-
lo,
|
|
202
|
-
hi;
|
|
203
|
-
|
|
204
|
-
for (i = 64; i <= n; i += 64) {
|
|
205
|
-
md5cycle(state, md5blk(s.substring(i - 64, i)));
|
|
206
|
-
}
|
|
207
|
-
s = s.substring(i - 64);
|
|
208
|
-
length = s.length;
|
|
209
|
-
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
210
|
-
for (i = 0; i < length; i += 1) {
|
|
211
|
-
tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
|
|
212
|
-
}
|
|
213
|
-
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
|
|
214
|
-
if (i > 55) {
|
|
215
|
-
md5cycle(state, tail);
|
|
216
|
-
for (i = 0; i < 16; i += 1) {
|
|
217
|
-
tail[i] = 0;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// Beware that the final length might not fit in 32 bits so we take care of that
|
|
222
|
-
tmp = n * 8;
|
|
223
|
-
tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
|
|
224
|
-
lo = parseInt(tmp[2], 16);
|
|
225
|
-
hi = parseInt(tmp[1], 16) || 0;
|
|
226
|
-
|
|
227
|
-
tail[14] = lo;
|
|
228
|
-
tail[15] = hi;
|
|
229
|
-
|
|
230
|
-
md5cycle(state, tail);
|
|
231
|
-
return state;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function md51_array(a) {
|
|
235
|
-
var n = a.length,
|
|
236
|
-
state = [1732584193, -271733879, -1732584194, 271733878],
|
|
237
|
-
i,
|
|
238
|
-
length,
|
|
239
|
-
tail,
|
|
240
|
-
tmp,
|
|
241
|
-
lo,
|
|
242
|
-
hi;
|
|
243
|
-
|
|
244
|
-
for (i = 64; i <= n; i += 64) {
|
|
245
|
-
md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Not sure if it is a bug, however IE10 will always produce a sub array of length 1
|
|
249
|
-
// containing the last element of the parent array if the sub array specified starts
|
|
250
|
-
// beyond the length of the parent array - weird.
|
|
251
|
-
// https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue
|
|
252
|
-
a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);
|
|
253
|
-
|
|
254
|
-
length = a.length;
|
|
255
|
-
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
256
|
-
for (i = 0; i < length; i += 1) {
|
|
257
|
-
tail[i >> 2] |= a[i] << ((i % 4) << 3);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
|
|
261
|
-
if (i > 55) {
|
|
262
|
-
md5cycle(state, tail);
|
|
263
|
-
for (i = 0; i < 16; i += 1) {
|
|
264
|
-
tail[i] = 0;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Beware that the final length might not fit in 32 bits so we take care of that
|
|
269
|
-
tmp = n * 8;
|
|
270
|
-
tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
|
|
271
|
-
lo = parseInt(tmp[2], 16);
|
|
272
|
-
hi = parseInt(tmp[1], 16) || 0;
|
|
273
|
-
|
|
274
|
-
tail[14] = lo;
|
|
275
|
-
tail[15] = hi;
|
|
276
|
-
|
|
277
|
-
md5cycle(state, tail);
|
|
278
|
-
|
|
279
|
-
return state;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
function rhex(n) {
|
|
283
|
-
var s = '',
|
|
284
|
-
j;
|
|
285
|
-
for (j = 0; j < 4; j += 1) {
|
|
286
|
-
s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];
|
|
287
|
-
}
|
|
288
|
-
return s;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function hex(x) {
|
|
292
|
-
var i;
|
|
293
|
-
for (i = 0; i < x.length; i += 1) {
|
|
294
|
-
x[i] = rhex(x[i]);
|
|
295
|
-
}
|
|
296
|
-
return x.join('');
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// In some cases the fast add32 function cannot be used..
|
|
300
|
-
if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') ;
|
|
301
|
-
|
|
302
|
-
// ---------------------------------------------------
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* ArrayBuffer slice polyfill.
|
|
306
|
-
*
|
|
307
|
-
* @see https://github.com/ttaubert/node-arraybuffer-slice
|
|
308
|
-
*/
|
|
309
|
-
|
|
310
|
-
if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {
|
|
311
|
-
(function () {
|
|
312
|
-
function clamp(val, length) {
|
|
313
|
-
val = (val | 0) || 0;
|
|
314
|
-
|
|
315
|
-
if (val < 0) {
|
|
316
|
-
return Math.max(val + length, 0);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return Math.min(val, length);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
ArrayBuffer.prototype.slice = function (from, to) {
|
|
323
|
-
var length = this.byteLength,
|
|
324
|
-
begin = clamp(from, length),
|
|
325
|
-
end = length,
|
|
326
|
-
num,
|
|
327
|
-
target,
|
|
328
|
-
targetArray,
|
|
329
|
-
sourceArray;
|
|
330
|
-
|
|
331
|
-
if (to !== undefined$1) {
|
|
332
|
-
end = clamp(to, length);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (begin > end) {
|
|
336
|
-
return new ArrayBuffer(0);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
num = end - begin;
|
|
340
|
-
target = new ArrayBuffer(num);
|
|
341
|
-
targetArray = new Uint8Array(target);
|
|
342
|
-
|
|
343
|
-
sourceArray = new Uint8Array(this, begin, num);
|
|
344
|
-
targetArray.set(sourceArray);
|
|
345
|
-
|
|
346
|
-
return target;
|
|
347
|
-
};
|
|
348
|
-
})();
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// ---------------------------------------------------
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Helpers.
|
|
355
|
-
*/
|
|
356
|
-
|
|
357
|
-
function toUtf8(str) {
|
|
358
|
-
if (/[\u0080-\uFFFF]/.test(str)) {
|
|
359
|
-
str = unescape(encodeURIComponent(str));
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
return str;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function utf8Str2ArrayBuffer(str, returnUInt8Array) {
|
|
366
|
-
var length = str.length,
|
|
367
|
-
buff = new ArrayBuffer(length),
|
|
368
|
-
arr = new Uint8Array(buff),
|
|
369
|
-
i;
|
|
370
|
-
|
|
371
|
-
for (i = 0; i < length; i += 1) {
|
|
372
|
-
arr[i] = str.charCodeAt(i);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
return returnUInt8Array ? arr : buff;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
function arrayBuffer2Utf8Str(buff) {
|
|
379
|
-
return String.fromCharCode.apply(null, new Uint8Array(buff));
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function concatenateArrayBuffers(first, second, returnUInt8Array) {
|
|
383
|
-
var result = new Uint8Array(first.byteLength + second.byteLength);
|
|
384
|
-
|
|
385
|
-
result.set(new Uint8Array(first));
|
|
386
|
-
result.set(new Uint8Array(second), first.byteLength);
|
|
387
|
-
|
|
388
|
-
return result ;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
function hexToBinaryString(hex) {
|
|
392
|
-
var bytes = [],
|
|
393
|
-
length = hex.length,
|
|
394
|
-
x;
|
|
395
|
-
|
|
396
|
-
for (x = 0; x < length - 1; x += 2) {
|
|
397
|
-
bytes.push(parseInt(hex.substr(x, 2), 16));
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
return String.fromCharCode.apply(String, bytes);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// ---------------------------------------------------
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* SparkMD5 OOP implementation.
|
|
407
|
-
*
|
|
408
|
-
* Use this class to perform an incremental md5, otherwise use the
|
|
409
|
-
* static methods instead.
|
|
410
|
-
*/
|
|
411
|
-
|
|
412
|
-
function SparkMD5() {
|
|
413
|
-
// call reset to init the instance
|
|
414
|
-
this.reset();
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Appends a string.
|
|
419
|
-
* A conversion will be applied if an utf8 string is detected.
|
|
420
|
-
*
|
|
421
|
-
* @param {String} str The string to be appended
|
|
422
|
-
*
|
|
423
|
-
* @return {SparkMD5} The instance itself
|
|
424
|
-
*/
|
|
425
|
-
SparkMD5.prototype.append = function (str) {
|
|
426
|
-
// Converts the string to utf8 bytes if necessary
|
|
427
|
-
// Then append as binary
|
|
428
|
-
this.appendBinary(toUtf8(str));
|
|
429
|
-
|
|
430
|
-
return this;
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Appends a binary string.
|
|
435
|
-
*
|
|
436
|
-
* @param {String} contents The binary string to be appended
|
|
437
|
-
*
|
|
438
|
-
* @return {SparkMD5} The instance itself
|
|
439
|
-
*/
|
|
440
|
-
SparkMD5.prototype.appendBinary = function (contents) {
|
|
441
|
-
this._buff += contents;
|
|
442
|
-
this._length += contents.length;
|
|
443
|
-
|
|
444
|
-
var length = this._buff.length,
|
|
445
|
-
i;
|
|
446
|
-
|
|
447
|
-
for (i = 64; i <= length; i += 64) {
|
|
448
|
-
md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
this._buff = this._buff.substring(i - 64);
|
|
452
|
-
|
|
453
|
-
return this;
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Finishes the incremental computation, reseting the internal state and
|
|
458
|
-
* returning the result.
|
|
459
|
-
*
|
|
460
|
-
* @param {Boolean} raw True to get the raw string, false to get the hex string
|
|
461
|
-
*
|
|
462
|
-
* @return {String} The result
|
|
463
|
-
*/
|
|
464
|
-
SparkMD5.prototype.end = function (raw) {
|
|
465
|
-
var buff = this._buff,
|
|
466
|
-
length = buff.length,
|
|
467
|
-
i,
|
|
468
|
-
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
469
|
-
ret;
|
|
470
|
-
|
|
471
|
-
for (i = 0; i < length; i += 1) {
|
|
472
|
-
tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
this._finish(tail, length);
|
|
476
|
-
ret = hex(this._hash);
|
|
477
|
-
|
|
478
|
-
if (raw) {
|
|
479
|
-
ret = hexToBinaryString(ret);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
this.reset();
|
|
483
|
-
|
|
484
|
-
return ret;
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* Resets the internal state of the computation.
|
|
489
|
-
*
|
|
490
|
-
* @return {SparkMD5} The instance itself
|
|
491
|
-
*/
|
|
492
|
-
SparkMD5.prototype.reset = function () {
|
|
493
|
-
this._buff = '';
|
|
494
|
-
this._length = 0;
|
|
495
|
-
this._hash = [1732584193, -271733879, -1732584194, 271733878];
|
|
496
|
-
|
|
497
|
-
return this;
|
|
498
|
-
};
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Gets the internal state of the computation.
|
|
502
|
-
*
|
|
503
|
-
* @return {Object} The state
|
|
504
|
-
*/
|
|
505
|
-
SparkMD5.prototype.getState = function () {
|
|
506
|
-
return {
|
|
507
|
-
buff: this._buff,
|
|
508
|
-
length: this._length,
|
|
509
|
-
hash: this._hash.slice()
|
|
510
|
-
};
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Gets the internal state of the computation.
|
|
515
|
-
*
|
|
516
|
-
* @param {Object} state The state
|
|
517
|
-
*
|
|
518
|
-
* @return {SparkMD5} The instance itself
|
|
519
|
-
*/
|
|
520
|
-
SparkMD5.prototype.setState = function (state) {
|
|
521
|
-
this._buff = state.buff;
|
|
522
|
-
this._length = state.length;
|
|
523
|
-
this._hash = state.hash;
|
|
524
|
-
|
|
525
|
-
return this;
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Releases memory used by the incremental buffer and other additional
|
|
530
|
-
* resources. If you plan to use the instance again, use reset instead.
|
|
531
|
-
*/
|
|
532
|
-
SparkMD5.prototype.destroy = function () {
|
|
533
|
-
delete this._hash;
|
|
534
|
-
delete this._buff;
|
|
535
|
-
delete this._length;
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Finish the final calculation based on the tail.
|
|
540
|
-
*
|
|
541
|
-
* @param {Array} tail The tail (will be modified)
|
|
542
|
-
* @param {Number} length The length of the remaining buffer
|
|
543
|
-
*/
|
|
544
|
-
SparkMD5.prototype._finish = function (tail, length) {
|
|
545
|
-
var i = length,
|
|
546
|
-
tmp,
|
|
547
|
-
lo,
|
|
548
|
-
hi;
|
|
549
|
-
|
|
550
|
-
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
|
|
551
|
-
if (i > 55) {
|
|
552
|
-
md5cycle(this._hash, tail);
|
|
553
|
-
for (i = 0; i < 16; i += 1) {
|
|
554
|
-
tail[i] = 0;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
// Do the final computation based on the tail and length
|
|
559
|
-
// Beware that the final length may not fit in 32 bits so we take care of that
|
|
560
|
-
tmp = this._length * 8;
|
|
561
|
-
tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
|
|
562
|
-
lo = parseInt(tmp[2], 16);
|
|
563
|
-
hi = parseInt(tmp[1], 16) || 0;
|
|
564
|
-
|
|
565
|
-
tail[14] = lo;
|
|
566
|
-
tail[15] = hi;
|
|
567
|
-
md5cycle(this._hash, tail);
|
|
568
|
-
};
|
|
569
|
-
|
|
570
|
-
/**
|
|
571
|
-
* Performs the md5 hash on a string.
|
|
572
|
-
* A conversion will be applied if utf8 string is detected.
|
|
573
|
-
*
|
|
574
|
-
* @param {String} str The string
|
|
575
|
-
* @param {Boolean} [raw] True to get the raw string, false to get the hex string
|
|
576
|
-
*
|
|
577
|
-
* @return {String} The result
|
|
578
|
-
*/
|
|
579
|
-
SparkMD5.hash = function (str, raw) {
|
|
580
|
-
// Converts the string to utf8 bytes if necessary
|
|
581
|
-
// Then compute it using the binary function
|
|
582
|
-
return SparkMD5.hashBinary(toUtf8(str), raw);
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Performs the md5 hash on a binary string.
|
|
587
|
-
*
|
|
588
|
-
* @param {String} content The binary string
|
|
589
|
-
* @param {Boolean} [raw] True to get the raw string, false to get the hex string
|
|
590
|
-
*
|
|
591
|
-
* @return {String} The result
|
|
592
|
-
*/
|
|
593
|
-
SparkMD5.hashBinary = function (content, raw) {
|
|
594
|
-
var hash = md51(content),
|
|
595
|
-
ret = hex(hash);
|
|
596
|
-
|
|
597
|
-
return raw ? hexToBinaryString(ret) : ret;
|
|
598
|
-
};
|
|
599
|
-
|
|
600
|
-
// ---------------------------------------------------
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* SparkMD5 OOP implementation for array buffers.
|
|
604
|
-
*
|
|
605
|
-
* Use this class to perform an incremental md5 ONLY for array buffers.
|
|
606
|
-
*/
|
|
607
|
-
SparkMD5.ArrayBuffer = function () {
|
|
608
|
-
// call reset to init the instance
|
|
609
|
-
this.reset();
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Appends an array buffer.
|
|
614
|
-
*
|
|
615
|
-
* @param {ArrayBuffer} arr The array to be appended
|
|
616
|
-
*
|
|
617
|
-
* @return {SparkMD5.ArrayBuffer} The instance itself
|
|
618
|
-
*/
|
|
619
|
-
SparkMD5.ArrayBuffer.prototype.append = function (arr) {
|
|
620
|
-
var buff = concatenateArrayBuffers(this._buff.buffer, arr),
|
|
621
|
-
length = buff.length,
|
|
622
|
-
i;
|
|
623
|
-
|
|
624
|
-
this._length += arr.byteLength;
|
|
625
|
-
|
|
626
|
-
for (i = 64; i <= length; i += 64) {
|
|
627
|
-
md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);
|
|
631
|
-
|
|
632
|
-
return this;
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Finishes the incremental computation, reseting the internal state and
|
|
637
|
-
* returning the result.
|
|
638
|
-
*
|
|
639
|
-
* @param {Boolean} raw True to get the raw string, false to get the hex string
|
|
640
|
-
*
|
|
641
|
-
* @return {String} The result
|
|
642
|
-
*/
|
|
643
|
-
SparkMD5.ArrayBuffer.prototype.end = function (raw) {
|
|
644
|
-
var buff = this._buff,
|
|
645
|
-
length = buff.length,
|
|
646
|
-
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
647
|
-
i,
|
|
648
|
-
ret;
|
|
649
|
-
|
|
650
|
-
for (i = 0; i < length; i += 1) {
|
|
651
|
-
tail[i >> 2] |= buff[i] << ((i % 4) << 3);
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
this._finish(tail, length);
|
|
655
|
-
ret = hex(this._hash);
|
|
656
|
-
|
|
657
|
-
if (raw) {
|
|
658
|
-
ret = hexToBinaryString(ret);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
this.reset();
|
|
662
|
-
|
|
663
|
-
return ret;
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* Resets the internal state of the computation.
|
|
668
|
-
*
|
|
669
|
-
* @return {SparkMD5.ArrayBuffer} The instance itself
|
|
670
|
-
*/
|
|
671
|
-
SparkMD5.ArrayBuffer.prototype.reset = function () {
|
|
672
|
-
this._buff = new Uint8Array(0);
|
|
673
|
-
this._length = 0;
|
|
674
|
-
this._hash = [1732584193, -271733879, -1732584194, 271733878];
|
|
675
|
-
|
|
676
|
-
return this;
|
|
677
|
-
};
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Gets the internal state of the computation.
|
|
681
|
-
*
|
|
682
|
-
* @return {Object} The state
|
|
683
|
-
*/
|
|
684
|
-
SparkMD5.ArrayBuffer.prototype.getState = function () {
|
|
685
|
-
var state = SparkMD5.prototype.getState.call(this);
|
|
686
|
-
|
|
687
|
-
// Convert buffer to a string
|
|
688
|
-
state.buff = arrayBuffer2Utf8Str(state.buff);
|
|
689
|
-
|
|
690
|
-
return state;
|
|
691
|
-
};
|
|
692
|
-
|
|
693
|
-
/**
|
|
694
|
-
* Gets the internal state of the computation.
|
|
695
|
-
*
|
|
696
|
-
* @param {Object} state The state
|
|
697
|
-
*
|
|
698
|
-
* @return {SparkMD5.ArrayBuffer} The instance itself
|
|
699
|
-
*/
|
|
700
|
-
SparkMD5.ArrayBuffer.prototype.setState = function (state) {
|
|
701
|
-
// Convert string to buffer
|
|
702
|
-
state.buff = utf8Str2ArrayBuffer(state.buff, true);
|
|
703
|
-
|
|
704
|
-
return SparkMD5.prototype.setState.call(this, state);
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
|
|
708
|
-
|
|
709
|
-
SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
|
|
710
|
-
|
|
711
|
-
/**
|
|
712
|
-
* Performs the md5 hash on an array buffer.
|
|
713
|
-
*
|
|
714
|
-
* @param {ArrayBuffer} arr The array buffer
|
|
715
|
-
* @param {Boolean} [raw] True to get the raw string, false to get the hex one
|
|
716
|
-
*
|
|
717
|
-
* @return {String} The result
|
|
718
|
-
*/
|
|
719
|
-
SparkMD5.ArrayBuffer.hash = function (arr, raw) {
|
|
720
|
-
var hash = md51_array(new Uint8Array(arr)),
|
|
721
|
-
ret = hex(hash);
|
|
722
|
-
|
|
723
|
-
return raw ? hexToBinaryString(ret) : ret;
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
return SparkMD5;
|
|
727
|
-
}));
|
|
728
|
-
} (sparkMd5));
|
|
729
|
-
|
|
730
|
-
var sparkMd5Exports = sparkMd5.exports;
|
|
731
|
-
var SparkMD5 = /*@__PURE__*/getDefaultExportFromCjs(sparkMd5Exports);
|
|
732
|
-
|
|
733
|
-
function createFileChunk(file, size) {
|
|
734
|
-
const chunks = [];
|
|
735
|
-
let cur = 0;
|
|
736
|
-
const intSize = parseInt(size + "");
|
|
737
|
-
while (cur < file.size) {
|
|
738
|
-
chunks.push(file.slice(cur, cur + intSize));
|
|
739
|
-
cur += intSize;
|
|
740
|
-
}
|
|
741
|
-
return chunks;
|
|
4
|
+
var v = { exports: {} };
|
|
5
|
+
(function(u, B) {
|
|
6
|
+
(function(y) {
|
|
7
|
+
u.exports = y();
|
|
8
|
+
})(function(y) {
|
|
9
|
+
var p = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
10
|
+
function o(i, f) {
|
|
11
|
+
var r = i[0], t = i[1], n = i[2], e = i[3];
|
|
12
|
+
r += (t & n | ~t & e) + f[0] - 680876936 | 0, r = (r << 7 | r >>> 25) + t | 0, e += (r & t | ~r & n) + f[1] - 389564586 | 0, e = (e << 12 | e >>> 20) + r | 0, n += (e & r | ~e & t) + f[2] + 606105819 | 0, n = (n << 17 | n >>> 15) + e | 0, t += (n & e | ~n & r) + f[3] - 1044525330 | 0, t = (t << 22 | t >>> 10) + n | 0, r += (t & n | ~t & e) + f[4] - 176418897 | 0, r = (r << 7 | r >>> 25) + t | 0, e += (r & t | ~r & n) + f[5] + 1200080426 | 0, e = (e << 12 | e >>> 20) + r | 0, n += (e & r | ~e & t) + f[6] - 1473231341 | 0, n = (n << 17 | n >>> 15) + e | 0, t += (n & e | ~n & r) + f[7] - 45705983 | 0, t = (t << 22 | t >>> 10) + n | 0, r += (t & n | ~t & e) + f[8] + 1770035416 | 0, r = (r << 7 | r >>> 25) + t | 0, e += (r & t | ~r & n) + f[9] - 1958414417 | 0, e = (e << 12 | e >>> 20) + r | 0, n += (e & r | ~e & t) + f[10] - 42063 | 0, n = (n << 17 | n >>> 15) + e | 0, t += (n & e | ~n & r) + f[11] - 1990404162 | 0, t = (t << 22 | t >>> 10) + n | 0, r += (t & n | ~t & e) + f[12] + 1804603682 | 0, r = (r << 7 | r >>> 25) + t | 0, e += (r & t | ~r & n) + f[13] - 40341101 | 0, e = (e << 12 | e >>> 20) + r | 0, n += (e & r | ~e & t) + f[14] - 1502002290 | 0, n = (n << 17 | n >>> 15) + e | 0, t += (n & e | ~n & r) + f[15] + 1236535329 | 0, t = (t << 22 | t >>> 10) + n | 0, r += (t & e | n & ~e) + f[1] - 165796510 | 0, r = (r << 5 | r >>> 27) + t | 0, e += (r & n | t & ~n) + f[6] - 1069501632 | 0, e = (e << 9 | e >>> 23) + r | 0, n += (e & t | r & ~t) + f[11] + 643717713 | 0, n = (n << 14 | n >>> 18) + e | 0, t += (n & r | e & ~r) + f[0] - 373897302 | 0, t = (t << 20 | t >>> 12) + n | 0, r += (t & e | n & ~e) + f[5] - 701558691 | 0, r = (r << 5 | r >>> 27) + t | 0, e += (r & n | t & ~n) + f[10] + 38016083 | 0, e = (e << 9 | e >>> 23) + r | 0, n += (e & t | r & ~t) + f[15] - 660478335 | 0, n = (n << 14 | n >>> 18) + e | 0, t += (n & r | e & ~r) + f[4] - 405537848 | 0, t = (t << 20 | t >>> 12) + n | 0, r += (t & e | n & ~e) + f[9] + 568446438 | 0, r = (r << 5 | r >>> 27) + t | 0, e += (r & n | t & ~n) + f[14] - 1019803690 | 0, e = (e << 9 | e >>> 23) + r | 0, n += (e & t | r & ~t) + f[3] - 187363961 | 0, n = (n << 14 | n >>> 18) + e | 0, t += (n & r | e & ~r) + f[8] + 1163531501 | 0, t = (t << 20 | t >>> 12) + n | 0, r += (t & e | n & ~e) + f[13] - 1444681467 | 0, r = (r << 5 | r >>> 27) + t | 0, e += (r & n | t & ~n) + f[2] - 51403784 | 0, e = (e << 9 | e >>> 23) + r | 0, n += (e & t | r & ~t) + f[7] + 1735328473 | 0, n = (n << 14 | n >>> 18) + e | 0, t += (n & r | e & ~r) + f[12] - 1926607734 | 0, t = (t << 20 | t >>> 12) + n | 0, r += (t ^ n ^ e) + f[5] - 378558 | 0, r = (r << 4 | r >>> 28) + t | 0, e += (r ^ t ^ n) + f[8] - 2022574463 | 0, e = (e << 11 | e >>> 21) + r | 0, n += (e ^ r ^ t) + f[11] + 1839030562 | 0, n = (n << 16 | n >>> 16) + e | 0, t += (n ^ e ^ r) + f[14] - 35309556 | 0, t = (t << 23 | t >>> 9) + n | 0, r += (t ^ n ^ e) + f[1] - 1530992060 | 0, r = (r << 4 | r >>> 28) + t | 0, e += (r ^ t ^ n) + f[4] + 1272893353 | 0, e = (e << 11 | e >>> 21) + r | 0, n += (e ^ r ^ t) + f[7] - 155497632 | 0, n = (n << 16 | n >>> 16) + e | 0, t += (n ^ e ^ r) + f[10] - 1094730640 | 0, t = (t << 23 | t >>> 9) + n | 0, r += (t ^ n ^ e) + f[13] + 681279174 | 0, r = (r << 4 | r >>> 28) + t | 0, e += (r ^ t ^ n) + f[0] - 358537222 | 0, e = (e << 11 | e >>> 21) + r | 0, n += (e ^ r ^ t) + f[3] - 722521979 | 0, n = (n << 16 | n >>> 16) + e | 0, t += (n ^ e ^ r) + f[6] + 76029189 | 0, t = (t << 23 | t >>> 9) + n | 0, r += (t ^ n ^ e) + f[9] - 640364487 | 0, r = (r << 4 | r >>> 28) + t | 0, e += (r ^ t ^ n) + f[12] - 421815835 | 0, e = (e << 11 | e >>> 21) + r | 0, n += (e ^ r ^ t) + f[15] + 530742520 | 0, n = (n << 16 | n >>> 16) + e | 0, t += (n ^ e ^ r) + f[2] - 995338651 | 0, t = (t << 23 | t >>> 9) + n | 0, r += (n ^ (t | ~e)) + f[0] - 198630844 | 0, r = (r << 6 | r >>> 26) + t | 0, e += (t ^ (r | ~n)) + f[7] + 1126891415 | 0, e = (e << 10 | e >>> 22) + r | 0, n += (r ^ (e | ~t)) + f[14] - 1416354905 | 0, n = (n << 15 | n >>> 17) + e | 0, t += (e ^ (n | ~r)) + f[5] - 57434055 | 0, t = (t << 21 | t >>> 11) + n | 0, r += (n ^ (t | ~e)) + f[12] + 1700485571 | 0, r = (r << 6 | r >>> 26) + t | 0, e += (t ^ (r | ~n)) + f[3] - 1894986606 | 0, e = (e << 10 | e >>> 22) + r | 0, n += (r ^ (e | ~t)) + f[10] - 1051523 | 0, n = (n << 15 | n >>> 17) + e | 0, t += (e ^ (n | ~r)) + f[1] - 2054922799 | 0, t = (t << 21 | t >>> 11) + n | 0, r += (n ^ (t | ~e)) + f[8] + 1873313359 | 0, r = (r << 6 | r >>> 26) + t | 0, e += (t ^ (r | ~n)) + f[15] - 30611744 | 0, e = (e << 10 | e >>> 22) + r | 0, n += (r ^ (e | ~t)) + f[6] - 1560198380 | 0, n = (n << 15 | n >>> 17) + e | 0, t += (e ^ (n | ~r)) + f[13] + 1309151649 | 0, t = (t << 21 | t >>> 11) + n | 0, r += (n ^ (t | ~e)) + f[4] - 145523070 | 0, r = (r << 6 | r >>> 26) + t | 0, e += (t ^ (r | ~n)) + f[11] - 1120210379 | 0, e = (e << 10 | e >>> 22) + r | 0, n += (r ^ (e | ~t)) + f[2] + 718787259 | 0, n = (n << 15 | n >>> 17) + e | 0, t += (e ^ (n | ~r)) + f[9] - 343485551 | 0, t = (t << 21 | t >>> 11) + n | 0, i[0] = r + i[0] | 0, i[1] = t + i[1] | 0, i[2] = n + i[2] | 0, i[3] = e + i[3] | 0;
|
|
13
|
+
}
|
|
14
|
+
function c(i) {
|
|
15
|
+
var f = [], r;
|
|
16
|
+
for (r = 0; r < 64; r += 4)
|
|
17
|
+
f[r >> 2] = i.charCodeAt(r) + (i.charCodeAt(r + 1) << 8) + (i.charCodeAt(r + 2) << 16) + (i.charCodeAt(r + 3) << 24);
|
|
18
|
+
return f;
|
|
19
|
+
}
|
|
20
|
+
function g(i) {
|
|
21
|
+
var f = [], r;
|
|
22
|
+
for (r = 0; r < 64; r += 4)
|
|
23
|
+
f[r >> 2] = i[r] + (i[r + 1] << 8) + (i[r + 2] << 16) + (i[r + 3] << 24);
|
|
24
|
+
return f;
|
|
25
|
+
}
|
|
26
|
+
function a(i) {
|
|
27
|
+
var f = i.length, r = [1732584193, -271733879, -1732584194, 271733878], t, n, e, s, l, b;
|
|
28
|
+
for (t = 64; t <= f; t += 64)
|
|
29
|
+
o(r, c(i.substring(t - 64, t)));
|
|
30
|
+
for (i = i.substring(t - 64), n = i.length, e = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], t = 0; t < n; t += 1)
|
|
31
|
+
e[t >> 2] |= i.charCodeAt(t) << (t % 4 << 3);
|
|
32
|
+
if (e[t >> 2] |= 128 << (t % 4 << 3), t > 55)
|
|
33
|
+
for (o(r, e), t = 0; t < 16; t += 1)
|
|
34
|
+
e[t] = 0;
|
|
35
|
+
return s = f * 8, s = s.toString(16).match(/(.*?)(.{0,8})$/), l = parseInt(s[2], 16), b = parseInt(s[1], 16) || 0, e[14] = l, e[15] = b, o(r, e), r;
|
|
36
|
+
}
|
|
37
|
+
function _(i) {
|
|
38
|
+
var f = i.length, r = [1732584193, -271733879, -1732584194, 271733878], t, n, e, s, l, b;
|
|
39
|
+
for (t = 64; t <= f; t += 64)
|
|
40
|
+
o(r, g(i.subarray(t - 64, t)));
|
|
41
|
+
for (i = t - 64 < f ? i.subarray(t - 64) : new Uint8Array(0), n = i.length, e = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], t = 0; t < n; t += 1)
|
|
42
|
+
e[t >> 2] |= i[t] << (t % 4 << 3);
|
|
43
|
+
if (e[t >> 2] |= 128 << (t % 4 << 3), t > 55)
|
|
44
|
+
for (o(r, e), t = 0; t < 16; t += 1)
|
|
45
|
+
e[t] = 0;
|
|
46
|
+
return s = f * 8, s = s.toString(16).match(/(.*?)(.{0,8})$/), l = parseInt(s[2], 16), b = parseInt(s[1], 16) || 0, e[14] = l, e[15] = b, o(r, e), r;
|
|
47
|
+
}
|
|
48
|
+
function d(i) {
|
|
49
|
+
var f = "", r;
|
|
50
|
+
for (r = 0; r < 4; r += 1)
|
|
51
|
+
f += p[i >> r * 8 + 4 & 15] + p[i >> r * 8 & 15];
|
|
52
|
+
return f;
|
|
53
|
+
}
|
|
54
|
+
function A(i) {
|
|
55
|
+
var f;
|
|
56
|
+
for (f = 0; f < i.length; f += 1)
|
|
57
|
+
i[f] = d(i[f]);
|
|
58
|
+
return i.join("");
|
|
59
|
+
}
|
|
60
|
+
A(a("hello")), typeof ArrayBuffer < "u" && !ArrayBuffer.prototype.slice && function() {
|
|
61
|
+
function i(f, r) {
|
|
62
|
+
return f = f | 0 || 0, f < 0 ? Math.max(f + r, 0) : Math.min(f, r);
|
|
63
|
+
}
|
|
64
|
+
ArrayBuffer.prototype.slice = function(f, r) {
|
|
65
|
+
var t = this.byteLength, n = i(f, t), e = t, s, l, b, S;
|
|
66
|
+
return r !== y && (e = i(r, t)), n > e ? new ArrayBuffer(0) : (s = e - n, l = new ArrayBuffer(s), b = new Uint8Array(l), S = new Uint8Array(this, n, s), b.set(S), l);
|
|
67
|
+
};
|
|
68
|
+
}();
|
|
69
|
+
function w(i) {
|
|
70
|
+
return /[\u0080-\uFFFF]/.test(i) && (i = unescape(encodeURIComponent(i))), i;
|
|
71
|
+
}
|
|
72
|
+
function U(i, f) {
|
|
73
|
+
var r = i.length, t = new ArrayBuffer(r), n = new Uint8Array(t), e;
|
|
74
|
+
for (e = 0; e < r; e += 1)
|
|
75
|
+
n[e] = i.charCodeAt(e);
|
|
76
|
+
return f ? n : t;
|
|
77
|
+
}
|
|
78
|
+
function C(i) {
|
|
79
|
+
return String.fromCharCode.apply(null, new Uint8Array(i));
|
|
80
|
+
}
|
|
81
|
+
function F(i, f, r) {
|
|
82
|
+
var t = new Uint8Array(i.byteLength + f.byteLength);
|
|
83
|
+
return t.set(new Uint8Array(i)), t.set(new Uint8Array(f), i.byteLength), t;
|
|
84
|
+
}
|
|
85
|
+
function m(i) {
|
|
86
|
+
var f = [], r = i.length, t;
|
|
87
|
+
for (t = 0; t < r - 1; t += 2)
|
|
88
|
+
f.push(parseInt(i.substr(t, 2), 16));
|
|
89
|
+
return String.fromCharCode.apply(String, f);
|
|
90
|
+
}
|
|
91
|
+
function h() {
|
|
92
|
+
this.reset();
|
|
93
|
+
}
|
|
94
|
+
return h.prototype.append = function(i) {
|
|
95
|
+
return this.appendBinary(w(i)), this;
|
|
96
|
+
}, h.prototype.appendBinary = function(i) {
|
|
97
|
+
this._buff += i, this._length += i.length;
|
|
98
|
+
var f = this._buff.length, r;
|
|
99
|
+
for (r = 64; r <= f; r += 64)
|
|
100
|
+
o(this._hash, c(this._buff.substring(r - 64, r)));
|
|
101
|
+
return this._buff = this._buff.substring(r - 64), this;
|
|
102
|
+
}, h.prototype.end = function(i) {
|
|
103
|
+
var f = this._buff, r = f.length, t, n = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], e;
|
|
104
|
+
for (t = 0; t < r; t += 1)
|
|
105
|
+
n[t >> 2] |= f.charCodeAt(t) << (t % 4 << 3);
|
|
106
|
+
return this._finish(n, r), e = A(this._hash), i && (e = m(e)), this.reset(), e;
|
|
107
|
+
}, h.prototype.reset = function() {
|
|
108
|
+
return this._buff = "", this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
|
|
109
|
+
}, h.prototype.getState = function() {
|
|
110
|
+
return {
|
|
111
|
+
buff: this._buff,
|
|
112
|
+
length: this._length,
|
|
113
|
+
hash: this._hash.slice()
|
|
114
|
+
};
|
|
115
|
+
}, h.prototype.setState = function(i) {
|
|
116
|
+
return this._buff = i.buff, this._length = i.length, this._hash = i.hash, this;
|
|
117
|
+
}, h.prototype.destroy = function() {
|
|
118
|
+
delete this._hash, delete this._buff, delete this._length;
|
|
119
|
+
}, h.prototype._finish = function(i, f) {
|
|
120
|
+
var r = f, t, n, e;
|
|
121
|
+
if (i[r >> 2] |= 128 << (r % 4 << 3), r > 55)
|
|
122
|
+
for (o(this._hash, i), r = 0; r < 16; r += 1)
|
|
123
|
+
i[r] = 0;
|
|
124
|
+
t = this._length * 8, t = t.toString(16).match(/(.*?)(.{0,8})$/), n = parseInt(t[2], 16), e = parseInt(t[1], 16) || 0, i[14] = n, i[15] = e, o(this._hash, i);
|
|
125
|
+
}, h.hash = function(i, f) {
|
|
126
|
+
return h.hashBinary(w(i), f);
|
|
127
|
+
}, h.hashBinary = function(i, f) {
|
|
128
|
+
var r = a(i), t = A(r);
|
|
129
|
+
return f ? m(t) : t;
|
|
130
|
+
}, h.ArrayBuffer = function() {
|
|
131
|
+
this.reset();
|
|
132
|
+
}, h.ArrayBuffer.prototype.append = function(i) {
|
|
133
|
+
var f = F(this._buff.buffer, i), r = f.length, t;
|
|
134
|
+
for (this._length += i.byteLength, t = 64; t <= r; t += 64)
|
|
135
|
+
o(this._hash, g(f.subarray(t - 64, t)));
|
|
136
|
+
return this._buff = t - 64 < r ? new Uint8Array(f.buffer.slice(t - 64)) : new Uint8Array(0), this;
|
|
137
|
+
}, h.ArrayBuffer.prototype.end = function(i) {
|
|
138
|
+
var f = this._buff, r = f.length, t = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], n, e;
|
|
139
|
+
for (n = 0; n < r; n += 1)
|
|
140
|
+
t[n >> 2] |= f[n] << (n % 4 << 3);
|
|
141
|
+
return this._finish(t, r), e = A(this._hash), i && (e = m(e)), this.reset(), e;
|
|
142
|
+
}, h.ArrayBuffer.prototype.reset = function() {
|
|
143
|
+
return this._buff = new Uint8Array(0), this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
|
|
144
|
+
}, h.ArrayBuffer.prototype.getState = function() {
|
|
145
|
+
var i = h.prototype.getState.call(this);
|
|
146
|
+
return i.buff = C(i.buff), i;
|
|
147
|
+
}, h.ArrayBuffer.prototype.setState = function(i) {
|
|
148
|
+
return i.buff = U(i.buff, !0), h.prototype.setState.call(this, i);
|
|
149
|
+
}, h.ArrayBuffer.prototype.destroy = h.prototype.destroy, h.ArrayBuffer.prototype._finish = h.prototype._finish, h.ArrayBuffer.hash = function(i, f) {
|
|
150
|
+
var r = _(new Uint8Array(i)), t = A(r);
|
|
151
|
+
return f ? m(t) : t;
|
|
152
|
+
}, h;
|
|
153
|
+
});
|
|
154
|
+
})(v);
|
|
155
|
+
var M = v.exports;
|
|
156
|
+
const L = /* @__PURE__ */ I(M);
|
|
157
|
+
function j(u, B) {
|
|
158
|
+
const y = [];
|
|
159
|
+
let p = 0;
|
|
160
|
+
const o = parseInt(B + "");
|
|
161
|
+
for (; p < u.size; )
|
|
162
|
+
y.push(u.slice(p, p + o)), p += o;
|
|
163
|
+
return y;
|
|
742
164
|
}
|
|
743
|
-
function
|
|
744
|
-
return new Promise((
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
chunks.push(file.slice(cur, cur + offset));
|
|
754
|
-
} else {
|
|
755
|
-
const mid = cur + offset / 2;
|
|
756
|
-
const end = cur + offset;
|
|
757
|
-
chunks.push(file.slice(cur, cur + 2));
|
|
758
|
-
chunks.push(file.slice(mid, mid + 2));
|
|
759
|
-
chunks.push(file.slice(end - 2, end));
|
|
165
|
+
function z(u) {
|
|
166
|
+
return new Promise((B) => {
|
|
167
|
+
const y = new L.ArrayBuffer(), p = new FileReader(), o = u.size, c = 2 * 1024 * 1024, g = [u.slice(0, c)];
|
|
168
|
+
let a = c;
|
|
169
|
+
for (; a < o; ) {
|
|
170
|
+
if (a + c >= o)
|
|
171
|
+
g.push(u.slice(a, a + c));
|
|
172
|
+
else {
|
|
173
|
+
const _ = a + c / 2, d = a + c;
|
|
174
|
+
g.push(u.slice(a, a + 2)), g.push(u.slice(_, _ + 2)), g.push(u.slice(d - 2, d));
|
|
760
175
|
}
|
|
761
|
-
|
|
176
|
+
a += c;
|
|
762
177
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
resolve(spark.end());
|
|
178
|
+
p.readAsArrayBuffer(new Blob(g)), p.onload = (_) => {
|
|
179
|
+
var d;
|
|
180
|
+
y.append((d = _.target) == null ? void 0 : d.result), B(y.end());
|
|
767
181
|
};
|
|
768
182
|
});
|
|
769
183
|
}
|
|
770
|
-
|
|
771
|
-
|
|
184
|
+
export {
|
|
185
|
+
z as calculateFileHashSample,
|
|
186
|
+
j as createFileChunk
|
|
187
|
+
};
|