@anov/3d 0.0.136 → 0.0.139

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 (206) hide show
  1. package/dist/anov3d.js +10 -10
  2. package/dist/anov3d.js.map +1 -1
  3. package/dist/applicationApi.js +17 -9
  4. package/dist/applicationApi.js.map +1 -1
  5. package/dist/factory/3d.js +6 -7
  6. package/dist/factory/3d.js.map +1 -1
  7. package/dist/factory/globalControl.js +3 -3
  8. package/dist/factory/globalControl.js.map +1 -1
  9. package/dist/factory/unit/CameraPoi.js +5 -6
  10. package/dist/factory/unit/CameraPoi.js.map +1 -1
  11. package/dist/factory/unit/areaBoundingBox.js +3 -3
  12. package/dist/factory/unit/areaBoundingBox.js.map +1 -1
  13. package/dist/factory/unit/circle.js +4 -4
  14. package/dist/factory/unit/circle.js.map +1 -1
  15. package/dist/factory/unit/cylinder.js +5 -5
  16. package/dist/factory/unit/cylinder.js.map +1 -1
  17. package/dist/factory/unit/districtLine.js +4 -4
  18. package/dist/factory/unit/districtLine.js.map +1 -1
  19. package/dist/factory/unit/glsl/heat/frag.js.map +1 -1
  20. package/dist/factory/unit/glsl/heat/ver.js.map +1 -1
  21. package/dist/factory/unit/glsl/highway/fragmentShader.js.map +1 -1
  22. package/dist/factory/unit/glsl/highway/fragmentShader2.js.map +1 -1
  23. package/dist/factory/unit/glsl/highway/vertexShader.js.map +1 -1
  24. package/dist/factory/unit/handle.js +3 -3
  25. package/dist/factory/unit/handle.js.map +1 -1
  26. package/dist/factory/unit/index.js +13 -14
  27. package/dist/factory/unit/index.js.map +1 -1
  28. package/dist/factory/unit/inspection/InspectionObject.js +4 -4
  29. package/dist/factory/unit/inspection/InspectionObject.js.map +1 -1
  30. package/dist/factory/unit/inspection/defaultFirstPerspectiveControls.js +3 -3
  31. package/dist/factory/unit/inspection/defaultFirstPerspectiveControls.js.map +1 -1
  32. package/dist/factory/unit/inspection/index.js +6 -8
  33. package/dist/factory/unit/inspection/index.js.map +1 -1
  34. package/dist/factory/unit/inspection/lineData.js.map +1 -1
  35. package/dist/factory/unit/inspection/map.js +3 -3
  36. package/dist/factory/unit/inspection/map.js.map +1 -1
  37. package/dist/factory/unit/inspection/tubeGeometry.js +3 -3
  38. package/dist/factory/unit/inspection/tubeGeometry.js.map +1 -1
  39. package/dist/factory/unit/layer/rise.js.map +1 -1
  40. package/dist/factory/unit/line.js +3 -3
  41. package/dist/factory/unit/line.js.map +1 -1
  42. package/dist/factory/unit/poi.js +5 -5
  43. package/dist/factory/unit/poi.js.map +1 -1
  44. package/dist/factory/unit/region.js +3 -3
  45. package/dist/factory/unit/region.js.map +1 -1
  46. package/dist/factory/unit/slice.js +3 -3
  47. package/dist/factory/unit/slice.js.map +1 -1
  48. package/dist/factory/unit/wall.js +3 -3
  49. package/dist/factory/unit/wall.js.map +1 -1
  50. package/dist/factory/utils/areaBoundingBox.js.map +1 -1
  51. package/dist/factory/utils/constant.js +6 -6
  52. package/dist/factory/utils/constant.js.map +1 -1
  53. package/dist/factory/utils/finirMaterial.js +0 -1
  54. package/dist/factory/utils/finirMaterial.js.map +1 -1
  55. package/dist/factory/utils/fontMesh.js +3 -3
  56. package/dist/factory/utils/fontMesh.js.map +1 -1
  57. package/dist/factory/utils/ground.js.map +1 -1
  58. package/dist/factory/utils/index.js.map +1 -1
  59. package/dist/factory/utils/observe.js +1 -1
  60. package/dist/factory/utils/observe.js.map +1 -1
  61. package/dist/factory/utils/switchMaterial.js.map +1 -1
  62. package/dist/hooksManager.js +1 -1
  63. package/dist/hooksManager.js.map +1 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/messageStatus.js +3 -3
  66. package/dist/messageStatus.js.map +1 -1
  67. package/dist/module/camera/index.js +3 -3
  68. package/dist/module/camera/index.js.map +1 -1
  69. package/dist/module/develop/index.js +3 -3
  70. package/dist/module/develop/index.js.map +1 -1
  71. package/dist/module/entity/baseEntity.js +146 -0
  72. package/dist/module/entity/baseEntity.js.map +1 -0
  73. package/dist/module/entity/dispose.js.map +1 -1
  74. package/dist/module/entity/hybridList.js +3 -3
  75. package/dist/module/entity/hybridList.js.map +1 -1
  76. package/dist/module/entity/index.js +149 -150
  77. package/dist/module/entity/index.js.map +1 -1
  78. package/dist/module/entity/model/index.js +116 -0
  79. package/dist/module/entity/model/index.js.map +1 -0
  80. package/dist/module/entity/model/load/loadGlb.js +19 -0
  81. package/dist/module/entity/model/load/loadGlb.js.map +1 -0
  82. package/dist/module/entity/model/load.js +47 -0
  83. package/dist/module/entity/model/load.js.map +1 -0
  84. package/dist/module/entity/poi/index.js +22 -43
  85. package/dist/module/entity/poi/index.js.map +1 -1
  86. package/dist/module/entity/poi/style/base.js +104 -0
  87. package/dist/module/entity/poi/style/base.js.map +1 -0
  88. package/dist/module/entity/poi/style/index.js +67 -0
  89. package/dist/module/entity/poi/style/index.js.map +1 -0
  90. package/dist/module/entity/poi/style/title_01.js +62 -0
  91. package/dist/module/entity/poi/style/title_01.js.map +1 -0
  92. package/dist/module/entity/poi/style/title_pin_01.js +68 -0
  93. package/dist/module/entity/poi/style/title_pin_01.js.map +1 -0
  94. package/dist/module/entity/poi/style/title_pin_02.js +70 -0
  95. package/dist/module/entity/poi/style/title_pin_02.js.map +1 -0
  96. package/dist/module/entity/poi/type.js.map +1 -1
  97. package/dist/module/entity/spline/index.js +29 -0
  98. package/dist/module/entity/spline/index.js.map +1 -0
  99. package/dist/module/entity/spline/resource.js +2 -0
  100. package/dist/module/entity/spline/resource.js.map +1 -0
  101. package/dist/module/entity/spline/style/index.js +47 -0
  102. package/dist/module/entity/spline/style/index.js.map +1 -0
  103. package/dist/module/entity/spline/style/line_01.js +67 -0
  104. package/dist/module/entity/spline/style/line_01.js.map +1 -0
  105. package/dist/module/entity/spline/style/line_texture_01.js +85 -0
  106. package/dist/module/entity/spline/style/line_texture_01.js.map +1 -0
  107. package/dist/module/entity/spline/type.js +2 -0
  108. package/dist/module/entity/spline/type.js.map +1 -0
  109. package/dist/module/entity/strategy.js +45 -2
  110. package/dist/module/entity/strategy.js.map +1 -1
  111. package/dist/module/entity/type.js +2 -0
  112. package/dist/module/entity/type.js.map +1 -0
  113. package/dist/module/entity/utils.js +15 -1
  114. package/dist/module/entity/utils.js.map +1 -1
  115. package/dist/module/environment/index.js +6 -6
  116. package/dist/module/environment/index.js.map +1 -1
  117. package/dist/module/environment/season/index.js +6 -8
  118. package/dist/module/environment/season/index.js.map +1 -1
  119. package/dist/module/environment/time/index.js.map +1 -1
  120. package/dist/module/eventBus/index.js +3 -3
  121. package/dist/module/eventBus/index.js.map +1 -1
  122. package/dist/module/model/index.js +6 -6
  123. package/dist/module/model/index.js.map +1 -1
  124. package/dist/module/scene/index.js +3 -3
  125. package/dist/module/scene/index.js.map +1 -1
  126. package/dist/sdkEntry.js +3 -3
  127. package/dist/sdkEntry.js.map +1 -1
  128. package/dist/utils/abstract.js +3 -3
  129. package/dist/utils/abstract.js.map +1 -1
  130. package/dist/utils/index.js +1 -1
  131. package/dist/utils/index.js.map +1 -1
  132. package/dist/utils/messageFn.js +8 -8
  133. package/dist/utils/messageFn.js.map +1 -1
  134. package/package.json +5 -4
  135. package/dist/anov3d.d.ts +0 -27
  136. package/dist/applicationApi.d.ts +0 -68
  137. package/dist/factory/3d.d.ts +0 -72
  138. package/dist/factory/globalControl.d.ts +0 -7
  139. package/dist/factory/globalData.d.ts +0 -1
  140. package/dist/factory/regionData.d.ts +0 -36
  141. package/dist/factory/type.d.ts +0 -10
  142. package/dist/factory/unit/CameraPoi.d.ts +0 -66
  143. package/dist/factory/unit/areaBoundingBox.d.ts +0 -7
  144. package/dist/factory/unit/circle.d.ts +0 -22
  145. package/dist/factory/unit/cylinder.d.ts +0 -24
  146. package/dist/factory/unit/districtLine.d.ts +0 -22
  147. package/dist/factory/unit/glsl/heat/frag.d.ts +0 -2
  148. package/dist/factory/unit/glsl/heat/ver.d.ts +0 -2
  149. package/dist/factory/unit/glsl/highway/fragmentShader.d.ts +0 -2
  150. package/dist/factory/unit/glsl/highway/fragmentShader2.d.ts +0 -2
  151. package/dist/factory/unit/glsl/highway/vertexShader.d.ts +0 -2
  152. package/dist/factory/unit/handle.d.ts +0 -42
  153. package/dist/factory/unit/index.d.ts +0 -9
  154. package/dist/factory/unit/inspection/InspectionObject.d.ts +0 -49
  155. package/dist/factory/unit/inspection/defaultFirstPerspectiveControls.d.ts +0 -6
  156. package/dist/factory/unit/inspection/index.d.ts +0 -52
  157. package/dist/factory/unit/inspection/lineData.d.ts +0 -26
  158. package/dist/factory/unit/inspection/map.d.ts +0 -11
  159. package/dist/factory/unit/inspection/tubeGeometry.d.ts +0 -16
  160. package/dist/factory/unit/layer/rise.d.ts +0 -6
  161. package/dist/factory/unit/line.d.ts +0 -13
  162. package/dist/factory/unit/poi.d.ts +0 -21
  163. package/dist/factory/unit/region.d.ts +0 -12
  164. package/dist/factory/unit/slice.d.ts +0 -12
  165. package/dist/factory/unit/wall.d.ts +0 -16
  166. package/dist/factory/utils/areaBoundingBox.d.ts +0 -14
  167. package/dist/factory/utils/constant.d.ts +0 -12
  168. package/dist/factory/utils/finirMaterial.d.ts +0 -4
  169. package/dist/factory/utils/fontMesh.d.ts +0 -10
  170. package/dist/factory/utils/ground.d.ts +0 -40
  171. package/dist/factory/utils/index.d.ts +0 -2
  172. package/dist/factory/utils/observe.d.ts +0 -3
  173. package/dist/factory/utils/switchMaterial.d.ts +0 -17
  174. package/dist/hooksManager.d.ts +0 -2
  175. package/dist/index.d.ts +0 -18
  176. package/dist/messageStatus.d.ts +0 -52
  177. package/dist/module/camera/index.d.ts +0 -74
  178. package/dist/module/develop/index.d.ts +0 -19
  179. package/dist/module/entity/dispose.d.ts +0 -6
  180. package/dist/module/entity/hybridList.d.ts +0 -11
  181. package/dist/module/entity/index.d.ts +0 -68
  182. package/dist/module/entity/poi/constant.d.ts +0 -48
  183. package/dist/module/entity/poi/constant.js +0 -54
  184. package/dist/module/entity/poi/constant.js.map +0 -1
  185. package/dist/module/entity/poi/index.d.ts +0 -13
  186. package/dist/module/entity/poi/label.d.ts +0 -9
  187. package/dist/module/entity/poi/label.js +0 -46
  188. package/dist/module/entity/poi/label.js.map +0 -1
  189. package/dist/module/entity/poi/resource.d.ts +0 -4
  190. package/dist/module/entity/poi/title.d.ts +0 -77
  191. package/dist/module/entity/poi/title.js +0 -265
  192. package/dist/module/entity/poi/title.js.map +0 -1
  193. package/dist/module/entity/poi/type.d.ts +0 -88
  194. package/dist/module/entity/strategy.d.ts +0 -3
  195. package/dist/module/entity/utils.d.ts +0 -4
  196. package/dist/module/environment/index.d.ts +0 -50
  197. package/dist/module/environment/season/index.d.ts +0 -22
  198. package/dist/module/environment/time/index.d.ts +0 -10
  199. package/dist/module/environment/weather/type.d.ts +0 -15
  200. package/dist/module/eventBus/index.d.ts +0 -27
  201. package/dist/module/model/index.d.ts +0 -15
  202. package/dist/module/scene/index.d.ts +0 -16
  203. package/dist/sdkEntry.d.ts +0 -5
  204. package/dist/utils/abstract.d.ts +0 -6
  205. package/dist/utils/index.d.ts +0 -30
  206. package/dist/utils/messageFn.d.ts +0 -19
