@10yun/cv-mobile-ui 0.5.53 → 0.5.55

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.
Files changed (1020) hide show
  1. package/build/parse-create.js +17 -5
  2. package/build/parse-pages-pkg.js +14 -5
  3. package/js-sdk/Sansnn-uQRCode/uqrcode.js +150 -75
  4. package/js-sdk/clipboard.min.js +9 -0
  5. package/js-sdk/gprint/encoding-indexes.js +47 -0
  6. package/js-sdk/gprint/encoding.js +3312 -0
  7. package/js-sdk/gprint/esc.js +548 -0
  8. package/js-sdk/gprint/tsc.js +222 -0
  9. package/js-sdk/ican-H5Api/ican-H5Api.js +68 -666
  10. package/other/api-set-tabbar.nvue +0 -3
  11. package/other/lime-painter/changelog.md +225 -0
  12. package/other/lime-painter/components/common/relation.js +150 -0
  13. package/other/lime-painter/components/l-painter/l-painter.vue +482 -0
  14. package/other/lime-painter/components/l-painter/nvue.js +203 -0
  15. package/other/lime-painter/components/l-painter/painter.js +1 -0
  16. package/other/lime-painter/components/l-painter/props.js +56 -0
  17. package/other/lime-painter/components/l-painter/single.js +1 -0
  18. package/other/lime-painter/components/l-painter/utils.js +382 -0
  19. package/other/lime-painter/components/l-painter-image/l-painter-image.vue +23 -0
  20. package/other/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue +22 -0
  21. package/other/lime-painter/components/l-painter-text/l-painter-text.vue +32 -0
  22. package/other/lime-painter/components/l-painter-view/l-painter-view.vue +28 -0
  23. package/other/lime-painter/components/lime-painter/lime-painter.vue +259 -0
  24. package/other/lime-painter/hybrid/html/index.html +117 -0
  25. package/other/lime-painter/hybrid/html/painter.js +1 -0
  26. package/other/lime-painter/hybrid/html/uni.webview.1.5.3.js +1 -0
  27. package/other/lime-painter/package.json +93 -0
  28. package/other/lime-painter/parser.js +388 -0
  29. package/other/lime-painter/readme.md +961 -0
  30. package/other/lime-painter2/README2.md +576 -0
  31. package/other/lime-painter2/changelog.md +225 -0
  32. package/other/lime-painter2/components/lime-painter/canvas.js +57 -0
  33. package/other/lime-painter2/components/lime-painter/draw.js +654 -0
  34. package/other/lime-painter2/components/lime-painter/draw2.js +709 -0
  35. package/other/lime-painter2/components/lime-painter/gradient.js +119 -0
  36. package/other/lime-painter2/components/lime-painter/index.vue +344 -0
  37. package/other/lime-painter2/components/lime-painter/index2.vue +197 -0
  38. package/other/lime-painter2/components/lime-painter/layout.js +374 -0
  39. package/other/lime-painter2/components/lime-painter/utils.js +420 -0
  40. package/other/lime-painter2/package.json +93 -0
  41. package/other/lime-painter2/readme.md +758 -0
  42. package/other/lime-painter2/test.md +45 -0
  43. package/other/mpvue-echarts/src/echarts.vue +116 -103
  44. package/other/mpvue-echarts/src/style.css +0 -6
  45. package/other/product.vue +45 -1
  46. package/other/qiun-data-charts/qiun-data-charts.vue +1618 -0
  47. package/other/u-parse-2019/components/wxParseAudio.vue +29 -0
  48. package/other/u-parse-2019/components/wxParseImg.vue +87 -0
  49. package/other/u-parse-2019/components/wxParseTemplate0.vue +105 -0
  50. package/other/u-parse-2019/components/wxParseTemplate1.vue +96 -0
  51. package/other/u-parse-2019/components/wxParseTemplate10.vue +95 -0
  52. package/other/u-parse-2019/components/wxParseTemplate11.vue +84 -0
  53. package/other/u-parse-2019/components/wxParseTemplate2.vue +95 -0
  54. package/other/u-parse-2019/components/wxParseTemplate3.vue +95 -0
  55. package/other/u-parse-2019/components/wxParseTemplate4.vue +95 -0
  56. package/other/u-parse-2019/components/wxParseTemplate5.vue +95 -0
  57. package/other/u-parse-2019/components/wxParseTemplate6.vue +95 -0
  58. package/other/u-parse-2019/components/wxParseTemplate7.vue +95 -0
  59. package/other/u-parse-2019/components/wxParseTemplate8.vue +95 -0
  60. package/other/u-parse-2019/components/wxParseTemplate9.vue +95 -0
  61. package/other/u-parse-2019/components/wxParseVideo.vue +15 -0
  62. package/other/u-parse-2019/libs/html2json.js +258 -0
  63. package/other/u-parse-2019/libs/htmlparser.js +163 -0
  64. package/other/u-parse-2019/libs/wxDiscode.js +195 -0
  65. package/other/u-parse-2019/readme.md +99 -0
  66. package/other/u-parse-2019/u-parse.css +240 -0
  67. package/other/u-parse-2019/u-parse.vue +114 -0
  68. package/other/u-parse2026/components/wxParseAudio.vue +29 -0
  69. package/other/u-parse2026/components/wxParseImg.vue +90 -0
  70. package/other/u-parse2026/components/wxParseTable.vue +51 -0
  71. package/other/u-parse2026/components/wxParseTemplate0.vue +93 -0
  72. package/other/u-parse2026/components/wxParseTemplate1.vue +92 -0
  73. package/other/u-parse2026/components/wxParseTemplate10.vue +82 -0
  74. package/other/u-parse2026/components/wxParseTemplate11.vue +79 -0
  75. package/other/u-parse2026/components/wxParseTemplate2.vue +92 -0
  76. package/other/u-parse2026/components/wxParseTemplate3.vue +92 -0
  77. package/other/u-parse2026/components/wxParseTemplate4.vue +92 -0
  78. package/other/u-parse2026/components/wxParseTemplate5.vue +92 -0
  79. package/other/u-parse2026/components/wxParseTemplate6.vue +92 -0
  80. package/other/u-parse2026/components/wxParseTemplate7.vue +92 -0
  81. package/other/u-parse2026/components/wxParseTemplate8.vue +92 -0
  82. package/other/u-parse2026/components/wxParseTemplate9.vue +82 -0
  83. package/other/u-parse2026/components/wxParseVideo.vue +15 -0
  84. package/other/u-parse2026/libs/html2json.js +258 -0
  85. package/other/u-parse2026/libs/htmlparser.js +163 -0
  86. package/other/u-parse2026/libs/wxDiscode.js +195 -0
  87. package/other/u-parse2026/readme.md +99 -0
  88. package/other/u-parse2026/u-parse.css +283 -0
  89. package/other/u-parse2026/u-parse.vue +114 -0
  90. package/other/uParse/components/wxParseVideo.vue +2 -1
  91. package/other/xt-parse/changelog.md +41 -0
  92. package/other/xt-parse/node/node.vue +752 -0
  93. package/other/xt-parse/package.json +129 -0
  94. package/other/xt-parse/parser.js +1461 -0
  95. package/other/xt-parse/props.js +49 -0
  96. package/other/xt-parse/readme.md +145 -0
  97. package/other/xt-parse/static/app-plus/u-parse/js/handler.js +1 -0
  98. package/other/xt-parse/static/app-plus/u-parse/js/handler2.js +224 -0
  99. package/other/xt-parse/static/app-plus/u-parse/js/uni.webview.min.js +1 -0
  100. package/other/xt-parse/static/app-plus/u-parse/js/uni.webview.min2.js +186 -0
  101. package/other/xt-parse/static/app-plus/u-parse/local.html +37 -0
  102. package/other/xt-parse/u-parse.vue +510 -0
  103. package/other/z-paging/changelog.md +52 -0
  104. package/other/z-paging/components/z-paging/components/z-paging-load-more.vue +182 -0
  105. package/other/z-paging/components/z-paging/components/z-paging-refresh.vue +214 -0
  106. package/other/z-paging/components/z-paging/config/index.js +3 -0
  107. package/other/z-paging/components/z-paging/css/z-paging-main.css +241 -0
  108. package/other/z-paging/components/z-paging/css/z-paging-static.css +50 -0
  109. package/other/z-paging/components/z-paging/i18n/en.json +23 -0
  110. package/other/z-paging/components/z-paging/i18n/index.js +8 -0
  111. package/other/z-paging/components/z-paging/i18n/zh-Hans.json +23 -0
  112. package/other/z-paging/components/z-paging/i18n/zh-Hant.json +23 -0
  113. package/other/z-paging/components/z-paging/js/hooks/useZPaging.js +25 -0
  114. package/other/z-paging/components/z-paging/js/hooks/useZPagingComp.js +25 -0
  115. package/other/z-paging/components/z-paging/js/modules/back-to-top.js +125 -0
  116. package/other/z-paging/components/z-paging/js/modules/chat-record-mode.js +149 -0
  117. package/other/z-paging/components/z-paging/js/modules/common-layout.js +152 -0
  118. package/other/z-paging/components/z-paging/js/modules/data-handle.js +736 -0
  119. package/other/z-paging/components/z-paging/js/modules/empty.js +144 -0
  120. package/other/z-paging/components/z-paging/js/modules/i18n.js +113 -0
  121. package/other/z-paging/components/z-paging/js/modules/load-more.js +374 -0
  122. package/other/z-paging/components/z-paging/js/modules/loading.js +95 -0
  123. package/other/z-paging/components/z-paging/js/modules/nvue.js +268 -0
  124. package/other/z-paging/components/z-paging/js/modules/refresher.js +831 -0
  125. package/other/z-paging/components/z-paging/js/modules/scroller.js +550 -0
  126. package/other/z-paging/components/z-paging/js/modules/virtual-list.js +555 -0
  127. package/other/z-paging/components/z-paging/js/z-paging-constant.js +19 -0
  128. package/other/z-paging/components/z-paging/js/z-paging-enum.js +45 -0
  129. package/other/z-paging/components/z-paging/js/z-paging-interceptor.js +97 -0
  130. package/other/z-paging/components/z-paging/js/z-paging-main.js +515 -0
  131. package/other/z-paging/components/z-paging/js/z-paging-mixin.js +22 -0
  132. package/other/z-paging/components/z-paging/js/z-paging-static.js +13 -0
  133. package/other/z-paging/components/z-paging/js/z-paging-utils.js +302 -0
  134. package/other/z-paging/components/z-paging/wxs/z-paging-renderjs.js +67 -0
  135. package/other/z-paging/components/z-paging/wxs/z-paging-wxs.wxs +382 -0
  136. package/other/z-paging/components/z-paging/z-paging.vue +538 -0
  137. package/other/z-paging/components/z-paging-cell/z-paging-cell.vue +47 -0
  138. package/other/z-paging/components/z-paging-empty-view/z-paging-empty-view.vue +209 -0
  139. package/other/z-paging/components/z-paging-swiper/z-paging-swiper.vue +176 -0
  140. package/other/z-paging/components/z-paging-swiper-item/z-paging-swiper-item.vue +171 -0
  141. package/other/z-paging/package.json +89 -0
  142. package/other/z-paging/readme.md +57 -0
  143. package/other/z-paging/types/comps/_common.d.ts +9 -0
  144. package/other/z-paging/types/comps/z-paging-cell.d.ts +29 -0
  145. package/other/z-paging/types/comps/z-paging-empty-view.d.ts +95 -0
  146. package/other/z-paging/types/comps/z-paging-swiper-item.d.ts +95 -0
  147. package/other/z-paging/types/comps/z-paging-swiper.d.ts +89 -0
  148. package/other/z-paging/types/comps/z-paging.d.ts +2083 -0
  149. package/other/z-paging/types/comps.d.ts +11 -0
  150. package/other/z-paging/types/index.d.ts +24 -0
  151. package/package.json +7 -7
  152. package/plugins/tui-validation.js +279 -0
  153. package/plugins/uni-async.js +28 -0
  154. package/ui-cv/components/cv-draw-gesture-lock/cv-draw-gesture-lock.vue +39 -1
  155. package/ui-cv/components/cv-draw-qrcode/cv-draw-qrcode.vue +18 -14
  156. package/ui-cv/components/cv-geo-region/mpvueCityPicker.vue +77 -1
  157. package/ui-cv/components/cv-lists-base/cv-lists-base.vue +2 -2
  158. package/ui-cv/components/cv-tab-lists/cv-tab-lists.vue +2 -2
  159. package/ui-fireui/components/u-icon/u-icon.vue +63 -1
  160. package/ui-sdks/qiun-data-charts/changelog.md +320 -0
  161. package/ui-sdks/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue +1618 -0
  162. package/ui-sdks/qiun-data-charts/components/qiun-error/qiun-error.vue +46 -0
  163. package/ui-sdks/qiun-data-charts/components/qiun-loading/loading1.vue +162 -0
  164. package/ui-sdks/qiun-data-charts/components/qiun-loading/loading2.vue +170 -0
  165. package/ui-sdks/qiun-data-charts/components/qiun-loading/loading3.vue +173 -0
  166. package/ui-sdks/qiun-data-charts/components/qiun-loading/loading4.vue +222 -0
  167. package/ui-sdks/qiun-data-charts/components/qiun-loading/loading5.vue +229 -0
  168. package/ui-sdks/qiun-data-charts/components/qiun-loading/qiun-loading.vue +36 -0
  169. package/ui-sdks/qiun-data-charts/js_sdk/u-charts/config-echarts.js +422 -0
  170. package/ui-sdks/qiun-data-charts/js_sdk/u-charts/config-ucharts.js +606 -0
  171. package/ui-sdks/qiun-data-charts/js_sdk/u-charts/readme.md +5 -0
  172. package/ui-sdks/qiun-data-charts/js_sdk/u-charts/u-charts.js +7706 -0
  173. package/ui-sdks/qiun-data-charts/js_sdk/u-charts/u-charts.min.js +18 -0
  174. package/ui-sdks/qiun-data-charts/license.md +201 -0
  175. package/ui-sdks/qiun-data-charts/package.json +80 -0
  176. package/ui-sdks/qiun-data-charts/readme.md +84 -0
  177. package/ui-sdks/qiun-data-charts/static/app-plus/echarts.min.js +23 -0
  178. package/ui-sdks/qiun-data-charts/static/h5/echarts.min.js +23 -0
  179. package/ui-sdks/tui-clipboard/tui-clipboard.js +53 -0
  180. package/uni-ui/lib/uni-badge/changelog.md +33 -0
  181. package/uni-ui/lib/uni-badge/package.json +107 -0
  182. package/uni-ui/lib/uni-badge/readme.md +8 -0
  183. package/uni-ui/lib/uni-badge/uni-badge.vue +87 -4
  184. package/uni-ui/lib/uni-breadcrumb/changelog.md +6 -0
  185. package/uni-ui/lib/uni-breadcrumb/package.json +104 -0
  186. package/uni-ui/lib/uni-breadcrumb/readme.md +66 -0
  187. package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +8 -1
  188. package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +38 -1
  189. package/uni-ui/lib/uni-calendar/calendar.js +0 -2
  190. package/uni-ui/lib/uni-calendar/changelog.md +30 -0
  191. package/uni-ui/lib/uni-calendar/package.json +105 -0
  192. package/uni-ui/lib/uni-calendar/readme.md +103 -0
  193. package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +83 -1
  194. package/uni-ui/lib/uni-calendar/uni-calendar.vue +206 -8
  195. package/uni-ui/lib/uni-calendar/util.js +1 -1
  196. package/uni-ui/lib/uni-card/changelog.md +26 -0
  197. package/uni-ui/lib/uni-card/package.json +107 -0
  198. package/uni-ui/lib/uni-card/readme.md +10 -0
  199. package/uni-ui/lib/uni-card/uni-card.vue +127 -4
  200. package/uni-ui/lib/uni-col/uni-col.vue +2155 -2
  201. package/uni-ui/lib/uni-collapse/changelog.md +48 -0
  202. package/uni-ui/lib/uni-collapse/package.json +106 -0
  203. package/uni-ui/lib/uni-collapse/readme.md +11 -0
  204. package/uni-ui/lib/uni-collapse/uni-collapse.vue +13 -1
  205. package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +127 -2
  206. package/uni-ui/lib/uni-combox/changelog.md +17 -0
  207. package/uni-ui/lib/uni-combox/package.json +107 -0
  208. package/uni-ui/lib/uni-combox/readme.md +10 -0
  209. package/uni-ui/lib/uni-combox/uni-combox.vue +145 -19
  210. package/uni-ui/lib/uni-countdown/changelog.md +30 -0
  211. package/uni-ui/lib/uni-countdown/package.json +105 -0
  212. package/uni-ui/lib/uni-countdown/readme.md +9 -0
  213. package/uni-ui/lib/uni-countdown/uni-countdown.vue +43 -16
  214. package/uni-ui/lib/uni-data-checkbox/changelog.md +51 -0
  215. package/uni-ui/lib/uni-data-checkbox/package.json +107 -0
  216. package/uni-ui/lib/uni-data-checkbox/readme.md +17 -0
  217. package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +326 -5
  218. package/uni-ui/lib/uni-data-picker/changelog.md +81 -0
  219. package/uni-ui/lib/uni-data-picker/package.json +109 -0
  220. package/uni-ui/lib/uni-data-picker/readme.md +21 -0
  221. package/uni-ui/lib/uni-data-picker/uni-data-picker.uvue +380 -0
  222. package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +52 -4
  223. package/uni-ui/lib/uni-data-pickerview/loading.uts +1 -0
  224. package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +150 -157
  225. package/uni-ui/lib/uni-data-pickerview/uni-data-picker.uts +693 -0
  226. package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +76 -0
  227. package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.uvue +69 -0
  228. package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +163 -1
  229. package/uni-ui/lib/uni-data-select/changelog.md +51 -0
  230. package/uni-ui/lib/uni-data-select/package.json +106 -0
  231. package/uni-ui/lib/uni-data-select/readme.md +7 -0
  232. package/uni-ui/lib/uni-data-select/uni-data-select.vue +555 -45
  233. package/uni-ui/lib/uni-dateformat/changelog.md +10 -0
  234. package/uni-ui/lib/uni-dateformat/package.json +107 -0
  235. package/uni-ui/lib/uni-dateformat/readme.md +10 -0
  236. package/uni-ui/lib/uni-dateformat/uni-dateformat.vue +2 -0
  237. package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +113 -1
  238. package/uni-ui/lib/uni-datetime-picker/calendar.vue +340 -20
  239. package/uni-ui/lib/uni-datetime-picker/changelog.md +177 -0
  240. package/uni-ui/lib/uni-datetime-picker/keypress.js +45 -0
  241. package/uni-ui/lib/uni-datetime-picker/package.json +107 -0
  242. package/uni-ui/lib/uni-datetime-picker/readme.md +20 -0
  243. package/uni-ui/lib/uni-datetime-picker/time-picker.vue +200 -8
  244. package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +287 -9
  245. package/uni-ui/lib/uni-datetime-picker/util.js +102 -85
  246. package/uni-ui/lib/uni-drawer/changelog.md +13 -0
  247. package/uni-ui/lib/uni-drawer/package.json +106 -0
  248. package/uni-ui/lib/uni-drawer/readme.md +9 -0
  249. package/uni-ui/lib/uni-drawer/uni-drawer.vue +72 -2
  250. package/uni-ui/lib/uni-easyinput/changelog.md +121 -0
  251. package/uni-ui/lib/uni-easyinput/common.js +0 -2
  252. package/uni-ui/lib/uni-easyinput/package.json +107 -0
  253. package/uni-ui/lib/uni-easyinput/readme.md +10 -0
  254. package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +247 -5
  255. package/uni-ui/lib/uni-fab/changelog.md +25 -0
  256. package/uni-ui/lib/uni-fab/package.json +107 -0
  257. package/uni-ui/lib/uni-fab/readme.md +8 -0
  258. package/uni-ui/lib/uni-fab/uni-fab.vue +255 -2
  259. package/uni-ui/lib/uni-fav/changelog.md +19 -0
  260. package/uni-ui/lib/uni-fav/package.json +106 -0
  261. package/uni-ui/lib/uni-fav/readme.md +9 -0
  262. package/uni-ui/lib/uni-fav/uni-fav.vue +45 -1
  263. package/uni-ui/lib/uni-file-picker/changelog.md +91 -0
  264. package/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +67 -4
  265. package/uni-ui/lib/uni-file-picker/package.json +105 -0
  266. package/uni-ui/lib/uni-file-picker/readme.md +10 -0
  267. package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +42 -22
  268. package/uni-ui/lib/uni-file-picker/upload-file.vue +152 -1
  269. package/uni-ui/lib/uni-file-picker/upload-image.vue +107 -5
  270. package/uni-ui/lib/uni-forms/changelog.md +100 -0
  271. package/uni-ui/lib/uni-forms/package.json +107 -0
  272. package/uni-ui/lib/uni-forms/readme.md +22 -0
  273. package/uni-ui/lib/uni-forms/uni-forms.vue +30 -3
  274. package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +181 -6
  275. package/uni-ui/lib/uni-goods-nav/changelog.md +18 -0
  276. package/uni-ui/lib/uni-goods-nav/package.json +105 -0
  277. package/uni-ui/lib/uni-goods-nav/readme.md +9 -0
  278. package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +124 -1
  279. package/uni-ui/lib/uni-grid/changelog.md +13 -0
  280. package/uni-ui/lib/uni-grid/package.json +106 -0
  281. package/uni-ui/lib/uni-grid/readme.md +10 -0
  282. package/uni-ui/lib/uni-grid/uni-grid.vue +36 -2
  283. package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +57 -2
  284. package/uni-ui/lib/uni-group/changelog.md +16 -0
  285. package/uni-ui/lib/uni-group/package.json +106 -0
  286. package/uni-ui/lib/uni-group/readme.md +8 -0
  287. package/uni-ui/lib/uni-group/uni-group.vue +50 -1
  288. package/uni-ui/lib/uni-icons/changelog.md +22 -0
  289. package/uni-ui/lib/uni-icons/package.json +77 -8
  290. package/uni-ui/lib/uni-icons/readme.md +0 -1
  291. package/uni-ui/lib/uni-icons/uni-icons.uvue +91 -0
  292. package/uni-ui/lib/uni-icons/uni-icons.vue +37 -13
  293. package/uni-ui/lib/uni-icons/uniicons.css +32 -31
  294. package/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
  295. package/uni-ui/lib/uni-icons/uniicons_file.ts +664 -0
  296. package/uni-ui/lib/uni-icons/uniicons_file_vue.js +649 -0
  297. package/uni-ui/lib/uni-indexed-list/changelog.md +19 -0
  298. package/uni-ui/lib/uni-indexed-list/package.json +107 -0
  299. package/uni-ui/lib/uni-indexed-list/readme.md +10 -0
  300. package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +90 -2
  301. package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +91 -3
  302. package/uni-ui/lib/uni-link/changelog.md +17 -0
  303. package/uni-ui/lib/uni-link/package.json +106 -0
  304. package/uni-ui/lib/uni-link/readme.md +10 -0
  305. package/uni-ui/lib/uni-link/uni-link.vue +3 -0
  306. package/uni-ui/lib/uni-list/changelog.md +52 -0
  307. package/uni-ui/lib/uni-list/package.json +108 -0
  308. package/uni-ui/lib/uni-list/readme.md +44 -0
  309. package/uni-ui/lib/uni-list/uni-list.vue +44 -1
  310. package/uni-ui/lib/uni-list/uni-refresh.vue +2 -0
  311. package/uni-ui/lib/uni-list/uni-refresh.wxs +1 -1
  312. package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +33 -1
  313. package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +265 -1
  314. package/uni-ui/lib/uni-list-item/uni-list-item.vue +185 -1
  315. package/uni-ui/lib/uni-load-more/changelog.md +27 -0
  316. package/uni-ui/lib/uni-load-more/package.json +105 -0
  317. package/uni-ui/lib/uni-load-more/readme.md +12 -0
  318. package/uni-ui/lib/uni-load-more/uni-load-more.vue +252 -1
  319. package/uni-ui/lib/uni-nav-bar/changelog.md +64 -0
  320. package/uni-ui/lib/uni-nav-bar/package.json +106 -0
  321. package/uni-ui/lib/uni-nav-bar/readme.md +13 -0
  322. package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +199 -5
  323. package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +11 -1
  324. package/uni-ui/lib/uni-notice-bar/changelog.md +22 -0
  325. package/uni-ui/lib/uni-notice-bar/package.json +107 -0
  326. package/uni-ui/lib/uni-notice-bar/readme.md +11 -0
  327. package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +136 -8
  328. package/uni-ui/lib/uni-number-box/changelog.md +39 -0
  329. package/uni-ui/lib/uni-number-box/package.json +104 -0
  330. package/uni-ui/lib/uni-number-box/readme.md +11 -0
  331. package/uni-ui/lib/uni-number-box/uni-number-box.vue +73 -4
  332. package/uni-ui/lib/uni-pagination/changelog.md +27 -0
  333. package/uni-ui/lib/uni-pagination/package.json +106 -0
  334. package/uni-ui/lib/uni-pagination/readme.md +10 -0
  335. package/uni-ui/lib/uni-pagination/uni-pagination.vue +157 -1
  336. package/uni-ui/lib/uni-popup/changelog.md +102 -0
  337. package/uni-ui/lib/uni-popup/package.json +107 -0
  338. package/uni-ui/lib/uni-popup/readme.md +15 -0
  339. package/uni-ui/lib/uni-popup/uni-popup.uvue +90 -0
  340. package/uni-ui/lib/uni-popup/uni-popup.vue +108 -15
  341. package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +167 -11
  342. package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +70 -1
  343. package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +87 -6
  344. package/uni-ui/lib/uni-rate/changelog.md +27 -0
  345. package/uni-ui/lib/uni-rate/package.json +106 -0
  346. package/uni-ui/lib/uni-rate/readme.md +11 -0
  347. package/uni-ui/lib/uni-rate/uni-rate.vue +64 -29
  348. package/uni-ui/lib/uni-row/changelog.md +10 -0
  349. package/uni-ui/lib/uni-row/package.json +106 -0
  350. package/uni-ui/lib/uni-row/readme.md +9 -0
  351. package/uni-ui/lib/uni-row/uni-row.vue +66 -1
  352. package/uni-ui/lib/uni-row/uni-row2.vue +144 -0
  353. package/uni-ui/lib/uni-scss/package.json +56 -39
  354. package/uni-ui/lib/uni-scss/readme.md +0 -1
  355. package/uni-ui/lib/uni-search-bar/changelog.md +47 -0
  356. package/uni-ui/lib/uni-search-bar/package.json +106 -0
  357. package/uni-ui/lib/uni-search-bar/readme.md +12 -0
  358. package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +85 -4
  359. package/uni-ui/lib/uni-section/changelog.md +2 -0
  360. package/uni-ui/lib/uni-section/package.json +104 -0
  361. package/uni-ui/lib/uni-section/readme.md +7 -0
  362. package/uni-ui/lib/uni-section/uni-section.vue +61 -1
  363. package/uni-ui/lib/uni-segmented-control/changelog.md +15 -0
  364. package/uni-ui/lib/uni-segmented-control/package.json +106 -0
  365. package/uni-ui/lib/uni-segmented-control/readme.md +11 -0
  366. package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +67 -5
  367. package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +3 -1
  368. package/uni-ui/lib/uni-steps/changelog.md +18 -0
  369. package/uni-ui/lib/uni-steps/package.json +106 -0
  370. package/uni-ui/lib/uni-steps/readme.md +11 -0
  371. package/uni-ui/lib/uni-steps/uni-steps.vue +201 -7
  372. package/uni-ui/lib/uni-swipe-action/changelog.md +60 -0
  373. package/uni-ui/lib/uni-swipe-action/package.json +113 -0
  374. package/uni-ui/lib/uni-swipe-action/readme.md +10 -0
  375. package/uni-ui/lib/uni-swipe-action/uni-swipe-action.vue +60 -1
  376. package/uni-ui/lib/uni-swipe-action-item/bindingx.js +286 -282
  377. package/uni-ui/lib/uni-swipe-action-item/mpwxs.js +1 -1
  378. package/uni-ui/lib/uni-swipe-action-item/render.js +21 -14
  379. package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +139 -18
  380. package/uni-ui/lib/uni-swipe-action-item/wx.wxs +10 -2
  381. package/uni-ui/lib/uni-swiper-dot/changelog.md +12 -0
  382. package/uni-ui/lib/uni-swiper-dot/package.json +106 -0
  383. package/uni-ui/lib/uni-swiper-dot/readme.md +10 -0
  384. package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +98 -2
  385. package/uni-ui/lib/uni-table/changelog.md +35 -0
  386. package/uni-ui/lib/uni-table/i18n/en.json +9 -0
  387. package/uni-ui/lib/uni-table/i18n/es.json +9 -0
  388. package/uni-ui/lib/uni-table/i18n/fr.json +9 -0
  389. package/uni-ui/lib/uni-table/i18n/index.js +12 -0
  390. package/uni-ui/lib/uni-table/i18n/zh-Hans.json +9 -0
  391. package/uni-ui/lib/uni-table/i18n/zh-Hant.json +9 -0
  392. package/uni-ui/lib/uni-table/package.json +106 -0
  393. package/uni-ui/lib/uni-table/readme.md +11 -0
  394. package/uni-ui/lib/uni-table/uni-table.vue +162 -1
  395. package/uni-ui/lib/uni-tag/changelog.md +25 -0
  396. package/uni-ui/lib/uni-tag/package.json +106 -0
  397. package/uni-ui/lib/uni-tag/readme.md +11 -0
  398. package/uni-ui/lib/uni-tag/uni-tag.vue +111 -3
  399. package/uni-ui/lib/uni-tbody/uni-tbody.vue +1 -1
  400. package/uni-ui/lib/uni-td/uni-td.vue +19 -1
  401. package/uni-ui/lib/uni-th/filter-dropdown.vue +224 -2
  402. package/uni-ui/lib/uni-th/uni-th.vue +82 -1
  403. package/uni-ui/lib/uni-thead/uni-thead.vue +53 -2
  404. package/uni-ui/lib/uni-title/changelog.md +10 -0
  405. package/uni-ui/lib/uni-title/package.json +107 -0
  406. package/uni-ui/lib/uni-title/readme.md +12 -0
  407. package/uni-ui/lib/uni-title/uni-title.vue +1 -1
  408. package/uni-ui/lib/uni-tooltip/changelog.md +16 -0
  409. package/uni-ui/lib/uni-tooltip/package.json +104 -0
  410. package/uni-ui/lib/uni-tooltip/readme.md +7 -0
  411. package/uni-ui/lib/uni-tooltip/uni-tooltip.vue +1 -1
  412. package/uni-ui/lib/uni-tr/table-checkbox.vue +85 -1
  413. package/uni-ui/lib/uni-tr/uni-tr.vue +45 -3
  414. package/uni-ui/lib/uni-transition/changelog.md +31 -0
  415. package/uni-ui/lib/uni-transition/package.json +112 -0
  416. package/uni-ui/lib/uni-transition/readme.md +10 -0
  417. package/uni-ui/lib/uni-transition/uni-transition.vue +36 -32
  418. package/uni-ui/lib/uni-ui/changelog.md +639 -0
  419. package/uni-ui/lib/uni-ui/package.json +148 -0
  420. package/uni-ui/lib/uni-ui/readme.md +247 -0
  421. package/uni-ui/lib/uni-ui/uni-ui.vue +7 -0
  422. package/uni-ui/package.json +1 -1
  423. package/uview-plus/components/u-action-sheet/u-action-sheet.vue +56 -1
  424. package/uview-plus/components/u-action-sheet-data/u-action-sheet-data.vue +10 -1
  425. package/uview-plus/components/u-agreement/u-agreement.vue +14 -3
  426. package/uview-plus/components/u-album/u-album.vue +29 -1
  427. package/uview-plus/components/u-alert/u-alert.vue +96 -1
  428. package/uview-plus/components/u-avatar/u-avatar.vue +21 -1
  429. package/uview-plus/components/u-avatar-group/u-avatar-group.vue +28 -1
  430. package/uview-plus/components/u-back-top/u-back-top.vue +16 -1
  431. package/uview-plus/components/u-badge/u-badge.vue +57 -1
  432. package/uview-plus/components/u-box/u-box.vue +101 -3
  433. package/uview-plus/components/u-button/u-button.vue +196 -3
  434. package/uview-plus/components/u-calendar/header.vue +59 -3
  435. package/uview-plus/components/u-calendar/month.vue +1 -3
  436. package/uview-plus/components/u-calendar/u-calendar.vue +3 -1
  437. package/uview-plus/components/u-calendar-wu/u-calendar-wu.vue +196 -1
  438. package/uview-plus/components/u-car-keyboard/u-car-keyboard.vue +70 -1
  439. package/uview-plus/components/u-card/u-card.vue +34 -1
  440. package/uview-plus/components/u-cascader/u-cascader.vue +16 -1
  441. package/uview-plus/components/u-cate-tab/u-cate-tab.vue +387 -3
  442. package/uview-plus/components/u-cell/u-cell.vue +113 -1
  443. package/uview-plus/components/u-cell-group/u-cell-group.vue +14 -1
  444. package/uview-plus/components/u-checkbox/u-checkbox.vue +77 -1
  445. package/uview-plus/components/u-checkbox-group/u-checkbox-group.vue +12 -1
  446. package/uview-plus/components/u-choose/u-choose.vue +15 -3
  447. package/uview-plus/components/u-circle-progress/u-circle-progress.vue +69 -1
  448. package/{ui-fireui copy/components/u-circular-progress/u-circular-progress.vue → uview-plus/components/u-circular-progress/u-circular-progress.vue} +1 -1
  449. package/uview-plus/components/u-city-locate/u-city-locate.vue +161 -1
  450. package/uview-plus/components/u-code-input/u-code-input.vue +68 -1
  451. package/uview-plus/components/u-col/u-col.vue +50 -1
  452. package/uview-plus/components/u-collapse-item/u-collapse-item.vue +10 -1
  453. package/uview-plus/components/u-color-picker/u-color-picker.vue +260 -1
  454. package/uview-plus/components/u-column-notice/u-column-notice.vue +37 -1
  455. package/uview-plus/components/u-count-down/u-count-down.vue +5 -1
  456. package/uview-plus/components/u-count-to/u-count-to.vue +6 -1
  457. package/uview-plus/components/u-coupon/u-coupon.vue +214 -1
  458. package/uview-plus/components/u-cropper/u-cropper.vue +1319 -1
  459. package/uview-plus/components/u-datetime-picker/u-datetime-picker.vue +26 -1
  460. package/uview-plus/components/u-divider/u-divider.vue +17 -1
  461. package/uview-plus/components/u-dragsort/u-dragsort.vue +40 -1
  462. package/uview-plus/components/u-dropdown/u-dropdown.vue +66 -1
  463. package/uview-plus/components/u-dropdown-item/u-dropdown-item.vue +3 -1
  464. package/{ui-fireui → uview-plus}/components/u-dropdown-list/u-dropdown-list.vue +1 -1
  465. package/uview-plus/components/u-empty/u-empty.vue +43 -32
  466. package/{ui-fireui copy/components/u-fab/u-fab.vue → uview-plus/components/u-fab/u-fab.vue} +1 -1
  467. package/uview-plus/components/u-float-button/u-float-button.vue +15 -1
  468. package/{ui-fireui → uview-plus}/components/u-footer/u-footer.vue +1 -1
  469. package/uview-plus/components/u-form-base/form.js +22 -0
  470. package/uview-plus/components/u-form-base/props.js +47 -0
  471. package/uview-plus/components/u-form-base/u-form.vue +243 -0
  472. package/uview-plus/components/u-form-item/u-form-item.vue +82 -1
  473. package/uview-plus/components/u-goods-sku/u-goods-sku.vue +100 -1
  474. package/uview-plus/components/u-grid/u-grid.vue +0 -2
  475. package/uview-plus/components/u-grid-item/u-grid-item.vue +30 -1
  476. package/uview-plus/components/u-icon/u-icon.vue +63 -1
  477. package/uview-plus/components/u-image/u-image.vue +25 -1
  478. package/{ui-fireui → uview-plus}/components/u-image-cropper/u-image-cropper.vue +1 -1
  479. package/{ui-fireui copy/components/u-image-group/u-image-group.vue → uview-plus/components/u-image-group/u-image-group.vue} +1 -1
  480. package/uview-plus/components/u-index-anchor/u-index-anchor.vue +22 -1
  481. package/uview-plus/components/u-index-list/u-index-list.vue +51 -1
  482. package/uview-plus/components/u-input/u-input.vue +65 -1
  483. package/uview-plus/components/u-keyboard/u-keyboard.vue +26 -1
  484. package/uview-plus/components/u-lazy-load/u-lazy-load.vue +12 -1
  485. package/uview-plus/components/u-line/u-line.vue +5 -1
  486. package/uview-plus/components/u-line-progress/u-line-progress.vue +38 -1
  487. package/uview-plus/components/u-link/u-link.vue +11 -1
  488. package/uview-plus/components/u-list/u-list.vue +6 -1
  489. package/uview-plus/components/u-list-item/u-list-item.vue +2 -1
  490. package/uview-plus/components/u-loading-icon/u-loading-icon.vue +138 -1
  491. package/uview-plus/components/u-loading-page/u-loading-page.vue +33 -1
  492. package/uview-plus/components/u-loadmore/u-loadmore.vue +29 -1
  493. package/uview-plus/components/u-markdown/u-markdown.vue +188 -1
  494. package/uview-plus/components/u-message-input/u-message-input.vue +115 -1
  495. package/uview-plus/components/u-modal/u-modal.vue +65 -1
  496. package/uview-plus/components/u-navbar/u-navbar.vue +52 -1
  497. package/uview-plus/components/u-navbar-mini/u-navbar-mini.vue +34 -1
  498. package/uview-plus/components/u-no-network/u-no-network.vue +38 -1
  499. package/uview-plus/components/u-notice-bar/u-notice-bar.vue +5 -1
  500. package/uview-plus/components/u-notify/u-notify.vue +28 -1
  501. package/uview-plus/components/u-number-box/u-number-box.vue +60 -2
  502. package/uview-plus/components/u-number-keyboard/u-number-keyboard.vue +45 -1
  503. package/uview-plus/components/u-overlay/u-overlay.vue +8 -1
  504. package/uview-plus/components/u-pagination/u-pagination.vue +255 -1
  505. package/uview-plus/components/u-parse/node/node.vue +319 -129
  506. package/uview-plus/components/u-pdf-reader/u-pdf-reader.vue +2 -1
  507. package/uview-plus/components/u-picker/u-picker.vue +58 -1
  508. package/uview-plus/components/u-picker-data/u-picker-data.vue +11 -1
  509. package/uview-plus/components/u-popover/u-popover.vue +8 -1
  510. package/uview-plus/components/u-popup/u-popup.vue +87 -1
  511. package/uview-plus/components/u-popup-wu/u-popup-wu.vue +2 -2
  512. package/uview-plus/components/u-poster/u-poster.vue +22 -1
  513. package/uview-plus/components/u-pull-refresh/u-pull-refresh.vue +51 -1
  514. package/uview-plus/components/u-qrcode/u-qrcode.vue +32 -1
  515. package/uview-plus/components/u-radio/u-radio.vue +77 -1
  516. package/uview-plus/components/u-radio-group/u-radio-group.vue +15 -1
  517. package/uview-plus/components/u-rate/u-rate.vue +32 -1
  518. package/uview-plus/components/u-read-more/u-read-more.vue +23 -1
  519. package/uview-plus/components/u-row/u-row.vue +6 -1
  520. package/uview-plus/components/u-row-notice/u-row-notice.vue +50 -1
  521. package/uview-plus/components/u-safe-bottom/u-safe-bottom.vue +5 -1
  522. package/uview-plus/components/u-scroll-list/u-scroll-list.vue +35 -1
  523. package/uview-plus/components/u-search/u-search.vue +87 -1
  524. package/uview-plus/components/u-select/u-select.vue +51 -1
  525. package/uview-plus/components/u-short-video/u-short-video.vue +118 -1
  526. package/uview-plus/components/u-signature/u-signature.vue +71 -1
  527. package/uview-plus/components/u-skeleton/u-skeleton.vue +52 -1
  528. package/uview-plus/components/u-sku-wu/u-sku-wu.vue +271 -1
  529. package/uview-plus/components/u-slider/nvue.js +165 -178
  530. package/uview-plus/components/u-slider/u-slider.vue +69 -1
  531. package/uview-plus/components/u-status-bar/u-status-bar.vue +6 -1
  532. package/uview-plus/components/u-steps/u-steps.vue +20 -1
  533. package/uview-plus/components/u-steps-item/u-steps-item.vue +112 -1
  534. package/uview-plus/components/u-sticky/u-sticky.vue +6 -1
  535. package/uview-plus/components/u-subsection/u-subsection.vue +101 -1
  536. package/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue +51 -1
  537. package/uview-plus/components/u-swiper/u-swiper.vue +50 -1
  538. package/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue +26 -1
  539. package/uview-plus/components/u-switch/u-switch.vue +47 -1
  540. package/uview-plus/components/u-tabbar/u-tabbar.vue +29 -1
  541. package/uview-plus/components/u-tabbar-item/u-tabbar-item.vue +59 -1
  542. package/uview-plus/components/u-table2/tableRow.vue +361 -1
  543. package/uview-plus/components/u-table2/u-table2.vue +763 -1
  544. package/uview-plus/components/u-tabs/u-tabs.vue +62 -1
  545. package/uview-plus/components/u-tag/u-tag.vue +169 -1
  546. package/uview-plus/components/u-td/u-td.vue +14 -1
  547. package/uview-plus/components/u-text/u-text.vue +50 -1
  548. package/uview-plus/components/u-textarea/u-textarea.vue +35 -1
  549. package/uview-plus/components/u-th/u-th.vue +13 -1
  550. package/uview-plus/components/u-title/u-title.vue +10 -3
  551. package/uview-plus/components/u-toast/u-toast.vue +67 -1
  552. package/uview-plus/components/u-toolbar/u-toolbar.vue +34 -1
  553. package/uview-plus/components/u-tooltip/u-tooltip.vue +65 -1
  554. package/uview-plus/components/u-tr/u-tr.vue +6 -1
  555. package/uview-plus/components/u-transition/u-transition.vue +98 -1
  556. package/uview-plus/components/u-upload/u-upload.vue +176 -1
  557. package/uview-plus/components/u-view/u-view.vue +2 -1
  558. package/uview-plus/components/u-virtual-list/u-virtual-list.vue +16 -1
  559. package/uview-plus/components/u-waterfall/u-waterfall.vue +28 -1
  560. package/uview-plus/libs/css/color2.scss +32 -0
  561. package/uview-plus/libs/css/variable2.scss +111 -0
  562. package/{plugins → uview-plus/libs/ctocode}/MessageTip.js +6 -6
  563. package/uview-plus/libs/ctocode/wait.js +47 -0
  564. package/uview-plus/libs/mixin/openType2.js +60 -0
  565. package/uview-plus/libs/util/route2.js +126 -0
  566. package/other/style.css +0 -46
  567. package/ui-cv/components/cv-draw-gesture-lock/style.css +0 -39
  568. package/ui-cv/components/cv-geo-region/style.css +0 -77
  569. package/ui-fireui/components/u-circular-progress/u-circular-progress.vue +0 -269
  570. package/ui-fireui/components/u-countdown/u-countdown.vue +0 -301
  571. package/ui-fireui/components/u-fab/u-fab.vue +0 -284
  572. package/ui-fireui/components/u-icon/style.css +0 -63
  573. package/ui-fireui/components/u-image-group/u-image-group.vue +0 -149
  574. package/ui-fireui copy/components/u-action-sheet/u-action-sheet.vue +0 -202
  575. package/ui-fireui copy/components/u-alert/u-alert.vue +0 -141
  576. package/ui-fireui copy/components/u-badge/u-badge.vue +0 -158
  577. package/ui-fireui copy/components/u-bottom-navigation/u-bottom-navigation.vue +0 -391
  578. package/ui-fireui copy/components/u-bottom-popup/u-bottom-popup.vue +0 -101
  579. package/ui-fireui copy/components/u-bubble-popup/u-bubble-popup.vue +0 -240
  580. package/ui-fireui copy/components/u-button/u-button.vue +0 -424
  581. package/ui-fireui copy/components/u-button/u-button2.vue +0 -553
  582. package/ui-fireui copy/components/u-calendar/u-calendar.js +0 -915
  583. package/ui-fireui copy/components/u-calendar/u-calendar.vue +0 -868
  584. package/ui-fireui copy/components/u-calendar/u-calendar2.vue +0 -801
  585. package/ui-fireui copy/components/u-card/u-card.vue +0 -231
  586. package/ui-fireui copy/components/u-cascade-selection/u-cascade-selection.vue +0 -538
  587. package/ui-fireui copy/components/u-collapse/u-collapse.vue +0 -179
  588. package/ui-fireui copy/components/u-datetime/u-datetime.vue +0 -570
  589. package/ui-fireui copy/components/u-divider/u-divider.vue +0 -118
  590. package/ui-fireui copy/components/u-drawer/u-drawer.vue +0 -103
  591. package/ui-fireui copy/components/u-dropdown-list/u-dropdown-list.vue +0 -75
  592. package/ui-fireui copy/components/u-footer/u-footer.vue +0 -135
  593. package/ui-fireui copy/components/u-grid/u-grid.vue +0 -50
  594. package/ui-fireui copy/components/u-grid-item/u-grid-item.vue +0 -142
  595. package/ui-fireui copy/components/u-icon/icons.js +0 -214
  596. package/ui-fireui copy/components/u-icon/props.js +0 -92
  597. package/ui-fireui copy/components/u-icon/style.css +0 -63
  598. package/ui-fireui copy/components/u-icon/style.scss +0 -1066
  599. package/ui-fireui copy/components/u-icon/u-icon.vue +0 -117
  600. package/ui-fireui copy/components/u-icon/u-icon2.vue +0 -149
  601. package/ui-fireui copy/components/u-icon/util.js +0 -68
  602. package/ui-fireui copy/components/u-image-cropper/u-image-cropper.vue +0 -1058
  603. package/ui-fireui copy/components/u-keyboard/u-keyboard.vue +0 -251
  604. package/ui-fireui copy/components/u-keyboard-input/u-keyboard-input.vue +0 -78
  605. package/ui-fireui copy/components/u-list-cell/u-list-cell.vue +0 -178
  606. package/ui-fireui copy/components/u-list-view/u-list-view.vue +0 -87
  607. package/ui-fireui copy/components/u-loading/u-loading.vue +0 -78
  608. package/ui-fireui copy/components/u-loadmore/u-loadmore.vue +0 -163
  609. package/ui-fireui copy/components/u-modal/u-modal.vue +0 -392
  610. package/ui-fireui copy/components/u-navigation-bar/u-navigation-bar.vue +0 -181
  611. package/ui-fireui copy/components/u-no-data/u-no-data.vue +0 -116
  612. package/ui-fireui copy/components/u-nomore/u-nomore.vue +0 -116
  613. package/ui-fireui copy/components/u-numberbox/u-numberbox.vue +0 -234
  614. package/ui-fireui copy/components/u-numberbox-border/u-numberbox-border.vue +0 -232
  615. package/ui-fireui copy/components/u-picture-cropper/u-picture-cropper.vue +0 -682
  616. package/ui-fireui copy/components/u-picture-cropper/u-picture-cropper.wxs +0 -582
  617. package/ui-fireui copy/components/u-round-progress/u-round-progress.vue +0 -306
  618. package/ui-fireui copy/components/u-scroll-top/u-scroll-top.vue +0 -189
  619. package/ui-fireui copy/components/u-share-model/u-share-model.vue +0 -181
  620. package/ui-fireui copy/components/u-skeleton/u-skeleton.vue +0 -248
  621. package/ui-fireui copy/components/u-steps/u-steps.vue +0 -214
  622. package/ui-fireui copy/components/u-sticky/u-sticky.vue +0 -155
  623. package/ui-fireui copy/components/u-sticky-wxs/u-sticky-wxs.vue +0 -133
  624. package/ui-fireui copy/components/u-sticky-wxs/u-sticky.wxs +0 -46
  625. package/ui-fireui copy/components/u-swipe-action/u-swipe-action.vue +0 -301
  626. package/ui-fireui copy/components/u-tabbar/u-tabbar.vue +0 -279
  627. package/ui-fireui copy/components/u-tabs/u-tabs.vue +0 -284
  628. package/ui-fireui copy/components/u-tabs2/u-tabs2.vue +0 -284
  629. package/ui-fireui copy/components/u-tag/u-tag.vue +0 -362
  630. package/ui-fireui copy/components/u-time-axis/u-time-axis.vue +0 -36
  631. package/ui-fireui copy/components/u-timeaxis-item/u-timeaxis-item.vue +0 -48
  632. package/ui-fireui copy/components/u-tips/u-tips.vue +0 -161
  633. package/ui-fireui copy/components/u-toast/u-toast.vue +0 -117
  634. package/ui-fireui copy/components/u-top-dropdown/u-top-dropdown.vue +0 -129
  635. package/ui-fireui copy/components/u-upload/u-upload.vue +0 -446
  636. package/ui-fireui copy/components/u-upload2/u-upload.vue +0 -464
  637. package/ui-fireui copy/components/u-uploadsamll/u-uploadsamll.vue +0 -472
  638. package/ui-fireui copy/css/thorui.css +0 -589
  639. package/ui-fireui copy/index.css +0 -1483
  640. package/ui-fireui copy/libs/fui-color-analysis/fui-color-analysis.js +0 -1
  641. package/ui-fireui copy/libs/fui-zh-pinyin/fui-zh-pinyin.js +0 -1
  642. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/bridge/bridge-weex.js +0 -241
  643. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-2d/FillStyleLinearGradient.js +0 -18
  644. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-2d/FillStylePattern.js +0 -8
  645. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-2d/FillStyleRadialGradient.js +0 -17
  646. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-2d/RenderingContext.js +0 -666
  647. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/ActiveInfo.js +0 -11
  648. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Buffer.js +0 -21
  649. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Framebuffer.js +0 -21
  650. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/GLenum.js +0 -298
  651. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/GLmethod.js +0 -142
  652. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/GLtype.js +0 -23
  653. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Program.js +0 -21
  654. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Renderbuffer.js +0 -21
  655. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/RenderingContext.js +0 -1191
  656. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Shader.js +0 -22
  657. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/ShaderPrecisionFormat.js +0 -11
  658. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/Texture.js +0 -22
  659. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/UniformLocation.js +0 -22
  660. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/context-webgl/classUtils.js +0 -3
  661. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/env/canvas.js +0 -74
  662. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/env/image.js +0 -96
  663. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/env/tool.js +0 -24
  664. package/ui-fireui copy/nvue/u-circular-progress/gcanvas/index.js +0 -47
  665. package/ui-fireui copy/nvue/u-circular-progress/u-circular-progress.nvue +0 -203
  666. package/ui-fireui copy/nvue/u-icon/icons.js +0 -188
  667. package/ui-fireui copy/nvue/u-icon/u-icon.vue +0 -78
  668. package/uni-ui/lib/uni-badge/style.css +0 -81
  669. package/uni-ui/lib/uni-badge/style.scss +0 -106
  670. package/uni-ui/lib/uni-breadcrumb/style.css +0 -3
  671. package/uni-ui/lib/uni-breadcrumb/style.scss +0 -4
  672. package/uni-ui/lib/uni-breadcrumb-item/style.css +0 -30
  673. package/uni-ui/lib/uni-breadcrumb-item/style.scss +0 -40
  674. package/uni-ui/lib/uni-calendar/style.css +0 -167
  675. package/uni-ui/lib/uni-calendar/style.scss +0 -200
  676. package/uni-ui/lib/uni-card/style.css +0 -115
  677. package/uni-ui/lib/uni-card/style.scss +0 -161
  678. package/uni-ui/lib/uni-col/style.css +0 -2145
  679. package/uni-ui/lib/uni-col/style.scss +0 -112
  680. package/uni-ui/lib/uni-collapse/style.css +0 -11
  681. package/uni-ui/lib/uni-collapse/style.scss +0 -12
  682. package/uni-ui/lib/uni-collapse-item/style.css +0 -120
  683. package/uni-ui/lib/uni-collapse-item/style.scss +0 -143
  684. package/uni-ui/lib/uni-combox/style.css +0 -114
  685. package/uni-ui/lib/uni-combox/style.scss +0 -133
  686. package/uni-ui/lib/uni-countdown/style.css +0 -16
  687. package/uni-ui/lib/uni-countdown/style.scss +0 -21
  688. package/uni-ui/lib/uni-data-checkbox/style.css +0 -302
  689. package/uni-ui/lib/uni-data-checkbox/style.scss +0 -366
  690. package/uni-ui/lib/uni-data-pickerview/style.css +0 -134
  691. package/uni-ui/lib/uni-data-pickerview/style.scss +0 -154
  692. package/uni-ui/lib/uni-data-select/style.css +0 -181
  693. package/uni-ui/lib/uni-data-select/style.scss +0 -213
  694. package/uni-ui/lib/uni-datetime-picker/style.css +0 -188
  695. package/uni-ui/lib/uni-datetime-picker/style.scss +0 -218
  696. package/uni-ui/lib/uni-drawer/style.css +0 -63
  697. package/uni-ui/lib/uni-drawer/style.scss +0 -77
  698. package/uni-ui/lib/uni-easyinput/style.css +0 -126
  699. package/uni-ui/lib/uni-easyinput/style.scss +0 -155
  700. package/uni-ui/lib/uni-fab/style.css +0 -185
  701. package/uni-ui/lib/uni-fab/style.scss +0 -259
  702. package/uni-ui/lib/uni-fav/style.css +0 -39
  703. package/uni-ui/lib/uni-fav/style.scss +0 -45
  704. package/uni-ui/lib/uni-file-picker/style.css +0 -97
  705. package/uni-ui/lib/uni-file-picker/style.scss +0 -110
  706. package/uni-ui/lib/uni-forms-item/style.css +0 -133
  707. package/uni-ui/lib/uni-goods-nav/style.css +0 -100
  708. package/uni-ui/lib/uni-goods-nav/style.scss +0 -122
  709. package/uni-ui/lib/uni-grid/style.css +0 -29
  710. package/uni-ui/lib/uni-grid/style.scss +0 -33
  711. package/uni-ui/lib/uni-grid-item/style.css +0 -49
  712. package/uni-ui/lib/uni-grid-item/style.scss +0 -55
  713. package/uni-ui/lib/uni-group/style.css +0 -36
  714. package/uni-ui/lib/uni-group/style.scss +0 -50
  715. package/uni-ui/lib/uni-icons/icons.js +0 -1169
  716. package/uni-ui/lib/uni-icons/style.css +0 -12
  717. package/uni-ui/lib/uni-icons/style.scss +0 -14
  718. package/uni-ui/lib/uni-indexed-list/style.css +0 -68
  719. package/uni-ui/lib/uni-indexed-list/style.scss +0 -83
  720. package/uni-ui/lib/uni-list/style.css +0 -43
  721. package/uni-ui/lib/uni-list/style.scss +0 -52
  722. package/uni-ui/lib/uni-list-ad/style.css +0 -30
  723. package/uni-ui/lib/uni-list-ad/style.scss +0 -35
  724. package/uni-ui/lib/uni-list-chat/style.css +0 -257
  725. package/uni-ui/lib/uni-list-chat/style.scss +0 -326
  726. package/uni-ui/lib/uni-list-item/style.css +0 -170
  727. package/uni-ui/lib/uni-list-item/style.scss +0 -213
  728. package/uni-ui/lib/uni-load-more/style.css +0 -194
  729. package/uni-ui/lib/uni-load-more/style.scss +0 -244
  730. package/uni-ui/lib/uni-nav-bar/style.css +0 -3
  731. package/uni-ui/lib/uni-nav-bar/style.scss +0 -6
  732. package/uni-ui/lib/uni-notice-bar/style.css +0 -109
  733. package/uni-ui/lib/uni-notice-bar/style.scss +0 -125
  734. package/uni-ui/lib/uni-number-box/style.css +0 -50
  735. package/uni-ui/lib/uni-number-box/style.scss +0 -64
  736. package/uni-ui/lib/uni-pagination/style.css +0 -125
  737. package/uni-ui/lib/uni-pagination/style.scss +0 -154
  738. package/uni-ui/lib/uni-popup/style.css +0 -41
  739. package/uni-ui/lib/uni-popup/style.scss +0 -51
  740. package/uni-ui/lib/uni-popup-dialog/style.css +0 -82
  741. package/uni-ui/lib/uni-popup-dialog/style.scss +0 -98
  742. package/uni-ui/lib/uni-popup-message/style.css +0 -57
  743. package/uni-ui/lib/uni-popup-message/style.scss +0 -69
  744. package/uni-ui/lib/uni-popup-share/style.css +0 -72
  745. package/uni-ui/lib/uni-popup-share/style.scss +0 -81
  746. package/uni-ui/lib/uni-rate/style.css +0 -29
  747. package/uni-ui/lib/uni-rate/style.scss +0 -33
  748. package/uni-ui/lib/uni-row/style.css +0 -58
  749. package/uni-ui/lib/uni-row/style.scss +0 -104
  750. package/uni-ui/lib/uni-search-bar/style.css +0 -59
  751. package/uni-ui/lib/uni-search-bar/style.scss +0 -70
  752. package/uni-ui/lib/uni-section/style.css +0 -55
  753. package/uni-ui/lib/uni-section/style.scss +0 -65
  754. package/uni-ui/lib/uni-segmented-control/style.css +0 -48
  755. package/uni-ui/lib/uni-segmented-control/style.scss +0 -55
  756. package/uni-ui/lib/uni-status-bar/style.css +0 -4
  757. package/uni-ui/lib/uni-steps/style.css +0 -152
  758. package/uni-ui/lib/uni-steps/style.scss +0 -179
  759. package/uni-ui/lib/uni-swipe-action-item/style.css +0 -90
  760. package/uni-ui/lib/uni-swipe-action-item/style.scss +0 -112
  761. package/uni-ui/lib/uni-swiper-dot/style.css +0 -75
  762. package/uni-ui/lib/uni-swiper-dot/style.scss +0 -95
  763. package/uni-ui/lib/uni-table/style.css +0 -123
  764. package/uni-ui/lib/uni-table/style.scss +0 -152
  765. package/uni-ui/lib/uni-tag/style.css +0 -105
  766. package/uni-ui/lib/uni-tag/style.scss +0 -141
  767. package/uni-ui/lib/uni-td/style.css +0 -13
  768. package/uni-ui/lib/uni-td/style.scss +0 -17
  769. package/uni-ui/lib/uni-th/style.css +0 -63
  770. package/uni-ui/lib/uni-th/style.scss +0 -78
  771. package/uni-ui/lib/uni-thead/style.css +0 -30
  772. package/uni-ui/lib/uni-thead/style.scss +0 -52
  773. package/uni-ui/lib/uni-tr/style.css +0 -25
  774. package/uni-ui/lib/uni-tr/style.scss +0 -46
  775. package/uview-plus/components/u-action-sheet/style.css +0 -56
  776. package/uview-plus/components/u-action-sheet/style.scss +0 -83
  777. package/uview-plus/components/u-action-sheet-data/style.css +0 -10
  778. package/uview-plus/components/u-action-sheet-data/style.scss +0 -12
  779. package/uview-plus/components/u-agreement/style.css +0 -10
  780. package/uview-plus/components/u-agreement/style.scss +0 -12
  781. package/uview-plus/components/u-album/style.css +0 -29
  782. package/uview-plus/components/u-alert/style.css +0 -90
  783. package/uview-plus/components/u-alert/style.scss +0 -111
  784. package/uview-plus/components/u-avatar/style.css +0 -21
  785. package/uview-plus/components/u-avatar/style.scss +0 -24
  786. package/uview-plus/components/u-avatar-group/style.css +0 -28
  787. package/uview-plus/components/u-avatar-group/style.scss +0 -26
  788. package/uview-plus/components/u-back-top/style.css +0 -16
  789. package/uview-plus/components/u-back-top/style.scss +0 -18
  790. package/uview-plus/components/u-badge/style.css +0 -57
  791. package/uview-plus/components/u-badge/style.scss +0 -83
  792. package/uview-plus/components/u-box/style.css +0 -51
  793. package/uview-plus/components/u-box/style.scss +0 -36
  794. package/uview-plus/components/u-button/style.css +0 -192
  795. package/uview-plus/components/u-calendar/style.css +0 -3
  796. package/uview-plus/components/u-calendar/style.scss +0 -5
  797. package/uview-plus/components/u-calendar-wu/style.css +0 -196
  798. package/uview-plus/components/u-car-keyboard/style.css +0 -69
  799. package/uview-plus/components/u-car-keyboard/style.scss +0 -89
  800. package/uview-plus/components/u-card/style.css +0 -34
  801. package/uview-plus/components/u-card/style.scss +0 -45
  802. package/uview-plus/components/u-cascader/style.css +0 -16
  803. package/uview-plus/components/u-cascader/style.scss +0 -25
  804. package/uview-plus/components/u-cate-tab/style.css +0 -98
  805. package/uview-plus/components/u-cate-tab/style.scss +0 -115
  806. package/uview-plus/components/u-cell/style.css +0 -112
  807. package/uview-plus/components/u-cell/style.scss +0 -148
  808. package/uview-plus/components/u-cell-group/style.css +0 -14
  809. package/uview-plus/components/u-cell-group/style.scss +0 -22
  810. package/uview-plus/components/u-checkbox/style.css +0 -77
  811. package/uview-plus/components/u-checkbox/style.scss +0 -102
  812. package/uview-plus/components/u-checkbox-group/style.css +0 -12
  813. package/uview-plus/components/u-checkbox-group/style.scss +0 -12
  814. package/uview-plus/components/u-choose/style.css +0 -13
  815. package/uview-plus/components/u-choose/style.scss +0 -17
  816. package/uview-plus/components/u-circle-progress/style.css +0 -69
  817. package/uview-plus/components/u-circle-progress/style.scss +0 -84
  818. package/uview-plus/components/u-city-locate/style.css +0 -20
  819. package/uview-plus/components/u-city-locate/style.scss +0 -20
  820. package/uview-plus/components/u-code-input/style.css +0 -68
  821. package/uview-plus/components/u-code-input/style.scss +0 -75
  822. package/uview-plus/components/u-col/style.css +0 -50
  823. package/uview-plus/components/u-col/style.scss +0 -65
  824. package/uview-plus/components/u-collapse-item/style.css +0 -10
  825. package/uview-plus/components/u-collapse-item/style.scss +0 -13
  826. package/uview-plus/components/u-color-picker/style.css +0 -246
  827. package/uview-plus/components/u-color-picker/style.scss +0 -299
  828. package/uview-plus/components/u-column-notice/style.css +0 -37
  829. package/uview-plus/components/u-column-notice/style.scss +0 -33
  830. package/uview-plus/components/u-count-down/style.css +0 -5
  831. package/uview-plus/components/u-count-down/style.scss +0 -11
  832. package/uview-plus/components/u-count-to/style.css +0 -6
  833. package/uview-plus/components/u-count-to/style.scss +0 -6
  834. package/uview-plus/components/u-coupon/style.css +0 -214
  835. package/uview-plus/components/u-coupon/style.scss +0 -246
  836. package/uview-plus/components/u-cropper/style.css +0 -91
  837. package/uview-plus/components/u-cropper/style.scss +0 -93
  838. package/uview-plus/components/u-datetime-picker/style.css +0 -26
  839. package/uview-plus/components/u-datetime-picker/style.scss +0 -26
  840. package/uview-plus/components/u-divider/style.css +0 -17
  841. package/uview-plus/components/u-divider/style.scss +0 -22
  842. package/uview-plus/components/u-dragsort/style.css +0 -40
  843. package/uview-plus/components/u-dragsort/style.scss +0 -52
  844. package/uview-plus/components/u-dropdown/style.css +0 -66
  845. package/uview-plus/components/u-dropdown/style.scss +0 -66
  846. package/uview-plus/components/u-dropdown-item/style.css +0 -3
  847. package/uview-plus/components/u-dropdown-item/style.scss +0 -3
  848. package/uview-plus/components/u-empty/style.css +0 -27
  849. package/uview-plus/components/u-empty/style.scss +0 -22
  850. package/uview-plus/components/u-empty/u-empty-new.vue +0 -102
  851. package/uview-plus/components/u-float-button/style.css +0 -15
  852. package/uview-plus/components/u-float-button/style.scss +0 -15
  853. package/uview-plus/components/u-form-item/style.css +0 -82
  854. package/uview-plus/components/u-form-item/style.scss +0 -72
  855. package/uview-plus/components/u-goods-sku/style.css +0 -100
  856. package/uview-plus/components/u-goods-sku/style.scss +0 -120
  857. package/uview-plus/components/u-grid/style.css +0 -21
  858. package/uview-plus/components/u-grid/style.scss +0 -21
  859. package/uview-plus/components/u-grid-item/style.css +0 -30
  860. package/uview-plus/components/u-grid-item/style.scss +0 -43
  861. package/uview-plus/components/u-icon/style.css +0 -63
  862. package/uview-plus/components/u-icon/style.scss +0 -82
  863. package/uview-plus/components/u-image/style.css +0 -24
  864. package/uview-plus/components/u-image/style.scss +0 -32
  865. package/uview-plus/components/u-index-anchor/style.css +0 -22
  866. package/uview-plus/components/u-index-anchor/style.scss +0 -18
  867. package/uview-plus/components/u-index-list/style.css +0 -51
  868. package/uview-plus/components/u-index-list/style.scss +0 -52
  869. package/uview-plus/components/u-input/style.css +0 -64
  870. package/uview-plus/components/u-input/style.scss +0 -62
  871. package/uview-plus/components/u-keyboard/style.css +0 -26
  872. package/uview-plus/components/u-keyboard/style.scss +0 -29
  873. package/uview-plus/components/u-lazy-load/style.css +0 -12
  874. package/uview-plus/components/u-lazy-load/style.scss +0 -15
  875. package/uview-plus/components/u-line/style.css +0 -5
  876. package/uview-plus/components/u-line/style.scss +0 -5
  877. package/uview-plus/components/u-line-progress/style.css +0 -38
  878. package/uview-plus/components/u-line-progress/style.scss +0 -35
  879. package/uview-plus/components/u-link/style.css +0 -11
  880. package/uview-plus/components/u-link/style.scss +0 -10
  881. package/uview-plus/components/u-list/style.css +0 -6
  882. package/uview-plus/components/u-list/style.scss +0 -3
  883. package/uview-plus/components/u-list-item/style.css +0 -2
  884. package/uview-plus/components/u-list-item/style.scss +0 -2
  885. package/uview-plus/components/u-loading-icon/style.css +0 -138
  886. package/uview-plus/components/u-loading-icon/style.scss +0 -152
  887. package/uview-plus/components/u-loading-page/style.css +0 -33
  888. package/uview-plus/components/u-loading-page/style.scss +0 -35
  889. package/uview-plus/components/u-loadmore/style.css +0 -29
  890. package/uview-plus/components/u-loadmore/style.scss +0 -27
  891. package/uview-plus/components/u-markdown/style.css +0 -188
  892. package/uview-plus/components/u-markdown/style.scss +0 -199
  893. package/uview-plus/components/u-message-input/style.css +0 -115
  894. package/uview-plus/components/u-message-input/style.scss +0 -134
  895. package/uview-plus/components/u-modal/style.css +0 -63
  896. package/uview-plus/components/u-modal/style.scss +0 -68
  897. package/uview-plus/components/u-navbar/style.css +0 -51
  898. package/uview-plus/components/u-navbar/style.scss +0 -56
  899. package/uview-plus/components/u-navbar-mini/style.css +0 -34
  900. package/uview-plus/components/u-navbar-mini/style.scss +0 -36
  901. package/uview-plus/components/u-no-network/style.css +0 -38
  902. package/uview-plus/components/u-no-network/style.scss +0 -34
  903. package/uview-plus/components/u-notice-bar/style.css +0 -5
  904. package/uview-plus/components/u-notice-bar/style.scss +0 -5
  905. package/uview-plus/components/u-notice-bar/u-notice-bar2.vue +0 -102
  906. package/uview-plus/components/u-notify/style.css +0 -28
  907. package/uview-plus/components/u-notify/style.scss +0 -38
  908. package/uview-plus/components/u-number-box/style.css +0 -56
  909. package/uview-plus/components/u-number-box/style.scss +0 -68
  910. package/uview-plus/components/u-number-keyboard/style.css +0 -45
  911. package/uview-plus/components/u-number-keyboard/style.scss +0 -61
  912. package/uview-plus/components/u-overlay/style.css +0 -8
  913. package/uview-plus/components/u-overlay/style.scss +0 -13
  914. package/uview-plus/components/u-pagination/style.css +0 -46
  915. package/uview-plus/components/u-pagination/style.scss +0 -51
  916. package/uview-plus/components/u-pdf-reader/style.css +0 -2
  917. package/uview-plus/components/u-pdf-reader/style.scss +0 -2
  918. package/uview-plus/components/u-picker/style.css +0 -58
  919. package/uview-plus/components/u-picker/style.scss +0 -54
  920. package/uview-plus/components/u-picker-data/style.css +0 -11
  921. package/uview-plus/components/u-picker-data/style.scss +0 -13
  922. package/uview-plus/components/u-popover/style.css +0 -8
  923. package/uview-plus/components/u-popover/style.scss +0 -7
  924. package/uview-plus/components/u-popup/style.css +0 -87
  925. package/uview-plus/components/u-popup/style.scss +0 -106
  926. package/uview-plus/components/u-poster/style.css +0 -22
  927. package/uview-plus/components/u-poster/style.scss +0 -26
  928. package/uview-plus/components/u-pull-refresh/style.css +0 -51
  929. package/uview-plus/components/u-pull-refresh/style.scss +0 -58
  930. package/uview-plus/components/u-qrcode/style.css +0 -33
  931. package/uview-plus/components/u-qrcode/style.scss +0 -33
  932. package/uview-plus/components/u-radio/style.css +0 -77
  933. package/uview-plus/components/u-radio/style.scss +0 -101
  934. package/uview-plus/components/u-radio-group/style.css +0 -15
  935. package/uview-plus/components/u-radio-group/style.scss +0 -14
  936. package/uview-plus/components/u-rate/style.css +0 -32
  937. package/uview-plus/components/u-rate/style.scss +0 -37
  938. package/uview-plus/components/u-read-more/style.css +0 -23
  939. package/uview-plus/components/u-read-more/style.scss +0 -21
  940. package/uview-plus/components/u-row/style.css +0 -6
  941. package/uview-plus/components/u-row/style.scss +0 -3
  942. package/uview-plus/components/u-row-notice/style.css +0 -50
  943. package/uview-plus/components/u-row-notice/style.scss +0 -49
  944. package/uview-plus/components/u-safe-bottom/style.css +0 -5
  945. package/uview-plus/components/u-safe-bottom/style.scss +0 -5
  946. package/uview-plus/components/u-scroll-list/style.css +0 -35
  947. package/uview-plus/components/u-scroll-list/style.scss +0 -32
  948. package/uview-plus/components/u-search/style.css +0 -87
  949. package/uview-plus/components/u-search/style.scss +0 -105
  950. package/uview-plus/components/u-select/style.css +0 -51
  951. package/uview-plus/components/u-select/style.scss +0 -47
  952. package/uview-plus/components/u-short-video/style.css +0 -117
  953. package/uview-plus/components/u-short-video/style.scss +0 -138
  954. package/uview-plus/components/u-signature/style.css +0 -70
  955. package/uview-plus/components/u-signature/style.scss +0 -88
  956. package/uview-plus/components/u-skeleton/style.css +0 -51
  957. package/uview-plus/components/u-skeleton/style.scss +0 -57
  958. package/uview-plus/components/u-sku-wu/style.css +0 -271
  959. package/uview-plus/components/u-slider/style.css +0 -69
  960. package/uview-plus/components/u-slider/style.scss +0 -76
  961. package/uview-plus/components/u-status-bar/style.css +0 -5
  962. package/uview-plus/components/u-status-bar/style.scss +0 -6
  963. package/uview-plus/components/u-steps/style.css +0 -20
  964. package/uview-plus/components/u-steps/style.scss +0 -21
  965. package/uview-plus/components/u-steps-item/style.css +0 -112
  966. package/uview-plus/components/u-steps-item/style.scss +0 -116
  967. package/uview-plus/components/u-sticky/style.css +0 -5
  968. package/uview-plus/components/u-sticky/style.scss +0 -6
  969. package/uview-plus/components/u-subsection/style.css +0 -101
  970. package/uview-plus/components/u-subsection/style.scss +0 -121
  971. package/uview-plus/components/u-swipe-action-item/style.css +0 -51
  972. package/uview-plus/components/u-swipe-action-item/style.scss +0 -44
  973. package/uview-plus/components/u-swiper/style.css +0 -50
  974. package/uview-plus/components/u-swiper/style.scss +0 -51
  975. package/uview-plus/components/u-swiper-indicator/style.css +0 -26
  976. package/uview-plus/components/u-swiper-indicator/style.scss +0 -29
  977. package/uview-plus/components/u-switch/style.css +0 -47
  978. package/uview-plus/components/u-switch/style.scss +0 -46
  979. package/uview-plus/components/u-tabbar/style.css +0 -29
  980. package/uview-plus/components/u-tabbar/style.scss +0 -23
  981. package/uview-plus/components/u-tabbar-item/style.css +0 -59
  982. package/uview-plus/components/u-tabbar-item/style.scss +0 -62
  983. package/uview-plus/components/u-table2/style.css +0 -90
  984. package/uview-plus/components/u-table2/style.scss +0 -117
  985. package/uview-plus/components/u-tabs/style.css +0 -62
  986. package/uview-plus/components/u-tabs/style.scss +0 -60
  987. package/uview-plus/components/u-tag/style.css +0 -169
  988. package/uview-plus/components/u-tag/style.scss +0 -204
  989. package/uview-plus/components/u-td/style.css +0 -14
  990. package/uview-plus/components/u-td/style.scss +0 -11
  991. package/uview-plus/components/u-text/style.css +0 -50
  992. package/uview-plus/components/u-text/style.scss +0 -56
  993. package/uview-plus/components/u-text/style2.scss +0 -60
  994. package/uview-plus/components/u-textarea/style.css +0 -35
  995. package/uview-plus/components/u-textarea/style.scss +0 -37
  996. package/uview-plus/components/u-th/style.css +0 -13
  997. package/uview-plus/components/u-th/style.scss +0 -10
  998. package/uview-plus/components/u-title/style.css +0 -8
  999. package/uview-plus/components/u-title/style.scss +0 -10
  1000. package/uview-plus/components/u-toast/style.css +0 -67
  1001. package/uview-plus/components/u-toast/style.scss +0 -106
  1002. package/uview-plus/components/u-toolbar/style.css +0 -33
  1003. package/uview-plus/components/u-toolbar/style.scss +0 -35
  1004. package/uview-plus/components/u-tooltip/style.css +0 -65
  1005. package/uview-plus/components/u-tooltip/style.scss +0 -62
  1006. package/uview-plus/components/u-tr/style.css +0 -6
  1007. package/uview-plus/components/u-tr/style.scss +0 -3
  1008. package/uview-plus/components/u-transition/style.css +0 -98
  1009. package/uview-plus/components/u-transition/style.scss +0 -120
  1010. package/uview-plus/components/u-upload/style.css +0 -174
  1011. package/uview-plus/components/u-upload/style.scss +0 -221
  1012. package/uview-plus/components/u-view/style.css +0 -2
  1013. package/uview-plus/components/u-view/style.scss +0 -2
  1014. package/uview-plus/components/u-virtual-list/style.css +0 -16
  1015. package/uview-plus/components/u-virtual-list/style.scss +0 -16
  1016. package/uview-plus/components/u-waterfall/style.css +0 -28
  1017. package/uview-plus/components/u-waterfall/style.scss +0 -25
  1018. /package/{uni-ui/lib/uni-forms/style.css → other/lime-painter2/components/lime-painter/qrcode.js} +0 -0
  1019. /package/{ui-fireui copy/components/u-countdown/u-countdown.vue → ui-fireui/components/u-count-down/u-count-down.vue} +0 -0
  1020. /package/{plugins → uview-plus/libs/ctocode}/MessageBox.js +0 -0
