bfg-common 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (782) hide show
  1. package/.eslintrc.js +21 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +49 -0
  3. package/.idea/modules.xml +8 -0
  4. package/.idea/prettier.xml +6 -0
  5. package/.idea/uikit.iml +12 -0
  6. package/.idea/vcs.xml +6 -0
  7. package/.prettierrc +5 -0
  8. package/PROJECT_STRUCTURE.md +42 -0
  9. package/README.md +42 -0
  10. package/assets/img/bg1.jpeg +0 -0
  11. package/assets/img/bg2.jpeg +0 -0
  12. package/assets/img/icons/icon-cps-dark-mode.png +0 -0
  13. package/assets/img/icons/icon-cps.png +0 -0
  14. package/assets/img/icons/icon-datastore.svg +1 -0
  15. package/assets/img/icons/icon-hcs.svg +4 -0
  16. package/assets/img/icons/icon-life-m-dark.svg +4 -0
  17. package/assets/img/icons/icon-life-m-light.svg +4 -0
  18. package/assets/img/icons/icon-ro-dark.svg +2 -0
  19. package/assets/img/icons/icon-ro-light.svg +3 -0
  20. package/assets/img/icons/icons-sprite-dark-1.svg +1 -0
  21. package/assets/img/icons/icons-sprite-dark-2.svg +1 -0
  22. package/assets/img/icons/icons-sprite-dark-3.svg +1 -0
  23. package/assets/img/icons/icons-sprite-dark-4.svg +1 -0
  24. package/assets/img/icons/icons-sprite-dark-5.svg +1 -0
  25. package/assets/img/icons/icons-sprite-light-1.svg +1 -0
  26. package/assets/img/icons/icons-sprite-light-2.svg +1 -0
  27. package/assets/img/icons/icons-sprite-light-3.svg +1 -0
  28. package/assets/img/icons/icons-sprite-light-4.svg +1 -0
  29. package/assets/img/icons/icons-sprite-light-5.svg +1 -0
  30. package/assets/img/icons/info.svg +8 -0
  31. package/assets/img/icons/sprite.png +0 -0
  32. package/assets/img/icons/summary-cluster.svg +1 -0
  33. package/assets/img/icons/vc.svg +53 -0
  34. package/assets/img/icons/vm-ui-icons.png +0 -0
  35. package/assets/img/logo copy.svg +50 -0
  36. package/assets/img/logo.png +0 -0
  37. package/assets/img/logo.svg +51 -0
  38. package/assets/localization/local_be.json +1851 -0
  39. package/assets/localization/local_en.json +1851 -0
  40. package/assets/localization/local_hy.json +1851 -0
  41. package/assets/localization/local_kk.json +1851 -0
  42. package/assets/localization/local_ru.json +1851 -0
  43. package/assets/localization/local_zh.json +1851 -0
  44. package/assets/scss/clarity/clr-ui.min.css +8 -0
  45. package/assets/scss/common/animations.scss +28 -0
  46. package/assets/scss/common/global.scss +178 -0
  47. package/assets/scss/common/icons/icons-1.scss +188 -0
  48. package/assets/scss/common/icons/icons-2.scss +208 -0
  49. package/assets/scss/common/icons/icons-3.scss +176 -0
  50. package/assets/scss/common/icons/icons-4.scss +179 -0
  51. package/assets/scss/common/icons/icons-5.scss +53 -0
  52. package/assets/scss/common/icons/icons.scss +14 -0
  53. package/assets/scss/common/mixins.scss +39 -0
  54. package/assets/scss/common/normalize.scss +320 -0
  55. package/assets/scss/common/theme.scss +230 -0
  56. package/assets/scss/common/utilities.scss +18 -0
  57. package/assets/scss/common/variables.scss +43 -0
  58. package/assets/scss/main.scss +13 -0
  59. package/components/atoms/DiagramIcon.vue +287 -0
  60. package/components/atoms/TheIcon.vue +1687 -0
  61. package/components/atoms/TheIcon2.vue +318 -0
  62. package/components/atoms/alert/Alert.spec.ts +38 -0
  63. package/components/atoms/alert/Alert.vue +84 -0
  64. package/components/atoms/alert/Notification.spec.ts +34 -0
  65. package/components/atoms/alert/Notification.vue +167 -0
  66. package/components/atoms/alert/models/enums.ts +12 -0
  67. package/components/atoms/alert/models/interfaces.ts +27 -0
  68. package/components/atoms/alert/models/types.ts +7 -0
  69. package/components/atoms/autocomplete/Autocomplete.vue +236 -0
  70. package/components/atoms/collapse/CollapseNav.vue +153 -0
  71. package/components/atoms/collapse/CollapseNavItem.vue +190 -0
  72. package/components/atoms/collapse/models/interfaces.ts +9 -0
  73. package/components/atoms/combobox/Combobox.vue +131 -0
  74. package/components/atoms/datepicker/Datepicker.vue +612 -0
  75. package/components/atoms/datepicker/config/allShortMonths.ts +103 -0
  76. package/components/atoms/datepicker/config/datapicker.ts +43 -0
  77. package/components/atoms/datepicker/models/interfaces.ts +8 -0
  78. package/components/atoms/dropdown/Portlet.spec.ts +26 -0
  79. package/components/atoms/dropdown/Portlet.vue +111 -0
  80. package/components/atoms/dropdown/dropdown/Dropdown.vue +148 -0
  81. package/components/atoms/dropdown/dropdown/models/interfaces.ts +8 -0
  82. package/components/atoms/dropdown/tree/Tree.vue +134 -0
  83. package/components/atoms/dropdown/tree/models/interfaces.ts +9 -0
  84. package/components/atoms/input/Search.vue +16 -0
  85. package/components/atoms/list/SelectList.vue +62 -0
  86. package/components/atoms/list/SimpleList.vue +29 -0
  87. package/components/atoms/list/dragDropList/DragDropList.vue +139 -0
  88. package/components/atoms/list/dragDropList/config/events.ts +4 -0
  89. package/components/atoms/loader/BarLoader.vue +21 -0
  90. package/components/atoms/loader/Loader.vue +26 -0
  91. package/components/atoms/loader/PreLoader.vue +34 -0
  92. package/components/atoms/loader/Preloader.spec.ts +24 -0
  93. package/components/atoms/modal/Modal.spec.ts +55 -0
  94. package/components/atoms/modal/Modal.vue +241 -0
  95. package/components/atoms/modal/bySteps/BySteps.spec.ts +66 -0
  96. package/components/atoms/modal/bySteps/BySteps.vue +234 -0
  97. package/components/atoms/modal/byStepsSecond/ByStepsSecond.vue +174 -0
  98. package/components/atoms/models/interfaces.ts +11 -0
  99. package/components/atoms/nav/NavBar.spec.ts +34 -0
  100. package/components/atoms/nav/NavBar.vue +116 -0
  101. package/components/atoms/nav/VerticalNavBar.vue +89 -0
  102. package/components/atoms/nav/models/interfaces.ts +5 -0
  103. package/components/atoms/notificationBar/NotificationBar.vue +175 -0
  104. package/components/atoms/notificationBar/models/enums.ts +27 -0
  105. package/components/atoms/notificationBar/models/interfaces.ts +6 -0
  106. package/components/atoms/notificationBar/models/types.ts +1 -0
  107. package/components/atoms/perPage/PerPage.vue +52 -0
  108. package/components/atoms/popover/Popover.vue +48 -0
  109. package/components/atoms/popup/SimplePopup.vue +90 -0
  110. package/components/atoms/select/TheSelect.vue +175 -0
  111. package/components/atoms/select/models/interfaces.ts +4 -0
  112. package/components/atoms/stack/StackBlock.vue +171 -0
  113. package/components/atoms/stack/StackContent.vue +60 -0
  114. package/components/atoms/step/VerticalStep.spec.ts +68 -0
  115. package/components/atoms/step/VerticalStep.vue +104 -0
  116. package/components/atoms/step/models/verticalStepItem.ts +7 -0
  117. package/components/atoms/switch/Switch.vue +107 -0
  118. package/components/atoms/table/compact/Compact.vue +526 -0
  119. package/components/atoms/table/compact/models/interfaces.ts +11 -0
  120. package/components/atoms/table/dataGrid/DataGrid.spec.ts +61 -0
  121. package/components/atoms/table/dataGrid/DataGrid.vue +1283 -0
  122. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +204 -0
  123. package/components/atoms/table/dataGrid/DataGridPage.vue +189 -0
  124. package/components/atoms/table/dataGrid/DataGridPagination.vue +83 -0
  125. package/components/atoms/table/dataGrid/config/itemsPerPage.ts +20 -0
  126. package/components/atoms/table/dataGrid/models/interfaces.ts +24 -0
  127. package/components/atoms/table/dataGrid/models/types.ts +5 -0
  128. package/components/atoms/table/dataGrid/utils/constructDataTable.ts +33 -0
  129. package/components/atoms/table/info/Info.vue +60 -0
  130. package/components/atoms/table/info/models/interfaces.ts +6 -0
  131. package/components/atoms/table/simpleEvent/SimpleEvent.vue +98 -0
  132. package/components/atoms/table/simpleEvent/models/interfaces.ts +9 -0
  133. package/components/atoms/table/simpleInfo/SimpleInfo.vue +68 -0
  134. package/components/atoms/table/simpleInfo/models/interfaces.ts +4 -0
  135. package/components/atoms/table/simpleTable/SimpleTable.vue +291 -0
  136. package/components/atoms/table/simpleTable/models/interfaces.ts +10 -0
  137. package/components/atoms/tabs/Tabs.vue +189 -0
  138. package/components/atoms/tabs/VerticalTabs.vue +81 -0
  139. package/components/atoms/tabs/models/interfaces.ts +4 -0
  140. package/components/atoms/tabs/models/types.ts +1 -0
  141. package/components/atoms/tooltip/Models/interfaces.ts +4 -0
  142. package/components/atoms/tooltip/Signpost.vue +224 -0
  143. package/components/atoms/tooltip/Text.vue +39 -0
  144. package/components/atoms/tooltip/Tooltip.vue +57 -0
  145. package/components/atoms/tooltip/TooltipError.vue +113 -0
  146. package/components/common/accordion/Accordion.vue +176 -0
  147. package/components/common/accordion/Recursion.vue +195 -0
  148. package/components/common/accordion/models/interfaces.ts +14 -0
  149. package/components/common/adapterManager/AdapterManager.vue +715 -0
  150. package/components/common/adapterManager/AddAdapterModal.vue +464 -0
  151. package/components/common/adapterManager/AddAdapterWarningModal.vue +82 -0
  152. package/components/common/adapterManager/NoActiveAdaptersModal.vue +62 -0
  153. package/components/common/adapterManager/NoConnectedActiveAdaptersModal.vue +62 -0
  154. package/components/common/adapterManager/config/index.ts +19 -0
  155. package/components/common/adapterManager/ui/NoSelectedAdapter.vue +39 -0
  156. package/components/common/adapterManager/ui/SecondTitle.vue +37 -0
  157. package/components/common/adapterManager/ui/actions/ActionsBar.vue +93 -0
  158. package/components/common/adapterManager/ui/actions/AddAdapterButton.vue +28 -0
  159. package/components/common/adapterManager/ui/actions/MoveDownAdapterButton.vue +33 -0
  160. package/components/common/adapterManager/ui/actions/MoveUpAdapterButton.vue +33 -0
  161. package/components/common/adapterManager/ui/actions/RemoveAdapterButton.vue +34 -0
  162. package/components/common/adapterManager/ui/actions/VerticalSeparator.vue +11 -0
  163. package/components/common/adapterManager/ui/table/Adapters.vue +91 -0
  164. package/components/common/adapterManager/ui/table/Header.vue +89 -0
  165. package/components/common/adapterManager/ui/table/Table.vue +167 -0
  166. package/components/common/addNetworking/AddNetworking.vue +982 -0
  167. package/components/common/addNetworking/Wizard.vue +286 -0
  168. package/components/common/addNetworking/config/addNetworkingSteps.ts +404 -0
  169. package/components/common/addNetworking/config/index.ts +46 -0
  170. package/components/common/addNetworking/config/initialData.ts +78 -0
  171. package/components/common/addNetworking/config/portPropertiesStep.ts +19 -0
  172. package/components/common/addNetworking/config/selectSwitch.ts +19 -0
  173. package/components/common/addNetworking/config/sendData.ts +87 -0
  174. package/components/common/addNetworking/config/temporaryData.ts +8 -0
  175. package/components/common/addNetworking/config/validation.ts +23 -0
  176. package/components/common/addNetworking/mappers/mappers.ts +166 -0
  177. package/components/common/addNetworking/modals/SelectNetwork.vue +149 -0
  178. package/components/common/addNetworking/modals/SelectStandardSwitch.vue +125 -0
  179. package/components/common/addNetworking/modals/SelectSwitch.vue +114 -0
  180. package/components/common/addNetworking/models/enums.ts +7 -0
  181. package/components/common/addNetworking/models/interfaces.ts +207 -0
  182. package/components/common/addNetworking/models/types.ts +5 -0
  183. package/components/common/addNetworking/steps/ConnectionSettings.vue +269 -0
  184. package/components/common/addNetworking/steps/CreateStandardSwitch.vue +91 -0
  185. package/components/common/addNetworking/steps/Header.vue +53 -0
  186. package/components/common/addNetworking/steps/IpFourSettings.vue +361 -0
  187. package/components/common/addNetworking/steps/PhysicalAdapter.vue +24 -0
  188. package/components/common/addNetworking/steps/PortProperties.vue +481 -0
  189. package/components/common/addNetworking/steps/ReadyComplete.vue +29 -0
  190. package/components/common/addNetworking/steps/SelectConnectionType.vue +106 -0
  191. package/components/common/addNetworking/steps/SelectedTargetDevice.vue +563 -0
  192. package/components/common/addNetworking/utils/index.ts +212 -0
  193. package/components/common/browse/Browse.vue +182 -0
  194. package/components/common/browse/blocks/Container.vue +102 -0
  195. package/components/common/browse/blocks/Title.vue +66 -0
  196. package/components/common/browse/blocks/contents/Files.vue +68 -0
  197. package/components/common/browse/blocks/info/Date.vue +21 -0
  198. package/components/common/browse/blocks/info/Size.vue +17 -0
  199. package/components/common/browse/blocks/info/Text.vue +17 -0
  200. package/components/common/browse/blocks/models/types.ts +1 -0
  201. package/components/common/browse/models/interfaces.ts +5 -0
  202. package/components/common/context/Context.spec.ts +20 -0
  203. package/components/common/context/Context.vue +97 -0
  204. package/components/common/context/ContextRecursion.spec.ts +55 -0
  205. package/components/common/context/ContextRecursion.vue +251 -0
  206. package/components/common/context/models/interfaces.ts +26 -0
  207. package/components/common/details/DetailsItem.vue +106 -0
  208. package/components/common/details/DetailsList.vue +23 -0
  209. package/components/common/details/model/interfaces.ts +9 -0
  210. package/components/common/diagramMain/Diagram.vue +186 -0
  211. package/components/common/diagramMain/DiagramMain.vue +979 -0
  212. package/components/common/diagramMain/Header.vue +160 -0
  213. package/components/common/diagramMain/Highlights.vue +102 -0
  214. package/components/common/diagramMain/adapter/Adapter.vue +105 -0
  215. package/components/common/diagramMain/adapter/AdapterItem.vue +227 -0
  216. package/components/common/diagramMain/adapter/AdapterItems.vue +57 -0
  217. package/components/common/diagramMain/adapter/Block.vue +41 -0
  218. package/components/common/diagramMain/adapter/Contents.vue +96 -0
  219. package/components/common/diagramMain/adapter/Lines.vue +52 -0
  220. package/components/common/diagramMain/adapter/SecondBlock.vue +42 -0
  221. package/components/common/diagramMain/config/index.ts +51 -0
  222. package/components/common/diagramMain/config/initial.ts +38 -0
  223. package/components/common/diagramMain/modals/ManagePhysicalAdaptersModal.vue +236 -0
  224. package/components/common/diagramMain/modals/MigrateVmkernelAdapter.vue +535 -0
  225. package/components/common/diagramMain/modals/config/adapterModal.ts +110 -0
  226. package/components/common/diagramMain/modals/config/diagramConfig.ts +17 -0
  227. package/components/common/diagramMain/modals/config/index.ts +57 -0
  228. package/components/common/diagramMain/modals/config/initial.ts +195 -0
  229. package/components/common/diagramMain/modals/config/migrateVmkernelAdapterSteps.ts +81 -0
  230. package/components/common/diagramMain/modals/config/networkModal.ts +337 -0
  231. package/components/common/diagramMain/modals/config/portModal.ts +201 -0
  232. package/components/common/diagramMain/modals/config/switchModal.ts +172 -0
  233. package/components/common/diagramMain/modals/config/vCenterModal.ts +30 -0
  234. package/components/common/diagramMain/modals/config/validation.ts +3 -0
  235. package/components/common/diagramMain/modals/config/vmKernelAdapter.ts +90 -0
  236. package/components/common/diagramMain/modals/editSettings/ConfirmTeamingSettingsModal.vue +41 -0
  237. package/components/common/diagramMain/modals/editSettings/EditSettings.vue +490 -0
  238. package/components/common/diagramMain/modals/editSettings/EditSettingsModal.vue +714 -0
  239. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +211 -0
  240. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +178 -0
  241. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +161 -0
  242. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +165 -0
  243. package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +392 -0
  244. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -0
  245. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +202 -0
  246. package/components/common/diagramMain/modals/remove/RemoveModal.vue +226 -0
  247. package/components/common/diagramMain/modals/steps/ConnectionSettings.vue +206 -0
  248. package/components/common/diagramMain/modals/steps/SelectVmkernelAdapter.vue +221 -0
  249. package/components/common/diagramMain/modals/steps/VmkernelAdapterReadyComplete.vue +50 -0
  250. package/components/common/diagramMain/modals/utils/index.ts +9 -0
  251. package/components/common/diagramMain/modals/viewSettings/Info.vue +94 -0
  252. package/components/common/diagramMain/modals/viewSettings/ViewSettings.vue +171 -0
  253. package/components/common/diagramMain/modals/viewSettings/ViewSettingsModal.vue +93 -0
  254. package/components/common/diagramMain/models/enums.ts +27 -0
  255. package/components/common/diagramMain/models/interfaces.ts +586 -0
  256. package/components/common/diagramMain/models/types.ts +9 -0
  257. package/components/common/diagramMain/network/Block.vue +55 -0
  258. package/components/common/diagramMain/network/Contents.vue +238 -0
  259. package/components/common/diagramMain/network/Lines.vue +65 -0
  260. package/components/common/diagramMain/network/Network.vue +117 -0
  261. package/components/common/diagramMain/network/NoNetwork.vue +47 -0
  262. package/components/common/diagramMain/network/SecondBlock.vue +51 -0
  263. package/components/common/diagramMain/port/Port.vue +301 -0
  264. package/components/common/diagramMain/port/Ports.vue +41 -0
  265. package/components/common/diagramMain/switch/Switch.vue +71 -0
  266. package/components/common/diagramMain/switch/SwitchSelected.vue +29 -0
  267. package/components/common/diagramMain/utils/utils.ts +218 -0
  268. package/components/common/feedback/Buttons.vue +232 -0
  269. package/components/common/feedback/Feedback.vue +236 -0
  270. package/components/common/feedback/Message.vue +468 -0
  271. package/components/common/feedback/VisitPortal.vue +54 -0
  272. package/components/common/feedback/config/drawingPanel.ts +31 -0
  273. package/components/common/feedback/config/feedbackTabs.ts +24 -0
  274. package/components/common/feedback/models/interfaces.ts +15 -0
  275. package/components/common/graph/Graph.vue +107 -0
  276. package/components/common/graph/utils/renderGraph.ts +389 -0
  277. package/components/common/headline/Headline.vue +32 -0
  278. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +343 -0
  279. package/components/common/mainNavigationPanel/models/interfaces.ts +6 -0
  280. package/components/common/mainNavigationPanel/models/types.ts +1 -0
  281. package/components/common/modals/Rename.vue +165 -0
  282. package/components/common/modals/config/defaultForm.ts +18 -0
  283. package/components/common/modals/config/renameLabelWidth.ts +3 -0
  284. package/components/common/modals/models/interfaces.ts +5 -0
  285. package/components/common/monitor/advanced/Advanced.vue +149 -0
  286. package/components/common/monitor/advanced/GraphView.vue +200 -0
  287. package/components/common/monitor/advanced/models/interfaces.ts +6 -0
  288. package/components/common/monitor/advanced/models/types.ts +1 -0
  289. package/components/common/monitor/advanced/table/Table.vue +90 -0
  290. package/components/common/monitor/advanced/table/config/performanceDatatable.ts +116 -0
  291. package/components/common/monitor/advanced/table/models/interfaces.ts +12 -0
  292. package/components/common/monitor/advanced/table/models/types.ts +10 -0
  293. package/components/common/monitor/advanced/tools/Tools.vue +281 -0
  294. package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModal.vue +109 -0
  295. package/components/common/monitor/advanced/tools/chartOptionsModal/Notification.vue +33 -0
  296. package/components/common/monitor/advanced/tools/chartOptionsModal/actions/Actions.vue +79 -0
  297. package/components/common/monitor/advanced/tools/chartOptionsModal/actions/config/optionsActions.ts +13 -0
  298. package/components/common/monitor/advanced/tools/chartOptionsModal/actions/saveOptionsModal/SaveOptionsModal.vue +53 -0
  299. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/Counters.vue +47 -0
  300. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/Table.vue +104 -0
  301. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/config/tableConfig.ts +73 -0
  302. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces.ts +15 -0
  303. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/types.ts +7 -0
  304. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/Timespan.vue +18 -0
  305. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +388 -0
  306. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/config/dateForm.ts +59 -0
  307. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/Object.vue +107 -0
  308. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/config/objectTable.ts +54 -0
  309. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/models/interfaces.ts +4 -0
  310. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/models/types.ts +1 -0
  311. package/components/common/monitor/advanced/tools/chartOptionsModal/metrics/Metrics.vue +32 -0
  312. package/components/common/monitor/advanced/tools/chartOptionsModal/metrics/config/optionsMetrics.ts +104 -0
  313. package/components/common/monitor/advanced/tools/config/advancedToolbar.ts +73 -0
  314. package/components/common/monitor/advanced/tools/models/interfaces.ts +4 -0
  315. package/components/common/monitor/config/getValidDateByOption.ts +14 -0
  316. package/components/common/monitor/models/interfaces.ts +16 -0
  317. package/components/common/monitor/overview/Overview.vue +412 -0
  318. package/components/common/monitor/overview/filters/Filters.vue +210 -0
  319. package/components/common/monitor/overview/filters/config/filterOptions.ts +56 -0
  320. package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModal.vue +220 -0
  321. package/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker.ts +35 -0
  322. package/components/common/monitor/overview/filters/models/interfaces.ts +6 -0
  323. package/components/common/monitor/overview/filters/models/types.ts +3 -0
  324. package/components/common/perPage/PerPage.vue +51 -0
  325. package/components/common/recursionTree/RecursionTree.vue +201 -0
  326. package/components/common/recursionTree/models/interfaces.ts +19 -0
  327. package/components/common/resource/models/interfaces.ts +9 -0
  328. package/components/common/resource/models/types.ts +1 -0
  329. package/components/common/resource/progressBlock/ProgressBlock.vue +105 -0
  330. package/components/common/resource/simple/Simple.vue +58 -0
  331. package/components/common/resource/simple/models/enums.ts +5 -0
  332. package/components/common/resource/utils.ts +33 -0
  333. package/components/common/select/button/ButtonDropdown.vue +100 -0
  334. package/components/common/select/button/models/interfaces.ts +6 -0
  335. package/components/common/select/radio/RadioGroup.vue +71 -0
  336. package/components/common/select/radio/models/interfaces.ts +10 -0
  337. package/components/common/spiceConsole/Drawer.vue +233 -0
  338. package/components/common/spiceConsole/SpiceConsole.vue +87 -0
  339. package/components/common/spiceConsole/keyboard/Keyboard.vue +402 -0
  340. package/components/common/spiceConsole/keyboard/config/keyboardRows.ts +891 -0
  341. package/components/common/spiceConsole/keyboard/models/interfaces.ts +17 -0
  342. package/components/common/spiceConsole/models/types.ts +1 -0
  343. package/components/common/split/horizontal/Horizontal.vue +306 -0
  344. package/components/common/split/horizontal/models/interfaces.ts +5 -0
  345. package/components/common/split/vertical/Vertical.vue +213 -0
  346. package/components/common/split/vertical/models/interfaces.ts +3 -0
  347. package/components/common/tools/Actions.vue +141 -0
  348. package/components/common/tools/models/interfaces.ts +6 -0
  349. package/components/common/vm/actions/add/Add.vue +654 -0
  350. package/components/common/vm/actions/add/FolderTreeView.vue +83 -0
  351. package/components/common/vm/actions/add/config/capabilities.ts +670 -0
  352. package/components/common/vm/actions/add/customizeHardware/CustomizeHardware.vue +236 -0
  353. package/components/common/vm/actions/add/customizeHardware/config/navItems.ts +19 -0
  354. package/components/common/vm/actions/add/customizeHardware/models/interfaces.ts +7 -0
  355. package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue +611 -0
  356. package/components/common/vm/actions/add/customizeHardware/virtualHardware/browseView/BrowseView.vue +203 -0
  357. package/components/common/vm/actions/add/customizeHardware/virtualHardware/browseView/models/interfaces.ts +8 -0
  358. package/components/common/vm/actions/add/customizeHardware/virtualHardware/bus/Bus.vue +86 -0
  359. package/components/common/vm/actions/add/customizeHardware/virtualHardware/bus/config/options.ts +13 -0
  360. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +223 -0
  361. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/config/fileTypes.ts +9 -0
  362. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/config/options.ts +11 -0
  363. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +55 -0
  364. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/models/types.ts +1 -0
  365. package/components/common/vm/actions/add/customizeHardware/virtualHardware/config/binaryOptions.ts +12 -0
  366. package/components/common/vm/actions/add/customizeHardware/virtualHardware/config/dropdownItems.ts +52 -0
  367. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +97 -0
  368. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +368 -0
  369. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CpuHotPlug.vue +49 -0
  370. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CpuModel.vue +220 -0
  371. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Hv.vue +93 -0
  372. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Iommu.vue +52 -0
  373. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/MaxCpu.vue +99 -0
  374. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Pc.vue +54 -0
  375. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Sa.vue +102 -0
  376. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/config/cpuOptions.ts +19 -0
  377. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/shares/Shares.vue +151 -0
  378. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/shares/config/options.ts +28 -0
  379. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/tooltip/Tooltip.vue +58 -0
  380. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +210 -0
  381. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts +28 -0
  382. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +278 -0
  383. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/MemoryHotPlug.vue +53 -0
  384. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +23 -0
  385. package/components/common/vm/actions/add/customizeHardware/virtualHardware/models/interfaces.ts +125 -0
  386. package/components/common/vm/actions/add/customizeHardware/virtualHardware/models/types.ts +4 -0
  387. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/DiskFile.vue +24 -0
  388. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/Location.vue +171 -0
  389. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/MaximumSize.vue +27 -0
  390. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +447 -0
  391. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/cache/Cache.vue +80 -0
  392. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/cache/config/options.ts +7 -0
  393. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/limitIops/LimitIops.vue +147 -0
  394. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/limitIops/config/options.ts +28 -0
  395. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/mode/Mode.vue +87 -0
  396. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/mode/config/options.ts +18 -0
  397. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/provisioning/Provisioning.vue +87 -0
  398. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/provisioning/config/options.ts +15 -0
  399. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/sharing/Sharing.vue +85 -0
  400. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/sharing/config/options.ts +12 -0
  401. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/Location.vue +141 -0
  402. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +252 -0
  403. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/adapterType/AdapterType.vue +86 -0
  404. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/adapterType/config/options.ts +9 -0
  405. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +140 -0
  406. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/macAddress/config/options.ts +11 -0
  407. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +157 -0
  408. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newPciDevice/config/options.ts +7 -0
  409. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIo.vue +44 -0
  410. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +49 -0
  411. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/config/options.ts +10 -0
  412. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +27 -0
  413. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGrid.vue +41 -0
  414. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newPciDevice/typeSelection/TypeSelection.vue +56 -0
  415. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +65 -0
  416. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newUsbController/config/options.ts +6 -0
  417. package/components/common/vm/actions/add/customizeHardware/virtualHardware/other/InputDevices.vue +21 -0
  418. package/components/common/vm/actions/add/customizeHardware/virtualHardware/other/Other.vue +27 -0
  419. package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/Reservation.vue +228 -0
  420. package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/config/options.ts +33 -0
  421. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/Graphics.vue +45 -0
  422. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/TotalVideoMemory.vue +120 -0
  423. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +169 -0
  424. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/config/options.ts +11 -0
  425. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/model/Model.vue +57 -0
  426. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/model/config/options.ts +10 -0
  427. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +82 -0
  428. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/numberDisplays/config/options.ts +14 -0
  429. package/components/common/vm/actions/add/customizeHardware/vmoptions/Vmoptions.vue +141 -0
  430. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/BootOptions.vue +110 -0
  431. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/Menu.vue +45 -0
  432. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/Secure.vue +45 -0
  433. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +50 -0
  434. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/delay/config/config.ts +14 -0
  435. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +83 -0
  436. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/firmware/config/config.ts +11 -0
  437. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/order/Order.vue +195 -0
  438. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/order/models/interfaces.ts +8 -0
  439. package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +114 -0
  440. package/components/common/vm/actions/add/customizeHardware/vmoptions/models/interfaces.ts +34 -0
  441. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +45 -0
  442. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/FileTransfer.vue +49 -0
  443. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/FolderSharing.vue +50 -0
  444. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/PlaybackCompression.vue +49 -0
  445. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/PowerControl.vue +49 -0
  446. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +226 -0
  447. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/imgCompression/ImgCompression.vue +82 -0
  448. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/imgCompression/config/config.ts +14 -0
  449. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/jpegCompression/JpegCompression.vue +82 -0
  450. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/jpegCompression/config/config.ts +12 -0
  451. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +50 -0
  452. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/config/config.ts +6 -0
  453. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/mouseMode/MouseMode.vue +52 -0
  454. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/mouseMode/config/config.ts +11 -0
  455. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +134 -0
  456. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/password/models/interfaces.ts +5 -0
  457. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/password/utils.ts +12 -0
  458. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/sharePolicy/SharePolicy.vue +52 -0
  459. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/sharePolicy/config/config.ts +11 -0
  460. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +82 -0
  461. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/config/config.ts +12 -0
  462. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/type/Type.vue +82 -0
  463. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/type/config/config.ts +7 -0
  464. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +56 -0
  465. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/config/config.ts +14 -0
  466. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/zlibCompression/ZlibCompression.vue +82 -0
  467. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/zlibCompression/config/config.ts +12 -0
  468. package/components/common/vm/actions/add/customizeHardware/vmoptions/tools/Tools.vue +63 -0
  469. package/components/common/vm/actions/add/models/enums.ts +89 -0
  470. package/components/common/vm/actions/add/models/interfaces.ts +125 -0
  471. package/components/common/vm/actions/add/models/types.ts +63 -0
  472. package/components/common/vm/actions/add/readyToComplete/ReadyToComplete.vue +15 -0
  473. package/components/common/vm/actions/add/select/compatibility/Compatibility.vue +151 -0
  474. package/components/common/vm/actions/add/select/computeResource/ComputeResource.spec.ts +479 -0
  475. package/components/common/vm/actions/add/select/computeResource/ComputeResource.vue +158 -0
  476. package/components/common/vm/actions/add/select/computeResource/TreeView.vue +126 -0
  477. package/components/common/vm/actions/add/select/createType/CreateType.vue +61 -0
  478. package/components/common/vm/actions/add/select/createType/config/items.ts +26 -0
  479. package/components/common/vm/actions/add/select/models/interfaces.ts +32 -0
  480. package/components/common/vm/actions/add/select/models/types.ts +44 -0
  481. package/components/common/vm/actions/add/select/name/Name.vue +163 -0
  482. package/components/common/vm/actions/add/select/os/os.vue +221 -0
  483. package/components/common/vm/actions/add/select/storage/Storage.vue +176 -0
  484. package/components/common/vm/actions/add/select/storage/config/config.ts +148 -0
  485. package/components/common/vm/actions/add/select/storage/models/types.ts +15 -0
  486. package/components/common/vm/actions/add/utils.ts +118 -0
  487. package/components/common/vm/actions/editSettings/EditSettings.vue +312 -0
  488. package/components/common/vm/actions/editSettings/models/types.ts +23 -0
  489. package/components/common/vm/actions/editSettings/utils.ts +48 -0
  490. package/components/common/vm/actions/models/interfaces.ts +6 -0
  491. package/components/common/vm/actions/models/types.ts +11 -0
  492. package/components/common/vm/actions/utils.ts +221 -0
  493. package/components/common/wizards/datastore/add/Add.vue +382 -0
  494. package/components/common/wizards/datastore/add/config/stepItems.ts +160 -0
  495. package/components/common/wizards/datastore/add/local/Local.vue +67 -0
  496. package/components/common/wizards/datastore/add/local/createName/CreateName.vue +159 -0
  497. package/components/common/wizards/datastore/add/local/createName/config/defaultForm.ts +15 -0
  498. package/components/common/wizards/datastore/add/models/interfaces.ts +35 -0
  499. package/components/common/wizards/datastore/add/models/types.ts +14 -0
  500. package/components/common/wizards/datastore/add/nfs/Nfs.vue +91 -0
  501. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +95 -0
  502. package/components/common/wizards/datastore/add/nfs/accessibility/config/tabsPannel.ts +24 -0
  503. package/components/common/wizards/datastore/add/nfs/accessibility/models/interfaces.ts +9 -0
  504. package/components/common/wizards/datastore/add/nfs/accessibility/models/types.ts +5 -0
  505. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/TablesView.vue +141 -0
  506. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/config/compatibleTable.ts +54 -0
  507. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/config/hostsTableItems.ts +75 -0
  508. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/config/incompatibleTable.ts +68 -0
  509. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/config/tableKeys.ts +15 -0
  510. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +373 -0
  511. package/components/common/wizards/datastore/add/nfs/configuration/config/defaultForm.ts +33 -0
  512. package/components/common/wizards/datastore/add/nfs/configuration/models/interfaces.ts +12 -0
  513. package/components/common/wizards/datastore/add/nfs/configuration/serversList/DeletePopover.vue +97 -0
  514. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -0
  515. package/components/common/wizards/datastore/add/nfs/configuration/serversList/config/serversListConfig.ts +41 -0
  516. package/components/common/wizards/datastore/add/nfs/configuration/serversList/config/tableKeys.ts +3 -0
  517. package/components/common/wizards/datastore/add/nfs/configuration/serversList/models/interfaces.ts +11 -0
  518. package/components/common/wizards/datastore/add/nfs/configuration/serversList/models/types.ts +1 -0
  519. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -0
  520. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/config/radioOptions.ts +24 -0
  521. package/components/common/wizards/datastore/add/nfs/version/Version.vue +70 -0
  522. package/components/common/wizards/datastore/add/nfs/version/config/versionOptions.ts +20 -0
  523. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +77 -0
  524. package/components/common/wizards/datastore/add/readyComplete/config/propertiesDetails.ts +165 -0
  525. package/components/common/wizards/datastore/add/readyComplete/models/interfaces.ts +4 -0
  526. package/components/common/wizards/datastore/add/sharedStorm/SharedStorm.vue +85 -0
  527. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +447 -0
  528. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/config/defaultForm.ts +18 -0
  529. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/config/selectOptions.ts +14 -0
  530. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -0
  531. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/config/hostsTable.ts +87 -0
  532. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/config/tableKeys.ts +11 -0
  533. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/models/interfaces.ts +55 -0
  534. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/models/types.ts +14 -0
  535. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -0
  536. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/config/selectOptions.ts +46 -0
  537. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/graphicTooltip/graphicTooltip.vue +64 -0
  538. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +225 -0
  539. package/components/common/wizards/datastore/add/sharedStorm/version/Version.vue +70 -0
  540. package/components/common/wizards/datastore/add/sharedStorm/version/config/versionOptions.ts +19 -0
  541. package/components/common/wizards/datastore/add/types/Types.vue +79 -0
  542. package/components/common/wizards/datastore/add/types/config/typeOptions.ts +31 -0
  543. package/components/common/wizards/datastore/add/utils.ts +69 -0
  544. package/components/models/interfaces.ts +14 -0
  545. package/composables/deepCopy.ts +21 -0
  546. package/composables/useDiff.ts +15 -0
  547. package/composables/useLocal.ts +36 -0
  548. package/composables/useLocalStorage.ts +45 -0
  549. package/composables/useThrottle.ts +32 -0
  550. package/composables/useUniqueId.ts +5 -0
  551. package/config/regExp.ts +13 -0
  552. package/eslint/index.js +15 -0
  553. package/eslint/no-import-type.js +17 -0
  554. package/eslint/no-invalid-type-prefix.js +32 -0
  555. package/minify.js +51 -0
  556. package/models/composables/useMyFetch/interfaces.ts +4 -0
  557. package/models/composables/useMyFetch/types.ts +1 -0
  558. package/models/enums.ts +21 -0
  559. package/models/interfaces.ts +29 -0
  560. package/models/plugins/date/interfaces.ts +5 -0
  561. package/models/plugins/date/types.ts +1 -0
  562. package/models/plugins/validation/interfaces.ts +21 -0
  563. package/models/plugins/validation/types.ts +1 -0
  564. package/models/store/host/interfaces.ts +38 -0
  565. package/models/store/interfaces.ts +47 -0
  566. package/models/store/network/interfaces.ts +13 -0
  567. package/models/store/storage/interfaces.ts +32 -0
  568. package/models/store/vm/interfaces.ts +87 -0
  569. package/models/types.ts +6 -0
  570. package/nuxt.config.ts +8 -0
  571. package/package.json +39 -0
  572. package/plugins/binary.ts +122 -0
  573. package/plugins/date.ts +179 -0
  574. package/plugins/recursion.ts +199 -0
  575. package/plugins/spice-console/spice.console.ts +128 -0
  576. package/plugins/text.ts +48 -0
  577. package/plugins/validation.ts +172 -0
  578. package/public/favicon.ico +0 -0
  579. package/public/spice-console/application/WorkerProcess.js +3350 -0
  580. package/public/spice-console/application/WorkerProcess_back.js +3144 -0
  581. package/public/spice-console/application/WorkerProcess_meta.js +3103 -0
  582. package/public/spice-console/application/WorkerProcess_reverse.js +3214 -0
  583. package/public/spice-console/application/agent.js +175 -0
  584. package/public/spice-console/application/application.js +641 -0
  585. package/public/spice-console/application/checkActivity.js +50 -0
  586. package/public/spice-console/application/clientgui.js +842 -0
  587. package/public/spice-console/application/clipboard/clipboarddataparser.js +92 -0
  588. package/public/spice-console/application/clipboard/local/localClipboard.js +110 -0
  589. package/public/spice-console/application/clipboard.js +82 -0
  590. package/public/spice-console/application/codec.js +257 -0
  591. package/public/spice-console/application/imagecache.js +81 -0
  592. package/public/spice-console/application/inputmanager.js +270 -0
  593. package/public/spice-console/application/packetfactory.js +202 -0
  594. package/public/spice-console/application/packetfilter.js +103 -0
  595. package/public/spice-console/application/packetprocess.js +75 -0
  596. package/public/spice-console/application/rasteroperation.js +118 -0
  597. package/public/spice-console/application/spiceconnection.js +197 -0
  598. package/public/spice-console/application/stream.js +67 -0
  599. package/public/spice-console/application/virtualmouse.js +109 -0
  600. package/public/spice-console/keymaps/keyevent.js +36 -0
  601. package/public/spice-console/keymaps/keymap.js +229 -0
  602. package/public/spice-console/keymaps/keymapes.js +375 -0
  603. package/public/spice-console/keymaps/keymapesObj.js +317 -0
  604. package/public/spice-console/keymaps/keymapus.js +317 -0
  605. package/public/spice-console/keymaps/scanCodeObjModifier.js +65 -0
  606. package/public/spice-console/keymaps/scanCodeObjProvider.js +60 -0
  607. package/public/spice-console/lib/AsyncConsumer.js +204 -0
  608. package/public/spice-console/lib/AsyncWorker.js +60 -0
  609. package/public/spice-console/lib/CollisionDetector.js +27 -0
  610. package/public/spice-console/lib/DataLogger.js +197 -0
  611. package/public/spice-console/lib/GenericObjectPool.js +152 -0
  612. package/public/spice-console/lib/GlobalPool.js +114 -0
  613. package/public/spice-console/lib/ImageUncompressor.js +138 -0
  614. package/public/spice-console/lib/IntegrationBenchmark.js +64 -0
  615. package/public/spice-console/lib/PacketWorkerIdentifier.js +107 -0
  616. package/public/spice-console/lib/SyncAsyncHandler.js +46 -0
  617. package/public/spice-console/lib/base64.js +298 -0
  618. package/public/spice-console/lib/biginteger.js +1640 -0
  619. package/public/spice-console/lib/bowser.js +276 -0
  620. package/public/spice-console/lib/decoder/dixie.js +7930 -0
  621. package/public/spice-console/lib/decoder/jmuxer.js +2815 -0
  622. package/public/spice-console/lib/displayRouter.js +83 -0
  623. package/public/spice-console/lib/encrypt.js +191 -0
  624. package/public/spice-console/lib/flipper.js +39 -0
  625. package/public/spice-console/lib/graphic.js +1230 -0
  626. package/public/spice-console/lib/graphicdebug.js +223 -0
  627. package/public/spice-console/lib/images/bitmap.js +194 -0
  628. package/public/spice-console/lib/images/jsquic_family.js +84 -0
  629. package/public/spice-console/lib/images/jsquic_rgba.js +343 -0
  630. package/public/spice-console/lib/images/jsquic_uncompress.js +530 -0
  631. package/public/spice-console/lib/images/lz.js +717 -0
  632. package/public/spice-console/lib/images/png.js +275 -0
  633. package/public/spice-console/lib/jgestures.min.js +44 -0
  634. package/public/spice-console/lib/jquery-2.0.3.js +8829 -0
  635. package/public/spice-console/lib/jquery-mousewheel.js +84 -0
  636. package/public/spice-console/lib/jquery-visibility.min.js +2 -0
  637. package/public/spice-console/lib/jsbn.js +578 -0
  638. package/public/spice-console/lib/jsbn2.js +675 -0
  639. package/public/spice-console/lib/lodash.4.0.0.min.js +136 -0
  640. package/public/spice-console/lib/modernizr.js +39 -0
  641. package/public/spice-console/lib/pixastic.js +3244 -0
  642. package/public/spice-console/lib/prettyprint.js +794 -0
  643. package/public/spice-console/lib/prng4.js +64 -0
  644. package/public/spice-console/lib/queue.js +259 -0
  645. package/public/spice-console/lib/rasterEngine.js +907 -0
  646. package/public/spice-console/lib/rng.js +87 -0
  647. package/public/spice-console/lib/runqueue.js +103 -0
  648. package/public/spice-console/lib/sha1.js +124 -0
  649. package/public/spice-console/lib/stuckkeyshandler.js +122 -0
  650. package/public/spice-console/lib/timelapsedetector.js +62 -0
  651. package/public/spice-console/lib/utils.js +327 -0
  652. package/public/spice-console/lib/virtualjoystick.js +370 -0
  653. package/public/spice-console/network/busconnection.js +195 -0
  654. package/public/spice-console/network/clusternodechooser.js +49 -0
  655. package/public/spice-console/network/connectioncontrol.js +60 -0
  656. package/public/spice-console/network/packetcontroller.js +62 -0
  657. package/public/spice-console/network/packetextractor.js +73 -0
  658. package/public/spice-console/network/packetlinkfactory.js +64 -0
  659. package/public/spice-console/network/packetreassembler.js +77 -0
  660. package/public/spice-console/network/reassemblerfactory.js +39 -0
  661. package/public/spice-console/network/sizedefiner.js +86 -0
  662. package/public/spice-console/network/socket.js +120 -0
  663. package/public/spice-console/network/socketqueue.js +95 -0
  664. package/public/spice-console/network/spicechannel.js +310 -0
  665. package/public/spice-console/network/websocketwrapper.js +75 -0
  666. package/public/spice-console/process/busprocess.js +309 -0
  667. package/public/spice-console/process/cursorprocess.js +110 -0
  668. package/public/spice-console/process/displaypreprocess.js +152 -0
  669. package/public/spice-console/process/displayprocess.js +210 -0
  670. package/public/spice-console/process/inputprocess.js +204 -0
  671. package/public/spice-console/process/mainprocess.js +78 -0
  672. package/public/spice-console/process/playbackprocess.js +233 -0
  673. package/public/spice-console/resources/magnifier.png +0 -0
  674. package/public/spice-console/resources/mouse.png +0 -0
  675. package/public/spice-console/resources/mouse_cursor.gif +0 -0
  676. package/public/spice-console/resources/mouse_cursor.png +0 -0
  677. package/public/spice-console/run.js +181 -0
  678. package/public/spice-console/spiceobjects/generated/protocol.js +537 -0
  679. package/public/spice-console/spiceobjects/spiceobjects.js +3474 -0
  680. package/public/spice-console/swcanvas/swcanvas.js +82 -0
  681. package/public/spice-console/tools/generate.php +269 -0
  682. package/public/spice-console/tools/generateKeyboardLayout.php +63 -0
  683. package/public/spice-console/tools/generateSpiceObject.php +81 -0
  684. package/public/spice-console-minify/application/WorkerProcess.min.js +1 -0
  685. package/public/spice-console-minify/application/WorkerProcess_back.min.js +1 -0
  686. package/public/spice-console-minify/application/WorkerProcess_meta.min.js +1 -0
  687. package/public/spice-console-minify/application/WorkerProcess_reverse.min.js +1 -0
  688. package/public/spice-console-minify/application/agent.min.js +1 -0
  689. package/public/spice-console-minify/application/application.min.js +1 -0
  690. package/public/spice-console-minify/application/checkActivity.min.js +1 -0
  691. package/public/spice-console-minify/application/clientgui.min.js +1 -0
  692. package/public/spice-console-minify/application/clipboard/clipboarddataparser.min.js +1 -0
  693. package/public/spice-console-minify/application/clipboard/local/localClipboard.min.js +1 -0
  694. package/public/spice-console-minify/application/clipboard.min.js +1 -0
  695. package/public/spice-console-minify/application/codec.min.js +1 -0
  696. package/public/spice-console-minify/application/imagecache.min.js +1 -0
  697. package/public/spice-console-minify/application/inputmanager.min.js +1 -0
  698. package/public/spice-console-minify/application/packetfactory.min.js +1 -0
  699. package/public/spice-console-minify/application/packetfilter.min.js +1 -0
  700. package/public/spice-console-minify/application/packetprocess.min.js +1 -0
  701. package/public/spice-console-minify/application/rasteroperation.min.js +1 -0
  702. package/public/spice-console-minify/application/spiceconnection.min.js +1 -0
  703. package/public/spice-console-minify/application/stream.min.js +1 -0
  704. package/public/spice-console-minify/application/virtualmouse.min.js +1 -0
  705. package/public/spice-console-minify/keymaps/keyevent.min.js +1 -0
  706. package/public/spice-console-minify/keymaps/keymap.min.js +1 -0
  707. package/public/spice-console-minify/keymaps/keymapes.min.js +1 -0
  708. package/public/spice-console-minify/keymaps/keymapesObj.min.js +1 -0
  709. package/public/spice-console-minify/keymaps/keymapus.min.js +1 -0
  710. package/public/spice-console-minify/keymaps/scanCodeObjModifier.min.js +1 -0
  711. package/public/spice-console-minify/keymaps/scanCodeObjProvider.min.js +1 -0
  712. package/public/spice-console-minify/lib/AsyncConsumer.min.js +1 -0
  713. package/public/spice-console-minify/lib/AsyncWorker.min.js +1 -0
  714. package/public/spice-console-minify/lib/CollisionDetector.min.js +1 -0
  715. package/public/spice-console-minify/lib/DataLogger.min.js +1 -0
  716. package/public/spice-console-minify/lib/GenericObjectPool.min.js +1 -0
  717. package/public/spice-console-minify/lib/GlobalPool.min.js +1 -0
  718. package/public/spice-console-minify/lib/ImageUncompressor.min.js +1 -0
  719. package/public/spice-console-minify/lib/IntegrationBenchmark.min.js +1 -0
  720. package/public/spice-console-minify/lib/PacketWorkerIdentifier.min.js +1 -0
  721. package/public/spice-console-minify/lib/SyncAsyncHandler.min.js +1 -0
  722. package/public/spice-console-minify/lib/base64.min.js +1 -0
  723. package/public/spice-console-minify/lib/biginteger.min.js +1 -0
  724. package/public/spice-console-minify/lib/bowser.min.js +1 -0
  725. package/public/spice-console-minify/lib/decoder/dixie.min.js +5 -0
  726. package/public/spice-console-minify/lib/decoder/jmuxer.min.js +1 -0
  727. package/public/spice-console-minify/lib/displayRouter.min.js +1 -0
  728. package/public/spice-console-minify/lib/encrypt.min.js +1 -0
  729. package/public/spice-console-minify/lib/flipper.min.js +1 -0
  730. package/public/spice-console-minify/lib/graphic.min.js +1 -0
  731. package/public/spice-console-minify/lib/graphicdebug.min.js +1 -0
  732. package/public/spice-console-minify/lib/images/bitmap.min.js +1 -0
  733. package/public/spice-console-minify/lib/images/jsquic_family.min.js +1 -0
  734. package/public/spice-console-minify/lib/images/jsquic_rgba.min.js +1 -0
  735. package/public/spice-console-minify/lib/images/jsquic_uncompress.min.js +1 -0
  736. package/public/spice-console-minify/lib/images/lz.min.js +1 -0
  737. package/public/spice-console-minify/lib/images/png.min.js +1 -0
  738. package/public/spice-console-minify/lib/jgestures.min.js +25 -0
  739. package/public/spice-console-minify/lib/jquery-2.0.3.min.js +25 -0
  740. package/public/spice-console-minify/lib/jquery-mousewheel.min.js +12 -0
  741. package/public/spice-console-minify/lib/jquery-visibility.min.js +2 -0
  742. package/public/spice-console-minify/lib/jsbn.min.js +1 -0
  743. package/public/spice-console-minify/lib/jsbn2.min.js +1 -0
  744. package/public/spice-console-minify/lib/lodash.4.0.0.min.js +6 -0
  745. package/public/spice-console-minify/lib/modernizr.min.js +1 -0
  746. package/public/spice-console-minify/lib/pixastic.min.js +1 -0
  747. package/public/spice-console-minify/lib/prettyprint.min.js +1 -0
  748. package/public/spice-console-minify/lib/prng4.min.js +1 -0
  749. package/public/spice-console-minify/lib/queue.min.js +1 -0
  750. package/public/spice-console-minify/lib/rasterEngine.min.js +1 -0
  751. package/public/spice-console-minify/lib/rng.min.js +1 -0
  752. package/public/spice-console-minify/lib/runqueue.min.js +1 -0
  753. package/public/spice-console-minify/lib/sha1.min.js +1 -0
  754. package/public/spice-console-minify/lib/stuckkeyshandler.min.js +1 -0
  755. package/public/spice-console-minify/lib/timelapsedetector.min.js +1 -0
  756. package/public/spice-console-minify/lib/utils.min.js +1 -0
  757. package/public/spice-console-minify/lib/virtualjoystick.min.js +1 -0
  758. package/public/spice-console-minify/network/busconnection.min.js +1 -0
  759. package/public/spice-console-minify/network/clusternodechooser.min.js +1 -0
  760. package/public/spice-console-minify/network/connectioncontrol.min.js +1 -0
  761. package/public/spice-console-minify/network/packetcontroller.min.js +1 -0
  762. package/public/spice-console-minify/network/packetextractor.min.js +1 -0
  763. package/public/spice-console-minify/network/packetlinkfactory.min.js +1 -0
  764. package/public/spice-console-minify/network/packetreassembler.min.js +1 -0
  765. package/public/spice-console-minify/network/reassemblerfactory.min.js +1 -0
  766. package/public/spice-console-minify/network/sizedefiner.min.js +1 -0
  767. package/public/spice-console-minify/network/socket.min.js +1 -0
  768. package/public/spice-console-minify/network/socketqueue.min.js +1 -0
  769. package/public/spice-console-minify/network/spicechannel.min.js +1 -0
  770. package/public/spice-console-minify/network/websocketwrapper.min.js +1 -0
  771. package/public/spice-console-minify/process/busprocess.min.js +1 -0
  772. package/public/spice-console-minify/process/cursorprocess.min.js +1 -0
  773. package/public/spice-console-minify/process/displaypreprocess.min.js +1 -0
  774. package/public/spice-console-minify/process/displayprocess.min.js +1 -0
  775. package/public/spice-console-minify/process/inputprocess.min.js +1 -0
  776. package/public/spice-console-minify/process/mainprocess.min.js +1 -0
  777. package/public/spice-console-minify/process/playbackprocess.min.js +1 -0
  778. package/public/spice-console-minify/run.min.js +1 -0
  779. package/public/spice-console-minify/spiceobjects/generated/protocol.min.js +1 -0
  780. package/public/spice-console-minify/spiceobjects/spiceobjects.min.js +1 -0
  781. package/public/spice-console-minify/swcanvas/swcanvas.min.js +1 -0
  782. package/tsconfig.json +4 -0