@@ -1 +1 @@
1
- {"version":3,"names":["disposeMaterial","material","map","dispose","lightMap","bumpMap","normalMap","specularMap","envMap","emissiveMap","createDisposeFn","traverse","child","geometry","Array","isArray","forEach","clear"],"sources":["../../../src/module/entity/dispose.ts"],"sourcesContent":["/**\n * clear mesh material\n * @param material\n */\nconst disposeMaterial = (material) => {\n if (material.map)\n material.map.dispose()\n if (material.lightMap)\n material.lightMap.dispose()\n if (material.bumpMap)\n material.bumpMap.dispose()\n if (material.normalMap)\n material.normalMap.dispose()\n if (material.specularMap)\n material.specularMap.dispose()\n if (material.envMap)\n material.envMap.dispose()\n if (material.emissiveMap)\n material.emissiveMap.dispose()\n material.dispose()\n}\n\n/**\n * create dispose function\n * @returns\n */\nconst createDisposeFn = () => function () {\n this.traverse((child) => {\n if (child.geometry)\n child.geometry.dispose()\n\n if (child.material) {\n if (Array.isArray(child.material)) {\n child.material.forEach((material) => {\n disposeMaterial(material)\n })\n }\n else {\n disposeMaterial(child.material)\n }\n }\n })\n\n this.clear()\n}\n\nexport default createDisposeFn"],"mappings":"AAAA;AACA;AACA;AACA;AACA,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAIC,QAAQ,EAAK;EACpC,IAAIA,QAAQ,CAACC,GAAG,EACdD,QAAQ,CAACC,GAAG,CAACC,OAAO,EAAE;EACxB,IAAIF,QAAQ,CAACG,QAAQ,EACnBH,QAAQ,CAACG,QAAQ,CAACD,OAAO,EAAE;EAC7B,IAAIF,QAAQ,CAACI,OAAO,EAClBJ,QAAQ,CAACI,OAAO,CAACF,OAAO,EAAE;EAC5B,IAAIF,QAAQ,CAACK,SAAS,EACpBL,QAAQ,CAACK,SAAS,CAACH,OAAO,EAAE;EAC9B,IAAIF,QAAQ,CAACM,WAAW,EACtBN,QAAQ,CAACM,WAAW,CAACJ,OAAO,EAAE;EAChC,IAAIF,QAAQ,CAACO,MAAM,EACjBP,QAAQ,CAACO,MAAM,CAACL,OAAO,EAAE;EAC3B,IAAIF,QAAQ,CAACQ,WAAW,EACtBR,QAAQ,CAACQ,WAAW,CAACN,OAAO,EAAE;EAChCF,QAAQ,CAACE,OAAO,EAAE;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA,IAAMO,eAAe,GAAG,SAAlBA,eAAe;EAAA,OAAS,YAAY;IACxC,IAAI,CAACC,QAAQ,CAAC,UAACC,KAAK,EAAK;MACvB,IAAIA,KAAK,CAACC,QAAQ,EAChBD,KAAK,CAACC,QAAQ,CAACV,OAAO,EAAE;MAE1B,IAAIS,KAAK,CAACX,QAAQ,EAAE;QAClB,IAAIa,KAAK,CAACC,OAAO,CAACH,KAAK,CAACX,QAAQ,CAAC,EAAE;UACjCW,KAAK,CAACX,QAAQ,CAACe,OAAO,CAAC,UAACf,QAAQ,EAAK;YACnCD,eAAe,CAACC,QAAQ,CAAC;UAC3B,CAAC,CAAC;QACJ,CAAC,MACI;UACHD,eAAe,CAACY,KAAK,CAACX,QAAQ,CAAC;QACjC;MACF;IACF,CAAC,CAAC;IAEF,IAAI,CAACgB,KAAK,EAAE;EACd,CAAC;AAAA;AAED,eAAeP,eAAe"}
1
+ {"version":3,"names":["disposeMaterial","material","map","dispose","lightMap","bumpMap","normalMap","specularMap","envMap","emissiveMap","createDisposeFn","traverse","child","geometry","Array","isArray","forEach","clear"],"sources":["../../../src/module/entity/dispose.ts"],"sourcesContent":["/**\n * clear mesh material\n * @param material\n */\nconst disposeMaterial = (material) => {\n if (material.map)\n material.map.dispose()\n if (material.lightMap)\n material.lightMap.dispose()\n if (material.bumpMap)\n material.bumpMap.dispose()\n if (material.normalMap)\n material.normalMap.dispose()\n if (material.specularMap)\n material.specularMap.dispose()\n if (material.envMap)\n material.envMap.dispose()\n if (material.emissiveMap)\n material.emissiveMap.dispose()\n material.dispose()\n}\n\n/**\n * create dispose function\n * @returns\n */\nconst createDisposeFn = () => function () {\n this.traverse((child) => {\n if (child.geometry)\n child.geometry.dispose()\n\n if (child.material) {\n if (Array.isArray(child.material)) {\n child.material.forEach((material) => {\n disposeMaterial(material)\n })\n }\n else {\n disposeMaterial(child.material)\n }\n }\n })\n\n this.clear()\n}\n\nexport default createDisposeFn"],"mappings":"AAAA;AACA;AACA;AACA;AACA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,QAAQ,EAAK;EACpC,IAAIA,QAAQ,CAACC,GAAG,EACdD,QAAQ,CAACC,GAAG,CAACC,OAAO,CAAC,CAAC;EACxB,IAAIF,QAAQ,CAACG,QAAQ,EACnBH,QAAQ,CAACG,QAAQ,CAACD,OAAO,CAAC,CAAC;EAC7B,IAAIF,QAAQ,CAACI,OAAO,EAClBJ,QAAQ,CAACI,OAAO,CAACF,OAAO,CAAC,CAAC;EAC5B,IAAIF,QAAQ,CAACK,SAAS,EACpBL,QAAQ,CAACK,SAAS,CAACH,OAAO,CAAC,CAAC;EAC9B,IAAIF,QAAQ,CAACM,WAAW,EACtBN,QAAQ,CAACM,WAAW,CAACJ,OAAO,CAAC,CAAC;EAChC,IAAIF,QAAQ,CAACO,MAAM,EACjBP,QAAQ,CAACO,MAAM,CAACL,OAAO,CAAC,CAAC;EAC3B,IAAIF,QAAQ,CAACQ,WAAW,EACtBR,QAAQ,CAACQ,WAAW,CAACN,OAAO,CAAC,CAAC;EAChCF,QAAQ,CAACE,OAAO,CAAC,CAAC;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA,IAAMO,eAAe,GAAG,SAAlBA,eAAeA,CAAA;EAAA,OAAS,YAAY;IACxC,IAAI,CAACC,QAAQ,CAAC,UAACC,KAAK,EAAK;MACvB,IAAIA,KAAK,CAACC,QAAQ,EAChBD,KAAK,CAACC,QAAQ,CAACV,OAAO,CAAC,CAAC;MAE1B,IAAIS,KAAK,CAACX,QAAQ,EAAE;QAClB,IAAIa,KAAK,CAACC,OAAO,CAACH,KAAK,CAACX,QAAQ,CAAC,EAAE;UACjCW,KAAK,CAACX,QAAQ,CAACe,OAAO,CAAC,UAACf,QAAQ,EAAK;YACnCD,eAAe,CAACC,QAAQ,CAAC;UAC3B,CAAC,CAAC;QACJ,CAAC,MACI;UACHD,eAAe,CAACY,KAAK,CAACX,QAAQ,CAAC;QACjC;MACF;IACF,CAAC,CAAC;IAEF,IAAI,CAACgB,KAAK,CAAC,CAAC;EACd,CAAC;AAAA;AAED,eAAeP,eAAe"}
@@ -1,10 +1,10 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
3
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
4
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  var ListNode = /*#__PURE__*/_createClass(function ListNode(value, key) {
9
9
  _classCallCheck(this, ListNode);
10
10
  _defineProperty(this, "value", void 0);
@@ -1 +1 @@
1
- {"version":3,"names":["ListNode","value","key","next","prev","HybridList","map","Map","head","tail","node","get","has","Error","newNode","set","delete"],"sources":["../../../src/module/entity/hybridList.ts"],"sourcesContent":["class ListNode<T> {\n value: T\n key: string | number\n next: ListNode<T> | null\n prev: ListNode<T> | null\n\n constructor(value: T, key: string | number) {\n this.value = value\n this.key = key\n this.next = null\n this.prev = null\n }\n}\n\nclass HybridList<T> {\n private map: Map<string | number, ListNode<T>>\n private head: ListNode<T> | null\n private tail: ListNode<T> | null\n\n constructor() {\n this.map = new Map<string | number, ListNode<T>>()\n this.head = null\n this.tail = null\n }\n\n get(key: string | number): T | null {\n const node = this.map.get(key)\n return node ? node.value : null\n }\n\n update(key: string | number, value: T): void {\n const node = this.map.get(key)\n if (node)\n node.value = value\n }\n\n add(key: string | number, value: T): void {\n if (this.map.has(key))\n throw new Error(`${key} already exists`)\n\n const newNode = new ListNode(value, key)\n this.map.set(key, newNode)\n\n if (this.tail) {\n this.tail.next = newNode\n newNode.prev = this.tail\n this.tail = newNode\n }\n else {\n this.head = this.tail = newNode\n }\n }\n\n delete(key: string | number): void {\n const node = this.map.get(key)\n\n if (!node)\n return\n\n if (node.prev)\n node.prev.next = node.next\n else\n this.head = node.next\n\n if (node.next)\n node.next.prev = node.prev\n else\n this.tail = node.prev\n\n this.map.delete(key)\n }\n}\n\nexport default HybridList\n"],"mappings":";;;;;;;IAAMA,QAAQ,6BAMZ,kBAAYC,KAAQ,EAAEC,GAAoB,EAAE;EAAA;EAAA;EAAA;EAAA;EAAA;EAC1C,IAAI,CAACD,KAAK,GAAGA,KAAK;EAClB,IAAI,CAACC,GAAG,GAAGA,GAAG;EACd,IAAI,CAACC,IAAI,GAAG,IAAI;EAChB,IAAI,CAACC,IAAI,GAAG,IAAI;AAClB,CAAC;AAAA,IAGGC,UAAU;EAKd,sBAAc;IAAA;IAAA;IAAA;IAAA;IACZ,IAAI,CAACC,GAAG,GAAG,IAAIC,GAAG,EAAgC;IAClD,IAAI,CAACC,IAAI,GAAG,IAAI;IAChB,IAAI,CAACC,IAAI,GAAG,IAAI;EAClB;EAAC;IAAA;IAAA,OAED,aAAIP,GAAoB,EAAY;MAClC,IAAMQ,IAAI,GAAG,IAAI,CAACJ,GAAG,CAACK,GAAG,CAACT,GAAG,CAAC;MAC9B,OAAOQ,IAAI,GAAGA,IAAI,CAACT,KAAK,GAAG,IAAI;IACjC;EAAC;IAAA;IAAA,OAED,gBAAOC,GAAoB,EAAED,KAAQ,EAAQ;MAC3C,IAAMS,IAAI,GAAG,IAAI,CAACJ,GAAG,CAACK,GAAG,CAACT,GAAG,CAAC;MAC9B,IAAIQ,IAAI,EACNA,IAAI,CAACT,KAAK,GAAGA,KAAK;IACtB;EAAC;IAAA;IAAA,OAED,aAAIC,GAAoB,EAAED,KAAQ,EAAQ;MACxC,IAAI,IAAI,CAACK,GAAG,CAACM,GAAG,CAACV,GAAG,CAAC,EACnB,MAAM,IAAIW,KAAK,WAAIX,GAAG,qBAAkB;MAE1C,IAAMY,OAAO,GAAG,IAAId,QAAQ,CAACC,KAAK,EAAEC,GAAG,CAAC;MACxC,IAAI,CAACI,GAAG,CAACS,GAAG,CAACb,GAAG,EAAEY,OAAO,CAAC;MAE1B,IAAI,IAAI,CAACL,IAAI,EAAE;QACb,IAAI,CAACA,IAAI,CAACN,IAAI,GAAGW,OAAO;QACxBA,OAAO,CAACV,IAAI,GAAG,IAAI,CAACK,IAAI;QACxB,IAAI,CAACA,IAAI,GAAGK,OAAO;MACrB,CAAC,MACI;QACH,IAAI,CAACN,IAAI,GAAG,IAAI,CAACC,IAAI,GAAGK,OAAO;MACjC;IACF;EAAC;IAAA;IAAA,OAED,iBAAOZ,GAAoB,EAAQ;MACjC,IAAMQ,IAAI,GAAG,IAAI,CAACJ,GAAG,CAACK,GAAG,CAACT,GAAG,CAAC;MAE9B,IAAI,CAACQ,IAAI,EACP;MAEF,IAAIA,IAAI,CAACN,IAAI,EACXM,IAAI,CAACN,IAAI,CAACD,IAAI,GAAGO,IAAI,CAACP,IAAI,MAE1B,IAAI,CAACK,IAAI,GAAGE,IAAI,CAACP,IAAI;MAEvB,IAAIO,IAAI,CAACP,IAAI,EACXO,IAAI,CAACP,IAAI,CAACC,IAAI,GAAGM,IAAI,CAACN,IAAI,MAE1B,IAAI,CAACK,IAAI,GAAGC,IAAI,CAACN,IAAI;MAEvB,IAAI,CAACE,GAAG,CAACU,MAAM,CAACd,GAAG,CAAC;IACtB;EAAC;EAAA;AAAA;AAGH,eAAeG,UAAU"}
1
+ {"version":3,"names":["ListNode","_createClass","value","key","_classCallCheck","_defineProperty","next","prev","HybridList","map","Map","head","tail","get","node","update","add","has","Error","concat","newNode","set","_delete","delete"],"sources":["../../../src/module/entity/hybridList.ts"],"sourcesContent":["class ListNode<T> {\n value: T\n key: string | number\n next: ListNode<T> | null\n prev: ListNode<T> | null\n\n constructor(value: T, key: string | number) {\n this.value = value\n this.key = key\n this.next = null\n this.prev = null\n }\n}\n\nclass HybridList<T> {\n private map: Map<string | number, ListNode<T>>\n private head: ListNode<T> | null\n private tail: ListNode<T> | null\n\n constructor() {\n this.map = new Map<string | number, ListNode<T>>()\n this.head = null\n this.tail = null\n }\n\n get(key: string | number): T | null {\n const node = this.map.get(key)\n return node ? node.value : null\n }\n\n update(key: string | number, value: T): void {\n const node = this.map.get(key)\n if (node)\n node.value = value\n }\n\n add(key: string | number, value: T): void {\n if (this.map.has(key))\n throw new Error(`${key} already exists`)\n\n const newNode = new ListNode(value, key)\n this.map.set(key, newNode)\n\n if (this.tail) {\n this.tail.next = newNode\n newNode.prev = this.tail\n this.tail = newNode\n }\n else {\n this.head = this.tail = newNode\n }\n }\n\n delete(key: string | number): void {\n const node = this.map.get(key)\n\n if (!node)\n return\n\n if (node.prev)\n node.prev.next = node.next\n else\n this.head = node.next\n\n if (node.next)\n node.next.prev = node.prev\n else\n this.tail = node.prev\n\n this.map.delete(key)\n }\n}\n\nexport default HybridList\n"],"mappings":";;;;;;;IAAMA,QAAQ,gBAAAC,YAAA,CAMZ,SAAAD,SAAYE,KAAQ,EAAEC,GAAoB,EAAE;EAAAC,eAAA,OAAAJ,QAAA;EAAAK,eAAA;EAAAA,eAAA;EAAAA,eAAA;EAAAA,eAAA;EAC1C,IAAI,CAACH,KAAK,GAAGA,KAAK;EAClB,IAAI,CAACC,GAAG,GAAGA,GAAG;EACd,IAAI,CAACG,IAAI,GAAG,IAAI;EAChB,IAAI,CAACC,IAAI,GAAG,IAAI;AAClB,CAAC;AAAA,IAGGC,UAAU;EAKd,SAAAA,WAAA,EAAc;IAAAJ,eAAA,OAAAI,UAAA;IAAAH,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACZ,IAAI,CAACI,GAAG,GAAG,IAAIC,GAAG,CAA+B,CAAC;IAClD,IAAI,CAACC,IAAI,GAAG,IAAI;IAChB,IAAI,CAACC,IAAI,GAAG,IAAI;EAClB;EAACX,YAAA,CAAAO,UAAA;IAAAL,GAAA;IAAAD,KAAA,EAED,SAAAW,IAAIV,GAAoB,EAAY;MAClC,IAAMW,IAAI,GAAG,IAAI,CAACL,GAAG,CAACI,GAAG,CAACV,GAAG,CAAC;MAC9B,OAAOW,IAAI,GAAGA,IAAI,CAACZ,KAAK,GAAG,IAAI;IACjC;EAAC;IAAAC,GAAA;IAAAD,KAAA,EAED,SAAAa,OAAOZ,GAAoB,EAAED,KAAQ,EAAQ;MAC3C,IAAMY,IAAI,GAAG,IAAI,CAACL,GAAG,CAACI,GAAG,CAACV,GAAG,CAAC;MAC9B,IAAIW,IAAI,EACNA,IAAI,CAACZ,KAAK,GAAGA,KAAK;IACtB;EAAC;IAAAC,GAAA;IAAAD,KAAA,EAED,SAAAc,IAAIb,GAAoB,EAAED,KAAQ,EAAQ;MACxC,IAAI,IAAI,CAACO,GAAG,CAACQ,GAAG,CAACd,GAAG,CAAC,EACnB,MAAM,IAAIe,KAAK,IAAAC,MAAA,CAAIhB,GAAG,oBAAiB,CAAC;MAE1C,IAAMiB,OAAO,GAAG,IAAIpB,QAAQ,CAACE,KAAK,EAAEC,GAAG,CAAC;MACxC,IAAI,CAACM,GAAG,CAACY,GAAG,CAAClB,GAAG,EAAEiB,OAAO,CAAC;MAE1B,IAAI,IAAI,CAACR,IAAI,EAAE;QACb,IAAI,CAACA,IAAI,CAACN,IAAI,GAAGc,OAAO;QACxBA,OAAO,CAACb,IAAI,GAAG,IAAI,CAACK,IAAI;QACxB,IAAI,CAACA,IAAI,GAAGQ,OAAO;MACrB,CAAC,MACI;QACH,IAAI,CAACT,IAAI,GAAG,IAAI,CAACC,IAAI,GAAGQ,OAAO;MACjC;IACF;EAAC;IAAAjB,GAAA;IAAAD,KAAA,EAED,SAAAoB,QAAOnB,GAAoB,EAAQ;MACjC,IAAMW,IAAI,GAAG,IAAI,CAACL,GAAG,CAACI,GAAG,CAACV,GAAG,CAAC;MAE9B,IAAI,CAACW,IAAI,EACP;MAEF,IAAIA,IAAI,CAACP,IAAI,EACXO,IAAI,CAACP,IAAI,CAACD,IAAI,GAAGQ,IAAI,CAACR,IAAI,MAE1B,IAAI,CAACK,IAAI,GAAGG,IAAI,CAACR,IAAI;MAEvB,IAAIQ,IAAI,CAACR,IAAI,EACXQ,IAAI,CAACR,IAAI,CAACC,IAAI,GAAGO,IAAI,CAACP,IAAI,MAE1B,IAAI,CAACK,IAAI,GAAGE,IAAI,CAACP,IAAI;MAEvB,IAAI,CAACE,GAAG,CAACc,MAAM,CAACpB,GAAG,CAAC;IACtB;EAAC;EAAA,OAAAK,UAAA;AAAA;AAGH,eAAeA,UAAU"}
@@ -1,33 +1,36 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
3
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
4
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
6
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
7
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
9
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
11
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
12
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
14
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
15
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
16
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
18
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
19
  import { Group, use } from '@anov/3d-core';
20
+ import _ from 'lodash';
20
21
  import { MessageType, sendToMessage } from "../../utils/messageFn";
21
22
  import { EMessageStatus } from "../../messageStatus";
22
23
  import HybridList from "./hybridList";
23
- import { entityStrategy } from "./strategy";
24
+ import { entityStrategy, eventPenetrateType } from "./strategy";
24
25
  import createDisposeFn from "./dispose";
26
+ import { getMinimumEntity } from "./utils";
25
27
  var hybridList = new HybridList();
26
28
  var Entity = /*#__PURE__*/function () {
27
29
  function Entity(app) {
28
30
  _classCallCheck(this, Entity);
29
31
  _defineProperty(this, "app", void 0);
30
32
  _defineProperty(this, "catchStrategy", new Map());
33
+ _defineProperty(this, "options", new Map());
31
34
  this.app = app;
32
35
  }
33
36
  _createClass(Entity, [{
@@ -71,13 +74,13 @@ var Entity = /*#__PURE__*/function () {
71
74
  }, {
72
75
  key: "singleCreate",
73
76
  value: function () {
74
- var _singleCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id, strategy, data, group) {
77
+ var _singleCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id, strategy, option, group) {
75
78
  var entityInfoArray, targetEntityInfo, entity;
76
79
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
77
80
  while (1) switch (_context2.prev = _context2.next) {
78
81
  case 0:
79
82
  _context2.next = 2;
80
- return Promise.allSettled([strategy.create(data)]);
83
+ return Promise.allSettled([strategy.create(option)]);
81
84
  case 2:
82
85
  entityInfoArray = _context2.sent;
83
86
  targetEntityInfo = entityInfoArray[0];
@@ -87,9 +90,12 @@ var Entity = /*#__PURE__*/function () {
87
90
  }
88
91
  throw new Error(targetEntityInfo.reason);
89
92
  case 6:
93
+ this.options.set(id, option);
90
94
  entity = targetEntityInfo.value;
95
+ entity.tag = 'entity'; // used for event penetration identification
96
+ entity.entityType = option.type;
91
97
  hybridList.add(id, entity);
92
- group === null || group === void 0 ? void 0 : group.add(entity);
98
+ group === null || group === void 0 || group.add(entity);
93
99
  return _context2.abrupt("return", {
94
100
  id: id,
95
101
  position: entity.position,
@@ -97,11 +103,11 @@ var Entity = /*#__PURE__*/function () {
97
103
  scale: entity.scale,
98
104
  visable: entity.visible
99
105
  });
100
- case 10:
106
+ case 13:
101
107
  case "end":
102
108
  return _context2.stop();
103
109
  }
104
- }, _callee2);
110
+ }, _callee2, this);
105
111
  }));
106
112
  function singleCreate(_x2, _x3, _x4, _x5) {
107
113
  return _singleCreate.apply(this, arguments);
@@ -110,10 +116,16 @@ var Entity = /*#__PURE__*/function () {
110
116
  }()
111
117
  }, {
112
118
  key: "multiCreate",
113
- value: function multiCreate(id, strategy, data, legends) {
119
+ value: function multiCreate(id, strategy, json) {
114
120
  var _this = this;
121
+ var itemType = json.itemType,
122
+ _json$items = json.items,
123
+ items = _json$items === void 0 ? [] : _json$items,
124
+ _json$legends = json.legends,
125
+ legends = _json$legends === void 0 ? [] : _json$legends;
126
+ this.options.set(id, json);
115
127
  var group = new Group();
116
- var entiryIdArray = data.map( /*#__PURE__*/function () {
128
+ var entiryIdArray = items.map( /*#__PURE__*/function () {
117
129
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(item) {
118
130
  var currentData;
119
131
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -125,11 +137,12 @@ var Entity = /*#__PURE__*/function () {
125
137
  return legend.name === item.legend;
126
138
  })), item);
127
139
  }
128
- _context3.next = 4;
140
+ currentData.type = itemType;
141
+ _context3.next = 5;
129
142
  return _this.singleCreate(item.id, strategy, currentData, group);
130
- case 4:
131
- return _context3.abrupt("return", _context3.sent);
132
143
  case 5:
144
+ return _context3.abrupt("return", _context3.sent);
145
+ case 6:
133
146
  case "end":
134
147
  return _context3.stop();
135
148
  }
@@ -139,6 +152,9 @@ var Entity = /*#__PURE__*/function () {
139
152
  return _ref.apply(this, arguments);
140
153
  };
141
154
  }());
155
+
156
+ // @ts-ignore
157
+ group.entityType = 'layer';
142
158
  hybridList.add(id, group);
143
159
  use.useScene().scene.add(group);
144
160
  return [{
@@ -149,17 +165,23 @@ var Entity = /*#__PURE__*/function () {
149
165
  key: "create",
150
166
  value: function () {
151
167
  var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(json) {
152
- var id, type, strategy;
168
+ var id, type, itemType, strategy;
153
169
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
154
170
  while (1) switch (_context4.prev = _context4.next) {
155
171
  case 0:
156
- id = json.id, type = json.type;
172
+ id = json.id, type = json.type, itemType = json.itemType;
157
173
  _context4.next = 3;
158
- return this.registerStrategy(type);
174
+ return this.registerStrategy(itemType || type);
159
175
  case 3:
160
176
  strategy = _context4.sent;
177
+ if (!(itemType && type === 'layer')) {
178
+ _context4.next = 8;
179
+ break;
180
+ }
181
+ return _context4.abrupt("return", Promise.all(this.multiCreate(id, strategy, json)));
182
+ case 8:
161
183
  return _context4.abrupt("return", this.singleCreate(id, strategy, json));
162
- case 5:
184
+ case 9:
163
185
  case "end":
164
186
  return _context4.stop();
165
187
  }
@@ -171,182 +193,140 @@ var Entity = /*#__PURE__*/function () {
171
193
  return create;
172
194
  }()
173
195
  }, {
174
- key: "create2",
196
+ key: "singleUpdate",
175
197
  value: function () {
176
- var _create2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(json) {
177
- var id, type, data, legends, strategy, singeData, _legends$find;
198
+ var _singleUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id, strategy, option, group) {
199
+ var target, entityInfoArray, targetEntityInfo, entity;
178
200
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
179
201
  while (1) switch (_context5.prev = _context5.next) {
180
202
  case 0:
181
- id = json.id, type = json.type, data = json.data, legends = json.legends;
182
- _context5.next = 3;
183
- return this.registerStrategy(type);
184
- case 3:
185
- strategy = _context5.sent;
186
- if (!(Array.isArray(data) && data.length)) {
187
- _context5.next = 8;
188
- break;
189
- }
190
- return _context5.abrupt("return", Promise.all(this.multiCreate(id, strategy, data, legends)));
191
- case 8:
192
- singeData = data;
193
- if (singeData.legend) {
194
- singeData = _objectSpread(_objectSpread({}, (_legends$find = legends.find(function (item) {
195
- return item.name === singeData.legend;
196
- })) !== null && _legends$find !== void 0 ? _legends$find : {}), singeData);
197
- }
198
- return _context5.abrupt("return", this.singleCreate(id, strategy, singeData));
199
- case 11:
200
- case "end":
201
- return _context5.stop();
202
- }
203
- }, _callee5, this);
204
- }));
205
- function create2(_x8) {
206
- return _create2.apply(this, arguments);
207
- }
208
- return create2;
209
- }()
210
- }, {
211
- key: "singleUpdate",
212
- value: function () {
213
- var _singleUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id, strategy, data, group) {
214
- var entityInfoArray, targetEntityInfo, entity;
215
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
216
- while (1) switch (_context6.prev = _context6.next) {
217
- case 0:
218
- _context6.next = 2;
219
- return Promise.allSettled([strategy.update(data)]);
220
- case 2:
221
- entityInfoArray = _context6.sent;
203
+ this.options.set(id, option);
204
+ target = hybridList.get(id);
205
+ _context5.next = 4;
206
+ return Promise.allSettled([strategy.update(target, option)]);
207
+ case 4:
208
+ entityInfoArray = _context5.sent;
222
209
  targetEntityInfo = entityInfoArray[0];
223
210
  if (!(targetEntityInfo.status === 'rejected')) {
224
- _context6.next = 6;
211
+ _context5.next = 8;
225
212
  break;
226
213
  }
227
214
  throw new Error(targetEntityInfo.reason);
228
- case 6:
215
+ case 8:
229
216
  entity = targetEntityInfo.value;
217
+ entity.tag = 'entity'; // use used for event penetration identification
218
+
230
219
  if (group) {
231
220
  group.remove(hybridList.get(id));
232
221
  group.add(entity);
233
222
  }
234
223
  hybridList.update(id, entity);
235
- return _context6.abrupt("return", {
224
+ return _context5.abrupt("return", {
236
225
  id: id,
237
226
  position: entity.position,
238
227
  rotation: entity.rotation,
239
228
  scale: entity.scale,
240
- visable: entity.visible
229
+ visible: entity.visible
241
230
  });
242
- case 10:
231
+ case 13:
243
232
  case "end":
244
- return _context6.stop();
233
+ return _context5.stop();
245
234
  }
246
- }, _callee6);
235
+ }, _callee5, this);
247
236
  }));