@@ -0,0 +1,3312 @@
1
+ // This is free and unencumbered software released into the public domain.
2
+ // See LICENSE.md for more information.
3
+
4
+ /**
5
+ * @fileoverview Global |this| required for resolving indexes in node.
6
+ * @suppress {globalThis}
7
+ */
8
+ (function(global) {
9
+ 'use strict';
10
+
11
+ // If we're in node require encoding-indexes and attach it to the global.
12
+ if (typeof module !== "undefined" && module.exports &&
13
+ !global["encoding-indexes"]) {
14
+ global["encoding-indexes"] =
15
+ require("./encoding-indexes.js")["encoding-indexes"];
16
+ }
17
+
18
+ //
19
+ // Utilities
20
+ //
21
+
22
+ /**
23
+ * @param {number} a The number to test.
24
+ * @param {number} min The minimum value in the range, inclusive.
25
+ * @param {number} max The maximum value in the range, inclusive.
26
+ * @return {boolean} True if a >= min and a <= max.
27
+ */
28
+ function inRange(a, min, max) {
29
+ return min <= a && a <= max;
30
+ }
31
+
32
+ /**
33
+ * @param {!Array.<*>} array The array to check.
34
+ * @param {*} item The item to look for in the array.
35
+ * @return {boolean} True if the item appears in the array.
36
+ */
37
+ function includes(array, item) {
38
+ return array.indexOf(item) !== -1;
39
+ }
40
+
41
+ var floor = Math.floor;
42
+
43
+ /**
44
+ * @param {*} o
45
+ * @return {Object}
46
+ */
47
+ function ToDictionary(o) {
48
+ if (o === undefined) return {};
49
+ if (o === Object(o)) return o;
50
+ throw TypeError('Could not convert argument to dictionary');
51
+ }
52
+
53
+ /**
54
+ * @param {string} string Input string of UTF-16 code units.
55
+ * @return {!Array.<number>} Code points.
56
+ */
57
+ function stringToCodePoints(string) {
58
+ // https://heycam.github.io/webidl/#dfn-obtain-unicode
59
+
60
+ // 1. Let S be the DOMString value.
61
+ var s = String(string);
62
+
63
+ // 2. Let n be the length of S.
64
+ var n = s.length;
65
+
66
+ // 3. Initialize i to 0.
67
+ var i = 0;
68
+
69
+ // 4. Initialize U to be an empty sequence of Unicode characters.
70
+ var u = [];
71
+
72
+ // 5. While i < n:
73
+ while (i < n) {
74
+
75
+ // 1. Let c be the code unit in S at index i.
76
+ var c = s.charCodeAt(i);
77
+
78
+ // 2. Depending on the value of c:
79
+
80
+ // c < 0xD800 or c > 0xDFFF
81
+ if (c < 0xD800 || c > 0xDFFF) {
82
+ // Append to U the Unicode character with code point c.
83
+ u.push(c);
84
+ }
85
+
86
+ // 0xDC00 ≤ c ≤ 0xDFFF
87
+ else if (0xDC00 <= c && c <= 0xDFFF) {
88
+ // Append to U a U+FFFD REPLACEMENT CHARACTER.
89
+ u.push(0xFFFD);
90
+ }
91
+
92
+ // 0xD800 ≤ c ≤ 0xDBFF
93
+ else if (0xD800 <= c && c <= 0xDBFF) {
94
+ // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT
95
+ // CHARACTER.
96
+ if (i === n - 1) {
97
+ u.push(0xFFFD);
98
+ }
99
+ // 2. Otherwise, i < n−1:
100
+ else {
101
+ // 1. Let d be the code unit in S at index i+1.
102
+ var d = s.charCodeAt(i + 1);
103
+
104
+ // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:
105
+ if (0xDC00 <= d && d <= 0xDFFF) {
106
+ // 1. Let a be c & 0x3FF.
107
+ var a = c & 0x3FF;
108
+
109
+ // 2. Let b be d & 0x3FF.
110
+ var b = d & 0x3FF;
111
+
112
+ // 3. Append to U the Unicode character with code point
113
+ // 2^16+2^10*a+b.
114
+ u.push(0x10000 + (a << 10) + b);
115
+
116
+ // 4. Set i to i+1.
117
+ i += 1;
118
+ }
119
+
120
+ // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a
121
+ // U+FFFD REPLACEMENT CHARACTER.
122
+ else {
123
+ u.push(0xFFFD);
124
+ }
125
+ }
126
+ }
127
+
128
+ // 3. Set i to i+1.
129
+ i += 1;
130
+ }
131
+
132
+ // 6. Return U.
133
+ return u;
134
+ }
135
+
136
+ /**
137
+ * @param {!Array.<number>} code_points Array of code points.
138
+ * @return {string} string String of UTF-16 code units.
139
+ */
140
+ function codePointsToString(code_points) {
141
+ var s = '';
142
+ for (var i = 0; i < code_points.length; ++i) {
143
+ var cp = code_points[i];
144
+ if (cp <= 0xFFFF) {
145
+ s += String.fromCharCode(cp);
146
+ } else {
147
+ cp -= 0x10000;
148
+ s += String.fromCharCode((cp >> 10) + 0xD800,
149
+ (cp & 0x3FF) + 0xDC00);
150
+ }
151
+ }
152
+ return s;
153
+ }
154
+
155
+
156
+ //
157
+ // Implementation of Encoding specification
158
+ // https://encoding.spec.whatwg.org/
159
+ //
160
+
161
+ //
162
+ // 4. Terminology
163
+ //
164
+
165
+ /**
166
+ * An ASCII byte is a byte in the range 0x00 to 0x7F, inclusive.
167
+ * @param {number} a The number to test.
168
+ * @return {boolean} True if a is in the range 0x00 to 0x7F, inclusive.
169
+ */
170
+ function isASCIIByte(a) {
171
+ return 0x00 <= a && a <= 0x7F;
172
+ }
173
+
174
+ /**
175
+ * An ASCII code point is a code point in the range U+0000 to
176
+ * U+007F, inclusive.
177
+ */
178
+ var isASCIICodePoint = isASCIIByte;
179
+
180
+
181
+ /**
182
+ * End-of-stream is a special token that signifies no more tokens
183
+ * are in the stream.
184
+ * @const
185
+ */ var end_of_stream = -1;
186
+
187
+ /**
188
+ * A stream represents an ordered sequence of tokens.
189
+ *
190
+ * @constructor
191
+ * @param {!(Array.<number>|Uint8Array)} tokens Array of tokens that provide
192
+ * the stream.
193
+ */
194
+ function Stream(tokens) {
195
+ /** @type {!Array.<number>} */
196
+ this.tokens = [].slice.call(tokens);
197
+ // Reversed as push/pop is more efficient than shift/unshift.
198
+ this.tokens.reverse();
199
+ }
200
+
201
+ Stream.prototype = {
202
+ /**
203
+ * @return {boolean} True if end-of-stream has been hit.
204
+ */
205
+ endOfStream: function() {
206
+ return !this.tokens.length;
207
+ },
208
+
209
+ /**
210
+ * When a token is read from a stream, the first token in the
211
+ * stream must be returned and subsequently removed, and
212
+ * end-of-stream must be returned otherwise.
213
+ *
214
+ * @return {number} Get the next token from the stream, or
215
+ * end_of_stream.
216
+ */
217
+ read: function() {
218
+ if (!this.tokens.length)
219
+ return end_of_stream;
220
+ return this.tokens.pop();
221
+ },
222
+
223
+ /**
224
+ * When one or more tokens are prepended to a stream, those tokens
225
+ * must be inserted, in given order, before the first token in the
226
+ * stream.
227
+ *
228
+ * @param {(number|!Array.<number>)} token The token(s) to prepend to the
229
+ * stream.
230
+ */
231
+ prepend: function(token) {
232
+ if (Array.isArray(token)) {
233
+ var tokens = /**@type {!Array.<number>}*/(token);
234
+ while (tokens.length)
235
+ this.tokens.push(tokens.pop());
236
+ } else {
237
+ this.tokens.push(token);
238
+ }
239
+ },
240
+
241
+ /**
242
+ * When one or more tokens are pushed to a stream, those tokens
243
+ * must be inserted, in given order, after the last token in the
244
+ * stream.
245
+ *
246
+ * @param {(number|!Array.<number>)} token The tokens(s) to push to the
247
+ * stream.
248
+ */
249
+ push: function(token) {
250
+ if (Array.isArray(token)) {
251
+ var tokens = /**@type {!Array.<number>}*/(token);
252
+ while (tokens.length)
253
+ this.tokens.unshift(tokens.shift());
254
+ } else {
255
+ this.tokens.unshift(token);
256
+ }
257
+ }
258
+ };
259
+
260
+ //
261
+ // 5. Encodings
262
+ //
263
+
264
+ // 5.1 Encoders and decoders
265
+
266
+ /** @const */
267
+ var finished = -1;
268
+
269
+ /**
270
+ * @param {boolean} fatal If true, decoding errors raise an exception.
271
+ * @param {number=} opt_code_point Override the standard fallback code point.
272
+ * @return {number} The code point to insert on a decoding error.
273
+ */
274
+ function decoderError(fatal, opt_code_point) {
275
+ if (fatal)
276
+ throw TypeError('Decoder error');
277
+ return opt_code_point || 0xFFFD;
278
+ }
279
+
280
+ /**
281
+ * @param {number} code_point The code point that could not be encoded.
282
+ * @return {number} Always throws, no value is actually returned.
283
+ */
284
+ function encoderError(code_point) {
285
+ throw TypeError('The code point ' + code_point + ' could not be encoded.');
286
+ }
287
+
288
+ /** @interface */
289
+ function Decoder() {}
290
+ Decoder.prototype = {
291
+ /**
292
+ * @param {Stream} stream The stream of bytes being decoded.
293
+ * @param {number} bite The next byte read from the stream.
294
+ * @return {?(number|!Array.<number>)} The next code point(s)
295
+ * decoded, or null if not enough data exists in the input
296
+ * stream to decode a complete code point, or |finished|.
297
+ */
298
+ handler: function(stream, bite) {}
299
+ };
300
+
301
+ /** @interface */
302
+ function Encoder() {}
303
+ Encoder.prototype = {
304
+ /**
305
+ * @param {Stream} stream The stream of code points being encoded.
306
+ * @param {number} code_point Next code point read from the stream.
307
+ * @return {(number|!Array.<number>)} Byte(s) to emit, or |finished|.
308
+ */
309
+ handler: function(stream, code_point) {}
310
+ };
311
+
312
+ // 5.2 Names and labels
313
+
314
+ // TODO: Define @typedef for Encoding: {name:string,labels:Array.<string>}
315
+ // https://github.com/google/closure-compiler/issues/247
316
+
317
+ /**
318
+ * @param {string} label The encoding label.
319
+ * @return {?{name:string,labels:Array.<string>}}
320
+ */
321
+ function getEncoding(label) {
322
+ // 1. Remove any leading and trailing ASCII whitespace from label.
323
+ label = String(label).trim().toLowerCase();
324
+
325
+ // 2. If label is an ASCII case-insensitive match for any of the
326
+ // labels listed in the table below, return the corresponding
327
+ // encoding, and failure otherwise.
328
+ if (Object.prototype.hasOwnProperty.call(label_to_encoding, label)) {
329
+ return label_to_encoding[label];
330
+ }
331
+ return null;
332
+ }
333
+
334
+ /**
335
+ * Encodings table: https://encoding.spec.whatwg.org/encodings.json
336
+ * @const
337
+ * @type {!Array.<{
338
+ * heading: string,
339
+ * encodings: Array.<{name:string,labels:Array.<string>}>
340
+ * }>}
341
+ */
342
+ var encodings = [
343
+ {
344
+ "encodings": [
345
+ {
346
+ "labels": [
347
+ "unicode-1-1-utf-8",
348
+ "utf-8",
349
+ "utf8"
350
+ ],
351
+ "name": "UTF-8"
352
+ }
353
+ ],
354
+ "heading": "The Encoding"
355
+ },
356
+ {
357
+ "encodings": [
358
+ {
359
+ "labels": [
360
+ "866",
361
+ "cp866",
362
+ "csibm866",
363
+ "ibm866"
364
+ ],
365
+ "name": "IBM866"
366
+ },
367
+ {
368
+ "labels": [
369
+ "csisolatin2",
370
+ "iso-8859-2",
371
+ "iso-ir-101",
372
+ "iso8859-2",
373
+ "iso88592",
374
+ "iso_8859-2",
375
+ "iso_8859-2:1987",
376
+ "l2",
377
+ "latin2"
378
+ ],
379
+ "name": "ISO-8859-2"
380
+ },
381
+ {
382
+ "labels": [
383
+ "csisolatin3",
384
+ "iso-8859-3",
385
+ "iso-ir-109",
386
+ "iso8859-3",
387
+ "iso88593",
388
+ "iso_8859-3",
389
+ "iso_8859-3:1988",
390
+ "l3",
391
+ "latin3"
392
+ ],
393
+ "name": "ISO-8859-3"
394
+ },
395
+ {
396
+ "labels": [
397
+ "csisolatin4",
398
+ "iso-8859-4",
399
+ "iso-ir-110",
400
+ "iso8859-4",
401
+ "iso88594",
402
+ "iso_8859-4",
403
+ "iso_8859-4:1988",
404
+ "l4",
405
+ "latin4"
406
+ ],
407
+ "name": "ISO-8859-4"
408
+ },
409
+ {
410
+ "labels": [
411
+ "csisolatincyrillic",
412
+ "cyrillic",
413
+ "iso-8859-5",
414
+ "iso-ir-144",
415
+ "iso8859-5",
416
+ "iso88595",
417
+ "iso_8859-5",
418
+ "iso_8859-5:1988"
419
+ ],
420
+ "name": "ISO-8859-5"
421
+ },
422
+ {
423
+ "labels": [
424
+ "arabic",
425
+ "asmo-708",
426
+ "csiso88596e",
427
+ "csiso88596i",
428
+ "csisolatinarabic",
429
+ "ecma-114",
430
+ "iso-8859-6",
431
+ "iso-8859-6-e",
432
+ "iso-8859-6-i",
433
+ "iso-ir-127",
434
+ "iso8859-6",
435
+ "iso88596",
436
+ "iso_8859-6",
437
+ "iso_8859-6:1987"
438
+ ],
439
+ "name": "ISO-8859-6"
440
+ },
441
+ {
442
+ "labels": [
443
+ "csisolatingreek",
444
+ "ecma-118",
445
+ "elot_928",
446
+ "greek",
447
+ "greek8",
448
+ "iso-8859-7",
449
+ "iso-ir-126",
450
+ "iso8859-7",
451
+ "iso88597",
452
+ "iso_8859-7",
453
+ "iso_8859-7:1987",
454
+ "sun_eu_greek"
455
+ ],
456
+ "name": "ISO-8859-7"
457
+ },
458
+ {
459
+ "labels": [
460
+ "csiso88598e",
461
+ "csisolatinhebrew",
462
+ "hebrew",
463
+ "iso-8859-8",
464
+ "iso-8859-8-e",
465
+ "iso-ir-138",
466
+ "iso8859-8",
467
+ "iso88598",
468
+ "iso_8859-8",
469
+ "iso_8859-8:1988",
470
+ "visual"
471
+ ],
472
+ "name": "ISO-8859-8"
473
+ },
474
+ {
475
+ "labels": [
476
+ "csiso88598i",
477
+ "iso-8859-8-i",
478
+ "logical"
479
+ ],
480
+ "name": "ISO-8859-8-I"
481
+ },
482
+ {
483
+ "labels": [
484
+ "csisolatin6",
485
+ "iso-8859-10",
486
+ "iso-ir-157",
487
+ "iso8859-10",
488
+ "iso885910",
489
+ "l6",
490
+ "latin6"
491
+ ],
492
+ "name": "ISO-8859-10"
493
+ },
494
+ {
495
+ "labels": [
496
+ "iso-8859-13",
497
+ "iso8859-13",
498
+ "iso885913"
499
+ ],
500
+ "name": "ISO-8859-13"
501
+ },
502
+ {
503
+ "labels": [
504
+ "iso-8859-14",
505
+ "iso8859-14",
506
+ "iso885914"
507
+ ],
508
+ "name": "ISO-8859-14"
509
+ },
510
+ {
511
+ "labels": [
512
+ "csisolatin9",
513
+ "iso-8859-15",
514
+ "iso8859-15",
515
+ "iso885915",
516
+ "iso_8859-15",
517
+ "l9"
518
+ ],
519
+ "name": "ISO-8859-15"
520
+ },
521
+ {
522
+ "labels": [
523
+ "iso-8859-16"
524
+ ],
525
+ "name": "ISO-8859-16"
526
+ },
527
+ {
528
+ "labels": [
529
+ "cskoi8r",
530
+ "koi",
531
+ "koi8",
532
+ "koi8-r",
533
+ "koi8_r"
534
+ ],
535
+ "name": "KOI8-R"
536
+ },
537
+ {
538
+ "labels": [
539
+ "koi8-ru",
540
+ "koi8-u"
541
+ ],
542
+ "name": "KOI8-U"
543
+ },
544
+ {
545
+ "labels": [
546
+ "csmacintosh",
547
+ "mac",
548
+ "macintosh",
549
+ "x-mac-roman"
550
+ ],
551
+ "name": "macintosh"
552
+ },
553
+ {
554
+ "labels": [
555
+ "dos-874",
556
+ "iso-8859-11",
557
+ "iso8859-11",
558
+ "iso885911",
559
+ "tis-620",
560
+ "windows-874"
561
+ ],
562
+ "name": "windows-874"
563
+ },
564
+ {
565
+ "labels": [
566
+ "cp1250",
567
+ "windows-1250",
568
+ "x-cp1250"
569
+ ],
570
+ "name": "windows-1250"
571
+ },
572
+ {
573
+ "labels": [
574
+ "cp1251",
575
+ "windows-1251",
576
+ "x-cp1251"
577
+ ],
578
+ "name": "windows-1251"
579
+ },
580
+ {
581
+ "labels": [
582
+ "ansi_x3.4-1968",
583
+ "ascii",
584
+ "cp1252",
585
+ "cp819",
586
+ "csisolatin1",
587
+ "ibm819",
588
+ "iso-8859-1",
589
+ "iso-ir-100",
590
+ "iso8859-1",
591
+ "iso88591",
592
+ "iso_8859-1",
593
+ "iso_8859-1:1987",
594
+ "l1",
595
+ "latin1",
596
+ "us-ascii",
597
+ "windows-1252",
598
+ "x-cp1252"
599
+ ],
600
+ "name": "windows-1252"
601
+ },
602
+ {
603
+ "labels": [
604
+ "cp1253",
605
+ "windows-1253",
606
+ "x-cp1253"
607
+ ],
608
+ "name": "windows-1253"
609
+ },
610
+ {
611
+ "labels": [
612
+ "cp1254",
613
+ "csisolatin5",
614
+ "iso-8859-9",
615
+ "iso-ir-148",
616
+ "iso8859-9",
617
+ "iso88599",
618
+ "iso_8859-9",
619
+ "iso_8859-9:1989",
620
+ "l5",
621
+ "latin5",
622
+ "windows-1254",
623
+ "x-cp1254"
624
+ ],
625
+ "name": "windows-1254"
626
+ },
627
+ {
628
+ "labels": [
629
+ "cp1255",
630
+ "windows-1255",
631
+ "x-cp1255"
632
+ ],
633
+ "name": "windows-1255"
634
+ },
635
+ {
636
+ "labels": [
637
+ "cp1256",
638
+ "windows-1256",
639
+ "x-cp1256"
640
+ ],
641
+ "name": "windows-1256"
642
+ },
643
+ {
644
+ "labels": [
645
+ "cp1257",
646
+ "windows-1257",
647
+ "x-cp1257"
648
+ ],
649
+ "name": "windows-1257"
650
+ },
651
+ {
652
+ "labels": [
653
+ "cp1258",
654
+ "windows-1258",
655
+ "x-cp1258"
656
+ ],
657
+ "name": "windows-1258"
658
+ },
659
+ {
660
+ "labels": [
661
+ "x-mac-cyrillic",
662
+ "x-mac-ukrainian"
663
+ ],
664
+ "name": "x-mac-cyrillic"
665
+ }
666
+ ],
667
+ "heading": "Legacy single-byte encodings"
668
+ },
669
+ {
670
+ "encodings": [
671
+ {
672
+ "labels": [
673
+ "chinese",
674
+ "csgb2312",
675
+ "csiso58gb231280",
676
+ "gb2312",
677
+ "gb_2312",
678
+ "gb_2312-80",
679
+ "gbk",
680
+ "iso-ir-58",
681
+ "x-gbk"
682
+ ],
683
+ "name": "GBK"
684
+ },
685
+ {
686
+ "labels": [
687
+ "gb18030"
688
+ ],
689
+ "name": "gb18030"
690
+ }
691
+ ],
692
+ "heading": "Legacy multi-byte Chinese (simplified) encodings"
693
+ },
694
+ {
695
+ "encodings": [
696
+ {
697
+ "labels": [
698
+ "big5",
699
+ "big5-hkscs",
700
+ "cn-big5",
701
+ "csbig5",
702
+ "x-x-big5"
703
+ ],
704
+ "name": "Big5"
705
+ }
706
+ ],
707
+ "heading": "Legacy multi-byte Chinese (traditional) encodings"
708
+ },
709
+ {
710
+ "encodings": [
711
+ {
712
+ "labels": [
713
+ "cseucpkdfmtjapanese",
714
+ "euc-jp",
715
+ "x-euc-jp"
716
+ ],
717
+ "name": "EUC-JP"
718
+ },
719
+ {
720
+ "labels": [
721
+ "csiso2022jp",
722
+ "iso-2022-jp"
723
+ ],
724
+ "name": "ISO-2022-JP"
725
+ },
726
+ {
727
+ "labels": [
728
+ "csshiftjis",
729
+ "ms932",
730
+ "ms_kanji",
731
+ "shift-jis",
732
+ "shift_jis",
733
+ "sjis",
734
+ "windows-31j",
735
+ "x-sjis"
736
+ ],
737
+ "name": "Shift_JIS"
738
+ }
739
+ ],
740
+ "heading": "Legacy multi-byte Japanese encodings"
741
+ },
742
+ {
743
+ "encodings": [
744
+ {
745
+ "labels": [
746
+ "cseuckr",
747
+ "csksc56011987",
748
+ "euc-kr",
749
+ "iso-ir-149",
750
+ "korean",
751
+ "ks_c_5601-1987",
752
+ "ks_c_5601-1989",
753
+ "ksc5601",
754
+ "ksc_5601",
755
+ "windows-949"
756
+ ],
757
+ "name": "EUC-KR"
758
+ }
759
+ ],
760
+ "heading": "Legacy multi-byte Korean encodings"
761
+ },
762
+ {
763
+ "encodings": [
764
+ {
765
+ "labels": [
766
+ "csiso2022kr",
767
+ "hz-gb-2312",
768
+ "iso-2022-cn",
769
+ "iso-2022-cn-ext",
770
+ "iso-2022-kr"
771
+ ],
772
+ "name": "replacement"
773
+ },
774
+ {
775
+ "labels": [
776
+ "utf-16be"
777
+ ],
778
+ "name": "UTF-16BE"
779
+ },
780
+ {
781
+ "labels": [
782
+ "utf-16",
783
+ "utf-16le"
784
+ ],
785
+ "name": "UTF-16LE"
786
+ },
787
+ {
788
+ "labels": [
789
+ "x-user-defined"
790
+ ],
791
+ "name": "x-user-defined"
792
+ }
793
+ ],
794
+ "heading": "Legacy miscellaneous encodings"
795
+ }
796
+ ];
797
+
798
+ // Label to encoding registry.
799
+ /** @type {Object.<string,{name:string,labels:Array.<string>}>} */
800
+ var label_to_encoding = {};
801
+ encodings.forEach(function(category) {
802
+ category.encodings.forEach(function(encoding) {
803
+ encoding.labels.forEach(function(label) {
804
+ label_to_encoding[label] = encoding;
805
+ });
806
+ });
807
+ });
808
+
809
+ // Registry of of encoder/decoder factories, by encoding name.
810
+ /** @type {Object.<string, function({fatal:boolean}): Encoder>} */
811
+ var encoders = {};
812
+ /** @type {Object.<string, function({fatal:boolean}): Decoder>} */
813
+ var decoders = {};
814
+
815
+ //
816
+ // 6. Indexes
817
+ //
818
+
819
+ /**
820
+ * @param {number} pointer The |pointer| to search for.
821
+ * @param {(!Array.<?number>|undefined)} index The |index| to search within.
822
+ * @return {?number} The code point corresponding to |pointer| in |index|,
823
+ * or null if |code point| is not in |index|.
824
+ */
825
+ function indexCodePointFor(pointer, index) {
826
+ if (!index) return null;
827
+ return index[pointer] || null;
828
+ }
829
+
830
+ /**
831
+ * @param {number} code_point The |code point| to search for.
832
+ * @param {!Array.<?number>} index The |index| to search within.
833
+ * @return {?number} The first pointer corresponding to |code point| in
834
+ * |index|, or null if |code point| is not in |index|.
835
+ */
836
+ function indexPointerFor(code_point, index) {
837
+ var pointer = index.indexOf(code_point);
838
+ return pointer === -1 ? null : pointer;
839
+ }
840
+
841
+ /**
842
+ * @param {string} name Name of the index.
843
+ * @return {(!Array.<number>|!Array.<Array.<number>>)}
844
+ * */
845
+ function index(name) {
846
+ if (!('encoding-indexes' in global)) {
847
+ throw Error("Indexes missing." +
848
+ " Did you forget to include encoding-indexes.js first?");
849
+ }
850
+ return global['encoding-indexes'][name];
851
+ }
852
+
853
+ /**
854
+ * @param {number} pointer The |pointer| to search for in the gb18030 index.
855
+ * @return {?number} The code point corresponding to |pointer| in |index|,
856
+ * or null if |code point| is not in the gb18030 index.
857
+ */
858
+ function indexGB18030RangesCodePointFor(pointer) {
859
+ // 1. If pointer is greater than 39419 and less than 189000, or
860
+ // pointer is greater than 1237575, return null.
861
+ if ((pointer > 39419 && pointer < 189000) || (pointer > 1237575))
862
+ return null;
863
+
864
+ // 2. If pointer is 7457, return code point U+E7C7.
865
+ if (pointer === 7457) return 0xE7C7;
866
+
867
+ // 3. Let offset be the last pointer in index gb18030 ranges that
868
+ // is equal to or less than pointer and let code point offset be
869
+ // its corresponding code point.
870
+ var offset = 0;
871
+ var code_point_offset = 0;
872
+ var idx = index('gb18030-ranges');
873
+ var i;
874
+ for (i = 0; i < idx.length; ++i) {
875
+ /** @type {!Array.<number>} */
876
+ var entry = idx[i];
877
+ if (entry[0] <= pointer) {
878
+ offset = entry[0];
879
+ code_point_offset = entry[1];
880
+ } else {
881
+ break;
882
+ }
883
+ }
884
+
885
+ // 4. Return a code point whose value is code point offset +
886
+ // pointer − offset.
887
+ return code_point_offset + pointer - offset;
888
+ }
889
+
890
+ /**
891
+ * @param {number} code_point The |code point| to locate in the gb18030 index.
892
+ * @return {number} The first pointer corresponding to |code point| in the
893
+ * gb18030 index.
894
+ */
895
+ function indexGB18030RangesPointerFor(code_point) {
896
+ // 1. If code point is U+E7C7, return pointer 7457.
897
+ if (code_point === 0xE7C7) return 7457;
898
+
899
+ // 2. Let offset be the last code point in index gb18030 ranges
900
+ // that is equal to or less than code point and let pointer offset
901
+ // be its corresponding pointer.
902
+ var offset = 0;
903
+ var pointer_offset = 0;
904
+ var idx = index('gb18030-ranges');
905
+ var i;
906
+ for (i = 0; i < idx.length; ++i) {
907
+ /** @type {!Array.<number>} */
908
+ var entry = idx[i];
909
+ if (entry[1] <= code_point) {
910
+ offset = entry[1];
911
+ pointer_offset = entry[0];
912
+ } else {
913
+ break;
914
+ }
915
+ }
916
+
917
+ // 3. Return a pointer whose value is pointer offset + code point
918
+ // − offset.
919
+ return pointer_offset + code_point - offset;
920
+ }
921
+
922
+ /**
923
+ * @param {number} code_point The |code_point| to search for in the Shift_JIS
924
+ * index.
925
+ * @return {?number} The code point corresponding to |pointer| in |index|,
926
+ * or null if |code point| is not in the Shift_JIS index.
927
+ */
928
+ function indexShiftJISPointerFor(code_point) {
929
+ // 1. Let index be index jis0208 excluding all entries whose
930
+ // pointer is in the range 8272 to 8835, inclusive.
931
+ shift_jis_index = shift_jis_index ||
932
+ index('jis0208').map(function(code_point, pointer) {
933
+ return inRange(pointer, 8272, 8835) ? null : code_point;
934
+ });
935
+ var index_ = shift_jis_index;
936
+
937
+ // 2. Return the index pointer for code point in index.
938
+ return index_.indexOf(code_point);
939
+ }
940
+ var shift_jis_index;
941
+
942
+ /**
943
+ * @param {number} code_point The |code_point| to search for in the big5
944
+ * index.
945
+ * @return {?number} The code point corresponding to |pointer| in |index|,
946
+ * or null if |code point| is not in the big5 index.
947
+ */
948
+ function indexBig5PointerFor(code_point) {
949
+ // 1. Let index be index Big5 excluding all entries whose pointer
950
+ big5_index_no_hkscs = big5_index_no_hkscs ||
951
+ index('big5').map(function(code_point, pointer) {
952
+ return (pointer < (0xA1 - 0x81) * 157) ? null : code_point;
953
+ });
954
+ var index_ = big5_index_no_hkscs;
955
+
956
+ // 2. If code point is U+2550, U+255E, U+2561, U+256A, U+5341, or
957
+ // U+5345, return the last pointer corresponding to code point in
958
+ // index.
959
+ if (code_point === 0x2550 || code_point === 0x255E ||
960
+ code_point === 0x2561 || code_point === 0x256A ||
961
+ code_point === 0x5341 || code_point === 0x5345) {
962
+ return index_.lastIndexOf(code_point);
963
+ }
964
+
965
+ // 3. Return the index pointer for code point in index.
966
+ return indexPointerFor(code_point, index_);
967
+ }
968
+ var big5_index_no_hkscs;
969
+
970
+ //
971
+ // 8. API
972
+ //
973
+
974
+ /** @const */ var DEFAULT_ENCODING = 'utf-8';
975
+
976
+ // 8.1 Interface TextDecoder
977
+
978
+ /**
979
+ * @constructor
980
+ * @param {string=} label The label of the encoding;
981
+ * defaults to 'utf-8'.
982
+ * @param {Object=} options
983
+ */
984
+ function TextDecoder(label, options) {
985
+ // Web IDL conventions
986
+ if (!(this instanceof TextDecoder))
987
+ throw TypeError('Called as a function. Did you forget \'new\'?');
988
+ label = label !== undefined ? String(label) : DEFAULT_ENCODING;
989
+ options = ToDictionary(options);
990
+
991
+ // A TextDecoder object has an associated encoding, decoder,
992
+ // stream, ignore BOM flag (initially unset), BOM seen flag
993
+ // (initially unset), error mode (initially replacement), and do
994
+ // not flush flag (initially unset).
995
+
996
+ /** @private */
997
+ this._encoding = null;
998
+ /** @private @type {?Decoder} */
999
+ this._decoder = null;
1000
+ /** @private @type {boolean} */
1001
+ this._ignoreBOM = false;
1002
+ /** @private @type {boolean} */
1003
+ this._BOMseen = false;
1004
+ /** @private @type {string} */
1005
+ this._error_mode = 'replacement';
1006
+ /** @private @type {boolean} */
1007
+ this._do_not_flush = false;
1008
+
1009
+
1010
+ // 1. Let encoding be the result of getting an encoding from
1011
+ // label.
1012
+ var encoding = getEncoding(label);
1013
+
1014
+ // 2. If encoding is failure or replacement, throw a RangeError.
1015
+ if (encoding === null || encoding.name === 'replacement')
1016
+ throw RangeError('Unknown encoding: ' + label);
1017
+ if (!decoders[encoding.name]) {
1018
+ throw Error('Decoder not present.' +
1019
+ ' Did you forget to include encoding-indexes.js first?');
1020
+ }
1021
+
1022
+ // 3. Let dec be a new TextDecoder object.
1023
+ var dec = this;
1024
+
1025
+ // 4. Set dec's encoding to encoding.
1026
+ dec._encoding = encoding;
1027
+
1028
+ // 5. If options's fatal member is true, set dec's error mode to
1029
+ // fatal.
1030
+ if (Boolean(options['fatal']))
1031
+ dec._error_mode = 'fatal';
1032
+
1033
+ // 6. If options's ignoreBOM member is true, set dec's ignore BOM
1034
+ // flag.
1035
+ if (Boolean(options['ignoreBOM']))
1036
+ dec._ignoreBOM = true;
1037
+
1038
+ // For pre-ES5 runtimes:
1039
+ if (!Object.defineProperty) {
1040
+ this.encoding = dec._encoding.name.toLowerCase();
1041
+ this.fatal = dec._error_mode === 'fatal';
1042
+ this.ignoreBOM = dec._ignoreBOM;
1043
+ }
1044
+
1045
+ // 7. Return dec.
1046
+ return dec;
1047
+ }
1048
+
1049
+ if (Object.defineProperty) {
1050
+ // The encoding attribute's getter must return encoding's name.
1051
+ Object.defineProperty(TextDecoder.prototype, 'encoding', {
1052
+ /** @this {TextDecoder} */
1053
+ get: function() { return this._encoding.name.toLowerCase(); }
1054
+ });
1055
+
1056
+ // The fatal attribute's getter must return true if error mode
1057
+ // is fatal, and false otherwise.
1058
+ Object.defineProperty(TextDecoder.prototype, 'fatal', {
1059
+ /** @this {TextDecoder} */
1060
+ get: function() { return this._error_mode === 'fatal'; }
1061
+ });
1062
+
1063
+ // The ignoreBOM attribute's getter must return true if ignore
1064
+ // BOM flag is set, and false otherwise.
1065
+ Object.defineProperty(TextDecoder.prototype, 'ignoreBOM', {
1066
+ /** @this {TextDecoder} */
1067
+ get: function() { return this._ignoreBOM; }
1068
+ });
1069
+ }
1070
+
1071
+ /**
1072
+ * @param {BufferSource=} input The buffer of bytes to decode.
1073
+ * @param {Object=} options
1074
+ * @return {string} The decoded string.
1075
+ */
1076
+ TextDecoder.prototype.decode = function decode(input, options) {
1077
+ var bytes;
1078
+ if (typeof input === 'object' && input instanceof ArrayBuffer) {
1079
+ bytes = new Uint8Array(input);
1080
+ } else if (typeof input === 'object' && 'buffer' in input &&
1081
+ input.buffer instanceof ArrayBuffer) {
1082
+ bytes = new Uint8Array(input.buffer,
1083
+ input.byteOffset,
1084
+ input.byteLength);
1085
+ } else {
1086
+ bytes = new Uint8Array(0);
1087
+ }
1088
+
1089
+ options = ToDictionary(options);
1090
+
1091
+ // 1. If the do not flush flag is unset, set decoder to a new
1092
+ // encoding's decoder, set stream to a new stream, and unset the
1093
+ // BOM seen flag.
1094
+ if (!this._do_not_flush) {
1095
+ this._decoder = decoders[this._encoding.name]({
1096
+ fatal: this._error_mode === 'fatal'});
1097
+ this._BOMseen = false;
1098
+ }
1099
+
1100
+ // 2. If options's stream is true, set the do not flush flag, and
1101
+ // unset the do not flush flag otherwise.
1102
+ this._do_not_flush = Boolean(options['stream']);
1103
+
1104
+ // 3. If input is given, push a copy of input to stream.
1105
+ // TODO: Align with spec algorithm - maintain stream on instance.
1106
+ var input_stream = new Stream(bytes);
1107
+
1108
+ // 4. Let output be a new stream.
1109
+ var output = [];
1110
+
1111
+ /** @type {?(number|!Array.<number>)} */
1112
+ var result;
1113
+
1114
+ // 5. While true:
1115
+ while (true) {
1116
+ // 1. Let token be the result of reading from stream.
1117
+ var token = input_stream.read();
1118
+
1119
+ // 2. If token is end-of-stream and the do not flush flag is
1120
+ // set, return output, serialized.
1121
+ // TODO: Align with spec algorithm.
1122
+ if (token === end_of_stream)
1123
+ break;
1124
+
1125
+ // 3. Otherwise, run these subsubsteps:
1126
+
1127
+ // 1. Let result be the result of processing token for decoder,
1128
+ // stream, output, and error mode.
1129
+ result = this._decoder.handler(input_stream, token);
1130
+
1131
+ // 2. If result is finished, return output, serialized.
1132
+ if (result === finished)
1133
+ break;
1134
+
1135
+ if (result !== null) {
1136
+ if (Array.isArray(result))
1137
+ output.push.apply(output, /**@type {!Array.<number>}*/(result));
1138
+ else
1139
+ output.push(result);
1140
+ }
1141
+
1142
+ // 3. Otherwise, if result is error, throw a TypeError.
1143
+ // (Thrown in handler)
1144
+
1145
+ // 4. Otherwise, do nothing.
1146
+ }
1147
+ // TODO: Align with spec algorithm.
1148
+ if (!this._do_not_flush) {
1149
+ do {
1150
+ result = this._decoder.handler(input_stream, input_stream.read());
1151
+ if (result === finished)
1152
+ break;
1153
+ if (result === null)
1154
+ continue;
1155
+ if (Array.isArray(result))
1156
+ output.push.apply(output, /**@type {!Array.<number>}*/(result));
1157
+ else
1158
+ output.push(result);
1159
+ } while (!input_stream.endOfStream());
1160
+ this._decoder = null;
1161
+ }
1162
+
1163
+ // A TextDecoder object also has an associated serialize stream
1164
+ // algorithm...
1165
+ /**
1166
+ * @param {!Array.<number>} stream
1167
+ * @return {string}
1168
+ * @this {TextDecoder}
1169
+ */
1170
+ function serializeStream(stream) {
1171
+ // 1. Let token be the result of reading from stream.
1172
+ // (Done in-place on array, rather than as a stream)
1173
+
1174
+ // 2. If encoding is UTF-8, UTF-16BE, or UTF-16LE, and ignore
1175
+ // BOM flag and BOM seen flag are unset, run these subsubsteps:
1176
+ if (includes(['UTF-8', 'UTF-16LE', 'UTF-16BE'], this._encoding.name) &&
1177
+ !this._ignoreBOM && !this._BOMseen) {
1178
+ if (stream.length > 0 && stream[0] === 0xFEFF) {
1179
+ // 1. If token is U+FEFF, set BOM seen flag.
1180
+ this._BOMseen = true;
1181
+ stream.shift();
1182
+ } else if (stream.length > 0) {
1183
+ // 2. Otherwise, if token is not end-of-stream, set BOM seen
1184
+ // flag and append token to stream.
1185
+ this._BOMseen = true;
1186
+ } else {
1187
+ // 3. Otherwise, if token is not end-of-stream, append token
1188
+ // to output.
1189
+ // (no-op)
1190
+ }
1191
+ }
1192
+ // 4. Otherwise, return output.
1193
+ return codePointsToString(stream);
1194
+ }
1195
+
1196
+ return serializeStream.call(this, output);
1197
+ };
1198
+
1199
+ // 8.2 Interface TextEncoder
1200
+
1201
+ /**
1202
+ * @constructor
1203
+ * @param {string=} label The label of the encoding. NONSTANDARD.
1204
+ * @param {Object=} options NONSTANDARD.
1205
+ */
1206
+ function TextEncoder(label, options) {
1207
+ // Web IDL conventions
1208
+ if (!(this instanceof TextEncoder))
1209
+ throw TypeError('Called as a function. Did you forget \'new\'?');
1210
+ options = ToDictionary(options);
1211
+
1212
+ // A TextEncoder object has an associated encoding and encoder.
1213
+
1214
+ /** @private */
1215
+ this._encoding = null;
1216
+ /** @private @type {?Encoder} */
1217
+ this._encoder = null;
1218
+
1219
+ // Non-standard
1220
+ /** @private @type {boolean} */
1221
+ this._do_not_flush = false;
1222
+ /** @private @type {string} */
1223
+ this._fatal = Boolean(options['fatal']) ? 'fatal' : 'replacement';
1224
+
1225
+ // 1. Let enc be a new TextEncoder object.
1226
+ var enc = this;
1227
+
1228
+ // 2. Set enc's encoding to UTF-8's encoder.
1229
+ if (Boolean(options['NONSTANDARD_allowLegacyEncoding'])) {
1230
+ // NONSTANDARD behavior.
1231
+ label = label !== undefined ? String(label) : DEFAULT_ENCODING;
1232
+ var encoding = getEncoding(label);
1233
+ if (encoding === null || encoding.name === 'replacement')
1234
+ throw RangeError('Unknown encoding: ' + label);
1235
+ if (!encoders[encoding.name]) {
1236
+ throw Error('Encoder not present.' +
1237
+ ' Did you forget to include encoding-indexes.js first?');
1238
+ }
1239
+ enc._encoding = encoding;
1240
+ } else {
1241
+ // Standard behavior.
1242
+ enc._encoding = getEncoding('utf-8');
1243
+
1244
+ if (label !== undefined && 'console' in global) {
1245
+ console.warn('TextEncoder constructor called with encoding label, '
1246
+ + 'which is ignored.');
1247
+ }
1248
+ }
1249
+
1250
+ // For pre-ES5 runtimes:
1251
+ if (!Object.defineProperty)
1252
+ this.encoding = enc._encoding.name.toLowerCase();
1253
+
1254
+ // 3. Return enc.
1255
+ return enc;
1256
+ }
1257
+
1258
+ if (Object.defineProperty) {
1259
+ // The encoding attribute's getter must return encoding's name.
1260
+ Object.defineProperty(TextEncoder.prototype, 'encoding', {
1261
+ /** @this {TextEncoder} */
1262
+ get: function() { return this._encoding.name.toLowerCase(); }
1263
+ });
1264
+ }
1265
+
1266
+ /**
1267
+ * @param {string=} opt_string The string to encode.
1268
+ * @param {Object=} options
1269
+ * @return {!Uint8Array} Encoded bytes, as a Uint8Array.
1270
+ */
1271
+ TextEncoder.prototype.encode = function encode(opt_string, options) {
1272
+ opt_string = opt_string === undefined ? '' : String(opt_string);
1273
+ options = ToDictionary(options);
1274
+
1275
+ // NOTE: This option is nonstandard. None of the encodings
1276
+ // permitted for encoding (i.e. UTF-8, UTF-16) are stateful when
1277
+ // the input is a USVString so streaming is not necessary.
1278
+ if (!this._do_not_flush)
1279
+ this._encoder = encoders[this._encoding.name]({
1280
+ fatal: this._fatal === 'fatal'});
1281
+ this._do_not_flush = Boolean(options['stream']);
1282
+
1283
+ // 1. Convert input to a stream.
1284
+ var input = new Stream(stringToCodePoints(opt_string));
1285
+
1286
+ // 2. Let output be a new stream
1287
+ var output = [];
1288
+
1289
+ /** @type {?(number|!Array.<number>)} */
1290
+ var result;
1291
+ // 3. While true, run these substeps:
1292
+ while (true) {
1293
+ // 1. Let token be the result of reading from input.
1294
+ var token = input.read();
1295
+ if (token === end_of_stream)
1296
+ break;
1297
+ // 2. Let result be the result of processing token for encoder,
1298
+ // input, output.
1299
+ result = this._encoder.handler(input, token);
1300
+ if (result === finished)
1301
+ break;
1302
+ if (Array.isArray(result))
1303
+ output.push.apply(output, /**@type {!Array.<number>}*/(result));
1304
+ else
1305
+ output.push(result);
1306
+ }
1307
+ // TODO: Align with spec algorithm.
1308
+ if (!this._do_not_flush) {
1309
+ while (true) {
1310
+ result = this._encoder.handler(input, input.read());
1311
+ if (result === finished)
1312
+ break;
1313
+ if (Array.isArray(result))
1314
+ output.push.apply(output, /**@type {!Array.<number>}*/(result));
1315
+ else
1316
+ output.push(result);
1317
+ }
1318
+ this._encoder = null;
1319
+ }
1320
+ // 3. If result is finished, convert output into a byte sequence,
1321
+ // and then return a Uint8Array object wrapping an ArrayBuffer
1322
+ // containing output.
1323
+ return new Uint8Array(output);
1324
+ };
1325
+
1326
+
1327
+ //
1328
+ // 9. The encoding
1329
+ //
1330
+
1331
+ // 9.1 utf-8
1332
+
1333
+ // 9.1.1 utf-8 decoder
1334
+ /**
1335
+ * @constructor
1336
+ * @implements {Decoder}
1337
+ * @param {{fatal: boolean}} options
1338
+ */
1339
+ function UTF8Decoder(options) {
1340
+ var fatal = options.fatal;
1341
+
1342
+ // utf-8's decoder's has an associated utf-8 code point, utf-8
1343
+ // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8
1344
+ // lower boundary (initially 0x80), and a utf-8 upper boundary
1345
+ // (initially 0xBF).
1346
+ var /** @type {number} */ utf8_code_point = 0,
1347
+ /** @type {number} */ utf8_bytes_seen = 0,
1348
+ /** @type {number} */ utf8_bytes_needed = 0,
1349
+ /** @type {number} */ utf8_lower_boundary = 0x80,
1350
+ /** @type {number} */ utf8_upper_boundary = 0xBF;
1351
+
1352
+ /**
1353
+ * @param {Stream} stream The stream of bytes being decoded.
1354
+ * @param {number} bite The next byte read from the stream.
1355
+ * @return {?(number|!Array.<number>)} The next code point(s)
1356
+ * decoded, or null if not enough data exists in the input
1357
+ * stream to decode a complete code point.
1358
+ */
1359
+ this.handler = function(stream, bite) {
1360
+ // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,
1361
+ // set utf-8 bytes needed to 0 and return error.
1362
+ if (bite === end_of_stream && utf8_bytes_needed !== 0) {
1363
+ utf8_bytes_needed = 0;
1364
+ return decoderError(fatal);
1365
+ }
1366
+
1367
+ // 2. If byte is end-of-stream, return finished.
1368
+ if (bite === end_of_stream)
1369
+ return finished;
1370
+
1371
+ // 3. If utf-8 bytes needed is 0, based on byte:
1372
+ if (utf8_bytes_needed === 0) {
1373
+
1374
+ // 0x00 to 0x7F
1375
+ if (inRange(bite, 0x00, 0x7F)) {
1376
+ // Return a code point whose value is byte.
1377
+ return bite;
1378
+ }
1379
+
1380
+ // 0xC2 to 0xDF
1381
+ else if (inRange(bite, 0xC2, 0xDF)) {
1382
+ // 1. Set utf-8 bytes needed to 1.
1383
+ utf8_bytes_needed = 1;
1384
+
1385
+ // 2. Set UTF-8 code point to byte & 0x1F.
1386
+ utf8_code_point = bite & 0x1F;
1387
+ }
1388
+
1389
+ // 0xE0 to 0xEF
1390
+ else if (inRange(bite, 0xE0, 0xEF)) {
1391
+ // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.
1392
+ if (bite === 0xE0)
1393
+ utf8_lower_boundary = 0xA0;
1394
+ // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.
1395
+ if (bite === 0xED)
1396
+ utf8_upper_boundary = 0x9F;
1397
+ // 3. Set utf-8 bytes needed to 2.
1398
+ utf8_bytes_needed = 2;
1399
+ // 4. Set UTF-8 code point to byte & 0xF.
1400
+ utf8_code_point = bite & 0xF;
1401
+ }
1402
+
1403
+ // 0xF0 to 0xF4
1404
+ else if (inRange(bite, 0xF0, 0xF4)) {
1405
+ // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.
1406
+ if (bite === 0xF0)
1407
+ utf8_lower_boundary = 0x90;
1408
+ // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.
1409
+ if (bite === 0xF4)
1410
+ utf8_upper_boundary = 0x8F;
1411
+ // 3. Set utf-8 bytes needed to 3.
1412
+ utf8_bytes_needed = 3;
1413
+ // 4. Set UTF-8 code point to byte & 0x7.
1414
+ utf8_code_point = bite & 0x7;
1415
+ }
1416
+
1417
+ // Otherwise
1418
+ else {
1419
+ // Return error.
1420
+ return decoderError(fatal);
1421
+ }
1422
+
1423
+ // Return continue.
1424
+ return null;
1425
+ }
1426
+
1427
+ // 4. If byte is not in the range utf-8 lower boundary to utf-8
1428
+ // upper boundary, inclusive, run these substeps:
1429
+ if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {
1430
+
1431
+ // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8
1432
+ // bytes seen to 0, set utf-8 lower boundary to 0x80, and set
1433
+ // utf-8 upper boundary to 0xBF.
1434
+ utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
1435
+ utf8_lower_boundary = 0x80;
1436
+ utf8_upper_boundary = 0xBF;
1437
+
1438
+ // 2. Prepend byte to stream.
1439
+ stream.prepend(bite);
1440
+
1441
+ // 3. Return error.
1442
+ return decoderError(fatal);
1443
+ }
1444
+
1445
+ // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary
1446
+ // to 0xBF.
1447
+ utf8_lower_boundary = 0x80;
1448
+ utf8_upper_boundary = 0xBF;
1449
+
1450
+ // 6. Set UTF-8 code point to (UTF-8 code point << 6) | (byte &
1451
+ // 0x3F)
1452
+ utf8_code_point = (utf8_code_point << 6) | (bite & 0x3F);
1453
+
1454
+ // 7. Increase utf-8 bytes seen by one.
1455
+ utf8_bytes_seen += 1;
1456
+
1457
+ // 8. If utf-8 bytes seen is not equal to utf-8 bytes needed,
1458
+ // continue.
1459
+ if (utf8_bytes_seen !== utf8_bytes_needed)
1460
+ return null;
1461
+
1462
+ // 9. Let code point be utf-8 code point.
1463
+ var code_point = utf8_code_point;
1464
+
1465
+ // 10. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes
1466
+ // seen to 0.
1467
+ utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
1468
+
1469
+ // 11. Return a code point whose value is code point.
1470
+ return code_point;
1471
+ };
1472
+ }
1473
+
1474
+ // 9.1.2 utf-8 encoder
1475
+ /**
1476
+ * @constructor
1477
+ * @implements {Encoder}
1478
+ * @param {{fatal: boolean}} options
1479
+ */
1480
+ function UTF8Encoder(options) {
1481
+ var fatal = options.fatal;
1482
+ /**
1483
+ * @param {Stream} stream Input stream.
1484
+ * @param {number} code_point Next code point read from the stream.
1485
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
1486
+ */
1487
+ this.handler = function(stream, code_point) {
1488
+ // 1. If code point is end-of-stream, return finished.
1489
+ if (code_point === end_of_stream)
1490
+ return finished;
1491
+
1492
+ // 2. If code point is an ASCII code point, return a byte whose
1493
+ // value is code point.
1494
+ if (isASCIICodePoint(code_point))
1495
+ return code_point;
1496
+
1497
+ // 3. Set count and offset based on the range code point is in:
1498
+ var count, offset;
1499
+ // U+0080 to U+07FF, inclusive:
1500
+ if (inRange(code_point, 0x0080, 0x07FF)) {
1501
+ // 1 and 0xC0
1502
+ count = 1;
1503
+ offset = 0xC0;
1504
+ }
1505
+ // U+0800 to U+FFFF, inclusive:
1506
+ else if (inRange(code_point, 0x0800, 0xFFFF)) {
1507
+ // 2 and 0xE0
1508
+ count = 2;
1509
+ offset = 0xE0;
1510
+ }
1511
+ // U+10000 to U+10FFFF, inclusive:
1512
+ else if (inRange(code_point, 0x10000, 0x10FFFF)) {
1513
+ // 3 and 0xF0
1514
+ count = 3;
1515
+ offset = 0xF0;
1516
+ }
1517
+
1518
+ // 4. Let bytes be a byte sequence whose first byte is (code
1519
+ // point >> (6 × count)) + offset.
1520
+ var bytes = [(code_point >> (6 * count)) + offset];
1521
+
1522
+ // 5. Run these substeps while count is greater than 0:
1523
+ while (count > 0) {
1524
+
1525
+ // 1. Set temp to code point >> (6 × (count − 1)).
1526
+ var temp = code_point >> (6 * (count - 1));
1527
+
1528
+ // 2. Append to bytes 0x80 | (temp & 0x3F).
1529
+ bytes.push(0x80 | (temp & 0x3F));
1530
+
1531
+ // 3. Decrease count by one.
1532
+ count -= 1;
1533
+ }
1534
+
1535
+ // 6. Return bytes bytes, in order.
1536
+ return bytes;
1537
+ };
1538
+ }
1539
+
1540
+ /** @param {{fatal: boolean}} options */
1541
+ encoders['UTF-8'] = function(options) {
1542
+ return new UTF8Encoder(options);
1543
+ };
1544
+ /** @param {{fatal: boolean}} options */
1545
+ decoders['UTF-8'] = function(options) {
1546
+ return new UTF8Decoder(options);
1547
+ };
1548
+
1549
+ //
1550
+ // 10. Legacy single-byte encodings
1551
+ //
1552
+
1553
+ // 10.1 single-byte decoder
1554
+ /**
1555
+ * @constructor
1556
+ * @implements {Decoder}
1557
+ * @param {!Array.<number>} index The encoding index.
1558
+ * @param {{fatal: boolean}} options
1559
+ */
1560
+ function SingleByteDecoder(index, options) {
1561
+ var fatal = options.fatal;
1562
+ /**
1563
+ * @param {Stream} stream The stream of bytes being decoded.
1564
+ * @param {number} bite The next byte read from the stream.
1565
+ * @return {?(number|!Array.<number>)} The next code point(s)
1566
+ * decoded, or null if not enough data exists in the input
1567
+ * stream to decode a complete code point.
1568
+ */
1569
+ this.handler = function(stream, bite) {
1570
+ // 1. If byte is end-of-stream, return finished.
1571
+ if (bite === end_of_stream)
1572
+ return finished;
1573
+
1574
+ // 2. If byte is an ASCII byte, return a code point whose value
1575
+ // is byte.
1576
+ if (isASCIIByte(bite))
1577
+ return bite;
1578
+
1579
+ // 3. Let code point be the index code point for byte − 0x80 in
1580
+ // index single-byte.
1581
+ var code_point = index[bite - 0x80];
1582
+
1583
+ // 4. If code point is null, return error.
1584
+ if (code_point === null)
1585
+ return decoderError(fatal);
1586
+
1587
+ // 5. Return a code point whose value is code point.
1588
+ return code_point;
1589
+ };
1590
+ }
1591
+
1592
+ // 10.2 single-byte encoder
1593
+ /**
1594
+ * @constructor
1595
+ * @implements {Encoder}
1596
+ * @param {!Array.<?number>} index The encoding index.
1597
+ * @param {{fatal: boolean}} options
1598
+ */
1599
+ function SingleByteEncoder(index, options) {
1600
+ var fatal = options.fatal;
1601
+ /**
1602
+ * @param {Stream} stream Input stream.
1603
+ * @param {number} code_point Next code point read from the stream.
1604
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
1605
+ */
1606
+ this.handler = function(stream, code_point) {
1607
+ // 1. If code point is end-of-stream, return finished.
1608
+ if (code_point === end_of_stream)
1609
+ return finished;
1610
+
1611
+ // 2. If code point is an ASCII code point, return a byte whose
1612
+ // value is code point.
1613
+ if (isASCIICodePoint(code_point))
1614
+ return code_point;
1615
+
1616
+ // 3. Let pointer be the index pointer for code point in index
1617
+ // single-byte.
1618
+ var pointer = indexPointerFor(code_point, index);
1619
+
1620
+ // 4. If pointer is null, return error with code point.
1621
+ if (pointer === null)
1622
+ encoderError(code_point);
1623
+
1624
+ // 5. Return a byte whose value is pointer + 0x80.
1625
+ return pointer + 0x80;
1626
+ };
1627
+ }
1628
+
1629
+ (function() {
1630
+ if (!('encoding-indexes' in global))
1631
+ return;
1632
+ encodings.forEach(function(category) {
1633
+ if (category.heading !== 'Legacy single-byte encodings')
1634
+ return;
1635
+ category.encodings.forEach(function(encoding) {
1636
+ var name = encoding.name;
1637
+ var idx = index(name.toLowerCase());
1638
+ /** @param {{fatal: boolean}} options */
1639
+ decoders[name] = function(options) {
1640
+ return new SingleByteDecoder(idx, options);
1641
+ };
1642
+ /** @param {{fatal: boolean}} options */
1643
+ encoders[name] = function(options) {
1644
+ return new SingleByteEncoder(idx, options);
1645
+ };
1646
+ });
1647
+ });
1648
+ }());
1649
+
1650
+ //
1651
+ // 11. Legacy multi-byte Chinese (simplified) encodings
1652
+ //
1653
+
1654
+ // 11.1 gbk
1655
+
1656
+ // 11.1.1 gbk decoder
1657
+ // gbk's decoder is gb18030's decoder.
1658
+ /** @param {{fatal: boolean}} options */
1659
+ decoders['GBK'] = function(options) {
1660
+ return new GB18030Decoder(options);
1661
+ };
1662
+
1663
+ // 11.1.2 gbk encoder
1664
+ // gbk's encoder is gb18030's encoder with its gbk flag set.
1665
+ /** @param {{fatal: boolean}} options */
1666
+ encoders['GBK'] = function(options) {
1667
+ return new GB18030Encoder(options, true);
1668
+ };
1669
+
1670
+ // 11.2 gb18030
1671
+ // 11.2.1 gb18030 decoder
1672
+ /**
1673
+ * @constructor
1674
+ * @implements {Decoder}
1675
+ * @param {{fatal: boolean}} options
1676
+ */
1677
+ function GB18030Decoder(options) {
1678
+ var fatal = options.fatal;
1679
+ // gb18030's decoder has an associated gb18030 first, gb18030
1680
+ // second, and gb18030 third (all initially 0x00).
1681
+ var /** @type {number} */ gb18030_first = 0x00,
1682
+ /** @type {number} */ gb18030_second = 0x00,
1683
+ /** @type {number} */ gb18030_third = 0x00;
1684
+ /**
1685
+ * @param {Stream} stream The stream of bytes being decoded.
1686
+ * @param {number} bite The next byte read from the stream.
1687
+ * @return {?(number|!Array.<number>)} The next code point(s)
1688
+ * decoded, or null if not enough data exists in the input
1689
+ * stream to decode a complete code point.
1690
+ */
1691
+ this.handler = function(stream, bite) {
1692
+ // 1. If byte is end-of-stream and gb18030 first, gb18030
1693
+ // second, and gb18030 third are 0x00, return finished.
1694
+ if (bite === end_of_stream && gb18030_first === 0x00 &&
1695
+ gb18030_second === 0x00 && gb18030_third === 0x00) {
1696
+ return finished;
1697
+ }
1698
+ // 2. If byte is end-of-stream, and gb18030 first, gb18030
1699
+ // second, or gb18030 third is not 0x00, set gb18030 first,
1700
+ // gb18030 second, and gb18030 third to 0x00, and return error.
1701
+ if (bite === end_of_stream &&
1702
+ (gb18030_first !== 0x00 || gb18030_second !== 0x00 ||
1703
+ gb18030_third !== 0x00)) {
1704
+ gb18030_first = 0x00;
1705
+ gb18030_second = 0x00;
1706
+ gb18030_third = 0x00;
1707
+ decoderError(fatal);
1708
+ }
1709
+ var code_point;
1710
+ // 3. If gb18030 third is not 0x00, run these substeps:
1711
+ if (gb18030_third !== 0x00) {
1712
+ // 1. Let code point be null.
1713
+ code_point = null;
1714
+ // 2. If byte is in the range 0x30 to 0x39, inclusive, set
1715
+ // code point to the index gb18030 ranges code point for
1716
+ // (((gb18030 first − 0x81) × 10 + gb18030 second − 0x30) ×
1717
+ // 126 + gb18030 third − 0x81) × 10 + byte − 0x30.
1718
+ if (inRange(bite, 0x30, 0x39)) {
1719
+ code_point = indexGB18030RangesCodePointFor(
1720
+ (((gb18030_first - 0x81) * 10 + gb18030_second - 0x30) * 126 +
1721
+ gb18030_third - 0x81) * 10 + bite - 0x30);
1722
+ }
1723
+
1724
+ // 3. Let buffer be a byte sequence consisting of gb18030
1725
+ // second, gb18030 third, and byte, in order.
1726
+ var buffer = [gb18030_second, gb18030_third, bite];
1727
+
1728
+ // 4. Set gb18030 first, gb18030 second, and gb18030 third to
1729
+ // 0x00.
1730
+ gb18030_first = 0x00;
1731
+ gb18030_second = 0x00;
1732
+ gb18030_third = 0x00;
1733
+
1734
+ // 5. If code point is null, prepend buffer to stream and
1735
+ // return error.
1736
+ if (code_point === null) {
1737
+ stream.prepend(buffer);
1738
+ return decoderError(fatal);
1739
+ }
1740
+
1741
+ // 6. Return a code point whose value is code point.
1742
+ return code_point;
1743
+ }
1744
+
1745
+ // 4. If gb18030 second is not 0x00, run these substeps:
1746
+ if (gb18030_second !== 0x00) {
1747
+
1748
+ // 1. If byte is in the range 0x81 to 0xFE, inclusive, set
1749
+ // gb18030 third to byte and return continue.
1750
+ if (inRange(bite, 0x81, 0xFE)) {
1751
+ gb18030_third = bite;
1752
+ return null;
1753
+ }
1754
+
1755
+ // 2. Prepend gb18030 second followed by byte to stream, set
1756
+ // gb18030 first and gb18030 second to 0x00, and return error.
1757
+ stream.prepend([gb18030_second, bite]);
1758
+ gb18030_first = 0x00;
1759
+ gb18030_second = 0x00;
1760
+ return decoderError(fatal);
1761
+ }
1762
+
1763
+ // 5. If gb18030 first is not 0x00, run these substeps:
1764
+ if (gb18030_first !== 0x00) {
1765
+
1766
+ // 1. If byte is in the range 0x30 to 0x39, inclusive, set
1767
+ // gb18030 second to byte and return continue.
1768
+ if (inRange(bite, 0x30, 0x39)) {
1769
+ gb18030_second = bite;
1770
+ return null;
1771
+ }
1772
+
1773
+ // 2. Let lead be gb18030 first, let pointer be null, and set
1774
+ // gb18030 first to 0x00.
1775
+ var lead = gb18030_first;
1776
+ var pointer = null;
1777
+ gb18030_first = 0x00;
1778
+
1779
+ // 3. Let offset be 0x40 if byte is less than 0x7F and 0x41
1780
+ // otherwise.
1781
+ var offset = bite < 0x7F ? 0x40 : 0x41;
1782
+
1783
+ // 4. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80
1784
+ // to 0xFE, inclusive, set pointer to (lead − 0x81) × 190 +
1785
+ // (byte − offset).
1786
+ if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFE))
1787
+ pointer = (lead - 0x81) * 190 + (bite - offset);
1788
+
1789
+ // 5. Let code point be null if pointer is null and the index
1790
+ // code point for pointer in index gb18030 otherwise.
1791
+ code_point = pointer === null ? null :
1792
+ indexCodePointFor(pointer, index('gb18030'));
1793
+
1794
+ // 6. If code point is null and byte is an ASCII byte, prepend
1795
+ // byte to stream.
1796
+ if (code_point === null && isASCIIByte(bite))
1797
+ stream.prepend(bite);
1798
+
1799
+ // 7. If code point is null, return error.
1800
+ if (code_point === null)
1801
+ return decoderError(fatal);
1802
+
1803
+ // 8. Return a code point whose value is code point.
1804
+ return code_point;
1805
+ }
1806
+
1807
+ // 6. If byte is an ASCII byte, return a code point whose value
1808
+ // is byte.
1809
+ if (isASCIIByte(bite))
1810
+ return bite;
1811
+
1812
+ // 7. If byte is 0x80, return code point U+20AC.
1813
+ if (bite === 0x80)
1814
+ return 0x20AC;
1815
+
1816
+ // 8. If byte is in the range 0x81 to 0xFE, inclusive, set
1817
+ // gb18030 first to byte and return continue.
1818
+ if (inRange(bite, 0x81, 0xFE)) {
1819
+ gb18030_first = bite;
1820
+ return null;
1821
+ }
1822
+
1823
+ // 9. Return error.
1824
+ return decoderError(fatal);
1825
+ };
1826
+ }
1827
+
1828
+ // 11.2.2 gb18030 encoder
1829
+ /**
1830
+ * @constructor
1831
+ * @implements {Encoder}
1832
+ * @param {{fatal: boolean}} options
1833
+ * @param {boolean=} gbk_flag
1834
+ */
1835
+ function GB18030Encoder(options, gbk_flag) {
1836
+ var fatal = options.fatal;
1837
+ // gb18030's decoder has an associated gbk flag (initially unset).
1838
+ /**
1839
+ * @param {Stream} stream Input stream.
1840
+ * @param {number} code_point Next code point read from the stream.
1841
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
1842
+ */
1843
+ this.handler = function(stream, code_point) {
1844
+ // 1. If code point is end-of-stream, return finished.
1845
+ if (code_point === end_of_stream)
1846
+ return finished;
1847
+
1848
+ // 2. If code point is an ASCII code point, return a byte whose
1849
+ // value is code point.
1850
+ if (isASCIICodePoint(code_point))
1851
+ return code_point;
1852
+
1853
+ // 3. If code point is U+E5E5, return error with code point.
1854
+ if (code_point === 0xE5E5)
1855
+ return encoderError(code_point);
1856
+
1857
+ // 4. If the gbk flag is set and code point is U+20AC, return
1858
+ // byte 0x80.
1859
+ if (gbk_flag && code_point === 0x20AC)
1860
+ return 0x80;
1861
+
1862
+ // 5. Let pointer be the index pointer for code point in index
1863
+ // gb18030.
1864
+ var pointer = indexPointerFor(code_point, index('gb18030'));
1865
+
1866
+ // 6. If pointer is not null, run these substeps:
1867
+ if (pointer !== null) {
1868
+
1869
+ // 1. Let lead be floor(pointer / 190) + 0x81.
1870
+ var lead = floor(pointer / 190) + 0x81;
1871
+
1872
+ // 2. Let trail be pointer % 190.
1873
+ var trail = pointer % 190;
1874
+
1875
+ // 3. Let offset be 0x40 if trail is less than 0x3F and 0x41 otherwise.
1876
+ var offset = trail < 0x3F ? 0x40 : 0x41;
1877
+
1878
+ // 4. Return two bytes whose values are lead and trail + offset.
1879
+ return [lead, trail + offset];
1880
+ }
1881
+
1882
+ // 7. If gbk flag is set, return error with code point.
1883
+ if (gbk_flag)
1884
+ return encoderError(code_point);
1885
+
1886
+ // 8. Set pointer to the index gb18030 ranges pointer for code
1887
+ // point.
1888
+ pointer = indexGB18030RangesPointerFor(code_point);
1889
+
1890
+ // 9. Let byte1 be floor(pointer / 10 / 126 / 10).
1891
+ var byte1 = floor(pointer / 10 / 126 / 10);
1892
+
1893
+ // 10. Set pointer to pointer − byte1 × 10 × 126 × 10.
1894
+ pointer = pointer - byte1 * 10 * 126 * 10;
1895
+
1896
+ // 11. Let byte2 be floor(pointer / 10 / 126).
1897
+ var byte2 = floor(pointer / 10 / 126);
1898
+
1899
+ // 12. Set pointer to pointer − byte2 × 10 × 126.
1900
+ pointer = pointer - byte2 * 10 * 126;
1901
+
1902
+ // 13. Let byte3 be floor(pointer / 10).
1903
+ var byte3 = floor(pointer / 10);
1904
+
1905
+ // 14. Let byte4 be pointer − byte3 × 10.
1906
+ var byte4 = pointer - byte3 * 10;
1907
+
1908
+ // 15. Return four bytes whose values are byte1 + 0x81, byte2 +
1909
+ // 0x30, byte3 + 0x81, byte4 + 0x30.
1910
+ return [byte1 + 0x81,
1911
+ byte2 + 0x30,
1912
+ byte3 + 0x81,
1913
+ byte4 + 0x30];
1914
+ };
1915
+ }
1916
+
1917
+ /** @param {{fatal: boolean}} options */
1918
+ encoders['gb18030'] = function(options) {
1919
+ return new GB18030Encoder(options);
1920
+ };
1921
+ /** @param {{fatal: boolean}} options */
1922
+ decoders['gb18030'] = function(options) {
1923
+ return new GB18030Decoder(options);
1924
+ };
1925
+
1926
+
1927
+ //
1928
+ // 12. Legacy multi-byte Chinese (traditional) encodings
1929
+ //
1930
+
1931
+ // 12.1 Big5
1932
+
1933
+ // 12.1.1 Big5 decoder
1934
+ /**
1935
+ * @constructor
1936
+ * @implements {Decoder}
1937
+ * @param {{fatal: boolean}} options
1938
+ */
1939
+ function Big5Decoder(options) {
1940
+ var fatal = options.fatal;
1941
+ // Big5's decoder has an associated Big5 lead (initially 0x00).
1942
+ var /** @type {number} */ Big5_lead = 0x00;
1943
+
1944
+ /**
1945
+ * @param {Stream} stream The stream of bytes being decoded.
1946
+ * @param {number} bite The next byte read from the stream.
1947
+ * @return {?(number|!Array.<number>)} The next code point(s)
1948
+ * decoded, or null if not enough data exists in the input
1949
+ * stream to decode a complete code point.
1950
+ */
1951
+ this.handler = function(stream, bite) {
1952
+ // 1. If byte is end-of-stream and Big5 lead is not 0x00, set
1953
+ // Big5 lead to 0x00 and return error.
1954
+ if (bite === end_of_stream && Big5_lead !== 0x00) {
1955
+ Big5_lead = 0x00;
1956
+ return decoderError(fatal);
1957
+ }
1958
+
1959
+ // 2. If byte is end-of-stream and Big5 lead is 0x00, return
1960
+ // finished.
1961
+ if (bite === end_of_stream && Big5_lead === 0x00)
1962
+ return finished;
1963
+
1964
+ // 3. If Big5 lead is not 0x00, let lead be Big5 lead, let
1965
+ // pointer be null, set Big5 lead to 0x00, and then run these
1966
+ // substeps:
1967
+ if (Big5_lead !== 0x00) {
1968
+ var lead = Big5_lead;
1969
+ var pointer = null;
1970
+ Big5_lead = 0x00;
1971
+
1972
+ // 1. Let offset be 0x40 if byte is less than 0x7F and 0x62
1973
+ // otherwise.
1974
+ var offset = bite < 0x7F ? 0x40 : 0x62;
1975
+
1976
+ // 2. If byte is in the range 0x40 to 0x7E, inclusive, or 0xA1
1977
+ // to 0xFE, inclusive, set pointer to (lead − 0x81) × 157 +
1978
+ // (byte − offset).
1979
+ if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0xA1, 0xFE))
1980
+ pointer = (lead - 0x81) * 157 + (bite - offset);
1981
+
1982
+ // 3. If there is a row in the table below whose first column
1983
+ // is pointer, return the two code points listed in its second
1984
+ // column
1985
+ // Pointer | Code points
1986
+ // --------+--------------
1987
+ // 1133 | U+00CA U+0304
1988
+ // 1135 | U+00CA U+030C
1989
+ // 1164 | U+00EA U+0304
1990
+ // 1166 | U+00EA U+030C
1991
+ switch (pointer) {
1992
+ case 1133: return [0x00CA, 0x0304];
1993
+ case 1135: return [0x00CA, 0x030C];
1994
+ case 1164: return [0x00EA, 0x0304];
1995
+ case 1166: return [0x00EA, 0x030C];
1996
+ }
1997
+
1998
+ // 4. Let code point be null if pointer is null and the index
1999
+ // code point for pointer in index Big5 otherwise.
2000
+ var code_point = (pointer === null) ? null :
2001
+ indexCodePointFor(pointer, index('big5'));
2002
+
2003
+ // 5. If code point is null and byte is an ASCII byte, prepend
2004
+ // byte to stream.
2005
+ if (code_point === null && isASCIIByte(bite))
2006
+ stream.prepend(bite);
2007
+
2008
+ // 6. If code point is null, return error.
2009
+ if (code_point === null)
2010
+ return decoderError(fatal);
2011
+
2012
+ // 7. Return a code point whose value is code point.
2013
+ return code_point;
2014
+ }
2015
+
2016
+ // 4. If byte is an ASCII byte, return a code point whose value
2017
+ // is byte.
2018
+ if (isASCIIByte(bite))
2019
+ return bite;
2020
+
2021
+ // 5. If byte is in the range 0x81 to 0xFE, inclusive, set Big5
2022
+ // lead to byte and return continue.
2023
+ if (inRange(bite, 0x81, 0xFE)) {
2024
+ Big5_lead = bite;
2025
+ return null;
2026
+ }
2027
+
2028
+ // 6. Return error.
2029
+ return decoderError(fatal);
2030
+ };
2031
+ }
2032
+
2033
+ // 12.1.2 Big5 encoder
2034
+ /**
2035
+ * @constructor
2036
+ * @implements {Encoder}
2037
+ * @param {{fatal: boolean}} options
2038
+ */
2039
+ function Big5Encoder(options) {
2040
+ var fatal = options.fatal;
2041
+ /**
2042
+ * @param {Stream} stream Input stream.
2043
+ * @param {number} code_point Next code point read from the stream.
2044
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2045
+ */
2046
+ this.handler = function(stream, code_point) {
2047
+ // 1. If code point is end-of-stream, return finished.
2048
+ if (code_point === end_of_stream)
2049
+ return finished;
2050
+
2051
+ // 2. If code point is an ASCII code point, return a byte whose
2052
+ // value is code point.
2053
+ if (isASCIICodePoint(code_point))
2054
+ return code_point;
2055
+
2056
+ // 3. Let pointer be the index Big5 pointer for code point.
2057
+ var pointer = indexBig5PointerFor(code_point);
2058
+
2059
+ // 4. If pointer is null, return error with code point.
2060
+ if (pointer === null)
2061
+ return encoderError(code_point);
2062
+
2063
+ // 5. Let lead be floor(pointer / 157) + 0x81.
2064
+ var lead = floor(pointer / 157) + 0x81;
2065
+
2066
+ // 6. If lead is less than 0xA1, return error with code point.
2067
+ if (lead < 0xA1)
2068
+ return encoderError(code_point);
2069
+
2070
+ // 7. Let trail be pointer % 157.
2071
+ var trail = pointer % 157;
2072
+
2073
+ // 8. Let offset be 0x40 if trail is less than 0x3F and 0x62
2074
+ // otherwise.
2075
+ var offset = trail < 0x3F ? 0x40 : 0x62;
2076
+
2077
+ // Return two bytes whose values are lead and trail + offset.
2078
+ return [lead, trail + offset];
2079
+ };
2080
+ }
2081
+
2082
+ /** @param {{fatal: boolean}} options */
2083
+ encoders['Big5'] = function(options) {
2084
+ return new Big5Encoder(options);
2085
+ };
2086
+ /** @param {{fatal: boolean}} options */
2087
+ decoders['Big5'] = function(options) {
2088
+ return new Big5Decoder(options);
2089
+ };
2090
+
2091
+
2092
+ //
2093
+ // 13. Legacy multi-byte Japanese encodings
2094
+ //
2095
+
2096
+ // 13.1 euc-jp
2097
+
2098
+ // 13.1.1 euc-jp decoder
2099
+ /**
2100
+ * @constructor
2101
+ * @implements {Decoder}
2102
+ * @param {{fatal: boolean}} options
2103
+ */
2104
+ function EUCJPDecoder(options) {
2105
+ var fatal = options.fatal;
2106
+
2107
+ // euc-jp's decoder has an associated euc-jp jis0212 flag
2108
+ // (initially unset) and euc-jp lead (initially 0x00).
2109
+ var /** @type {boolean} */ eucjp_jis0212_flag = false,
2110
+ /** @type {number} */ eucjp_lead = 0x00;
2111
+
2112
+ /**
2113
+ * @param {Stream} stream The stream of bytes being decoded.
2114
+ * @param {number} bite The next byte read from the stream.
2115
+ * @return {?(number|!Array.<number>)} The next code point(s)
2116
+ * decoded, or null if not enough data exists in the input
2117
+ * stream to decode a complete code point.
2118
+ */
2119
+ this.handler = function(stream, bite) {
2120
+ // 1. If byte is end-of-stream and euc-jp lead is not 0x00, set
2121
+ // euc-jp lead to 0x00, and return error.
2122
+ if (bite === end_of_stream && eucjp_lead !== 0x00) {
2123
+ eucjp_lead = 0x00;
2124
+ return decoderError(fatal);
2125
+ }
2126
+
2127
+ // 2. If byte is end-of-stream and euc-jp lead is 0x00, return
2128
+ // finished.
2129
+ if (bite === end_of_stream && eucjp_lead === 0x00)
2130
+ return finished;
2131
+
2132
+ // 3. If euc-jp lead is 0x8E and byte is in the range 0xA1 to
2133
+ // 0xDF, inclusive, set euc-jp lead to 0x00 and return a code
2134
+ // point whose value is 0xFF61 − 0xA1 + byte.
2135
+ if (eucjp_lead === 0x8E && inRange(bite, 0xA1, 0xDF)) {
2136
+ eucjp_lead = 0x00;
2137
+ return 0xFF61 - 0xA1 + bite;
2138
+ }
2139
+
2140
+ // 4. If euc-jp lead is 0x8F and byte is in the range 0xA1 to
2141
+ // 0xFE, inclusive, set the euc-jp jis0212 flag, set euc-jp lead
2142
+ // to byte, and return continue.
2143
+ if (eucjp_lead === 0x8F && inRange(bite, 0xA1, 0xFE)) {
2144
+ eucjp_jis0212_flag = true;
2145
+ eucjp_lead = bite;
2146
+ return null;
2147
+ }
2148
+
2149
+ // 5. If euc-jp lead is not 0x00, let lead be euc-jp lead, set
2150
+ // euc-jp lead to 0x00, and run these substeps:
2151
+ if (eucjp_lead !== 0x00) {
2152
+ var lead = eucjp_lead;
2153
+ eucjp_lead = 0x00;
2154
+
2155
+ // 1. Let code point be null.
2156
+ var code_point = null;
2157
+
2158
+ // 2. If lead and byte are both in the range 0xA1 to 0xFE,
2159
+ // inclusive, set code point to the index code point for (lead
2160
+ // − 0xA1) × 94 + byte − 0xA1 in index jis0208 if the euc-jp
2161
+ // jis0212 flag is unset and in index jis0212 otherwise.
2162
+ if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {
2163
+ code_point = indexCodePointFor(
2164
+ (lead - 0xA1) * 94 + (bite - 0xA1),
2165
+ index(!eucjp_jis0212_flag ? 'jis0208' : 'jis0212'));
2166
+ }
2167
+
2168
+ // 3. Unset the euc-jp jis0212 flag.
2169
+ eucjp_jis0212_flag = false;
2170
+
2171
+ // 4. If byte is not in the range 0xA1 to 0xFE, inclusive,
2172
+ // prepend byte to stream.
2173
+ if (!inRange(bite, 0xA1, 0xFE))
2174
+ stream.prepend(bite);
2175
+
2176
+ // 5. If code point is null, return error.
2177
+ if (code_point === null)
2178
+ return decoderError(fatal);
2179
+
2180
+ // 6. Return a code point whose value is code point.
2181
+ return code_point;
2182
+ }
2183
+
2184
+ // 6. If byte is an ASCII byte, return a code point whose value
2185
+ // is byte.
2186
+ if (isASCIIByte(bite))
2187
+ return bite;
2188
+
2189
+ // 7. If byte is 0x8E, 0x8F, or in the range 0xA1 to 0xFE,
2190
+ // inclusive, set euc-jp lead to byte and return continue.
2191
+ if (bite === 0x8E || bite === 0x8F || inRange(bite, 0xA1, 0xFE)) {
2192
+ eucjp_lead = bite;
2193
+ return null;
2194
+ }
2195
+
2196
+ // 8. Return error.
2197
+ return decoderError(fatal);
2198
+ };
2199
+ }
2200
+
2201
+ // 13.1.2 euc-jp encoder
2202
+ /**
2203
+ * @constructor
2204
+ * @implements {Encoder}
2205
+ * @param {{fatal: boolean}} options
2206
+ */
2207
+ function EUCJPEncoder(options) {
2208
+ var fatal = options.fatal;
2209
+ /**
2210
+ * @param {Stream} stream Input stream.
2211
+ * @param {number} code_point Next code point read from the stream.
2212
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2213
+ */
2214
+ this.handler = function(stream, code_point) {
2215
+ // 1. If code point is end-of-stream, return finished.
2216
+ if (code_point === end_of_stream)
2217
+ return finished;
2218
+
2219
+ // 2. If code point is an ASCII code point, return a byte whose
2220
+ // value is code point.
2221
+ if (isASCIICodePoint(code_point))
2222
+ return code_point;
2223
+
2224
+ // 3. If code point is U+00A5, return byte 0x5C.
2225
+ if (code_point === 0x00A5)
2226
+ return 0x5C;
2227
+
2228
+ // 4. If code point is U+203E, return byte 0x7E.
2229
+ if (code_point === 0x203E)
2230
+ return 0x7E;
2231
+
2232
+ // 5. If code point is in the range U+FF61 to U+FF9F, inclusive,
2233
+ // return two bytes whose values are 0x8E and code point −
2234
+ // 0xFF61 + 0xA1.
2235
+ if (inRange(code_point, 0xFF61, 0xFF9F))
2236
+ return [0x8E, code_point - 0xFF61 + 0xA1];
2237
+
2238
+ // 6. If code point is U+2212, set it to U+FF0D.
2239
+ if (code_point === 0x2212)
2240
+ code_point = 0xFF0D;
2241
+
2242
+ // 7. Let pointer be the index pointer for code point in index
2243
+ // jis0208.
2244
+ var pointer = indexPointerFor(code_point, index('jis0208'));
2245
+
2246
+ // 8. If pointer is null, return error with code point.
2247
+ if (pointer === null)
2248
+ return encoderError(code_point);
2249
+
2250
+ // 9. Let lead be floor(pointer / 94) + 0xA1.
2251
+ var lead = floor(pointer / 94) + 0xA1;
2252
+
2253
+ // 10. Let trail be pointer % 94 + 0xA1.
2254
+ var trail = pointer % 94 + 0xA1;
2255
+
2256
+ // 11. Return two bytes whose values are lead and trail.
2257
+ return [lead, trail];
2258
+ };
2259
+ }
2260
+
2261
+ /** @param {{fatal: boolean}} options */
2262
+ encoders['EUC-JP'] = function(options) {
2263
+ return new EUCJPEncoder(options);
2264
+ };
2265
+ /** @param {{fatal: boolean}} options */
2266
+ decoders['EUC-JP'] = function(options) {
2267
+ return new EUCJPDecoder(options);
2268
+ };
2269
+
2270
+ // 13.2 iso-2022-jp
2271
+
2272
+ // 13.2.1 iso-2022-jp decoder
2273
+ /**
2274
+ * @constructor
2275
+ * @implements {Decoder}
2276
+ * @param {{fatal: boolean}} options
2277
+ */
2278
+ function ISO2022JPDecoder(options) {
2279
+ var fatal = options.fatal;
2280
+ /** @enum */
2281
+ var states = {
2282
+ ASCII: 0,
2283
+ Roman: 1,
2284
+ Katakana: 2,
2285
+ LeadByte: 3,
2286
+ TrailByte: 4,
2287
+ EscapeStart: 5,
2288
+ Escape: 6
2289
+ };
2290
+ // iso-2022-jp's decoder has an associated iso-2022-jp decoder
2291
+ // state (initially ASCII), iso-2022-jp decoder output state
2292
+ // (initially ASCII), iso-2022-jp lead (initially 0x00), and
2293
+ // iso-2022-jp output flag (initially unset).
2294
+ var /** @type {number} */ iso2022jp_decoder_state = states.ASCII,
2295
+ /** @type {number} */ iso2022jp_decoder_output_state = states.ASCII,
2296
+ /** @type {number} */ iso2022jp_lead = 0x00,
2297
+ /** @type {boolean} */ iso2022jp_output_flag = false;
2298
+ /**
2299
+ * @param {Stream} stream The stream of bytes being decoded.
2300
+ * @param {number} bite The next byte read from the stream.
2301
+ * @return {?(number|!Array.<number>)} The next code point(s)
2302
+ * decoded, or null if not enough data exists in the input
2303
+ * stream to decode a complete code point.
2304
+ */
2305
+ this.handler = function(stream, bite) {
2306
+ // switching on iso-2022-jp decoder state:
2307
+ switch (iso2022jp_decoder_state) {
2308
+ default:
2309
+ case states.ASCII:
2310
+ // ASCII
2311
+ // Based on byte:
2312
+
2313
+ // 0x1B
2314
+ if (bite === 0x1B) {
2315
+ // Set iso-2022-jp decoder state to escape start and return
2316
+ // continue.
2317
+ iso2022jp_decoder_state = states.EscapeStart;
2318
+ return null;
2319
+ }
2320
+
2321
+ // 0x00 to 0x7F, excluding 0x0E, 0x0F, and 0x1B
2322
+ if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E
2323
+ && bite !== 0x0F && bite !== 0x1B) {
2324
+ // Unset the iso-2022-jp output flag and return a code point
2325
+ // whose value is byte.
2326
+ iso2022jp_output_flag = false;
2327
+ return bite;
2328
+ }
2329
+
2330
+ // end-of-stream
2331
+ if (bite === end_of_stream) {
2332
+ // Return finished.
2333
+ return finished;
2334
+ }
2335
+
2336
+ // Otherwise
2337
+ // Unset the iso-2022-jp output flag and return error.
2338
+ iso2022jp_output_flag = false;
2339
+ return decoderError(fatal);
2340
+
2341
+ case states.Roman:
2342
+ // Roman
2343
+ // Based on byte:
2344
+
2345
+ // 0x1B
2346
+ if (bite === 0x1B) {
2347
+ // Set iso-2022-jp decoder state to escape start and return
2348
+ // continue.
2349
+ iso2022jp_decoder_state = states.EscapeStart;
2350
+ return null;
2351
+ }
2352
+
2353
+ // 0x5C
2354
+ if (bite === 0x5C) {
2355
+ // Unset the iso-2022-jp output flag and return code point
2356
+ // U+00A5.
2357
+ iso2022jp_output_flag = false;
2358
+ return 0x00A5;
2359
+ }
2360
+
2361
+ // 0x7E
2362
+ if (bite === 0x7E) {
2363
+ // Unset the iso-2022-jp output flag and return code point
2364
+ // U+203E.
2365
+ iso2022jp_output_flag = false;
2366
+ return 0x203E;
2367
+ }
2368
+
2369
+ // 0x00 to 0x7F, excluding 0x0E, 0x0F, 0x1B, 0x5C, and 0x7E
2370
+ if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E && bite !== 0x0F
2371
+ && bite !== 0x1B && bite !== 0x5C && bite !== 0x7E) {
2372
+ // Unset the iso-2022-jp output flag and return a code point
2373
+ // whose value is byte.
2374
+ iso2022jp_output_flag = false;
2375
+ return bite;
2376
+ }
2377
+
2378
+ // end-of-stream
2379
+ if (bite === end_of_stream) {
2380
+ // Return finished.
2381
+ return finished;
2382
+ }
2383
+
2384
+ // Otherwise
2385
+ // Unset the iso-2022-jp output flag and return error.
2386
+ iso2022jp_output_flag = false;
2387
+ return decoderError(fatal);
2388
+
2389
+ case states.Katakana:
2390
+ // Katakana
2391
+ // Based on byte:
2392
+
2393
+ // 0x1B
2394
+ if (bite === 0x1B) {
2395
+ // Set iso-2022-jp decoder state to escape start and return
2396
+ // continue.
2397
+ iso2022jp_decoder_state = states.EscapeStart;
2398
+ return null;
2399
+ }
2400
+
2401
+ // 0x21 to 0x5F
2402
+ if (inRange(bite, 0x21, 0x5F)) {
2403
+ // Unset the iso-2022-jp output flag and return a code point
2404
+ // whose value is 0xFF61 − 0x21 + byte.
2405
+ iso2022jp_output_flag = false;
2406
+ return 0xFF61 - 0x21 + bite;
2407
+ }
2408
+
2409
+ // end-of-stream
2410
+ if (bite === end_of_stream) {
2411
+ // Return finished.
2412
+ return finished;
2413
+ }
2414
+
2415
+ // Otherwise
2416
+ // Unset the iso-2022-jp output flag and return error.
2417
+ iso2022jp_output_flag = false;
2418
+ return decoderError(fatal);
2419
+
2420
+ case states.LeadByte:
2421
+ // Lead byte
2422
+ // Based on byte:
2423
+
2424
+ // 0x1B
2425
+ if (bite === 0x1B) {
2426
+ // Set iso-2022-jp decoder state to escape start and return
2427
+ // continue.
2428
+ iso2022jp_decoder_state = states.EscapeStart;
2429
+ return null;
2430
+ }
2431
+
2432
+ // 0x21 to 0x7E
2433
+ if (inRange(bite, 0x21, 0x7E)) {
2434
+ // Unset the iso-2022-jp output flag, set iso-2022-jp lead
2435
+ // to byte, iso-2022-jp decoder state to trail byte, and
2436
+ // return continue.
2437
+ iso2022jp_output_flag = false;
2438
+ iso2022jp_lead = bite;
2439
+ iso2022jp_decoder_state = states.TrailByte;
2440
+ return null;
2441
+ }
2442
+
2443
+ // end-of-stream
2444
+ if (bite === end_of_stream) {
2445
+ // Return finished.
2446
+ return finished;
2447
+ }
2448
+
2449
+ // Otherwise
2450
+ // Unset the iso-2022-jp output flag and return error.
2451
+ iso2022jp_output_flag = false;
2452
+ return decoderError(fatal);
2453
+
2454
+ case states.TrailByte:
2455
+ // Trail byte
2456
+ // Based on byte:
2457
+
2458
+ // 0x1B
2459
+ if (bite === 0x1B) {
2460
+ // Set iso-2022-jp decoder state to escape start and return
2461
+ // continue.
2462
+ iso2022jp_decoder_state = states.EscapeStart;
2463
+ return decoderError(fatal);
2464
+ }
2465
+
2466
+ // 0x21 to 0x7E
2467
+ if (inRange(bite, 0x21, 0x7E)) {
2468
+ // 1. Set the iso-2022-jp decoder state to lead byte.
2469
+ iso2022jp_decoder_state = states.LeadByte;
2470
+
2471
+ // 2. Let pointer be (iso-2022-jp lead − 0x21) × 94 + byte − 0x21.
2472
+ var pointer = (iso2022jp_lead - 0x21) * 94 + bite - 0x21;
2473
+
2474
+ // 3. Let code point be the index code point for pointer in
2475
+ // index jis0208.
2476
+ var code_point = indexCodePointFor(pointer, index('jis0208'));
2477
+
2478
+ // 4. If code point is null, return error.
2479
+ if (code_point === null)
2480
+ return decoderError(fatal);
2481
+
2482
+ // 5. Return a code point whose value is code point.
2483
+ return code_point;
2484
+ }
2485
+
2486
+ // end-of-stream
2487
+ if (bite === end_of_stream) {
2488
+ // Set the iso-2022-jp decoder state to lead byte, prepend
2489
+ // byte to stream, and return error.
2490
+ iso2022jp_decoder_state = states.LeadByte;
2491
+ stream.prepend(bite);
2492
+ return decoderError(fatal);
2493
+ }
2494
+
2495
+ // Otherwise
2496
+ // Set iso-2022-jp decoder state to lead byte and return
2497
+ // error.
2498
+ iso2022jp_decoder_state = states.LeadByte;
2499
+ return decoderError(fatal);
2500
+
2501
+ case states.EscapeStart:
2502
+ // Escape start
2503
+
2504
+ // 1. If byte is either 0x24 or 0x28, set iso-2022-jp lead to
2505
+ // byte, iso-2022-jp decoder state to escape, and return
2506
+ // continue.
2507
+ if (bite === 0x24 || bite === 0x28) {
2508
+ iso2022jp_lead = bite;
2509
+ iso2022jp_decoder_state = states.Escape;
2510
+ return null;
2511
+ }
2512
+
2513
+ // 2. Prepend byte to stream.
2514
+ stream.prepend(bite);
2515
+
2516
+ // 3. Unset the iso-2022-jp output flag, set iso-2022-jp
2517
+ // decoder state to iso-2022-jp decoder output state, and
2518
+ // return error.
2519
+ iso2022jp_output_flag = false;
2520
+ iso2022jp_decoder_state = iso2022jp_decoder_output_state;
2521
+ return decoderError(fatal);
2522
+
2523
+ case states.Escape:
2524
+ // Escape
2525
+
2526
+ // 1. Let lead be iso-2022-jp lead and set iso-2022-jp lead to
2527
+ // 0x00.
2528
+ var lead = iso2022jp_lead;
2529
+ iso2022jp_lead = 0x00;
2530
+
2531
+ // 2. Let state be null.
2532
+ var state = null;
2533
+
2534
+ // 3. If lead is 0x28 and byte is 0x42, set state to ASCII.
2535
+ if (lead === 0x28 && bite === 0x42)
2536
+ state = states.ASCII;
2537
+
2538
+ // 4. If lead is 0x28 and byte is 0x4A, set state to Roman.
2539
+ if (lead === 0x28 && bite === 0x4A)
2540
+ state = states.Roman;
2541
+
2542
+ // 5. If lead is 0x28 and byte is 0x49, set state to Katakana.
2543
+ if (lead === 0x28 && bite === 0x49)
2544
+ state = states.Katakana;
2545
+
2546
+ // 6. If lead is 0x24 and byte is either 0x40 or 0x42, set
2547
+ // state to lead byte.
2548
+ if (lead === 0x24 && (bite === 0x40 || bite === 0x42))
2549
+ state = states.LeadByte;
2550
+
2551
+ // 7. If state is non-null, run these substeps:
2552
+ if (state !== null) {
2553
+ // 1. Set iso-2022-jp decoder state and iso-2022-jp decoder
2554
+ // output state to states.
2555
+ iso2022jp_decoder_state = iso2022jp_decoder_state = state;
2556
+
2557
+ // 2. Let output flag be the iso-2022-jp output flag.
2558
+ var output_flag = iso2022jp_output_flag;
2559
+
2560
+ // 3. Set the iso-2022-jp output flag.
2561
+ iso2022jp_output_flag = true;
2562
+
2563
+ // 4. Return continue, if output flag is unset, and error
2564
+ // otherwise.
2565
+ return !output_flag ? null : decoderError(fatal);
2566
+ }
2567
+
2568
+ // 8. Prepend lead and byte to stream.
2569
+ stream.prepend([lead, bite]);
2570
+
2571
+ // 9. Unset the iso-2022-jp output flag, set iso-2022-jp
2572
+ // decoder state to iso-2022-jp decoder output state and
2573
+ // return error.
2574
+ iso2022jp_output_flag = false;
2575
+ iso2022jp_decoder_state = iso2022jp_decoder_output_state;
2576
+ return decoderError(fatal);
2577
+ }
2578
+ };
2579
+ }
2580
+
2581
+ // 13.2.2 iso-2022-jp encoder
2582
+ /**
2583
+ * @constructor
2584
+ * @implements {Encoder}
2585
+ * @param {{fatal: boolean}} options
2586
+ */
2587
+ function ISO2022JPEncoder(options) {
2588
+ var fatal = options.fatal;
2589
+ // iso-2022-jp's encoder has an associated iso-2022-jp encoder
2590
+ // state which is one of ASCII, Roman, and jis0208 (initially
2591
+ // ASCII).
2592
+ /** @enum */
2593
+ var states = {
2594
+ ASCII: 0,
2595
+ Roman: 1,
2596
+ jis0208: 2
2597
+ };
2598
+ var /** @type {number} */ iso2022jp_state = states.ASCII;
2599
+ /**
2600
+ * @param {Stream} stream Input stream.
2601
+ * @param {number} code_point Next code point read from the stream.
2602
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2603
+ */
2604
+ this.handler = function(stream, code_point) {
2605
+ // 1. If code point is end-of-stream and iso-2022-jp encoder
2606
+ // state is not ASCII, prepend code point to stream, set
2607
+ // iso-2022-jp encoder state to ASCII, and return three bytes
2608
+ // 0x1B 0x28 0x42.
2609
+ if (code_point === end_of_stream &&
2610
+ iso2022jp_state !== states.ASCII) {
2611
+ stream.prepend(code_point);
2612
+ iso2022jp_state = states.ASCII;
2613
+ return [0x1B, 0x28, 0x42];
2614
+ }
2615
+
2616
+ // 2. If code point is end-of-stream and iso-2022-jp encoder
2617
+ // state is ASCII, return finished.
2618
+ if (code_point === end_of_stream && iso2022jp_state === states.ASCII)
2619
+ return finished;
2620
+
2621
+ // 3. If ISO-2022-JP encoder state is ASCII or Roman, and code
2622
+ // point is U+000E, U+000F, or U+001B, return error with U+FFFD.
2623
+ if ((iso2022jp_state === states.ASCII ||
2624
+ iso2022jp_state === states.Roman) &&
2625
+ (code_point === 0x000E || code_point === 0x000F ||
2626
+ code_point === 0x001B)) {
2627
+ return encoderError(0xFFFD);
2628
+ }
2629
+
2630
+ // 4. If iso-2022-jp encoder state is ASCII and code point is an
2631
+ // ASCII code point, return a byte whose value is code point.
2632
+ if (iso2022jp_state === states.ASCII &&
2633
+ isASCIICodePoint(code_point))
2634
+ return code_point;
2635
+
2636
+ // 5. If iso-2022-jp encoder state is Roman and code point is an
2637
+ // ASCII code point, excluding U+005C and U+007E, or is U+00A5
2638
+ // or U+203E, run these substeps:
2639
+ if (iso2022jp_state === states.Roman &&
2640
+ ((isASCIICodePoint(code_point) &&
2641
+ code_point !== 0x005C && code_point !== 0x007E) ||
2642
+ (code_point == 0x00A5 || code_point == 0x203E))) {
2643
+
2644
+ // 1. If code point is an ASCII code point, return a byte
2645
+ // whose value is code point.
2646
+ if (isASCIICodePoint(code_point))
2647
+ return code_point;
2648
+
2649
+ // 2. If code point is U+00A5, return byte 0x5C.
2650
+ if (code_point === 0x00A5)
2651
+ return 0x5C;
2652
+
2653
+ // 3. If code point is U+203E, return byte 0x7E.
2654
+ if (code_point === 0x203E)
2655
+ return 0x7E;
2656
+ }
2657
+
2658
+ // 6. If code point is an ASCII code point, and iso-2022-jp
2659
+ // encoder state is not ASCII, prepend code point to stream, set
2660
+ // iso-2022-jp encoder state to ASCII, and return three bytes
2661
+ // 0x1B 0x28 0x42.
2662
+ if (isASCIICodePoint(code_point) &&
2663
+ iso2022jp_state !== states.ASCII) {
2664
+ stream.prepend(code_point);
2665
+ iso2022jp_state = states.ASCII;
2666
+ return [0x1B, 0x28, 0x42];
2667
+ }
2668
+
2669
+ // 7. If code point is either U+00A5 or U+203E, and iso-2022-jp
2670
+ // encoder state is not Roman, prepend code point to stream, set
2671
+ // iso-2022-jp encoder state to Roman, and return three bytes
2672
+ // 0x1B 0x28 0x4A.
2673
+ if ((code_point === 0x00A5 || code_point === 0x203E) &&
2674
+ iso2022jp_state !== states.Roman) {
2675
+ stream.prepend(code_point);
2676
+ iso2022jp_state = states.Roman;
2677
+ return [0x1B, 0x28, 0x4A];
2678
+ }
2679
+
2680
+ // 8. If code point is U+2212, set it to U+FF0D.
2681
+ if (code_point === 0x2212)
2682
+ code_point = 0xFF0D;
2683
+
2684
+ // 9. Let pointer be the index pointer for code point in index
2685
+ // jis0208.
2686
+ var pointer = indexPointerFor(code_point, index('jis0208'));
2687
+
2688
+ // 10. If pointer is null, return error with code point.
2689
+ if (pointer === null)
2690
+ return encoderError(code_point);
2691
+
2692
+ // 11. If iso-2022-jp encoder state is not jis0208, prepend code
2693
+ // point to stream, set iso-2022-jp encoder state to jis0208,
2694
+ // and return three bytes 0x1B 0x24 0x42.
2695
+ if (iso2022jp_state !== states.jis0208) {
2696
+ stream.prepend(code_point);
2697
+ iso2022jp_state = states.jis0208;
2698
+ return [0x1B, 0x24, 0x42];
2699
+ }
2700
+
2701
+ // 12. Let lead be floor(pointer / 94) + 0x21.
2702
+ var lead = floor(pointer / 94) + 0x21;
2703
+
2704
+ // 13. Let trail be pointer % 94 + 0x21.
2705
+ var trail = pointer % 94 + 0x21;
2706
+
2707
+ // 14. Return two bytes whose values are lead and trail.
2708
+ return [lead, trail];
2709
+ };
2710
+ }
2711
+
2712
+ /** @param {{fatal: boolean}} options */
2713
+ encoders['ISO-2022-JP'] = function(options) {
2714
+ return new ISO2022JPEncoder(options);
2715
+ };
2716
+ /** @param {{fatal: boolean}} options */
2717
+ decoders['ISO-2022-JP'] = function(options) {
2718
+ return new ISO2022JPDecoder(options);
2719
+ };
2720
+
2721
+ // 13.3 Shift_JIS
2722
+
2723
+ // 13.3.1 Shift_JIS decoder
2724
+ /**
2725
+ * @constructor
2726
+ * @implements {Decoder}
2727
+ * @param {{fatal: boolean}} options
2728
+ */
2729
+ function ShiftJISDecoder(options) {
2730
+ var fatal = options.fatal;
2731
+ // Shift_JIS's decoder has an associated Shift_JIS lead (initially
2732
+ // 0x00).
2733
+ var /** @type {number} */ Shift_JIS_lead = 0x00;
2734
+ /**
2735
+ * @param {Stream} stream The stream of bytes being decoded.
2736
+ * @param {number} bite The next byte read from the stream.
2737
+ * @return {?(number|!Array.<number>)} The next code point(s)
2738
+ * decoded, or null if not enough data exists in the input
2739
+ * stream to decode a complete code point.
2740
+ */
2741
+ this.handler = function(stream, bite) {
2742
+ // 1. If byte is end-of-stream and Shift_JIS lead is not 0x00,
2743
+ // set Shift_JIS lead to 0x00 and return error.
2744
+ if (bite === end_of_stream && Shift_JIS_lead !== 0x00) {
2745
+ Shift_JIS_lead = 0x00;
2746
+ return decoderError(fatal);
2747
+ }
2748
+
2749
+ // 2. If byte is end-of-stream and Shift_JIS lead is 0x00,
2750
+ // return finished.
2751
+ if (bite === end_of_stream && Shift_JIS_lead === 0x00)
2752
+ return finished;
2753
+
2754
+ // 3. If Shift_JIS lead is not 0x00, let lead be Shift_JIS lead,
2755
+ // let pointer be null, set Shift_JIS lead to 0x00, and then run
2756
+ // these substeps:
2757
+ if (Shift_JIS_lead !== 0x00) {
2758
+ var lead = Shift_JIS_lead;
2759
+ var pointer = null;
2760
+ Shift_JIS_lead = 0x00;
2761
+
2762
+ // 1. Let offset be 0x40, if byte is less than 0x7F, and 0x41
2763
+ // otherwise.
2764
+ var offset = (bite < 0x7F) ? 0x40 : 0x41;
2765
+
2766
+ // 2. Let lead offset be 0x81, if lead is less than 0xA0, and
2767
+ // 0xC1 otherwise.
2768
+ var lead_offset = (lead < 0xA0) ? 0x81 : 0xC1;
2769
+
2770
+ // 3. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80
2771
+ // to 0xFC, inclusive, set pointer to (lead − lead offset) ×
2772
+ // 188 + byte − offset.
2773
+ if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFC))
2774
+ pointer = (lead - lead_offset) * 188 + bite - offset;
2775
+
2776
+ // 4. If pointer is in the range 8836 to 10715, inclusive,
2777
+ // return a code point whose value is 0xE000 − 8836 + pointer.
2778
+ if (inRange(pointer, 8836, 10715))
2779
+ return 0xE000 - 8836 + pointer;
2780
+
2781
+ // 5. Let code point be null, if pointer is null, and the
2782
+ // index code point for pointer in index jis0208 otherwise.
2783
+ var code_point = (pointer === null) ? null :
2784
+ indexCodePointFor(pointer, index('jis0208'));
2785
+
2786
+ // 6. If code point is null and byte is an ASCII byte, prepend
2787
+ // byte to stream.
2788
+ if (code_point === null && isASCIIByte(bite))
2789
+ stream.prepend(bite);
2790
+
2791
+ // 7. If code point is null, return error.
2792
+ if (code_point === null)
2793
+ return decoderError(fatal);
2794
+
2795
+ // 8. Return a code point whose value is code point.
2796
+ return code_point;
2797
+ }
2798
+
2799
+ // 4. If byte is an ASCII byte or 0x80, return a code point
2800
+ // whose value is byte.
2801
+ if (isASCIIByte(bite) || bite === 0x80)
2802
+ return bite;
2803
+
2804
+ // 5. If byte is in the range 0xA1 to 0xDF, inclusive, return a
2805
+ // code point whose value is 0xFF61 − 0xA1 + byte.
2806
+ if (inRange(bite, 0xA1, 0xDF))
2807
+ return 0xFF61 - 0xA1 + bite;
2808
+
2809
+ // 6. If byte is in the range 0x81 to 0x9F, inclusive, or 0xE0
2810
+ // to 0xFC, inclusive, set Shift_JIS lead to byte and return
2811
+ // continue.
2812
+ if (inRange(bite, 0x81, 0x9F) || inRange(bite, 0xE0, 0xFC)) {
2813
+ Shift_JIS_lead = bite;
2814
+ return null;
2815
+ }
2816
+
2817
+ // 7. Return error.
2818
+ return decoderError(fatal);
2819
+ };
2820
+ }
2821
+
2822
+ // 13.3.2 Shift_JIS encoder
2823
+ /**
2824
+ * @constructor
2825
+ * @implements {Encoder}
2826
+ * @param {{fatal: boolean}} options
2827
+ */
2828
+ function ShiftJISEncoder(options) {
2829
+ var fatal = options.fatal;
2830
+ /**
2831
+ * @param {Stream} stream Input stream.
2832
+ * @param {number} code_point Next code point read from the stream.
2833
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2834
+ */
2835
+ this.handler = function(stream, code_point) {
2836
+ // 1. If code point is end-of-stream, return finished.
2837
+ if (code_point === end_of_stream)
2838
+ return finished;
2839
+
2840
+ // 2. If code point is an ASCII code point or U+0080, return a
2841
+ // byte whose value is code point.
2842
+ if (isASCIICodePoint(code_point) || code_point === 0x0080)
2843
+ return code_point;
2844
+
2845
+ // 3. If code point is U+00A5, return byte 0x5C.
2846
+ if (code_point === 0x00A5)
2847
+ return 0x5C;
2848
+
2849
+ // 4. If code point is U+203E, return byte 0x7E.
2850
+ if (code_point === 0x203E)
2851
+ return 0x7E;
2852
+
2853
+ // 5. If code point is in the range U+FF61 to U+FF9F, inclusive,
2854
+ // return a byte whose value is code point − 0xFF61 + 0xA1.
2855
+ if (inRange(code_point, 0xFF61, 0xFF9F))
2856
+ return code_point - 0xFF61 + 0xA1;
2857
+
2858
+ // 6. If code point is U+2212, set it to U+FF0D.
2859
+ if (code_point === 0x2212)
2860
+ code_point = 0xFF0D;
2861
+
2862
+ // 7. Let pointer be the index Shift_JIS pointer for code point.
2863
+ var pointer = indexShiftJISPointerFor(code_point);
2864
+
2865
+ // 8. If pointer is null, return error with code point.
2866
+ if (pointer === null)
2867
+ return encoderError(code_point);
2868
+
2869
+ // 9. Let lead be floor(pointer / 188).
2870
+ var lead = floor(pointer / 188);
2871
+
2872
+ // 10. Let lead offset be 0x81, if lead is less than 0x1F, and
2873
+ // 0xC1 otherwise.
2874
+ var lead_offset = (lead < 0x1F) ? 0x81 : 0xC1;
2875
+
2876
+ // 11. Let trail be pointer % 188.
2877
+ var trail = pointer % 188;
2878
+
2879
+ // 12. Let offset be 0x40, if trail is less than 0x3F, and 0x41
2880
+ // otherwise.
2881
+ var offset = (trail < 0x3F) ? 0x40 : 0x41;
2882
+
2883
+ // 13. Return two bytes whose values are lead + lead offset and
2884
+ // trail + offset.
2885
+ return [lead + lead_offset, trail + offset];
2886
+ };
2887
+ }
2888
+
2889
+ /** @param {{fatal: boolean}} options */
2890
+ encoders['Shift_JIS'] = function(options) {
2891
+ return new ShiftJISEncoder(options);
2892
+ };
2893
+ /** @param {{fatal: boolean}} options */
2894
+ decoders['Shift_JIS'] = function(options) {
2895
+ return new ShiftJISDecoder(options);
2896
+ };
2897
+
2898
+ //
2899
+ // 14. Legacy multi-byte Korean encodings
2900
+ //
2901
+
2902
+ // 14.1 euc-kr
2903
+
2904
+ // 14.1.1 euc-kr decoder
2905
+ /**
2906
+ * @constructor
2907
+ * @implements {Decoder}
2908
+ * @param {{fatal: boolean}} options
2909
+ */
2910
+ function EUCKRDecoder(options) {
2911
+ var fatal = options.fatal;
2912
+
2913
+ // euc-kr's decoder has an associated euc-kr lead (initially 0x00).
2914
+ var /** @type {number} */ euckr_lead = 0x00;
2915
+ /**
2916
+ * @param {Stream} stream The stream of bytes being decoded.
2917
+ * @param {number} bite The next byte read from the stream.
2918
+ * @return {?(number|!Array.<number>)} The next code point(s)
2919
+ * decoded, or null if not enough data exists in the input
2920
+ * stream to decode a complete code point.
2921
+ */
2922
+ this.handler = function(stream, bite) {
2923
+ // 1. If byte is end-of-stream and euc-kr lead is not 0x00, set
2924
+ // euc-kr lead to 0x00 and return error.
2925
+ if (bite === end_of_stream && euckr_lead !== 0) {
2926
+ euckr_lead = 0x00;
2927
+ return decoderError(fatal);
2928
+ }
2929
+
2930
+ // 2. If byte is end-of-stream and euc-kr lead is 0x00, return
2931
+ // finished.
2932
+ if (bite === end_of_stream && euckr_lead === 0)
2933
+ return finished;
2934
+
2935
+ // 3. If euc-kr lead is not 0x00, let lead be euc-kr lead, let
2936
+ // pointer be null, set euc-kr lead to 0x00, and then run these
2937
+ // substeps:
2938
+ if (euckr_lead !== 0x00) {
2939
+ var lead = euckr_lead;
2940
+ var pointer = null;
2941
+ euckr_lead = 0x00;
2942
+
2943
+ // 1. If byte is in the range 0x41 to 0xFE, inclusive, set
2944
+ // pointer to (lead − 0x81) × 190 + (byte − 0x41).
2945
+ if (inRange(bite, 0x41, 0xFE))
2946
+ pointer = (lead - 0x81) * 190 + (bite - 0x41);
2947
+
2948
+ // 2. Let code point be null, if pointer is null, and the
2949
+ // index code point for pointer in index euc-kr otherwise.
2950
+ var code_point = (pointer === null)
2951
+ ? null : indexCodePointFor(pointer, index('euc-kr'));
2952
+
2953
+ // 3. If code point is null and byte is an ASCII byte, prepend
2954
+ // byte to stream.
2955
+ if (pointer === null && isASCIIByte(bite))
2956
+ stream.prepend(bite);
2957
+
2958
+ // 4. If code point is null, return error.
2959
+ if (code_point === null)
2960
+ return decoderError(fatal);
2961
+
2962
+ // 5. Return a code point whose value is code point.
2963
+ return code_point;
2964
+ }
2965
+
2966
+ // 4. If byte is an ASCII byte, return a code point whose value
2967
+ // is byte.
2968
+ if (isASCIIByte(bite))
2969
+ return bite;
2970
+
2971
+ // 5. If byte is in the range 0x81 to 0xFE, inclusive, set
2972
+ // euc-kr lead to byte and return continue.
2973
+ if (inRange(bite, 0x81, 0xFE)) {
2974
+ euckr_lead = bite;
2975
+ return null;
2976
+ }
2977
+
2978
+ // 6. Return error.
2979
+ return decoderError(fatal);
2980
+ };
2981
+ }
2982
+
2983
+ // 14.1.2 euc-kr encoder
2984
+ /**
2985
+ * @constructor
2986
+ * @implements {Encoder}
2987
+ * @param {{fatal: boolean}} options
2988
+ */
2989
+ function EUCKREncoder(options) {
2990
+ var fatal = options.fatal;
2991
+ /**
2992
+ * @param {Stream} stream Input stream.
2993
+ * @param {number} code_point Next code point read from the stream.
2994
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2995
+ */
2996
+ this.handler = function(stream, code_point) {
2997
+ // 1. If code point is end-of-stream, return finished.
2998
+ if (code_point === end_of_stream)
2999
+ return finished;
3000
+
3001
+ // 2. If code point is an ASCII code point, return a byte whose
3002
+ // value is code point.
3003
+ if (isASCIICodePoint(code_point))
3004
+ return code_point;
3005
+
3006
+ // 3. Let pointer be the index pointer for code point in index
3007
+ // euc-kr.
3008
+ var pointer = indexPointerFor(code_point, index('euc-kr'));
3009
+
3010
+ // 4. If pointer is null, return error with code point.
3011
+ if (pointer === null)
3012
+ return encoderError(code_point);
3013
+
3014
+ // 5. Let lead be floor(pointer / 190) + 0x81.
3015
+ var lead = floor(pointer / 190) + 0x81;
3016
+
3017
+ // 6. Let trail be pointer % 190 + 0x41.
3018
+ var trail = (pointer % 190) + 0x41;
3019
+
3020
+ // 7. Return two bytes whose values are lead and trail.
3021
+ return [lead, trail];
3022
+ };
3023
+ }
3024
+
3025
+ /** @param {{fatal: boolean}} options */
3026
+ encoders['EUC-KR'] = function(options) {
3027
+ return new EUCKREncoder(options);
3028
+ };
3029
+ /** @param {{fatal: boolean}} options */
3030
+ decoders['EUC-KR'] = function(options) {
3031
+ return new EUCKRDecoder(options);
3032
+ };
3033
+
3034
+
3035
+ //
3036
+ // 15. Legacy miscellaneous encodings
3037
+ //
3038
+
3039
+ // 15.1 replacement
3040
+
3041
+ // Not needed - API throws RangeError
3042
+
3043
+ // 15.2 Common infrastructure for utf-16be and utf-16le
3044
+
3045
+ /**
3046
+ * @param {number} code_unit
3047
+ * @param {boolean} utf16be
3048
+ * @return {!Array.<number>} bytes
3049
+ */
3050
+ function convertCodeUnitToBytes(code_unit, utf16be) {
3051
+ // 1. Let byte1 be code unit >> 8.
3052
+ var byte1 = code_unit >> 8;
3053
+
3054
+ // 2. Let byte2 be code unit & 0x00FF.
3055
+ var byte2 = code_unit & 0x00FF;
3056
+
3057
+ // 3. Then return the bytes in order:
3058
+ // utf-16be flag is set: byte1, then byte2.
3059
+ if (utf16be)
3060
+ return [byte1, byte2];
3061
+ // utf-16be flag is unset: byte2, then byte1.
3062
+ return [byte2, byte1];
3063
+ }
3064
+
3065
+ // 15.2.1 shared utf-16 decoder
3066
+ /**
3067
+ * @constructor
3068
+ * @implements {Decoder}
3069
+ * @param {boolean} utf16_be True if big-endian, false if little-endian.
3070
+ * @param {{fatal: boolean}} options
3071
+ */
3072
+ function UTF16Decoder(utf16_be, options) {
3073
+ var fatal = options.fatal;
3074
+ var /** @type {?number} */ utf16_lead_byte = null,
3075
+ /** @type {?number} */ utf16_lead_surrogate = null;
3076
+ /**
3077
+ * @param {Stream} stream The stream of bytes being decoded.
3078
+ * @param {number} bite The next byte read from the stream.
3079
+ * @return {?(number|!Array.<number>)} The next code point(s)
3080
+ * decoded, or null if not enough data exists in the input
3081
+ * stream to decode a complete code point.
3082
+ */
3083
+ this.handler = function(stream, bite) {
3084
+ // 1. If byte is end-of-stream and either utf-16 lead byte or
3085
+ // utf-16 lead surrogate is not null, set utf-16 lead byte and
3086
+ // utf-16 lead surrogate to null, and return error.
3087
+ if (bite === end_of_stream && (utf16_lead_byte !== null ||
3088
+ utf16_lead_surrogate !== null)) {
3089
+ return decoderError(fatal);
3090
+ }
3091
+
3092
+ // 2. If byte is end-of-stream and utf-16 lead byte and utf-16
3093
+ // lead surrogate are null, return finished.
3094
+ if (bite === end_of_stream && utf16_lead_byte === null &&
3095
+ utf16_lead_surrogate === null) {
3096
+ return finished;
3097
+ }
3098
+
3099
+ // 3. If utf-16 lead byte is null, set utf-16 lead byte to byte
3100
+ // and return continue.
3101
+ if (utf16_lead_byte === null) {
3102
+ utf16_lead_byte = bite;
3103
+ return null;
3104
+ }
3105
+
3106
+ // 4. Let code unit be the result of:
3107
+ var code_unit;
3108
+ if (utf16_be) {
3109
+ // utf-16be decoder flag is set
3110
+ // (utf-16 lead byte << 8) + byte.
3111
+ code_unit = (utf16_lead_byte << 8) + bite;
3112
+ } else {
3113
+ // utf-16be decoder flag is unset
3114
+ // (byte << 8) + utf-16 lead byte.
3115
+ code_unit = (bite << 8) + utf16_lead_byte;
3116
+ }
3117
+ // Then set utf-16 lead byte to null.
3118
+ utf16_lead_byte = null;
3119
+
3120
+ // 5. If utf-16 lead surrogate is not null, let lead surrogate
3121
+ // be utf-16 lead surrogate, set utf-16 lead surrogate to null,
3122
+ // and then run these substeps:
3123
+ if (utf16_lead_surrogate !== null) {
3124
+ var lead_surrogate = utf16_lead_surrogate;
3125
+ utf16_lead_surrogate = null;
3126
+
3127
+ // 1. If code unit is in the range U+DC00 to U+DFFF,
3128
+ // inclusive, return a code point whose value is 0x10000 +
3129
+ // ((lead surrogate − 0xD800) << 10) + (code unit − 0xDC00).
3130
+ if (inRange(code_unit, 0xDC00, 0xDFFF)) {
3131
+ return 0x10000 + (lead_surrogate - 0xD800) * 0x400 +
3132
+ (code_unit - 0xDC00);
3133
+ }
3134
+
3135
+ // 2. Prepend the sequence resulting of converting code unit
3136
+ // to bytes using utf-16be decoder flag to stream and return
3137
+ // error.
3138
+ stream.prepend(convertCodeUnitToBytes(code_unit, utf16_be));
3139
+ return decoderError(fatal);
3140
+ }
3141
+
3142
+ // 6. If code unit is in the range U+D800 to U+DBFF, inclusive,
3143
+ // set utf-16 lead surrogate to code unit and return continue.
3144
+ if (inRange(code_unit, 0xD800, 0xDBFF)) {
3145
+ utf16_lead_surrogate = code_unit;
3146
+ return null;
3147
+ }
3148
+
3149
+ // 7. If code unit is in the range U+DC00 to U+DFFF, inclusive,
3150
+ // return error.
3151
+ if (inRange(code_unit, 0xDC00, 0xDFFF))
3152
+ return decoderError(fatal);
3153
+
3154
+ // 8. Return code point code unit.
3155
+ return code_unit;
3156
+ };
3157
+ }
3158
+
3159
+ // 15.2.2 shared utf-16 encoder
3160
+ /**
3161
+ * @constructor
3162
+ * @implements {Encoder}
3163
+ * @param {boolean} utf16_be True if big-endian, false if little-endian.
3164
+ * @param {{fatal: boolean}} options
3165
+ */
3166
+ function UTF16Encoder(utf16_be, options) {
3167
+ var fatal = options.fatal;
3168
+ /**
3169
+ * @param {Stream} stream Input stream.
3170
+ * @param {number} code_point Next code point read from the stream.
3171
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
3172
+ */
3173
+ this.handler = function(stream, code_point) {
3174
+ // 1. If code point is end-of-stream, return finished.
3175
+ if (code_point === end_of_stream)
3176
+ return finished;
3177
+
3178
+ // 2. If code point is in the range U+0000 to U+FFFF, inclusive,
3179
+ // return the sequence resulting of converting code point to
3180
+ // bytes using utf-16be encoder flag.
3181
+ if (inRange(code_point, 0x0000, 0xFFFF))
3182
+ return convertCodeUnitToBytes(code_point, utf16_be);
3183
+
3184
+ // 3. Let lead be ((code point − 0x10000) >> 10) + 0xD800,
3185
+ // converted to bytes using utf-16be encoder flag.
3186
+ var lead = convertCodeUnitToBytes(
3187
+ ((code_point - 0x10000) >> 10) + 0xD800, utf16_be);
3188
+
3189
+ // 4. Let trail be ((code point − 0x10000) & 0x3FF) + 0xDC00,
3190
+ // converted to bytes using utf-16be encoder flag.
3191
+ var trail = convertCodeUnitToBytes(
3192
+ ((code_point - 0x10000) & 0x3FF) + 0xDC00, utf16_be);
3193
+
3194
+ // 5. Return a byte sequence of lead followed by trail.
3195
+ return lead.concat(trail);
3196
+ };
3197
+ }
3198
+
3199
+ // 15.3 utf-16be
3200
+ // 15.3.1 utf-16be decoder
3201
+ /** @param {{fatal: boolean}} options */
3202
+ encoders['UTF-16BE'] = function(options) {
3203
+ return new UTF16Encoder(true, options);
3204
+ };
3205
+ // 15.3.2 utf-16be encoder
3206
+ /** @param {{fatal: boolean}} options */
3207
+ decoders['UTF-16BE'] = function(options) {
3208
+ return new UTF16Decoder(true, options);
3209
+ };
3210
+
3211
+ // 15.4 utf-16le
3212
+ // 15.4.1 utf-16le decoder
3213
+ /** @param {{fatal: boolean}} options */
3214
+ encoders['UTF-16LE'] = function(options) {
3215
+ return new UTF16Encoder(false, options);
3216
+ };
3217
+ // 15.4.2 utf-16le encoder
3218
+ /** @param {{fatal: boolean}} options */
3219
+ decoders['UTF-16LE'] = function(options) {
3220
+ return new UTF16Decoder(false, options);
3221
+ };
3222
+
3223
+ // 15.5 x-user-defined
3224
+
3225
+ // 15.5.1 x-user-defined decoder
3226
+ /**
3227
+ * @constructor
3228
+ * @implements {Decoder}
3229
+ * @param {{fatal: boolean}} options
3230
+ */
3231
+ function XUserDefinedDecoder(options) {
3232
+ var fatal = options.fatal;
3233
+ /**
3234
+ * @param {Stream} stream The stream of bytes being decoded.
3235
+ * @param {number} bite The next byte read from the stream.
3236
+ * @return {?(number|!Array.<number>)} The next code point(s)
3237
+ * decoded, or null if not enough data exists in the input
3238
+ * stream to decode a complete code point.
3239
+ */
3240
+ this.handler = function(stream, bite) {
3241
+ // 1. If byte is end-of-stream, return finished.
3242
+ if (bite === end_of_stream)
3243
+ return finished;
3244
+
3245
+ // 2. If byte is an ASCII byte, return a code point whose value
3246
+ // is byte.
3247
+ if (isASCIIByte(bite))
3248
+ return bite;
3249
+
3250
+ // 3. Return a code point whose value is 0xF780 + byte − 0x80.
3251
+ return 0xF780 + bite - 0x80;
3252
+ };
3253
+ }
3254
+
3255
+ // 15.5.2 x-user-defined encoder
3256
+ /**
3257
+ * @constructor
3258
+ * @implements {Encoder}
3259
+ * @param {{fatal: boolean}} options
3260
+ */
3261
+ function XUserDefinedEncoder(options) {
3262
+ var fatal = options.fatal;
3263
+ /**
3264
+ * @param {Stream} stream Input stream.
3265
+ * @param {number} code_point Next code point read from the stream.
3266
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
3267
+ */
3268
+ this.handler = function(stream, code_point) {
3269
+ // 1.If code point is end-of-stream, return finished.
3270
+ if (code_point === end_of_stream)
3271
+ return finished;
3272
+
3273
+ // 2. If code point is an ASCII code point, return a byte whose
3274
+ // value is code point.
3275
+ if (isASCIICodePoint(code_point))
3276
+ return code_point;
3277
+
3278
+ // 3. If code point is in the range U+F780 to U+F7FF, inclusive,
3279
+ // return a byte whose value is code point − 0xF780 + 0x80.
3280
+ if (inRange(code_point, 0xF780, 0xF7FF))
3281
+ return code_point - 0xF780 + 0x80;
3282
+
3283
+ // 4. Return error with code point.
3284
+ return encoderError(code_point);
3285
+ };
3286
+ }
3287
+
3288
+ /** @param {{fatal: boolean}} options */
3289
+ encoders['x-user-defined'] = function(options) {
3290
+ return new XUserDefinedEncoder(options);
3291
+ };
3292
+ /** @param {{fatal: boolean}} options */
3293
+ decoders['x-user-defined'] = function(options) {
3294
+ return new XUserDefinedDecoder(options);
3295
+ };
3296
+
3297
+ if (!global['TextEncoder'])
3298
+ global['TextEncoder'] = TextEncoder;
3299
+ if (!global['TextDecoder'])
3300
+ global['TextDecoder'] = TextDecoder;
3301
+
3302
+ if (typeof module !== "undefined" && module.exports) {
3303
+ module.exports = {
3304
+ TextEncoder: global['TextEncoder'],
3305
+ TextDecoder: global['TextDecoder'],
3306
+ EncodingIndexes: global["encoding-indexes"]
3307
+ };
3308
+ }
3309
+
3310
+ // For strict environments where `this` inside the global scope
3311
+ // is `undefined`, take a pure object instead
3312
+ }(this || {}));