@@ -0,0 +1,2815 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('stream')) :
3
+ typeof define === 'function' && define.amd ? define(['stream'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.JMuxer = factory(global.stream));
5
+ })(this, (function (stream) { 'use strict';
6
+
7
+ function _typeof(obj) {
8
+ "@babel/helpers - typeof";
9
+
10
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
11
+ _typeof = function (obj) {
12
+ return typeof obj;
13
+ };
14
+ } else {
15
+ _typeof = function (obj) {
16
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
17
+ };
18
+ }
19
+
20
+ return _typeof(obj);
21
+ }
22
+
23
+ function _classCallCheck(instance, Constructor) {
24
+ if (!(instance instanceof Constructor)) {
25
+ throw new TypeError("Cannot call a class as a function");
26
+ }
27
+ }
28
+
29
+ function _defineProperties(target, props) {
30
+ for (var i = 0; i < props.length; i++) {
31
+ var descriptor = props[i];
32
+ descriptor.enumerable = descriptor.enumerable || false;
33
+ descriptor.configurable = true;
34
+ if ("value" in descriptor) descriptor.writable = true;
35
+ Object.defineProperty(target, descriptor.key, descriptor);
36
+ }
37
+ }
38
+
39
+ function _createClass(Constructor, protoProps, staticProps) {
40
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
41
+ if (staticProps) _defineProperties(Constructor, staticProps);
42
+ return Constructor;
43
+ }
44
+
45
+ function _defineProperty(obj, key, value) {
46
+ if (key in obj) {
47
+ Object.defineProperty(obj, key, {
48
+ value: value,
49
+ enumerable: true,
50
+ configurable: true,
51
+ writable: true
52
+ });
53
+ } else {
54
+ obj[key] = value;
55
+ }
56
+
57
+ return obj;
58
+ }
59
+
60
+ function _inherits(subClass, superClass) {
61
+ if (typeof superClass !== "function" && superClass !== null) {
62
+ throw new TypeError("Super expression must either be null or a function");
63
+ }
64
+
65
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
66
+ constructor: {
67
+ value: subClass,
68
+ writable: true,
69
+ configurable: true
70
+ }
71
+ });
72
+ if (superClass) _setPrototypeOf(subClass, superClass);
73
+ }
74
+
75
+ function _getPrototypeOf(o) {
76
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
77
+ return o.__proto__ || Object.getPrototypeOf(o);
78
+ };
79
+ return _getPrototypeOf(o);
80
+ }
81
+
82
+ function _setPrototypeOf(o, p) {
83
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
84
+ o.__proto__ = p;
85
+ return o;
86
+ };
87
+
88
+ return _setPrototypeOf(o, p);
89
+ }
90
+
91
+ function _isNativeReflectConstruct() {
92
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
93
+ if (Reflect.construct.sham) return false;
94
+ if (typeof Proxy === "function") return true;
95
+
96
+ try {
97
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
98
+ return true;
99
+ } catch (e) {
100
+ return false;
101
+ }
102
+ }
103
+
104
+ function _assertThisInitialized(self) {
105
+ if (self === void 0) {
106
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
107
+ }
108
+
109
+ return self;
110
+ }
111
+
112
+ function _possibleConstructorReturn(self, call) {
113
+ if (call && (typeof call === "object" || typeof call === "function")) {
114
+ return call;
115
+ } else if (call !== void 0) {
116
+ throw new TypeError("Derived constructors may only return object or undefined");
117
+ }
118
+
119
+ return _assertThisInitialized(self);
120
+ }
121
+
122
+ function _createSuper(Derived) {
123
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
124
+
125
+ return function _createSuperInternal() {
126
+ var Super = _getPrototypeOf(Derived),
127
+ result;
128
+
129
+ if (hasNativeReflectConstruct) {
130
+ var NewTarget = _getPrototypeOf(this).constructor;
131
+
132
+ result = Reflect.construct(Super, arguments, NewTarget);
133
+ } else {
134
+ result = Super.apply(this, arguments);
135
+ }
136
+
137
+ return _possibleConstructorReturn(this, result);
138
+ };
139
+ }
140
+
141
+ function _slicedToArray(arr, i) {
142
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
143
+ }
144
+
145
+ function _arrayWithHoles(arr) {
146
+ if (Array.isArray(arr)) return arr;
147
+ }
148
+
149
+ function _iterableToArrayLimit(arr, i) {
150
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
151
+
152
+ if (_i == null) return;
153
+ var _arr = [];
154
+ var _n = true;
155
+ var _d = false;
156
+
157
+ var _s, _e;
158
+
159
+ try {
160
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
161
+ _arr.push(_s.value);
162
+
163
+ if (i && _arr.length === i) break;
164
+ }
165
+ } catch (err) {
166
+ _d = true;
167
+ _e = err;
168
+ } finally {
169
+ try {
170
+ if (!_n && _i["return"] != null) _i["return"]();
171
+ } finally {
172
+ if (_d) throw _e;
173
+ }
174
+ }
175
+
176
+ return _arr;
177
+ }
178
+
179
+ function _unsupportedIterableToArray(o, minLen) {
180
+ if (!o) return;
181
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
182
+ var n = Object.prototype.toString.call(o).slice(8, -1);
183
+ if (n === "Object" && o.constructor) n = o.constructor.name;
184
+ if (n === "Map" || n === "Set") return Array.from(o);
185
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
186
+ }
187
+
188
+ function _arrayLikeToArray(arr, len) {
189
+ if (len == null || len > arr.length) len = arr.length;
190
+
191
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
192
+
193
+ return arr2;
194
+ }
195
+
196
+ function _nonIterableRest() {
197
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
198
+ }
199
+
200
+ function _createForOfIteratorHelper(o, allowArrayLike) {
201
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
202
+
203
+ if (!it) {
204
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
205
+ if (it) o = it;
206
+ var i = 0;
207
+
208
+ var F = function () {};
209
+
210
+ return {
211
+ s: F,
212
+ n: function () {
213
+ if (i >= o.length) return {
214
+ done: true
215
+ };
216
+ return {
217
+ done: false,
218
+ value: o[i++]
219
+ };
220
+ },
221
+ e: function (e) {
222
+ throw e;
223
+ },
224
+ f: F
225
+ };
226
+ }
227
+
228
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
229
+ }
230
+
231
+ var normalCompletion = true,
232
+ didErr = false,
233
+ err;
234
+ return {
235
+ s: function () {
236
+ it = it.call(o);
237
+ },
238
+ n: function () {
239
+ var step = it.next();
240
+ normalCompletion = step.done;
241
+ return step;
242
+ },
243
+ e: function (e) {
244
+ didErr = true;
245
+ err = e;
246
+ },
247
+ f: function () {
248
+ try {
249
+ if (!normalCompletion && it.return != null) it.return();
250
+ } finally {
251
+ if (didErr) throw err;
252
+ }
253
+ }
254
+ };
255
+ }
256
+
257
+ var logger;
258
+ var errorLogger;
259
+ function setLogger() {
260
+ /*eslint-disable */
261
+ logger = console.log;
262
+ errorLogger = console.error;
263
+ /*eslint-enable */
264
+ }
265
+ function log(message) {
266
+ if (logger) {
267
+ for (var _len = arguments.length, optionalParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
268
+ optionalParams[_key - 1] = arguments[_key];
269
+ }
270
+
271
+ logger.apply(void 0, [message].concat(optionalParams));
272
+ }
273
+ }
274
+ function error(message) {
275
+ if (errorLogger) {
276
+ for (var _len2 = arguments.length, optionalParams = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
277
+ optionalParams[_key2 - 1] = arguments[_key2];
278
+ }
279
+
280
+ errorLogger.apply(void 0, [message].concat(optionalParams));
281
+ }
282
+ }
283
+
284
+ var NALU = /*#__PURE__*/function () {
285
+ function NALU(data) {
286
+ _classCallCheck(this, NALU);
287
+
288
+ this.payload = data;
289
+ this.nri = (this.payload[0] & 0x60) >> 5; // nal_ref_idc
290
+
291
+ this.ntype = this.payload[0] & 0x1f;
292
+ this.isvcl = this.ntype == 1 || this.ntype == 5;
293
+ this.stype = ''; // slice_type
294
+
295
+ this.isfmb = false; // first_mb_in_slice
296
+ }
297
+
298
+ _createClass(NALU, [{
299
+ key: "toString",
300
+ value: function toString() {
301
+ return "".concat(NALU.type(this), ": NRI: ").concat(this.getNri());
302
+ }
303
+ }, {
304
+ key: "getNri",
305
+ value: function getNri() {
306
+ return this.nri;
307
+ }
308
+ }, {
309
+ key: "type",
310
+ value: function type() {
311
+ return this.ntype;
312
+ }
313
+ }, {
314
+ key: "isKeyframe",
315
+ value: function isKeyframe() {
316
+ return this.ntype === NALU.IDR;
317
+ }
318
+ }, {
319
+ key: "getPayload",
320
+ value: function getPayload() {
321
+ return this.payload;
322
+ }
323
+ }, {
324
+ key: "getPayloadSize",
325
+ value: function getPayloadSize() {
326
+ return this.payload.byteLength;
327
+ }
328
+ }, {
329
+ key: "getSize",
330
+ value: function getSize() {
331
+ return 4 + this.getPayloadSize();
332
+ }
333
+ }, {
334
+ key: "getData",
335
+ value: function getData() {
336
+ var result = new Uint8Array(this.getSize());
337
+ var view = new DataView(result.buffer);
338
+ view.setUint32(0, this.getSize() - 4);
339
+ result.set(this.getPayload(), 4);
340
+ return result;
341
+ }
342
+ }], [{
343
+ key: "NDR",
344
+ get: function get() {
345
+ return 1;
346
+ }
347
+ }, {
348
+ key: "IDR",
349
+ get: function get() {
350
+ return 5;
351
+ }
352
+ }, {
353
+ key: "SEI",
354
+ get: function get() {
355
+ return 6;
356
+ }
357
+ }, {
358
+ key: "SPS",
359
+ get: function get() {
360
+ return 7;
361
+ }
362
+ }, {
363
+ key: "PPS",
364
+ get: function get() {
365
+ return 8;
366
+ }
367
+ }, {
368
+ key: "AUD",
369
+ get: function get() {
370
+ return 9;
371
+ }
372
+ }, {
373
+ key: "TYPES",
374
+ get: function get() {
375
+ var _ref;
376
+
377
+ return _ref = {}, _defineProperty(_ref, NALU.IDR, 'IDR'), _defineProperty(_ref, NALU.SEI, 'SEI'), _defineProperty(_ref, NALU.SPS, 'SPS'), _defineProperty(_ref, NALU.PPS, 'PPS'), _defineProperty(_ref, NALU.NDR, 'NDR'), _defineProperty(_ref, NALU.AUD, 'AUD'), _ref;
378
+ }
379
+ }, {
380
+ key: "type",
381
+ value: function type(nalu) {
382
+ if (nalu.ntype in NALU.TYPES) {
383
+ return NALU.TYPES[nalu.ntype];
384
+ } else {
385
+ return 'UNKNOWN';
386
+ }
387
+ }
388
+ }]);
389
+
390
+ return NALU;
391
+ }();
392
+
393
+ function appendByteArray(buffer1, buffer2) {
394
+ var tmp = new Uint8Array((buffer1.byteLength | 0) + (buffer2.byteLength | 0));
395
+ tmp.set(buffer1, 0);
396
+ tmp.set(buffer2, buffer1.byteLength | 0);
397
+ return tmp;
398
+ }
399
+ function secToTime(sec) {
400
+ var seconds,
401
+ hours,
402
+ minutes,
403
+ result = '';
404
+ seconds = Math.floor(sec);
405
+ hours = parseInt(seconds / 3600, 10) % 24;
406
+ minutes = parseInt(seconds / 60, 10) % 60;
407
+ seconds = seconds < 0 ? 0 : seconds % 60;
408
+
409
+ if (hours > 0) {
410
+ result += (hours < 10 ? '0' + hours : hours) + ':';
411
+ }
412
+
413
+ result += (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds);
414
+ return result;
415
+ }
416
+
417
+ /**
418
+ * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.
419
+ */
420
+ var ExpGolomb = /*#__PURE__*/function () {
421
+ function ExpGolomb(data) {
422
+ _classCallCheck(this, ExpGolomb);
423
+
424
+ this.data = data;
425
+ this.index = 0;
426
+ this.bitLength = data.byteLength * 8;
427
+ }
428
+
429
+ _createClass(ExpGolomb, [{
430
+ key: "setData",
431
+ value: function setData(data) {
432
+ this.data = data;
433
+ this.index = 0;
434
+ this.bitLength = data.byteLength * 8;
435
+ }
436
+ }, {
437
+ key: "bitsAvailable",
438
+ get: function get() {
439
+ return this.bitLength - this.index;
440
+ }
441
+ }, {
442
+ key: "skipBits",
443
+ value: function skipBits(size) {
444
+ // console.log(` skip bits: size=${size}, ${this.index}.`);
445
+ if (this.bitsAvailable < size) {
446
+ //throw new Error('no bytes available');
447
+ return false;
448
+ }
449
+
450
+ this.index += size;
451
+ }
452
+ }, {
453
+ key: "readBits",
454
+ value: function readBits(size) {
455
+ var moveIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
456
+ // console.log(` read bits: size=${size}, ${this.index}.`);
457
+ var result = this.getBits(size, this.index, moveIndex); // console.log(` read bits: result=${result}`);
458
+
459
+ return result;
460
+ }
461
+ }, {
462
+ key: "getBits",
463
+ value: function getBits(size, offsetBits) {
464
+ var moveIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
465
+
466
+ if (this.bitsAvailable < size) {
467
+ //throw new Error('no bytes available');
468
+ return 0;
469
+ }
470
+
471
+ var offset = offsetBits % 8;
472
+
473
+ var _byte = this.data[offsetBits / 8 | 0] & 0xff >>> offset;
474
+
475
+ var bits = 8 - offset;
476
+
477
+ if (bits >= size) {
478
+ if (moveIndex) {
479
+ this.index += size;
480
+ }
481
+
482
+ return _byte >> bits - size;
483
+ } else {
484
+ if (moveIndex) {
485
+ this.index += bits;
486
+ }
487
+
488
+ var nextSize = size - bits;
489
+ return _byte << nextSize | this.getBits(nextSize, offsetBits + bits, moveIndex);
490
+ }
491
+ }
492
+ }, {
493
+ key: "skipLZ",
494
+ value: function skipLZ() {
495
+ var leadingZeroCount;
496
+
497
+ for (leadingZeroCount = 0; leadingZeroCount < this.bitLength - this.index; ++leadingZeroCount) {
498
+ if (this.getBits(1, this.index + leadingZeroCount, false) !== 0) {
499
+ // console.log(` skip LZ : size=${leadingZeroCount}, ${this.index}.`);
500
+ this.index += leadingZeroCount;
501
+ return leadingZeroCount;
502
+ }
503
+ }
504
+
505
+ return leadingZeroCount;
506
+ }
507
+ }, {
508
+ key: "skipUEG",
509
+ value: function skipUEG() {
510
+ this.skipBits(1 + this.skipLZ());
511
+ }
512
+ }, {
513
+ key: "skipEG",
514
+ value: function skipEG() {
515
+ this.skipBits(1 + this.skipLZ());
516
+ }
517
+ }, {
518
+ key: "readUEG",
519
+ value: function readUEG() {
520
+ var prefix = this.skipLZ();
521
+ return this.readBits(prefix + 1) - 1;
522
+ }
523
+ }, {
524
+ key: "readEG",
525
+ value: function readEG() {
526
+ var value = this.readUEG();
527
+
528
+ if (0x01 & value) {
529
+ // the number is odd if the low order bit is set
530
+ return 1 + value >>> 1; // add 1 to make it even, and divide by 2
531
+ } else {
532
+ return -1 * (value >>> 1); // divide by two then make it negative
533
+ }
534
+ }
535
+ }, {
536
+ key: "readBoolean",
537
+ value: function readBoolean() {
538
+ return this.readBits(1) === 1;
539
+ }
540
+ }, {
541
+ key: "readUByte",
542
+ value: function readUByte() {
543
+ var numberOfBytes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
544
+ return this.readBits(numberOfBytes * 8);
545
+ }
546
+ }, {
547
+ key: "readUShort",
548
+ value: function readUShort() {
549
+ return this.readBits(16);
550
+ }
551
+ }, {
552
+ key: "readUInt",
553
+ value: function readUInt() {
554
+ return this.readBits(32);
555
+ }
556
+ }]);
557
+
558
+ return ExpGolomb;
559
+ }();
560
+
561
+ var H264Parser = /*#__PURE__*/function () {
562
+ function H264Parser(remuxer) {
563
+ _classCallCheck(this, H264Parser);
564
+
565
+ this.remuxer = remuxer;
566
+ this.track = remuxer.mp4track;
567
+ }
568
+
569
+ _createClass(H264Parser, [{
570
+ key: "parseSPS",
571
+ value: function parseSPS(sps) {
572
+ var config = H264Parser.readSPS(new Uint8Array(sps));
573
+ this.track.fps = config.fps;
574
+ this.track.width = config.width;
575
+ this.track.height = config.height;
576
+ this.track.sps = [new Uint8Array(sps)];
577
+ this.track.codec = 'avc1.';
578
+ var codecarray = new DataView(sps.buffer, sps.byteOffset + 1, 4);
579
+
580
+ for (var i = 0; i < 3; ++i) {
581
+ var h = codecarray.getUint8(i).toString(16);
582
+
583
+ if (h.length < 2) {
584
+ h = '0' + h;
585
+ }
586
+
587
+ this.track.codec += h;
588
+ }
589
+ }
590
+ }, {
591
+ key: "parsePPS",
592
+ value: function parsePPS(pps) {
593
+ this.track.pps = [new Uint8Array(pps)];
594
+ }
595
+ }, {
596
+ key: "parseNAL",
597
+ value: function parseNAL(unit) {
598
+ if (!unit) return false;
599
+ var push = false;
600
+
601
+ switch (unit.type()) {
602
+ case NALU.IDR:
603
+ case NALU.NDR:
604
+ push = true;
605
+ break;
606
+
607
+ case NALU.PPS:
608
+ if (!this.track.pps) {
609
+ this.parsePPS(unit.getPayload());
610
+
611
+ if (!this.remuxer.readyToDecode && this.track.pps && this.track.sps) {
612
+ this.remuxer.readyToDecode = true;
613
+ }
614
+ }
615
+
616
+ push = true;
617
+ break;
618
+
619
+ case NALU.SPS:
620
+ if (!this.track.sps) {
621
+ this.parseSPS(unit.getPayload());
622
+
623
+ if (!this.remuxer.readyToDecode && this.track.pps && this.track.sps) {
624
+ this.remuxer.readyToDecode = true;
625
+ }
626
+ }
627
+
628
+ push = true;
629
+ break;
630
+
631
+ case NALU.AUD:
632
+ log('AUD - ignoing');
633
+ break;
634
+
635
+ case NALU.SEI:
636
+ log('SEI - ignoing');
637
+ break;
638
+ }
639
+
640
+ return push;
641
+ }
642
+ }], [{
643
+ key: "extractNALu",
644
+ value: function extractNALu(buffer) {
645
+ var i = 0,
646
+ length = buffer.byteLength,
647
+ value,
648
+ state = 0,
649
+ result = [],
650
+ left,
651
+ lastIndex = 0;
652
+
653
+ while (i < length) {
654
+ value = buffer[i++]; // finding 3 or 4-byte start codes (00 00 01 OR 00 00 00 01)
655
+
656
+ switch (state) {
657
+ case 0:
658
+ if (value === 0) {
659
+ state = 1;
660
+ }
661
+
662
+ break;
663
+
664
+ case 1:
665
+ if (value === 0) {
666
+ state = 2;
667
+ } else {
668
+ state = 0;
669
+ }
670
+
671
+ break;
672
+
673
+ case 2:
674
+ case 3:
675
+ if (value === 0) {
676
+ state = 3;
677
+ } else if (value === 1 && i < length) {
678
+ if (lastIndex != i - state - 1) {
679
+ result.push(buffer.subarray(lastIndex, i - state - 1));
680
+ }
681
+
682
+ lastIndex = i;
683
+ state = 0;
684
+ } else {
685
+ state = 0;
686
+ }
687
+
688
+ break;
689
+ }
690
+ }
691
+
692
+ if (lastIndex < length) {
693
+ left = buffer.subarray(lastIndex, length);
694
+ }
695
+
696
+ return [result, left];
697
+ }
698
+ /**
699
+ * Advance the ExpGolomb decoder past a scaling list. The scaling
700
+ * list is optionally transmitted as part of a sequence parameter
701
+ * set and is not relevant to transmuxing.
702
+ * @param decoder {ExpGolomb} exp golomb decoder
703
+ * @param count {number} the number of entries in this scaling list
704
+ * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1
705
+ */
706
+
707
+ }, {
708
+ key: "skipScalingList",
709
+ value: function skipScalingList(decoder, count) {
710
+ var lastScale = 8,
711
+ nextScale = 8,
712
+ deltaScale;
713
+
714
+ for (var j = 0; j < count; j++) {
715
+ if (nextScale !== 0) {
716
+ deltaScale = decoder.readEG();
717
+ nextScale = (lastScale + deltaScale + 256) % 256;
718
+ }
719
+
720
+ lastScale = nextScale === 0 ? lastScale : nextScale;
721
+ }
722
+ }
723
+ /**
724
+ * Read a sequence parameter set and return some interesting video
725
+ * properties. A sequence parameter set is the H264 metadata that
726
+ * describes the properties of upcoming video frames.
727
+ * @param data {Uint8Array} the bytes of a sequence parameter set
728
+ * @return {object} an object with configuration parsed from the
729
+ * sequence parameter set, including the dimensions of the
730
+ * associated video frames.
731
+ */
732
+
733
+ }, {
734
+ key: "readSPS",
735
+ value: function readSPS(data) {
736
+ var decoder = new ExpGolomb(data);
737
+ var frameCropLeftOffset = 0,
738
+ frameCropRightOffset = 0,
739
+ frameCropTopOffset = 0,
740
+ frameCropBottomOffset = 0,
741
+ sarScale = 1,
742
+ profileIdc,
743
+ numRefFramesInPicOrderCntCycle,
744
+ picWidthInMbsMinus1,
745
+ picHeightInMapUnitsMinus1,
746
+ frameMbsOnlyFlag,
747
+ scalingListCount,
748
+ fps = 0;
749
+ decoder.readUByte(); // skip NAL header
750
+ // rewrite NAL
751
+
752
+ var rbsp = [],
753
+ hdr_bytes = 1,
754
+ nal_bytes = data.byteLength;
755
+
756
+ for (var i = hdr_bytes; i < nal_bytes; i++) {
757
+ if (i + 2 < nal_bytes && decoder.readBits(24, false) === 0x000003) {
758
+ rbsp.push(decoder.readBits(8));
759
+ rbsp.push(decoder.readBits(8));
760
+ i += 2; // emulation_prevention_three_byte
761
+
762
+ decoder.readBits(8);
763
+ } else {
764
+ rbsp.push(decoder.readBits(8));
765
+ }
766
+ }
767
+
768
+ decoder.setData(new Uint8Array(rbsp)); // end of rewrite data
769
+
770
+ profileIdc = decoder.readUByte(); // profile_idc
771
+
772
+ decoder.readBits(5); // constraint_set[0-4]_flag, u(5)
773
+
774
+ decoder.skipBits(3); // reserved_zero_3bits u(3),
775
+
776
+ decoder.readUByte(); // level_idc u(8)
777
+
778
+ decoder.skipUEG(); // seq_parameter_set_id
779
+ // some profiles have more optional data we don't need
780
+
781
+ if (profileIdc === 100 || profileIdc === 110 || profileIdc === 122 || profileIdc === 244 || profileIdc === 44 || profileIdc === 83 || profileIdc === 86 || profileIdc === 118 || profileIdc === 128) {
782
+ var chromaFormatIdc = decoder.readUEG();
783
+
784
+ if (chromaFormatIdc === 3) {
785
+ decoder.skipBits(1); // separate_colour_plane_flag
786
+ }
787
+
788
+ decoder.skipUEG(); // bit_depth_luma_minus8
789
+
790
+ decoder.skipUEG(); // bit_depth_chroma_minus8
791
+
792
+ decoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag
793
+
794
+ if (decoder.readBoolean()) {
795
+ // seq_scaling_matrix_present_flag
796
+ scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;
797
+
798
+ for (var _i = 0; _i < scalingListCount; ++_i) {
799
+ if (decoder.readBoolean()) {
800
+ // seq_scaling_list_present_flag[ i ]
801
+ if (_i < 6) {
802
+ H264Parser.skipScalingList(decoder, 16);
803
+ } else {
804
+ H264Parser.skipScalingList(decoder, 64);
805
+ }
806
+ }
807
+ }
808
+ }
809
+ }
810
+
811
+ decoder.skipUEG(); // log2_max_frame_num_minus4
812
+
813
+ var picOrderCntType = decoder.readUEG();
814
+
815
+ if (picOrderCntType === 0) {
816
+ decoder.readUEG(); // log2_max_pic_order_cnt_lsb_minus4
817
+ } else if (picOrderCntType === 1) {
818
+ decoder.skipBits(1); // delta_pic_order_always_zero_flag
819
+
820
+ decoder.skipEG(); // offset_for_non_ref_pic
821
+
822
+ decoder.skipEG(); // offset_for_top_to_bottom_field
823
+
824
+ numRefFramesInPicOrderCntCycle = decoder.readUEG();
825
+
826
+ for (var _i2 = 0; _i2 < numRefFramesInPicOrderCntCycle; ++_i2) {
827
+ decoder.skipEG(); // offset_for_ref_frame[ i ]
828
+ }
829
+ }
830
+
831
+ decoder.skipUEG(); // max_num_ref_frames
832
+
833
+ decoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag
834
+
835
+ picWidthInMbsMinus1 = decoder.readUEG();
836
+ picHeightInMapUnitsMinus1 = decoder.readUEG();
837
+ frameMbsOnlyFlag = decoder.readBits(1);
838
+
839
+ if (frameMbsOnlyFlag === 0) {
840
+ decoder.skipBits(1); // mb_adaptive_frame_field_flag
841
+ }
842
+
843
+ decoder.skipBits(1); // direct_8x8_inference_flag
844
+
845
+ if (decoder.readBoolean()) {
846
+ // frame_cropping_flag
847
+ frameCropLeftOffset = decoder.readUEG();
848
+ frameCropRightOffset = decoder.readUEG();
849
+ frameCropTopOffset = decoder.readUEG();
850
+ frameCropBottomOffset = decoder.readUEG();
851
+ }
852
+
853
+ if (decoder.readBoolean()) {
854
+ // vui_parameters_present_flag
855
+ if (decoder.readBoolean()) {
856
+ // aspect_ratio_info_present_flag
857
+ var sarRatio;
858
+ var aspectRatioIdc = decoder.readUByte();
859
+
860
+ switch (aspectRatioIdc) {
861
+ case 1:
862
+ sarRatio = [1, 1];
863
+ break;
864
+
865
+ case 2:
866
+ sarRatio = [12, 11];
867
+ break;
868
+
869
+ case 3:
870
+ sarRatio = [10, 11];
871
+ break;
872
+
873
+ case 4:
874
+ sarRatio = [16, 11];
875
+ break;
876
+
877
+ case 5:
878
+ sarRatio = [40, 33];
879
+ break;
880
+
881
+ case 6:
882
+ sarRatio = [24, 11];
883
+ break;
884
+
885
+ case 7:
886
+ sarRatio = [20, 11];
887
+ break;
888
+
889
+ case 8:
890
+ sarRatio = [32, 11];
891
+ break;
892
+
893
+ case 9:
894
+ sarRatio = [80, 33];
895
+ break;
896
+
897
+ case 10:
898
+ sarRatio = [18, 11];
899
+ break;
900
+
901
+ case 11:
902
+ sarRatio = [15, 11];
903
+ break;
904
+
905
+ case 12:
906
+ sarRatio = [64, 33];
907
+ break;
908
+
909
+ case 13:
910
+ sarRatio = [160, 99];
911
+ break;
912
+
913
+ case 14:
914
+ sarRatio = [4, 3];
915
+ break;
916
+
917
+ case 15:
918
+ sarRatio = [3, 2];
919
+ break;
920
+
921
+ case 16:
922
+ sarRatio = [2, 1];
923
+ break;
924
+
925
+ case 255:
926
+ {
927
+ sarRatio = [decoder.readUByte() << 8 | decoder.readUByte(), decoder.readUByte() << 8 | decoder.readUByte()];
928
+ break;
929
+ }
930
+ }
931
+
932
+ if (sarRatio && sarRatio[0] > 0 && sarRatio[1] > 0) {
933
+ sarScale = sarRatio[0] / sarRatio[1];
934
+ }
935
+ }
936
+
937
+ if (decoder.readBoolean()) {
938
+ decoder.skipBits(1);
939
+ }
940
+
941
+ if (decoder.readBoolean()) {
942
+ decoder.skipBits(4);
943
+
944
+ if (decoder.readBoolean()) {
945
+ decoder.skipBits(24);
946
+ }
947
+ }
948
+
949
+ if (decoder.readBoolean()) {
950
+ decoder.skipUEG();
951
+ decoder.skipUEG();
952
+ }
953
+
954
+ if (decoder.readBoolean()) {
955
+ var unitsInTick = decoder.readUInt();
956
+ var timeScale = decoder.readUInt();
957
+ var fixedFrameRate = decoder.readBoolean();
958
+ var frameDuration = timeScale / (2 * unitsInTick);
959
+
960
+ if (fixedFrameRate) {
961
+ fps = frameDuration;
962
+ }
963
+ }
964
+ }
965
+
966
+ return {
967
+ fps: fps > 0 ? fps : undefined,
968
+ width: Math.ceil(((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2) * sarScale),
969
+ height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - (frameMbsOnlyFlag ? 2 : 4) * (frameCropTopOffset + frameCropBottomOffset)
970
+ };
971
+ }
972
+ }, {
973
+ key: "parseHeader",
974
+ value: function parseHeader(unit) {
975
+ var decoder = new ExpGolomb(unit.getPayload()); // skip NALu type
976
+
977
+ decoder.readUByte();
978
+ unit.isfmb = decoder.readUEG() === 0;
979
+ unit.stype = decoder.readUEG();
980
+ }
981
+ }]);
982
+
983
+ return H264Parser;
984
+ }();
985
+
986
+ var AACParser = /*#__PURE__*/function () {
987
+ function AACParser(remuxer) {
988
+ _classCallCheck(this, AACParser);
989
+
990
+ this.remuxer = remuxer;
991
+ this.track = remuxer.mp4track;
992
+ }
993
+
994
+ _createClass(AACParser, [{
995
+ key: "extractAAC",
996
+ value: function extractAAC(buffer) {
997
+ var i = 0,
998
+ length = buffer.byteLength,
999
+ result = [],
1000
+ headerLength,
1001
+ frameLength;
1002
+
1003
+ if (!AACParser.isAACPattern(buffer)) {
1004
+ error('Invalid ADTS audio format');
1005
+ return result;
1006
+ }
1007
+
1008
+ headerLength = AACParser.getHeaderLength(buffer);
1009
+
1010
+ if (!this.aacHeader) {
1011
+ this.aacHeader = buffer.subarray(0, headerLength);
1012
+ }
1013
+
1014
+ while (i < length) {
1015
+ frameLength = AACParser.getFrameLength(buffer);
1016
+ result.push(buffer.subarray(headerLength, frameLength));
1017
+ buffer = buffer.slice(frameLength);
1018
+ i += frameLength;
1019
+ }
1020
+
1021
+ return result;
1022
+ }
1023
+ }, {
1024
+ key: "setAACConfig",
1025
+ value: function setAACConfig() {
1026
+ var objectType,
1027
+ sampleIndex,
1028
+ channelCount,
1029
+ config = new Uint8Array(2),
1030
+ headerData = this.aacHeader;
1031
+ if (!headerData) return;
1032
+ objectType = ((headerData[2] & 0xC0) >>> 6) + 1;
1033
+ sampleIndex = (headerData[2] & 0x3C) >>> 2;
1034
+ channelCount = (headerData[2] & 0x01) << 2;
1035
+ channelCount |= (headerData[3] & 0xC0) >>> 6;
1036
+ /* refer to http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config */
1037
+
1038
+ config[0] = objectType << 3;
1039
+ config[0] |= (sampleIndex & 0x0E) >> 1;
1040
+ config[1] |= (sampleIndex & 0x01) << 7;
1041
+ config[1] |= channelCount << 3;
1042
+ this.track.codec = 'mp4a.40.' + objectType;
1043
+ this.track.channelCount = channelCount;
1044
+ this.track.config = config;
1045
+ this.remuxer.readyToDecode = true;
1046
+ }
1047
+ }], [{
1048
+ key: "samplingRateMap",
1049
+ get: function get() {
1050
+ return [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350];
1051
+ }
1052
+ }, {
1053
+ key: "getHeaderLength",
1054
+ value: function getHeaderLength(data) {
1055
+ return data[1] & 0x01 ? 7 : 9; // without CRC 7 and with CRC 9 Refs: https://wiki.multimedia.cx/index.php?title=ADTS
1056
+ }
1057
+ }, {
1058
+ key: "getFrameLength",
1059
+ value: function getFrameLength(data) {
1060
+ return (data[3] & 0x03) << 11 | data[4] << 3 | (data[5] & 0xE0) >>> 5; // 13 bits length ref: https://wiki.multimedia.cx/index.php?title=ADTS
1061
+ }
1062
+ }, {
1063
+ key: "isAACPattern",
1064
+ value: function isAACPattern(data) {
1065
+ return data[0] === 0xff && (data[1] & 0xf0) === 0xf0 && (data[1] & 0x06) === 0x00;
1066
+ }
1067
+ }]);
1068
+
1069
+ return AACParser;
1070
+ }();
1071
+
1072
+ var Event = /*#__PURE__*/function () {
1073
+ function Event(type) {
1074
+ _classCallCheck(this, Event);
1075
+
1076
+ this.listener = {};
1077
+ this.type = type | '';
1078
+ }
1079
+
1080
+ _createClass(Event, [{
1081
+ key: "on",
1082
+ value: function on(event, fn) {
1083
+ if (!this.listener[event]) {
1084
+ this.listener[event] = [];
1085
+ }
1086
+
1087
+ this.listener[event].push(fn);
1088
+ return true;
1089
+ }
1090
+ }, {
1091
+ key: "off",
1092
+ value: function off(event, fn) {
1093
+ if (this.listener[event]) {
1094
+ var index = this.listener[event].indexOf(fn);
1095
+
1096
+ if (index > -1) {
1097
+ this.listener[event].splice(index, 1);
1098
+ }
1099
+
1100
+ return true;
1101
+ }
1102
+
1103
+ return false;
1104
+ }
1105
+ }, {
1106
+ key: "offAll",
1107
+ value: function offAll() {
1108
+ this.listener = {};
1109
+ }
1110
+ }, {
1111
+ key: "dispatch",
1112
+ value: function dispatch(event, data) {
1113
+ if (this.listener[event]) {
1114
+ this.listener[event].map(function (each) {
1115
+ each.apply(null, [data]);
1116
+ });
1117
+ return true;
1118
+ }
1119
+
1120
+ return false;
1121
+ }
1122
+ }]);
1123
+
1124
+ return Event;
1125
+ }();
1126
+
1127
+ /**
1128
+ * Generate MP4 Box
1129
+ * taken from: https://github.com/dailymotion/hls.js
1130
+ */
1131
+ var MP4 = /*#__PURE__*/function () {
1132
+ function MP4() {
1133
+ _classCallCheck(this, MP4);
1134
+ }
1135
+
1136
+ _createClass(MP4, null, [{
1137
+ key: "init",
1138
+ value: function init() {
1139
+ MP4.types = {
1140
+ avc1: [],
1141
+ // codingname
1142
+ avcC: [],
1143
+ btrt: [],
1144
+ dinf: [],
1145
+ dref: [],
1146
+ esds: [],
1147
+ ftyp: [],
1148
+ hdlr: [],
1149
+ mdat: [],
1150
+ mdhd: [],
1151
+ mdia: [],
1152
+ mfhd: [],
1153
+ minf: [],
1154
+ moof: [],
1155
+ moov: [],
1156
+ mp4a: [],
1157
+ mvex: [],
1158
+ mvhd: [],
1159
+ sdtp: [],
1160
+ stbl: [],
1161
+ stco: [],
1162
+ stsc: [],
1163
+ stsd: [],
1164
+ stsz: [],
1165
+ stts: [],
1166
+ tfdt: [],
1167
+ tfhd: [],
1168
+ traf: [],
1169
+ trak: [],
1170
+ trun: [],
1171
+ trex: [],
1172
+ tkhd: [],
1173
+ vmhd: [],
1174
+ smhd: []
1175
+ };
1176
+ var i;
1177
+
1178
+ for (i in MP4.types) {
1179
+ if (MP4.types.hasOwnProperty(i)) {
1180
+ MP4.types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)];
1181
+ }
1182
+ }
1183
+
1184
+ var videoHdlr = new Uint8Array([0x00, // version 0
1185
+ 0x00, 0x00, 0x00, // flags
1186
+ 0x00, 0x00, 0x00, 0x00, // pre_defined
1187
+ 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'
1188
+ 0x00, 0x00, 0x00, 0x00, // reserved
1189
+ 0x00, 0x00, 0x00, 0x00, // reserved
1190
+ 0x00, 0x00, 0x00, 0x00, // reserved
1191
+ 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'
1192
+ ]);
1193
+ var audioHdlr = new Uint8Array([0x00, // version 0
1194
+ 0x00, 0x00, 0x00, // flags
1195
+ 0x00, 0x00, 0x00, 0x00, // pre_defined
1196
+ 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun'
1197
+ 0x00, 0x00, 0x00, 0x00, // reserved
1198
+ 0x00, 0x00, 0x00, 0x00, // reserved
1199
+ 0x00, 0x00, 0x00, 0x00, // reserved
1200
+ 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'
1201
+ ]);
1202
+ MP4.HDLR_TYPES = {
1203
+ video: videoHdlr,
1204
+ audio: audioHdlr
1205
+ };
1206
+ var dref = new Uint8Array([0x00, // version 0
1207
+ 0x00, 0x00, 0x00, // flags
1208
+ 0x00, 0x00, 0x00, 0x01, // entry_count
1209
+ 0x00, 0x00, 0x00, 0x0c, // entry_size
1210
+ 0x75, 0x72, 0x6c, 0x20, // 'url' type
1211
+ 0x00, // version 0
1212
+ 0x00, 0x00, 0x01 // entry_flags
1213
+ ]);
1214
+ var stco = new Uint8Array([0x00, // version
1215
+ 0x00, 0x00, 0x00, // flags
1216
+ 0x00, 0x00, 0x00, 0x00 // entry_count
1217
+ ]);
1218
+ MP4.STTS = MP4.STSC = MP4.STCO = stco;
1219
+ MP4.STSZ = new Uint8Array([0x00, // version
1220
+ 0x00, 0x00, 0x00, // flags
1221
+ 0x00, 0x00, 0x00, 0x00, // sample_size
1222
+ 0x00, 0x00, 0x00, 0x00 // sample_count
1223
+ ]);
1224
+ MP4.VMHD = new Uint8Array([0x00, // version
1225
+ 0x00, 0x00, 0x01, // flags
1226
+ 0x00, 0x00, // graphicsmode
1227
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor
1228
+ ]);
1229
+ MP4.SMHD = new Uint8Array([0x00, // version
1230
+ 0x00, 0x00, 0x00, // flags
1231
+ 0x00, 0x00, // balance
1232
+ 0x00, 0x00 // reserved
1233
+ ]);
1234
+ MP4.STSD = new Uint8Array([0x00, // version 0
1235
+ 0x00, 0x00, 0x00, // flags
1236
+ 0x00, 0x00, 0x00, 0x01]); // entry_count
1237
+
1238
+ var majorBrand = new Uint8Array([105, 115, 111, 109]); // isom
1239
+
1240
+ var avc1Brand = new Uint8Array([97, 118, 99, 49]); // avc1
1241
+
1242
+ var minorVersion = new Uint8Array([0, 0, 0, 1]);
1243
+ MP4.FTYP = MP4.box(MP4.types.ftyp, majorBrand, minorVersion, majorBrand, avc1Brand);
1244
+ MP4.DINF = MP4.box(MP4.types.dinf, MP4.box(MP4.types.dref, dref));
1245
+ }
1246
+ }, {
1247
+ key: "box",
1248
+ value: function box(type) {
1249
+ for (var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1250
+ payload[_key - 1] = arguments[_key];
1251
+ }
1252
+
1253
+ var size = 8,
1254
+ i = payload.length,
1255
+ len = i,
1256
+ result; // calculate the total size we need to allocate
1257
+
1258
+ while (i--) {
1259
+ size += payload[i].byteLength;
1260
+ }
1261
+
1262
+ result = new Uint8Array(size);
1263
+ result[0] = size >> 24 & 0xff;
1264
+ result[1] = size >> 16 & 0xff;
1265
+ result[2] = size >> 8 & 0xff;
1266
+ result[3] = size & 0xff;
1267
+ result.set(type, 4); // copy the payload into the result
1268
+
1269
+ for (i = 0, size = 8; i < len; ++i) {
1270
+ // copy payload[i] array @ offset size
1271
+ result.set(payload[i], size);
1272
+ size += payload[i].byteLength;
1273
+ }
1274
+
1275
+ return result;
1276
+ }
1277
+ }, {
1278
+ key: "hdlr",
1279
+ value: function hdlr(type) {
1280
+ return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]);
1281
+ }
1282
+ }, {
1283
+ key: "mdat",
1284
+ value: function mdat(data) {
1285
+ return MP4.box(MP4.types.mdat, data);
1286
+ }
1287
+ }, {
1288
+ key: "mdhd",
1289
+ value: function mdhd(timescale, duration) {
1290
+ return MP4.box(MP4.types.mdhd, new Uint8Array([0x00, // version 0
1291
+ 0x00, 0x00, 0x00, // flags
1292
+ 0x00, 0x00, 0x00, 0x02, // creation_time
1293
+ 0x00, 0x00, 0x00, 0x03, // modification_time
1294
+ timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // timescale
1295
+ duration >> 24, duration >> 16 & 0xFF, duration >> 8 & 0xFF, duration & 0xFF, // duration
1296
+ 0x55, 0xc4, // 'und' language (undetermined)
1297
+ 0x00, 0x00]));
1298
+ }
1299
+ }, {
1300
+ key: "mdia",
1301
+ value: function mdia(track) {
1302
+ return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale, track.duration), MP4.hdlr(track.type), MP4.minf(track));
1303
+ }
1304
+ }, {
1305
+ key: "mfhd",
1306
+ value: function mfhd(sequenceNumber) {
1307
+ return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags
1308
+ sequenceNumber >> 24, sequenceNumber >> 16 & 0xFF, sequenceNumber >> 8 & 0xFF, sequenceNumber & 0xFF // sequence_number
1309
+ ]));
1310
+ }
1311
+ }, {
1312
+ key: "minf",
1313
+ value: function minf(track) {
1314
+ if (track.type === 'audio') {
1315
+ return MP4.box(MP4.types.minf, MP4.box(MP4.types.smhd, MP4.SMHD), MP4.DINF, MP4.stbl(track));
1316
+ } else {
1317
+ return MP4.box(MP4.types.minf, MP4.box(MP4.types.vmhd, MP4.VMHD), MP4.DINF, MP4.stbl(track));
1318
+ }
1319
+ }
1320
+ }, {
1321
+ key: "moof",
1322
+ value: function moof(sn, baseMediaDecodeTime, track) {
1323
+ return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track, baseMediaDecodeTime));
1324
+ }
1325
+ /**
1326
+ * @param tracks... (optional) {array} the tracks associated with this movie
1327
+ */
1328
+
1329
+ }, {
1330
+ key: "moov",
1331
+ value: function moov(tracks, duration, timescale) {
1332
+ var i = tracks.length,
1333
+ boxes = [];
1334
+
1335
+ while (i--) {
1336
+ boxes[i] = MP4.trak(tracks[i]);
1337
+ }
1338
+
1339
+ return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(timescale, duration)].concat(boxes).concat(MP4.mvex(tracks)));
1340
+ }
1341
+ }, {
1342
+ key: "mvex",
1343
+ value: function mvex(tracks) {
1344
+ var i = tracks.length,
1345
+ boxes = [];
1346
+
1347
+ while (i--) {
1348
+ boxes[i] = MP4.trex(tracks[i]);
1349
+ }
1350
+
1351
+ return MP4.box.apply(null, [MP4.types.mvex].concat(boxes));
1352
+ }
1353
+ }, {
1354
+ key: "mvhd",
1355
+ value: function mvhd(timescale, duration) {
1356
+ var bytes = new Uint8Array([0x00, // version 0
1357
+ 0x00, 0x00, 0x00, // flags
1358
+ 0x00, 0x00, 0x00, 0x01, // creation_time
1359
+ 0x00, 0x00, 0x00, 0x02, // modification_time
1360
+ timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // timescale
1361
+ duration >> 24 & 0xFF, duration >> 16 & 0xFF, duration >> 8 & 0xFF, duration & 0xFF, // duration
1362
+ 0x00, 0x01, 0x00, 0x00, // 1.0 rate
1363
+ 0x01, 0x00, // 1.0 volume
1364
+ 0x00, 0x00, // reserved
1365
+ 0x00, 0x00, 0x00, 0x00, // reserved
1366
+ 0x00, 0x00, 0x00, 0x00, // reserved
1367
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix
1368
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined
1369
+ 0xff, 0xff, 0xff, 0xff // next_track_ID
1370
+ ]);
1371
+ return MP4.box(MP4.types.mvhd, bytes);
1372
+ }
1373
+ }, {
1374
+ key: "sdtp",
1375
+ value: function sdtp(track) {
1376
+ var samples = track.samples || [],
1377
+ bytes = new Uint8Array(4 + samples.length),
1378
+ flags,
1379
+ i; // leave the full box header (4 bytes) all zero
1380
+ // write the sample table
1381
+
1382
+ for (i = 0; i < samples.length; i++) {
1383
+ flags = samples[i].flags;
1384
+ bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
1385
+ }
1386
+
1387
+ return MP4.box(MP4.types.sdtp, bytes);
1388
+ }
1389
+ }, {
1390
+ key: "stbl",
1391
+ value: function stbl(track) {
1392
+ return MP4.box(MP4.types.stbl, MP4.stsd(track), MP4.box(MP4.types.stts, MP4.STTS), MP4.box(MP4.types.stsc, MP4.STSC), MP4.box(MP4.types.stsz, MP4.STSZ), MP4.box(MP4.types.stco, MP4.STCO));
1393
+ }
1394
+ }, {
1395
+ key: "avc1",
1396
+ value: function avc1(track) {
1397
+ var sps = [],
1398
+ pps = [],
1399
+ i,
1400
+ data,
1401
+ len; // assemble the SPSs
1402
+
1403
+ for (i = 0; i < track.sps.length; i++) {
1404
+ data = track.sps[i];
1405
+ len = data.byteLength;
1406
+ sps.push(len >>> 8 & 0xFF);
1407
+ sps.push(len & 0xFF);
1408
+ sps = sps.concat(Array.prototype.slice.call(data)); // SPS
1409
+ } // assemble the PPSs
1410
+
1411
+
1412
+ for (i = 0; i < track.pps.length; i++) {
1413
+ data = track.pps[i];
1414
+ len = data.byteLength;
1415
+ pps.push(len >>> 8 & 0xFF);
1416
+ pps.push(len & 0xFF);
1417
+ pps = pps.concat(Array.prototype.slice.call(data));
1418
+ }
1419
+
1420
+ var avcc = MP4.box(MP4.types.avcC, new Uint8Array([0x01, // version
1421
+ sps[3], // profile
1422
+ sps[4], // profile compat
1423
+ sps[5], // level
1424
+ 0xfc | 3, // lengthSizeMinusOne, hard-coded to 4 bytes
1425
+ 0xE0 | track.sps.length // 3bit reserved (111) + numOfSequenceParameterSets
1426
+ ].concat(sps).concat([track.pps.length // numOfPictureParameterSets
1427
+ ]).concat(pps))),
1428
+ // "PPS"
1429
+ width = track.width,
1430
+ height = track.height; // console.log('avcc:' + Hex.hexDump(avcc));
1431
+
1432
+ return MP4.box(MP4.types.avc1, new Uint8Array([0x00, 0x00, 0x00, // reserved
1433
+ 0x00, 0x00, 0x00, // reserved
1434
+ 0x00, 0x01, // data_reference_index
1435
+ 0x00, 0x00, // pre_defined
1436
+ 0x00, 0x00, // reserved
1437
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined
1438
+ width >> 8 & 0xFF, width & 0xff, // width
1439
+ height >> 8 & 0xFF, height & 0xff, // height
1440
+ 0x00, 0x48, 0x00, 0x00, // horizresolution
1441
+ 0x00, 0x48, 0x00, 0x00, // vertresolution
1442
+ 0x00, 0x00, 0x00, 0x00, // reserved
1443
+ 0x00, 0x01, // frame_count
1444
+ 0x12, 0x62, 0x69, 0x6E, 0x65, // binelpro.ru
1445
+ 0x6C, 0x70, 0x72, 0x6F, 0x2E, 0x72, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname
1446
+ 0x00, 0x18, // depth = 24
1447
+ 0x11, 0x11]), // pre_defined = -1
1448
+ avcc, MP4.box(MP4.types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB
1449
+ 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate
1450
+ 0x00, 0x2d, 0xc6, 0xc0])) // avgBitrate
1451
+ );
1452
+ }
1453
+ }, {
1454
+ key: "esds",
1455
+ value: function esds(track) {
1456
+ var configlen = track.config.byteLength;
1457
+ var data = new Uint8Array(26 + configlen + 3);
1458
+ data.set([0x00, // version 0
1459
+ 0x00, 0x00, 0x00, // flags
1460
+ 0x03, // descriptor_type
1461
+ 0x17 + configlen, // length
1462
+ 0x00, 0x01, // es_id
1463
+ 0x00, // stream_priority
1464
+ 0x04, // descriptor_type
1465
+ 0x0f + configlen, // length
1466
+ 0x40, // codec : mpeg4_audio
1467
+ 0x15, // stream_type
1468
+ 0x00, 0x00, 0x00, // buffer_size
1469
+ 0x00, 0x00, 0x00, 0x00, // maxBitrate
1470
+ 0x00, 0x00, 0x00, 0x00, // avgBitrate
1471
+ 0x05, // descriptor_type
1472
+ configlen]);
1473
+ data.set(track.config, 26);
1474
+ data.set([0x06, 0x01, 0x02], 26 + configlen); // return new Uint8Array([
1475
+ // 0x00, // version 0
1476
+ // 0x00, 0x00, 0x00, // flags
1477
+ //
1478
+ // 0x03, // descriptor_type
1479
+ // 0x17+configlen, // length
1480
+ // 0x00, 0x01, //es_id
1481
+ // 0x00, // stream_priority
1482
+ //
1483
+ // 0x04, // descriptor_type
1484
+ // 0x0f+configlen, // length
1485
+ // 0x40, //codec : mpeg4_audio
1486
+ // 0x15, // stream_type
1487
+ // 0x00, 0x00, 0x00, // buffer_size
1488
+ // 0x00, 0x00, 0x00, 0x00, // maxBitrate
1489
+ // 0x00, 0x00, 0x00, 0x00, // avgBitrate
1490
+ //
1491
+ // 0x05 // descriptor_type
1492
+ // ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor
1493
+
1494
+ return data;
1495
+ }
1496
+ }, {
1497
+ key: "mp4a",
1498
+ value: function mp4a(track) {
1499
+ var audiosamplerate = track.audiosamplerate;
1500
+ return MP4.box(MP4.types.mp4a, new Uint8Array([0x00, 0x00, 0x00, // reserved
1501
+ 0x00, 0x00, 0x00, // reserved
1502
+ 0x00, 0x01, // data_reference_index
1503
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved
1504
+ 0x00, track.channelCount, // channelcount
1505
+ 0x00, 0x10, // sampleSize:16bits
1506
+ 0x00, 0x00, // pre_defined
1507
+ 0x00, 0x00, // reserved2
1508
+ audiosamplerate >> 8 & 0xFF, audiosamplerate & 0xff, //
1509
+ 0x00, 0x00]), MP4.box(MP4.types.esds, MP4.esds(track)));
1510
+ }
1511
+ }, {
1512
+ key: "stsd",
1513
+ value: function stsd(track) {
1514
+ if (track.type === 'audio') {
1515
+ return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));
1516
+ } else {
1517
+ return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));
1518
+ }
1519
+ }
1520
+ }, {
1521
+ key: "tkhd",
1522
+ value: function tkhd(track) {
1523
+ var id = track.id,
1524
+ duration = track.duration,
1525
+ width = track.width,
1526
+ height = track.height,
1527
+ volume = track.volume;
1528
+ return MP4.box(MP4.types.tkhd, new Uint8Array([0x00, // version 0
1529
+ 0x00, 0x00, 0x07, // flags
1530
+ 0x00, 0x00, 0x00, 0x00, // creation_time
1531
+ 0x00, 0x00, 0x00, 0x00, // modification_time
1532
+ id >> 24 & 0xFF, id >> 16 & 0xFF, id >> 8 & 0xFF, id & 0xFF, // track_ID
1533
+ 0x00, 0x00, 0x00, 0x00, // reserved
1534
+ duration >> 24, duration >> 16 & 0xFF, duration >> 8 & 0xFF, duration & 0xFF, // duration
1535
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved
1536
+ 0x00, 0x00, // layer
1537
+ 0x00, 0x00, // alternate_group
1538
+ volume >> 0 & 0xff, volume % 1 * 10 >> 0 & 0xff, // track volume // FIXME
1539
+ 0x00, 0x00, // reserved
1540
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix
1541
+ width >> 8 & 0xFF, width & 0xFF, 0x00, 0x00, // width
1542
+ height >> 8 & 0xFF, height & 0xFF, 0x00, 0x00 // height
1543
+ ]));
1544
+ }
1545
+ }, {
1546
+ key: "traf",
1547
+ value: function traf(track, baseMediaDecodeTime) {
1548
+ var sampleDependencyTable = MP4.sdtp(track),
1549
+ id = track.id;
1550
+ return MP4.box(MP4.types.traf, MP4.box(MP4.types.tfhd, new Uint8Array([0x00, // version 0
1551
+ 0x00, 0x00, 0x00, // flags
1552
+ id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF // track_ID
1553
+ ])), MP4.box(MP4.types.tfdt, new Uint8Array([0x00, // version 0
1554
+ 0x00, 0x00, 0x00, // flags
1555
+ baseMediaDecodeTime >> 24, baseMediaDecodeTime >> 16 & 0XFF, baseMediaDecodeTime >> 8 & 0XFF, baseMediaDecodeTime & 0xFF // baseMediaDecodeTime
1556
+ ])), MP4.trun(track, sampleDependencyTable.length + 16 + // tfhd
1557
+ 16 + // tfdt
1558
+ 8 + // traf header
1559
+ 16 + // mfhd
1560
+ 8 + // moof header
1561
+ 8), // mdat header
1562
+ sampleDependencyTable);
1563
+ }
1564
+ /**
1565
+ * Generate a track box.
1566
+ * @param track {object} a track definition
1567
+ * @return {Uint8Array} the track box
1568
+ */
1569
+
1570
+ }, {
1571
+ key: "trak",
1572
+ value: function trak(track) {
1573
+ track.duration = track.duration || 0xffffffff;
1574
+ return MP4.box(MP4.types.trak, MP4.tkhd(track), MP4.mdia(track));
1575
+ }
1576
+ }, {
1577
+ key: "trex",
1578
+ value: function trex(track) {
1579
+ var id = track.id;
1580
+ return MP4.box(MP4.types.trex, new Uint8Array([0x00, // version 0
1581
+ 0x00, 0x00, 0x00, // flags
1582
+ id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF, // track_ID
1583
+ 0x00, 0x00, 0x00, 0x01, // default_sample_description_index
1584
+ 0x00, 0x00, 0x00, 0x00, // default_sample_duration
1585
+ 0x00, 0x00, 0x00, 0x00, // default_sample_size
1586
+ 0x00, 0x01, 0x00, 0x01 // default_sample_flags
1587
+ ]));
1588
+ }
1589
+ }, {
1590
+ key: "trun",
1591
+ value: function trun(track, offset) {
1592
+ var samples = track.samples || [],
1593
+ len = samples.length,
1594
+ arraylen = 12 + 16 * len,
1595
+ array = new Uint8Array(arraylen),
1596
+ i,
1597
+ sample,
1598
+ duration,
1599
+ size,
1600
+ flags,
1601
+ cts;
1602
+ offset += 8 + arraylen;
1603
+ array.set([0x00, // version 0
1604
+ 0x00, 0x0f, 0x01, // flags
1605
+ len >>> 24 & 0xFF, len >>> 16 & 0xFF, len >>> 8 & 0xFF, len & 0xFF, // sample_count
1606
+ offset >>> 24 & 0xFF, offset >>> 16 & 0xFF, offset >>> 8 & 0xFF, offset & 0xFF // data_offset
1607
+ ], 0);
1608
+
1609
+ for (i = 0; i < len; i++) {
1610
+ sample = samples[i];
1611
+ duration = sample.duration;
1612
+ size = sample.size;
1613
+ flags = sample.flags;
1614
+ cts = sample.cts;
1615
+ array.set([duration >>> 24 & 0xFF, duration >>> 16 & 0xFF, duration >>> 8 & 0xFF, duration & 0xFF, // sample_duration
1616
+ size >>> 24 & 0xFF, size >>> 16 & 0xFF, size >>> 8 & 0xFF, size & 0xFF, // sample_size
1617
+ flags.isLeading << 2 | flags.dependsOn, flags.isDependedOn << 6 | flags.hasRedundancy << 4 | flags.paddingValue << 1 | flags.isNonSync, flags.degradPrio & 0xF0 << 8, flags.degradPrio & 0x0F, // sample_flags
1618
+ cts >>> 24 & 0xFF, cts >>> 16 & 0xFF, cts >>> 8 & 0xFF, cts & 0xFF // sample_composition_time_offset
1619
+ ], 12 + 16 * i);
1620
+ }
1621
+
1622
+ return MP4.box(MP4.types.trun, array);
1623
+ }
1624
+ }, {
1625
+ key: "initSegment",
1626
+ value: function initSegment(tracks, duration, timescale) {
1627
+ if (!MP4.types) {
1628
+ MP4.init();
1629
+ }
1630
+
1631
+ var movie = MP4.moov(tracks, duration, timescale),
1632
+ result;
1633
+ result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength);
1634
+ result.set(MP4.FTYP);
1635
+ result.set(movie, MP4.FTYP.byteLength);
1636
+ return result;
1637
+ }
1638
+ }]);
1639
+
1640
+ return MP4;
1641
+ }();
1642
+
1643
+ var track_id = 1;
1644
+ var BaseRemuxer = /*#__PURE__*/function () {
1645
+ function BaseRemuxer() {
1646
+ _classCallCheck(this, BaseRemuxer);
1647
+ }
1648
+
1649
+ _createClass(BaseRemuxer, [{
1650
+ key: "flush",
1651
+ value: function flush() {
1652
+ this.mp4track.len = 0;
1653
+ this.mp4track.samples = [];
1654
+ }
1655
+ }, {
1656
+ key: "isReady",
1657
+ value: function isReady() {
1658
+ if (!this.readyToDecode || !this.samples.length) return null;
1659
+ return true;
1660
+ }
1661
+ }], [{
1662
+ key: "getTrackID",
1663
+ value: function getTrackID() {
1664
+ return track_id++;
1665
+ }
1666
+ }]);
1667
+
1668
+ return BaseRemuxer;
1669
+ }();
1670
+
1671
+ var AACRemuxer = /*#__PURE__*/function (_BaseRemuxer) {
1672
+ _inherits(AACRemuxer, _BaseRemuxer);
1673
+
1674
+ var _super = _createSuper(AACRemuxer);
1675
+
1676
+ function AACRemuxer(timescale) {
1677
+ var _this;
1678
+
1679
+ _classCallCheck(this, AACRemuxer);
1680
+
1681
+ _this = _super.call(this);
1682
+ _this.readyToDecode = false;
1683
+ _this.nextDts = 0;
1684
+ _this.dts = 0;
1685
+ _this.mp4track = {
1686
+ id: BaseRemuxer.getTrackID(),
1687
+ type: 'audio',
1688
+ channelCount: 0,
1689
+ len: 0,
1690
+ fragmented: true,
1691
+ timescale: timescale,
1692
+ duration: timescale,
1693
+ samples: [],
1694
+ config: '',
1695
+ codec: ''
1696
+ };
1697
+ _this.samples = [];
1698
+ _this.aac = new AACParser(_assertThisInitialized(_this));
1699
+ return _this;
1700
+ }
1701
+
1702
+ _createClass(AACRemuxer, [{
1703
+ key: "resetTrack",
1704
+ value: function resetTrack() {
1705
+ this.readyToDecode = false;
1706
+ this.mp4track.codec = '';
1707
+ this.mp4track.channelCount = '';
1708
+ this.mp4track.config = '';
1709
+ this.mp4track.timescale = this.timescale;
1710
+ this.nextDts = 0;
1711
+ this.dts = 0;
1712
+ }
1713
+ }, {
1714
+ key: "remux",
1715
+ value: function remux(frames) {
1716
+ if (frames.length > 0) {
1717
+ for (var i = 0; i < frames.length; i++) {
1718
+ var frame = frames[i];
1719
+ var payload = frame.units;
1720
+ var size = payload.byteLength;
1721
+ this.samples.push({
1722
+ units: payload,
1723
+ size: size,
1724
+ duration: frame.duration
1725
+ });
1726
+ this.mp4track.len += size;
1727
+
1728
+ if (!this.readyToDecode) {
1729
+ this.aac.setAACConfig();
1730
+ }
1731
+ }
1732
+ }
1733
+ }
1734
+ }, {
1735
+ key: "getPayload",
1736
+ value: function getPayload() {
1737
+ if (!this.isReady()) {
1738
+ return null;
1739
+ }
1740
+
1741
+ var payload = new Uint8Array(this.mp4track.len);
1742
+ var offset = 0;
1743
+ var samples = this.mp4track.samples;
1744
+ var mp4Sample, duration;
1745
+ this.dts = this.nextDts;
1746
+
1747
+ while (this.samples.length) {
1748
+ var sample = this.samples.shift();
1749
+ sample.units;
1750
+ duration = sample.duration;
1751
+
1752
+ if (duration <= 0) {
1753
+ log("remuxer: invalid sample duration at DTS: ".concat(this.nextDts, " :").concat(duration));
1754
+ this.mp4track.len -= sample.size;
1755
+ continue;
1756
+ }
1757
+
1758
+ this.nextDts += duration;
1759
+ mp4Sample = {
1760
+ size: sample.size,
1761
+ duration: duration,
1762
+ cts: 0,
1763
+ flags: {
1764
+ isLeading: 0,
1765
+ isDependedOn: 0,
1766
+ hasRedundancy: 0,
1767
+ degradPrio: 0,
1768
+ dependsOn: 1
1769
+ }
1770
+ };
1771
+ payload.set(sample.units, offset);
1772
+ offset += sample.size;
1773
+ samples.push(mp4Sample);
1774
+ }
1775
+
1776
+ if (!samples.length) return null;
1777
+ return new Uint8Array(payload.buffer, 0, this.mp4track.len);
1778
+ }
1779
+ }, {
1780
+ key: "getAacParser",
1781
+ value: function getAacParser() {
1782
+ return this.aac;
1783
+ }
1784
+ }]);
1785
+
1786
+ return AACRemuxer;
1787
+ }(BaseRemuxer);
1788
+
1789
+ var H264Remuxer = /*#__PURE__*/function (_BaseRemuxer) {
1790
+ _inherits(H264Remuxer, _BaseRemuxer);
1791
+
1792
+ var _super = _createSuper(H264Remuxer);
1793
+
1794
+ function H264Remuxer(timescale) {
1795
+ var _this;
1796
+
1797
+ _classCallCheck(this, H264Remuxer);
1798
+
1799
+ _this = _super.call(this);
1800
+ _this.readyToDecode = false;
1801
+ _this.nextDts = 0;
1802
+ _this.dts = 0;
1803
+ _this.mp4track = {
1804
+ id: BaseRemuxer.getTrackID(),
1805
+ type: 'video',
1806
+ len: 0,
1807
+ fragmented: true,
1808
+ sps: '',
1809
+ pps: '',
1810
+ fps: 30,
1811
+ width: 0,
1812
+ height: 0,
1813
+ timescale: timescale,
1814
+ duration: timescale,
1815
+ samples: []
1816
+ };
1817
+ _this.samples = [];
1818
+ _this.h264 = new H264Parser(_assertThisInitialized(_this));
1819
+ return _this;
1820
+ }
1821
+
1822
+ _createClass(H264Remuxer, [{
1823
+ key: "resetTrack",
1824
+ value: function resetTrack() {
1825
+ this.readyToDecode = false;
1826
+ this.mp4track.sps = '';
1827
+ this.mp4track.pps = '';
1828
+ this.nextDts = 0;
1829
+ this.dts = 0;
1830
+ }
1831
+ }, {
1832
+ key: "remux",
1833
+ value: function remux(frames) {
1834
+ var _iterator = _createForOfIteratorHelper(frames),
1835
+ _step;
1836
+
1837
+ try {
1838
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1839
+ var frame = _step.value;
1840
+ var units = [];
1841
+ var size = 0;
1842
+
1843
+ var _iterator2 = _createForOfIteratorHelper(frame.units),
1844
+ _step2;
1845
+
1846
+ try {
1847
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1848
+ var unit = _step2.value;
1849
+
1850
+ if (this.h264.parseNAL(unit)) {
1851
+ units.push(unit);
1852
+ size += unit.getSize();
1853
+ }
1854
+ }
1855
+ } catch (err) {
1856
+ _iterator2.e(err);
1857
+ } finally {
1858
+ _iterator2.f();
1859
+ }
1860
+
1861
+ if (units.length > 0 && this.readyToDecode) {
1862
+ this.mp4track.len += size;
1863
+ this.samples.push({
1864
+ units: units,
1865
+ size: size,
1866
+ keyFrame: frame.keyFrame,
1867
+ duration: frame.duration,
1868
+ compositionTimeOffset: frame.compositionTimeOffset
1869
+ });
1870
+ }
1871
+ }
1872
+ } catch (err) {
1873
+ _iterator.e(err);
1874
+ } finally {
1875
+ _iterator.f();
1876
+ }
1877
+ }
1878
+ }, {
1879
+ key: "getPayload",
1880
+ value: function getPayload() {
1881
+ if (!this.isReady()) {
1882
+ return null;
1883
+ }
1884
+
1885
+ var payload = new Uint8Array(this.mp4track.len);
1886
+ var offset = 0;
1887
+ var samples = this.mp4track.samples;
1888
+ var mp4Sample, duration;
1889
+ this.dts = this.nextDts;
1890
+
1891
+ while (this.samples.length) {
1892
+ var sample = this.samples.shift(),
1893
+ units = sample.units;
1894
+ duration = sample.duration;
1895
+
1896
+ if (duration <= 0) {
1897
+ log("remuxer: invalid sample duration at DTS: ".concat(this.nextDts, " :").concat(duration));
1898
+ this.mp4track.len -= sample.size;
1899
+ continue;
1900
+ }
1901
+
1902
+ this.nextDts += duration;
1903
+ mp4Sample = {
1904
+ size: sample.size,
1905
+ duration: duration,
1906
+ cts: sample.compositionTimeOffset || 0,
1907
+ flags: {
1908
+ isLeading: 0,
1909
+ isDependedOn: 0,
1910
+ hasRedundancy: 0,
1911
+ degradPrio: 0,
1912
+ isNonSync: sample.keyFrame ? 0 : 1,
1913
+ dependsOn: sample.keyFrame ? 2 : 1
1914
+ }
1915
+ };
1916
+
1917
+ var _iterator3 = _createForOfIteratorHelper(units),
1918
+ _step3;
1919
+
1920
+ try {
1921
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1922
+ var unit = _step3.value;
1923
+ payload.set(unit.getData(), offset);
1924
+ offset += unit.getSize();
1925
+ }
1926
+ } catch (err) {
1927
+ _iterator3.e(err);
1928
+ } finally {
1929
+ _iterator3.f();
1930
+ }
1931
+
1932
+ samples.push(mp4Sample);
1933
+ }
1934
+
1935
+ if (!samples.length) return null;
1936
+ return new Uint8Array(payload.buffer, 0, this.mp4track.len);
1937
+ }
1938
+ }]);
1939
+
1940
+ return H264Remuxer;
1941
+ }(BaseRemuxer);
1942
+
1943
+ var RemuxController = /*#__PURE__*/function (_Event) {
1944
+ _inherits(RemuxController, _Event);
1945
+
1946
+ var _super = _createSuper(RemuxController);
1947
+
1948
+ function RemuxController(env) {
1949
+ var _this;
1950
+
1951
+ _classCallCheck(this, RemuxController);
1952
+
1953
+ _this = _super.call(this, 'remuxer');
1954
+ _this.initialized = false;
1955
+ _this.trackTypes = [];
1956
+ _this.tracks = {};
1957
+ _this.seq = 1;
1958
+ _this.env = env;
1959
+ _this.timescale = 1000;
1960
+ _this.mediaDuration = 0;
1961
+ _this.aacParser = null;
1962
+ return _this;
1963
+ }
1964
+
1965
+ _createClass(RemuxController, [{
1966
+ key: "addTrack",
1967
+ value: function addTrack(type) {
1968
+ if (type === 'video' || type === 'both') {
1969
+ this.tracks.video = new H264Remuxer(this.timescale);
1970
+ this.trackTypes.push('video');
1971
+ }
1972
+
1973
+ if (type === 'audio' || type === 'both') {
1974
+ var aacRemuxer = new AACRemuxer(this.timescale);
1975
+ this.aacParser = aacRemuxer.getAacParser();
1976
+ this.tracks.audio = aacRemuxer;
1977
+ this.trackTypes.push('audio');
1978
+ }
1979
+ }
1980
+ }, {
1981
+ key: "reset",
1982
+ value: function reset() {
1983
+ var _iterator = _createForOfIteratorHelper(this.trackTypes),
1984
+ _step;
1985
+
1986
+ try {
1987
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1988
+ var type = _step.value;
1989
+ this.tracks[type].resetTrack();
1990
+ }
1991
+ } catch (err) {
1992
+ _iterator.e(err);
1993
+ } finally {
1994
+ _iterator.f();
1995
+ }
1996
+
1997
+ this.initialized = false;
1998
+ }
1999
+ }, {
2000
+ key: "destroy",
2001
+ value: function destroy() {
2002
+ this.tracks = {};
2003
+ this.offAll();
2004
+ }
2005
+ }, {
2006
+ key: "flush",
2007
+ value: function flush() {
2008
+ if (!this.initialized) {
2009
+ if (this.isReady()) {
2010
+ this.dispatch('ready');
2011
+ this.initSegment();
2012
+ this.initialized = true;
2013
+ this.flush();
2014
+ }
2015
+ } else {
2016
+ var _iterator2 = _createForOfIteratorHelper(this.trackTypes),
2017
+ _step2;
2018
+
2019
+ try {
2020
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2021
+ var type = _step2.value;
2022
+ var track = this.tracks[type];
2023
+ var pay = track.getPayload();
2024
+
2025
+ if (pay && pay.byteLength) {
2026
+ var moof = MP4.moof(this.seq, track.dts, track.mp4track);
2027
+ var mdat = MP4.mdat(pay);
2028
+ var payload = appendByteArray(moof, mdat);
2029
+ var data = {
2030
+ type: type,
2031
+ payload: payload,
2032
+ dts: track.dts
2033
+ };
2034
+
2035
+ if (type === 'video') {
2036
+ data.fps = track.mp4track.fps;
2037
+ }
2038
+
2039
+ this.dispatch('buffer', data);
2040
+ var duration = secToTime(track.dts / this.timescale);
2041
+ log("put segment (".concat(type, "): dts: ").concat(track.dts, " frames: ").concat(track.mp4track.samples.length, " second: ").concat(duration));
2042
+ track.flush();
2043
+ this.seq++;
2044
+ }
2045
+ }
2046
+ } catch (err) {
2047
+ _iterator2.e(err);
2048
+ } finally {
2049
+ _iterator2.f();
2050
+ }
2051
+ }
2052
+ }
2053
+ }, {
2054
+ key: "initSegment",
2055
+ value: function initSegment() {
2056
+ var tracks = [];
2057
+
2058
+ var _iterator3 = _createForOfIteratorHelper(this.trackTypes),
2059
+ _step3;
2060
+
2061
+ try {
2062
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2063
+ var type = _step3.value;
2064
+ var track = this.tracks[type];
2065
+
2066
+ if (this.env == 'browser') {
2067
+ var _data = {
2068
+ type: type,
2069
+ payload: MP4.initSegment([track.mp4track], this.mediaDuration, this.timescale)
2070
+ };
2071
+ this.dispatch('buffer', _data);
2072
+ } else {
2073
+ tracks.push(track.mp4track);
2074
+ }
2075
+ }
2076
+ } catch (err) {
2077
+ _iterator3.e(err);
2078
+ } finally {
2079
+ _iterator3.f();
2080
+ }
2081
+
2082
+ if (this.env == 'node') {
2083
+ var data = {
2084
+ type: 'all',
2085
+ payload: MP4.initSegment(tracks, this.mediaDuration, this.timescale)
2086
+ };
2087
+ this.dispatch('buffer', data);
2088
+ }
2089
+
2090
+ log('Initial segment generated.');
2091
+ }
2092
+ }, {
2093
+ key: "isReady",
2094
+ value: function isReady() {
2095
+ var _iterator4 = _createForOfIteratorHelper(this.trackTypes),
2096
+ _step4;
2097
+
2098
+ try {
2099
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
2100
+ var type = _step4.value;
2101
+ if (!this.tracks[type].readyToDecode || !this.tracks[type].samples.length) return false;
2102
+ }
2103
+ } catch (err) {
2104
+ _iterator4.e(err);
2105
+ } finally {
2106
+ _iterator4.f();
2107
+ }
2108
+
2109
+ return true;
2110
+ }
2111
+ }, {
2112
+ key: "remux",
2113
+ value: function remux(data) {
2114
+ var _iterator5 = _createForOfIteratorHelper(this.trackTypes),
2115
+ _step5;
2116
+
2117
+ try {
2118
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
2119
+ var type = _step5.value;
2120
+ var frames = data[type];
2121
+ if (type === 'audio' && this.tracks.video && !this.tracks.video.readyToDecode) continue;
2122
+ /* if video is present, don't add audio until video get ready */
2123
+
2124
+ if (frames.length > 0) {
2125
+ this.tracks[type].remux(frames);
2126
+ }
2127
+ }
2128
+ } catch (err) {
2129
+ _iterator5.e(err);
2130
+ } finally {
2131
+ _iterator5.f();
2132
+ }
2133
+
2134
+ this.flush();
2135
+ }
2136
+ }]);
2137
+
2138
+ return RemuxController;
2139
+ }(Event);
2140
+
2141
+ var BufferController = /*#__PURE__*/function (_Event) {
2142
+ _inherits(BufferController, _Event);
2143
+
2144
+ var _super = _createSuper(BufferController);
2145
+
2146
+ function BufferController(sourceBuffer, type) {
2147
+ var _this;
2148
+
2149
+ _classCallCheck(this, BufferController);
2150
+
2151
+ _this = _super.call(this, 'buffer');
2152
+ _this.type = type;
2153
+ _this.queue = new Uint8Array();
2154
+ _this.cleaning = false;
2155
+ _this.pendingCleaning = 0;
2156
+ _this.cleanOffset = 30;
2157
+ _this.cleanRanges = [];
2158
+ _this.sourceBuffer = sourceBuffer;
2159
+
2160
+ _this.sourceBuffer.addEventListener('updateend', function () {
2161
+ if (_this.pendingCleaning > 0) {
2162
+ _this.initCleanup(_this.pendingCleaning);
2163
+
2164
+ _this.pendingCleaning = 0;
2165
+ }
2166
+
2167
+ _this.cleaning = false;
2168
+
2169
+ if (_this.cleanRanges.length) {
2170
+ _this.doCleanup();
2171
+
2172
+ return;
2173
+ }
2174
+ });
2175
+
2176
+ _this.sourceBuffer.addEventListener('error', function () {
2177
+ _this.dispatch('error', {
2178
+ type: _this.type,
2179
+ name: 'buffer',
2180
+ error: 'buffer error'
2181
+ });
2182
+ });
2183
+
2184
+ return _this;
2185
+ }
2186
+
2187
+ _createClass(BufferController, [{
2188
+ key: "destroy",
2189
+ value: function destroy() {
2190
+ this.queue = null;
2191
+ this.sourceBuffer = null;
2192
+ this.offAll();
2193
+ }
2194
+ }, {
2195
+ key: "doCleanup",
2196
+ value: function doCleanup() {
2197
+ if (!this.cleanRanges.length) {
2198
+ this.cleaning = false;
2199
+ return;
2200
+ }
2201
+
2202
+ var range = this.cleanRanges.shift();
2203
+ log("".concat(this.type, " remove range [").concat(range[0], " - ").concat(range[1], ")"));
2204
+ this.cleaning = true;
2205
+ this.sourceBuffer.remove(range[0], range[1]);
2206
+ }
2207
+ }, {
2208
+ key: "initCleanup",
2209
+ value: function initCleanup(cleanMaxLimit) {
2210
+ try {
2211
+ if (this.sourceBuffer.updating) {
2212
+ this.pendingCleaning = cleanMaxLimit;
2213
+ return;
2214
+ }
2215
+
2216
+ if (this.sourceBuffer.buffered && this.sourceBuffer.buffered.length && !this.cleaning) {
2217
+ for (var i = 0; i < this.sourceBuffer.buffered.length; ++i) {
2218
+ var start = this.sourceBuffer.buffered.start(i);
2219
+ var end = this.sourceBuffer.buffered.end(i);
2220
+
2221
+ if (cleanMaxLimit - start > this.cleanOffset) {
2222
+ end = cleanMaxLimit - this.cleanOffset;
2223
+
2224
+ if (start < end) {
2225
+ this.cleanRanges.push([start, end]);
2226
+ }
2227
+ }
2228
+ }
2229
+
2230
+ this.doCleanup();
2231
+ }
2232
+ } catch (e) {
2233
+ error("Error occured while cleaning ".concat(this.type, " buffer - ").concat(e.name, ": ").concat(e.message));
2234
+ }
2235
+ }
2236
+ }, {
2237
+ key: "doAppend",
2238
+ value: function doAppend() {
2239
+ if (!this.queue.length) return;
2240
+ if (!this.sourceBuffer || this.sourceBuffer.updating) return;
2241
+
2242
+ try {
2243
+ this.sourceBuffer.appendBuffer(this.queue);
2244
+ this.queue = new Uint8Array();
2245
+ } catch (e) {
2246
+ var name = 'unexpectedError';
2247
+
2248
+ if (e.name === 'QuotaExceededError') {
2249
+ log("".concat(this.type, " buffer quota full"));
2250
+ name = 'QuotaExceeded';
2251
+ } else {
2252
+ error("Error occured while appending ".concat(this.type, " buffer - ").concat(e.name, ": ").concat(e.message));
2253
+ name = 'InvalidStateError';
2254
+ }
2255
+
2256
+ this.dispatch('error', {
2257
+ type: this.type,
2258
+ name: name,
2259
+ error: 'buffer error'
2260
+ });
2261
+ }
2262
+ }
2263
+ }, {
2264
+ key: "feed",
2265
+ value: function feed(data) {
2266
+ this.queue = appendByteArray(this.queue, data);
2267
+ }
2268
+ }]);
2269
+
2270
+ return BufferController;
2271
+ }(Event);
2272
+
2273
+ var JMuxer = /*#__PURE__*/function (_Event) {
2274
+ _inherits(JMuxer, _Event);
2275
+
2276
+ var _super = _createSuper(JMuxer);
2277
+
2278
+ function JMuxer(options) {
2279
+ var _this;
2280
+
2281
+ _classCallCheck(this, JMuxer);
2282
+
2283
+ _this = _super.call(this, 'jmuxer');
2284
+ _this.isReset = false;
2285
+ var defaults = {
2286
+ node: '',
2287
+ mode: 'both',
2288
+ // both, audio, video
2289
+ flushingTime: 500,
2290
+ maxDelay: 500,
2291
+ clearBuffer: true,
2292
+ fps: 30,
2293
+ readFpsFromTrack: false,
2294
+ // set true to fetch fps value from NALu
2295
+ debug: false,
2296
+ onReady: function onReady() {},
2297
+ // function called when MSE is ready to accept frames
2298
+ onError: function onError() {} // function called when jmuxer encounters any buffer related error
2299
+
2300
+ };
2301
+ _this.options = Object.assign({}, defaults, options);
2302
+ _this.env = (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && typeof window === 'undefined' ? 'node' : 'browser';
2303
+
2304
+ if (_this.options.debug) {
2305
+ setLogger();
2306
+ }
2307
+
2308
+ if (!_this.options.fps) {
2309
+ _this.options.fps = 30;
2310
+ }
2311
+
2312
+ _this.frameDuration = 1000 / _this.options.fps | 0;
2313
+ _this.remuxController = new RemuxController(_this.env);
2314
+
2315
+ _this.remuxController.addTrack(_this.options.mode);
2316
+
2317
+ _this.initData();
2318
+ /* events callback */
2319
+
2320
+
2321
+ _this.remuxController.on('buffer', _this.onBuffer.bind(_assertThisInitialized(_this)));
2322
+
2323
+ if (_this.env == 'browser') {
2324
+ _this.remuxController.on('ready', _this.createBuffer.bind(_assertThisInitialized(_this)));
2325
+
2326
+ _this.initBrowser();
2327
+ }
2328
+
2329
+ return _this;
2330
+ }
2331
+
2332
+ _createClass(JMuxer, [{
2333
+ key: "initData",
2334
+ value: function initData() {
2335
+ this.lastCleaningTime = Date.now();
2336
+ this.kfPosition = [];
2337
+ this.kfCounter = 0;
2338
+ this.pendingUnits = {};
2339
+ this.remainingData = new Uint8Array();
2340
+ this.startInterval();
2341
+ }
2342
+ }, {
2343
+ key: "initBrowser",
2344
+ value: function initBrowser() {
2345
+ if (typeof this.options.node === 'string' && this.options.node == '') {
2346
+ error('no video element were found to render, provide a valid video element');
2347
+ }
2348
+
2349
+ this.node = typeof this.options.node === 'string' ? document.getElementById(this.options.node) : this.options.node;
2350
+ this.mseReady = false;
2351
+ this.setupMSE();
2352
+ }
2353
+ }, {
2354
+ key: "createStream",
2355
+ value: function createStream() {
2356
+ var feed = this.feed.bind(this);
2357
+ var destroy = this.destroy.bind(this);
2358
+ this.stream = new stream.Duplex({
2359
+ writableObjectMode: true,
2360
+ read: function read(size) {},
2361
+ write: function write(data, encoding, callback) {
2362
+ feed(data);
2363
+ callback();
2364
+ },
2365
+ "final": function final(callback) {
2366
+ destroy();
2367
+ callback();
2368
+ }
2369
+ });
2370
+ return this.stream;
2371
+ }
2372
+ }, {
2373
+ key: "setupMSE",
2374
+ value: function setupMSE() {
2375
+ window.MediaSource = window.MediaSource || window.WebKitMediaSource;
2376
+
2377
+ if (!window.MediaSource) {
2378
+ throw 'Oops! Browser does not support media source extension.';
2379
+ }
2380
+
2381
+ this.isMSESupported = !!window.MediaSource;
2382
+ this.mediaSource = new MediaSource();
2383
+ this.url = URL.createObjectURL(this.mediaSource);
2384
+ this.node.src = this.url;
2385
+ this.mseEnded = false;
2386
+ this.mediaSource.addEventListener('sourceopen', this.onMSEOpen.bind(this));
2387
+ this.mediaSource.addEventListener('sourceclose', this.onMSEClose.bind(this));
2388
+ this.mediaSource.addEventListener('webkitsourceopen', this.onMSEOpen.bind(this));
2389
+ this.mediaSource.addEventListener('webkitsourceclose', this.onMSEClose.bind(this));
2390
+ }
2391
+ }, {
2392
+ key: "endMSE",
2393
+ value: function endMSE() {
2394
+ if (!this.mseEnded) {
2395
+ try {
2396
+ this.mseEnded = true;
2397
+ this.mediaSource.endOfStream();
2398
+ } catch (e) {
2399
+ error('mediasource is not available to end');
2400
+ }
2401
+ }
2402
+ }
2403
+ }, {
2404
+ key: "feed",
2405
+ value: function feed(data) {
2406
+ var remux = false,
2407
+ slices,
2408
+ left,
2409
+ duration,
2410
+ chunks = {
2411
+ video: [],
2412
+ audio: []
2413
+ };
2414
+ if (!data || !this.remuxController) return;
2415
+ duration = data.duration ? parseInt(data.duration) : 0;
2416
+
2417
+ if (data.video) {
2418
+ data.video = appendByteArray(this.remainingData, data.video);
2419
+
2420
+ var _H264Parser$extractNA = H264Parser.extractNALu(data.video);
2421
+
2422
+ var _H264Parser$extractNA2 = _slicedToArray(_H264Parser$extractNA, 2);
2423
+
2424
+ slices = _H264Parser$extractNA2[0];
2425
+ left = _H264Parser$extractNA2[1];
2426
+ this.remainingData = left || new Uint8Array();
2427
+
2428
+ if (slices.length > 0) {
2429
+ chunks.video = this.getVideoFrames(slices, duration, data.compositionTimeOffset);
2430
+ remux = true;
2431
+ } else {
2432
+ error('Failed to extract any NAL units from video data:', left);
2433
+ return;
2434
+ }
2435
+ }
2436
+
2437
+ if (data.audio) {
2438
+ slices = this.remuxController.aacParser.extractAAC(data.audio);
2439
+
2440
+ if (slices.length > 0) {
2441
+ chunks.audio = this.getAudioFrames(slices, duration);
2442
+ remux = true;
2443
+ } else {
2444
+ error('Failed to extract audio data from:', data.audio);
2445
+ return;
2446
+ }
2447
+ }
2448
+
2449
+ if (!remux) {
2450
+ error('Input object must have video and/or audio property. Make sure it is a valid typed array');
2451
+ return;
2452
+ }
2453
+
2454
+ this.remuxController.remux(chunks);
2455
+ }
2456
+ }, {
2457
+ key: "getVideoFrames",
2458
+ value: function getVideoFrames(nalus, duration, compositionTimeOffset) {
2459
+ var _this2 = this;
2460
+
2461
+ var units = [],
2462
+ frames = [],
2463
+ fd = 0,
2464
+ tt = 0,
2465
+ keyFrame = false,
2466
+ vcl = false;
2467
+
2468
+ if (this.pendingUnits.units) {
2469
+ units = this.pendingUnits.units;
2470
+ vcl = this.pendingUnits.vcl;
2471
+ keyFrame = this.pendingUnits.keyFrame;
2472
+ this.pendingUnits = {};
2473
+ }
2474
+
2475
+ var _iterator = _createForOfIteratorHelper(nalus),
2476
+ _step;
2477
+
2478
+ try {
2479
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2480
+ var nalu = _step.value;
2481
+ var unit = new NALU(nalu);
2482
+
2483
+ if (unit.type() === NALU.IDR || unit.type() === NALU.NDR) {
2484
+ H264Parser.parseHeader(unit);
2485
+ }
2486
+
2487
+ if (units.length && vcl && (unit.isfmb || !unit.isvcl)) {
2488
+ frames.push({
2489
+ units: units,
2490
+ keyFrame: keyFrame
2491
+ });
2492
+ units = [];
2493
+ keyFrame = false;
2494
+ vcl = false;
2495
+ }
2496
+
2497
+ units.push(unit);
2498
+ keyFrame = keyFrame || unit.isKeyframe();
2499
+ vcl = vcl || unit.isvcl;
2500
+ }
2501
+ } catch (err) {
2502
+ _iterator.e(err);
2503
+ } finally {
2504
+ _iterator.f();
2505
+ }
2506
+
2507
+ if (units.length) {
2508
+ // lets keep indecisive nalus as pending in case of fixed fps
2509
+ if (!duration) {
2510
+ this.pendingUnits = {
2511
+ units: units,
2512
+ keyFrame: keyFrame,
2513
+ vcl: vcl
2514
+ };
2515
+ } else if (vcl) {
2516
+ frames.push({
2517
+ units: units,
2518
+ keyFrame: keyFrame
2519
+ });
2520
+ } else {
2521
+ var last = frames.length - 1;
2522
+
2523
+ if (last >= 0) {
2524
+ frames[last].units = frames[last].units.concat(units);
2525
+ }
2526
+ }
2527
+ }
2528
+
2529
+ fd = duration ? duration / frames.length | 0 : this.frameDuration;
2530
+ tt = duration ? duration - fd * frames.length : 0;
2531
+ frames.map(function (frame) {
2532
+ frame.duration = fd;
2533
+ frame.compositionTimeOffset = compositionTimeOffset;
2534
+
2535
+ if (tt > 0) {
2536
+ frame.duration++;
2537
+ tt--;
2538
+ }
2539
+
2540
+ _this2.kfCounter++;
2541
+
2542
+ if (frame.keyFrame && _this2.options.clearBuffer) {
2543
+ _this2.kfPosition.push(_this2.kfCounter * fd / 1000);
2544
+ }
2545
+ });
2546
+ log("jmuxer: No. of frames of the last chunk: ".concat(frames.length));
2547
+ return frames;
2548
+ }
2549
+ }, {
2550
+ key: "getAudioFrames",
2551
+ value: function getAudioFrames(aacFrames, duration) {
2552
+ var frames = [],
2553
+ fd = 0,
2554
+ tt = 0;
2555
+
2556
+ var _iterator2 = _createForOfIteratorHelper(aacFrames),
2557
+ _step2;
2558
+
2559
+ try {
2560
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2561
+ var units = _step2.value;
2562
+ frames.push({
2563
+ units: units
2564
+ });
2565
+ }
2566
+ } catch (err) {
2567
+ _iterator2.e(err);
2568
+ } finally {
2569
+ _iterator2.f();
2570
+ }
2571
+
2572
+ fd = duration ? duration / frames.length | 0 : this.frameDuration;
2573
+ tt = duration ? duration - fd * frames.length : 0;
2574
+ frames.map(function (frame) {
2575
+ frame.duration = fd;
2576
+
2577
+ if (tt > 0) {
2578
+ frame.duration++;
2579
+ tt--;
2580
+ }
2581
+ });
2582
+ return frames;
2583
+ }
2584
+ }, {
2585
+ key: "destroy",
2586
+ value: function destroy() {
2587
+ this.stopInterval();
2588
+
2589
+ if (this.stream) {
2590
+ this.remuxController.flush();
2591
+ this.stream.push(null);
2592
+ this.stream = null;
2593
+ }
2594
+
2595
+ if (this.remuxController) {
2596
+ this.remuxController.destroy();
2597
+ this.remuxController = null;
2598
+ }
2599
+
2600
+ if (this.bufferControllers) {
2601
+ for (var type in this.bufferControllers) {
2602
+ this.bufferControllers[type].destroy();
2603
+ }
2604
+
2605
+ this.bufferControllers = null;
2606
+ this.endMSE();
2607
+ }
2608
+
2609
+ this.node = false;
2610
+ this.mseReady = false;
2611
+ this.videoStarted = false;
2612
+ this.mediaSource = null;
2613
+ }
2614
+ }, {
2615
+ key: "reset",
2616
+ value: function reset() {
2617
+ this.stopInterval();
2618
+ this.isReset = true;
2619
+ this.node.pause();
2620
+
2621
+ if (this.remuxController) {
2622
+ this.remuxController.reset();
2623
+ }
2624
+
2625
+ if (this.bufferControllers) {
2626
+ for (var type in this.bufferControllers) {
2627
+ this.bufferControllers[type].destroy();
2628
+ }
2629
+
2630
+ this.bufferControllers = null;
2631
+ this.endMSE();
2632
+ }
2633
+
2634
+ this.initData();
2635
+
2636
+ if (this.env == 'browser') {
2637
+ this.initBrowser();
2638
+ }
2639
+
2640
+ log('JMuxer was reset');
2641
+ }
2642
+ }, {
2643
+ key: "createBuffer",
2644
+ value: function createBuffer() {
2645
+ if (!this.mseReady || !this.remuxController || !this.remuxController.isReady() || this.bufferControllers) return;
2646
+ this.bufferControllers = {};
2647
+
2648
+ for (var type in this.remuxController.tracks) {
2649
+ var track = this.remuxController.tracks[type];
2650
+
2651
+ if (!JMuxer.isSupported("".concat(type, "/mp4; codecs=\"").concat(track.mp4track.codec, "\""))) {
2652
+ error('Browser does not support codec');
2653
+ return false;
2654
+ }
2655
+
2656
+ var sb = this.mediaSource.addSourceBuffer("".concat(type, "/mp4; codecs=\"").concat(track.mp4track.codec, "\""));
2657
+ this.bufferControllers[type] = new BufferController(sb, type);
2658
+ this.bufferControllers[type].on('error', this.onBufferError.bind(this));
2659
+ }
2660
+ }
2661
+ }, {
2662
+ key: "startInterval",
2663
+ value: function startInterval() {
2664
+ var _this3 = this;
2665
+
2666
+ this.interval = setInterval(function () {
2667
+ if (_this3.options.flushingTime) {
2668
+ _this3.applyAndClearBuffer();
2669
+ } else if (_this3.bufferControllers) {
2670
+ _this3.cancelDelay();
2671
+ }
2672
+ }, this.options.flushingTime || 1000);
2673
+ }
2674
+ }, {
2675
+ key: "stopInterval",
2676
+ value: function stopInterval() {
2677
+ if (this.interval) {
2678
+ clearInterval(this.interval);
2679
+ }
2680
+ }
2681
+ }, {
2682
+ key: "cancelDelay",
2683
+ value: function cancelDelay() {
2684
+ if (this.node.buffered && this.node.buffered.length > 0 && !this.node.seeking) {
2685
+ var end = this.node.buffered.end(0);
2686
+
2687
+ if (end - this.node.currentTime > this.options.maxDelay / 1000) {
2688
+ console.log('delay');
2689
+ this.node.currentTime = end - 0.001;
2690
+ }
2691
+ }
2692
+ }
2693
+ }, {
2694
+ key: "releaseBuffer",
2695
+ value: function releaseBuffer() {
2696
+ for (var type in this.bufferControllers) {
2697
+ this.bufferControllers[type].doAppend();
2698
+ }
2699
+ }
2700
+ }, {
2701
+ key: "applyAndClearBuffer",
2702
+ value: function applyAndClearBuffer() {
2703
+ if (this.bufferControllers) {
2704
+ this.releaseBuffer();
2705
+ this.clearBuffer();
2706
+ }
2707
+ }
2708
+ }, {
2709
+ key: "getSafeClearOffsetOfBuffer",
2710
+ value: function getSafeClearOffsetOfBuffer(offset) {
2711
+ var maxLimit = this.options.mode === 'audio' && offset || 0,
2712
+ adjacentOffset;
2713
+
2714
+ for (var i = 0; i < this.kfPosition.length; i++) {
2715
+ if (this.kfPosition[i] >= offset) {
2716
+ break;
2717
+ }
2718
+
2719
+ adjacentOffset = this.kfPosition[i];
2720
+ }
2721
+
2722
+ if (adjacentOffset) {
2723
+ this.kfPosition = this.kfPosition.filter(function (kfDelimiter) {
2724
+ if (kfDelimiter < adjacentOffset) {
2725
+ maxLimit = kfDelimiter;
2726
+ }
2727
+
2728
+ return kfDelimiter >= adjacentOffset;
2729
+ });
2730
+ }
2731
+
2732
+ return maxLimit;
2733
+ }
2734
+ }, {
2735
+ key: "clearBuffer",
2736
+ value: function clearBuffer() {
2737
+ if (this.options.clearBuffer && Date.now() - this.lastCleaningTime > 10000) {
2738
+ for (var type in this.bufferControllers) {
2739
+ var cleanMaxLimit = this.getSafeClearOffsetOfBuffer(this.node.currentTime);
2740
+ this.bufferControllers[type].initCleanup(cleanMaxLimit);
2741
+ }
2742
+
2743
+ this.lastCleaningTime = Date.now();
2744
+ }
2745
+ }
2746
+ }, {
2747
+ key: "onBuffer",
2748
+ value: function onBuffer(data) {
2749
+ if (this.options.readFpsFromTrack && typeof data.fps !== 'undefined' && this.options.fps != data.fps) {
2750
+ this.options.fps = data.fps;
2751
+ this.frameDuration = Math.ceil(1000 / data.fps);
2752
+ log("JMuxer changed FPS to ".concat(data.fps, " from track data"));
2753
+ }
2754
+
2755
+ if (this.env == 'browser') {
2756
+ if (this.bufferControllers && this.bufferControllers[data.type]) {
2757
+ this.bufferControllers[data.type].feed(data.payload);
2758
+ }
2759
+ } else if (this.stream) {
2760
+ this.stream.push(data.payload);
2761
+ }
2762
+
2763
+ if (this.options.flushingTime === 0) {
2764
+ this.applyAndClearBuffer();
2765
+ }
2766
+ }
2767
+ /* Events on MSE */
2768
+
2769
+ }, {
2770
+ key: "onMSEOpen",
2771
+ value: function onMSEOpen() {
2772
+ this.mseReady = true;
2773
+ URL.revokeObjectURL(this.url); // this.createBuffer();
2774
+
2775
+ if (typeof this.options.onReady === 'function') {
2776
+ this.options.onReady.call(null, this.isReset);
2777
+ }
2778
+ }
2779
+ }, {
2780
+ key: "onMSEClose",
2781
+ value: function onMSEClose() {
2782
+ this.mseReady = false;
2783
+ this.videoStarted = false;
2784
+ }
2785
+ }, {
2786
+ key: "onBufferError",
2787
+ value: function onBufferError(data) {
2788
+ if (data.name == 'QuotaExceeded') {
2789
+ log("JMuxer cleaning ".concat(data.type, " buffer due to QuotaExceeded error"));
2790
+ this.bufferControllers[data.type].initCleanup(this.node.currentTime);
2791
+ return;
2792
+ } else if (data.name == 'InvalidStateError') {
2793
+ log('JMuxer is reseting due to InvalidStateError');
2794
+ this.reset();
2795
+ } else {
2796
+ this.endMSE();
2797
+ }
2798
+
2799
+ if (typeof this.options.onError === 'function') {
2800
+ this.options.onError.call(null, data);
2801
+ }
2802
+ }
2803
+ }], [{
2804
+ key: "isSupported",
2805
+ value: function isSupported(codec) {
2806
+ return window.MediaSource && window.MediaSource.isTypeSupported(codec);
2807
+ }
2808
+ }]);
2809
+
2810
+ return JMuxer;
2811
+ }(Event);
2812
+
2813
+ return JMuxer;
2814
+
2815
+ }));