248
- function singleUpdate(_x9, _x10, _x11, _x12) {
237
+ function singleUpdate(_x8, _x9, _x10, _x11) {
249
238
  return _singleUpdate.apply(this, arguments);
250
239
  }
251
240
  return singleUpdate;
252
241
  }()
253
242
  }, {
254
243
  key: "multiUpdate",
255
- value: function multiUpdate(id, strategy, data, legends) {
244
+ value: function multiUpdate(id, strategy, option) {
256
245
  var _this2 = this;
257
246
  var group = hybridList.get(id);
258
- var entiryIdArray = data.map( /*#__PURE__*/function () {
259
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(item) {
260
- var currentData;
261
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
262
- while (1) switch (_context7.prev = _context7.next) {
247
+ var items = option.items,
248
+ legends = option.legends,
249
+ itemType = option.itemType;
250
+ var entityIdArray = items.map( /*#__PURE__*/function () {
251
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(item) {
252
+ var legendItem, currentItem, singleOption, isUpdate;
253
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
254
+ while (1) switch (_context6.prev = _context6.next) {
263
255
  case 0:
264
- currentData = item;
265
- if (currentData.legend) {
266
- currentData = _objectSpread(_objectSpread({}, legends.find(function (legend) {
267
- return legend.name === item.legend;
268
- })), item);
256
+ legendItem = legends === null || legends === void 0 ? void 0 : legends.find(function (legend) {
257
+ return legend.name === item.legend;
258
+ });
259
+ currentItem = legendItem ? _objectSpread(_objectSpread({}, legendItem), item) : item;
260
+ singleOption = _this2.options.get(item.id);
261
+ isUpdate = !!singleOption;
262
+ if (!isUpdate) {
263
+ _context6.next = 11;
264
+ break;
269
265
  }
270
- _context7.next = 4;
271
- return _this2.singleUpdate(item.id, strategy, currentData, group);
272
- case 4:
273
- return _context7.abrupt("return", _context7.sent);
274
- case 5:
266
+ _.assignWith(singleOption, currentItem, _this2.customizer);
267
+ _context6.next = 8;
268
+ return _this2.singleUpdate(item.id, strategy, singleOption, group);
269
+ case 8:
270
+ return _context6.abrupt("return", _context6.sent);
271
+ case 11:
272
+ currentItem.type = itemType;
273
+ _context6.next = 14;
274
+ return _this2.singleCreate(item.id, strategy, currentItem, group);
275
+ case 14:
276
+ return _context6.abrupt("return", _context6.sent);
277
+ case 15:
275
278
  case "end":
276
- return _context7.stop();
279
+ return _context6.stop();
277
280
  }
278
- }, _callee7);
281
+ }, _callee6);
279
282
  }));
280
- return function (_x13) {
283
+ return function (_x12) {
281
284
  return _ref2.apply(this, arguments);
282
285
  };
283
286
  }());
284
287
  return [{
285
288
  id: id
286
- }].concat(_toConsumableArray(entiryIdArray));
289
+ }].concat(_toConsumableArray(entityIdArray));
287
290
  }
288
291
  }, {
289
292
  key: "update",
290
293
  value: function () {
291
- var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(json) {
292
- var id, type, strategy;
293
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
294
- while (1) switch (_context8.prev = _context8.next) {
294
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(json) {
295
+ var id, option, type, itemType, strategy;
296
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
297
+ while (1) switch (_context7.prev = _context7.next) {
295
298
  case 0:
296
- id = json.id, type = json.type;
297
- _context8.next = 3;
298
- return this.registerStrategy(type);
299
- case 3:
300
- strategy = _context8.sent;
301
- return _context8.abrupt("return", this.singleUpdate(id, strategy, json));
302
- case 5:
303
- case "end":
304
- return _context8.stop();
305
- }
306
- }, _callee8, this);
307
- }));
308
- function update(_x14) {
309
- return _update.apply(this, arguments);
310
- }
311
- return update;
312
- }()
313
- }, {
314
- key: "update2",
315
- value: function () {
316
- var _update2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(json) {
317
- var id, type, data, legends, strategy, singeData, _legends$find2;
318
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
319
- while (1) switch (_context9.prev = _context9.next) {
320
- case 0:
321
- id = json.id, type = json.type, data = json.data, legends = json.legends;
322
- _context9.next = 3;
323
- return this.registerStrategy(type);
324
- case 3:
325
- strategy = _context9.sent;
326
- if (!(Array.isArray(data) && data.length)) {
327
- _context9.next = 8;
299
+ id = json.id; // 参数合并
300
+ option = this.options.get(id);
301
+ _.assignWith(option, json, this.customizer);
302
+ type = option.type, itemType = option.itemType;
303
+ _context7.next = 6;
304
+ return this.registerStrategy(itemType || type);
305
+ case 6:
306
+ strategy = _context7.sent;
307
+ if (!(itemType && type === 'layer')) {
308
+ _context7.next = 11;
328
309
  break;
329
310
  }
330
- return _context9.abrupt("return", Promise.all(this.multiUpdate(id, strategy, data, legends)));
331
- case 8:
332
- singeData = data;
333
- if (singeData.legend) {
334
- singeData = _objectSpread(_objectSpread({}, (_legends$find2 = legends.find(function (item) {
335
- return item.name === singeData.legend;
336
- })) !== null && _legends$find2 !== void 0 ? _legends$find2 : {}), singeData);
337
- }
338
- return _context9.abrupt("return", this.singleUpdate(id, strategy, data));
311
+ return _context7.abrupt("return", Promise.all(this.multiUpdate(id, strategy, option)));
339
312
  case 11:
313
+ return _context7.abrupt("return", this.singleUpdate(id, strategy, option));
314
+ case 12:
340
315
  case "end":
341
- return _context9.stop();
316
+ return _context7.stop();
342
317
  }
343
- }, _callee9, this);
318
+ }, _callee7, this);
344
319
  }));
345
- function update2(_x15) {
346
- return _update2.apply(this, arguments);
320
+ function update(_x13) {
321
+ return _update.apply(this, arguments);
347
322
  }
348
- return update2;
323
+ return update;
349
324
  }()
325
+ }, {
326
+ key: "customizer",
327
+ value: function customizer(objValue, srcValue) {
328
+ if (_.isArray(objValue) && srcValue) return srcValue;
329
+ }
350
330
  }, {
351
331
  key: "delete",
352
332
  value: function _delete(json) {
@@ -354,6 +334,7 @@ var Entity = /*#__PURE__*/function () {
354
334
  var target = hybridList.get(id);
355
335
  if (!target) throw new Error("entity ".concat(id, " is not exist"));
356
336
  target.removeFromParent();
337
+ this.options.has(id) && this.options.delete(id);
357
338
  var entityDispose = createDisposeFn();
358
339
 
359
340
  // @ts-ignore
@@ -373,14 +354,32 @@ var Entity = /*#__PURE__*/function () {
373
354
  id = opts.id;
374
355
  var target = hybridList.get(id);
375
356
  if (!target) throw new Error("entity ".concat(id, " is not exist"));
376
- this.app.interactionManager.add(target);
377
- target.addEventListener(eventName, function (e) {
378
- sendToMessage({
379
- messageType: MessageType.Event,
380
- messageName: eventName,
381
- status: EMessageStatus.Success
357
+
358
+ // @ts-ignore
359
+ if (eventPenetrateType.includes(target.entityType)) {
360
+ this.app.interactionManager.add(target);
361
+ target.addEventListener(eventName, function (e) {
362
+ var closestMesh = e.newClosestMesh;
363
+ var minimumEntity = getMinimumEntity(closestMesh, target);
364
+ minimumEntity && sendToMessage({
365
+ messageType: MessageType.Event,
366
+ messageName: eventName,
367
+ status: EMessageStatus.Success
368
+ }, {
369
+ id: minimumEntity.id
370
+ });
382
371
  });
383
- });
372
+ } else {
373
+ this.app.interactionManager.add(target);
374
+ target.addEventListener(eventName, function (e) {
375
+ console.log(e);
376
+ sendToMessage({
377
+ messageType: MessageType.Event,
378
+ messageName: eventName,
379
+ status: EMessageStatus.Success
380
+ });
381
+ });
382
+ }
384
383
  }
385
384
  }]);
386
385
  return Entity;