@labelbee/lb-components 1.16.0-alpha.1 → 1.16.0-alpha.10

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 (183) hide show
  1. package/dist/assets/annotation/audio/clip.svg.js +1 -0
  2. package/dist/assets/annotation/audio/clipA.svg.js +1 -0
  3. package/dist/assets/annotation/audio/clipASmall.svg.js +1 -0
  4. package/dist/assets/annotation/audio/clipSmall.svg.js +1 -0
  5. package/dist/assets/annotation/audio/delete.svg.js +1 -0
  6. package/dist/assets/annotation/audio/loop.svg.js +1 -0
  7. package/dist/assets/annotation/audio/loopA.svg.js +1 -0
  8. package/dist/assets/annotation/audio/progressDot.svg.js +1 -0
  9. package/dist/assets/annotation/audio/progressDotA.svg.js +1 -0
  10. package/dist/assets/annotation/audio/tag.svg.js +1 -0
  11. package/dist/assets/annotation/audio/tagA.svg.js +1 -0
  12. package/dist/assets/annotation/toolHotKeyIcon/deleteRemark.svg.js +1 -0
  13. package/dist/assets/annotation/toolHotKeyIcon/icon_down.svg.js +1 -0
  14. package/dist/assets/annotation/toolHotKeyIcon/icon_eyeLock_kj.svg.js +1 -0
  15. package/dist/assets/annotation/toolHotKeyIcon/icon_polygonCut_kj.svg.js +1 -0
  16. package/dist/assets/annotation/toolHotKeyIcon/icon_up.svg.js +1 -0
  17. package/dist/assets/annotation/toolHotKeyIcon/nextRemark.svg.js +1 -0
  18. package/dist/assets/annotation/toolHotKeyIcon/preRemark.svg.js +1 -0
  19. package/dist/assets/annotation/video/icon_clip.svg.js +1 -0
  20. package/dist/components/audioAnnotate/audioContext/index.js +1 -0
  21. package/dist/components/audioAnnotate/audioContext/index.module.scss.js +1 -0
  22. package/dist/components/audioAnnotate/audioSide/LabelDetailPopover/index.js +1 -0
  23. package/dist/components/audioAnnotate/audioSide/LabelDetailPopover/index.module.scss.js +1 -0
  24. package/dist/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -0
  25. package/dist/components/audioAnnotate/audioSide/clipSidebar/index.module.scss.js +1 -0
  26. package/dist/components/audioAnnotate/audioSide/labelFilterInput/index.js +1 -0
  27. package/dist/components/audioAnnotate/audioSide/labelFilterInput/index.module.scss.js +1 -0
  28. package/dist/components/audioAnnotate/audioSide/labelSidebar/index.js +1 -0
  29. package/dist/components/audioAnnotate/audioSide/labelSidebar/index.module.scss.js +1 -0
  30. package/dist/components/audioAnnotate/index.js +1 -0
  31. package/dist/components/audioAnnotate/index.module.scss.js +1 -0
  32. package/dist/components/audioAnnotate/tagResultShow/index.js +1 -0
  33. package/dist/components/audioAnnotate/tagResultShow/index.module.scss.js +1 -0
  34. package/dist/components/audioAnnotate/textInput/index.js +1 -0
  35. package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -0
  36. package/dist/components/audioAnnotate/utils/getWebPcm2Wac.js +1 -0
  37. package/dist/components/audioPlayer/clipRegion/index.js +1 -0
  38. package/dist/components/audioPlayer/clipRegion/index.module.scss.js +1 -0
  39. package/dist/components/audioPlayer/clipTip/index.js +1 -0
  40. package/dist/components/audioPlayer/combineTip/index.js +1 -0
  41. package/dist/components/audioPlayer/index.js +1 -0
  42. package/dist/components/audioPlayer/index.module.scss.js +1 -0
  43. package/dist/components/audioPlayer/labelDisplayToggle/index.js +1 -0
  44. package/dist/components/audioPlayer/labelDisplayToggle/index.module.scss.js +1 -0
  45. package/dist/components/audioPlayer/progressDot/index.js +1 -0
  46. package/dist/components/audioPlayer/progressDot/index.module.scss.js +1 -0
  47. package/dist/components/audioPlayer/segmentTip/index.js +1 -0
  48. package/dist/components/audioPlayer/useAudioCombine/index.js +2 -0
  49. package/dist/components/audioPlayer/useAudioScroll/index.js +1 -0
  50. package/dist/components/audioPlayer/useAudioSegment/index.js +1 -0
  51. package/dist/components/audioPlayer/useSwitchHotkey/index.js +1 -0
  52. package/dist/components/audioPlayer/zoomSlider/index.js +1 -0
  53. package/dist/components/audioPlayer/zoomSlider/index.module.scss.js +1 -0
  54. package/dist/components/imageError/index.js +1 -0
  55. package/dist/components/invalidPage/index.js +1 -0
  56. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  57. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  58. package/dist/components/videoPlayer/components/SpeedController/index.js +1 -0
  59. package/dist/components/videoPlayer/components/SpeedController/index.module.scss.js +1 -0
  60. package/dist/components/videoPlayer/components/controller/index.js +1 -1
  61. package/dist/components/videoPlayer/index.js +1 -1
  62. package/dist/index.css +721 -0
  63. package/dist/store/annotation/reducer.js +1 -1
  64. package/dist/types/App.d.ts +1 -0
  65. package/dist/types/components/attributeList/index.d.ts +1 -0
  66. package/dist/types/components/audioAnnotate/audioContext/index.d.ts +40 -0
  67. package/dist/types/components/audioAnnotate/audioSide/LabelDetailPopover/index.d.ts +9 -0
  68. package/dist/types/components/audioAnnotate/audioSide/clipSidebar/index.d.ts +11 -0
  69. package/dist/types/components/audioAnnotate/audioSide/labelFilterInput/index.d.ts +7 -0
  70. package/dist/types/components/audioAnnotate/audioSide/labelSidebar/index.d.ts +49 -0
  71. package/dist/types/components/audioAnnotate/index.d.ts +12 -0
  72. package/dist/types/components/audioAnnotate/tagResultShow/index.d.ts +3 -0
  73. package/dist/types/components/audioAnnotate/textInput/index.d.ts +52 -0
  74. package/dist/types/components/audioAnnotate/utils/getWebPcm2Wac.d.ts +1 -0
  75. package/dist/types/components/audioPlayer/clipRegion/index.d.ts +22 -0
  76. package/dist/types/components/audioPlayer/clipTip/index.d.ts +15 -0
  77. package/dist/types/components/audioPlayer/combineTip/index.d.ts +12 -0
  78. package/dist/types/components/audioPlayer/index.d.ts +43 -0
  79. package/dist/types/components/audioPlayer/labelDisplayToggle/index.d.ts +6 -0
  80. package/dist/types/components/audioPlayer/progressDot/index.d.ts +6 -0
  81. package/dist/types/components/audioPlayer/segmentTip/index.d.ts +12 -0
  82. package/dist/types/components/audioPlayer/useAudioCombine/index.d.ts +30 -0
  83. package/dist/types/components/audioPlayer/useAudioScroll/index.d.ts +17 -0
  84. package/dist/types/components/audioPlayer/useAudioSegment/index.d.ts +31 -0
  85. package/dist/types/components/audioPlayer/useSwitchHotkey/index.d.ts +12 -0
  86. package/dist/types/components/audioPlayer/zoomSlider/index.d.ts +13 -0
  87. package/dist/types/components/imageError/index.d.ts +14 -0
  88. package/dist/types/components/invalidPage/index.d.ts +9 -0
  89. package/dist/types/components/pointCloudView/hooks/usePointCloudViews.d.ts +1 -3
  90. package/dist/types/components/videoPlayer/components/SpeedController/index.d.ts +16 -0
  91. package/dist/types/components/videoPlayer/components/controller/index.d.ts +11 -0
  92. package/dist/types/hooks/annotation.d.ts +1 -1
  93. package/dist/types/utils/StepUtils.d.ts +7 -0
  94. package/dist/types/utils/ToolUtils.d.ts +1 -0
  95. package/dist/types/utils/audio.d.ts +132 -0
  96. package/dist/types/views/MainView/toolFooter/FooterTips/ToolHotKey/audioText/index.d.ts +18 -0
  97. package/dist/types/views/MainView/toolFooter/FooterTips/ToolHotKey/common/index.d.ts +39 -0
  98. package/dist/types/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.d.ts +1 -1
  99. package/dist/utils/StepUtils.js +1 -1
  100. package/dist/utils/ToolUtils.js +1 -1
  101. package/dist/utils/audio.js +1 -0
  102. package/dist/views/MainView/index.js +1 -1
  103. package/dist/views/MainView/sidebar/ToolStyle/index.js +1 -1
  104. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/audioText/index.js +1 -0
  105. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/common/index.js +1 -1
  106. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  107. package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/line/index.js +1 -1
  108. package/dist/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  109. package/dist/views/MainView/toolHeader/headerOption/index.js +1 -1
  110. package/es/assets/annotation/audio/clip.svg.js +1 -0
  111. package/es/assets/annotation/audio/clipA.svg.js +1 -0
  112. package/es/assets/annotation/audio/clipASmall.svg.js +1 -0
  113. package/es/assets/annotation/audio/clipSmall.svg.js +1 -0
  114. package/es/assets/annotation/audio/delete.svg.js +1 -0
  115. package/es/assets/annotation/audio/loop.svg.js +1 -0
  116. package/es/assets/annotation/audio/loopA.svg.js +1 -0
  117. package/es/assets/annotation/audio/progressDot.svg.js +1 -0
  118. package/es/assets/annotation/audio/progressDotA.svg.js +1 -0
  119. package/es/assets/annotation/audio/tag.svg.js +1 -0
  120. package/es/assets/annotation/audio/tagA.svg.js +1 -0
  121. package/es/assets/annotation/toolHotKeyIcon/deleteRemark.svg.js +1 -0
  122. package/es/assets/annotation/toolHotKeyIcon/icon_down.svg.js +1 -0
  123. package/es/assets/annotation/toolHotKeyIcon/icon_eyeLock_kj.svg.js +1 -0
  124. package/es/assets/annotation/toolHotKeyIcon/icon_polygonCut_kj.svg.js +1 -0
  125. package/es/assets/annotation/toolHotKeyIcon/icon_up.svg.js +1 -0
  126. package/es/assets/annotation/toolHotKeyIcon/nextRemark.svg.js +1 -0
  127. package/es/assets/annotation/toolHotKeyIcon/preRemark.svg.js +1 -0
  128. package/es/assets/annotation/video/icon_clip.svg.js +1 -0
  129. package/es/components/audioAnnotate/audioContext/index.js +1 -0
  130. package/es/components/audioAnnotate/audioContext/index.module.scss.js +1 -0
  131. package/es/components/audioAnnotate/audioSide/LabelDetailPopover/index.js +1 -0
  132. package/es/components/audioAnnotate/audioSide/LabelDetailPopover/index.module.scss.js +1 -0
  133. package/es/components/audioAnnotate/audioSide/clipSidebar/index.js +1 -0
  134. package/es/components/audioAnnotate/audioSide/clipSidebar/index.module.scss.js +1 -0
  135. package/es/components/audioAnnotate/audioSide/labelFilterInput/index.js +1 -0
  136. package/es/components/audioAnnotate/audioSide/labelFilterInput/index.module.scss.js +1 -0
  137. package/es/components/audioAnnotate/audioSide/labelSidebar/index.js +1 -0
  138. package/es/components/audioAnnotate/audioSide/labelSidebar/index.module.scss.js +1 -0
  139. package/es/components/audioAnnotate/index.js +1 -0
  140. package/es/components/audioAnnotate/index.module.scss.js +1 -0
  141. package/es/components/audioAnnotate/tagResultShow/index.js +1 -0
  142. package/es/components/audioAnnotate/tagResultShow/index.module.scss.js +1 -0
  143. package/es/components/audioAnnotate/textInput/index.js +1 -0
  144. package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -0
  145. package/es/components/audioAnnotate/utils/getWebPcm2Wac.js +1 -0
  146. package/es/components/audioPlayer/clipRegion/index.js +1 -0
  147. package/es/components/audioPlayer/clipRegion/index.module.scss.js +1 -0
  148. package/es/components/audioPlayer/clipTip/index.js +1 -0
  149. package/es/components/audioPlayer/combineTip/index.js +1 -0
  150. package/es/components/audioPlayer/index.js +1 -0
  151. package/es/components/audioPlayer/index.module.scss.js +1 -0
  152. package/es/components/audioPlayer/labelDisplayToggle/index.js +1 -0
  153. package/es/components/audioPlayer/labelDisplayToggle/index.module.scss.js +1 -0
  154. package/es/components/audioPlayer/progressDot/index.js +1 -0
  155. package/es/components/audioPlayer/progressDot/index.module.scss.js +1 -0
  156. package/es/components/audioPlayer/segmentTip/index.js +1 -0
  157. package/es/components/audioPlayer/useAudioCombine/index.js +2 -0
  158. package/es/components/audioPlayer/useAudioScroll/index.js +1 -0
  159. package/es/components/audioPlayer/useAudioSegment/index.js +1 -0
  160. package/es/components/audioPlayer/useSwitchHotkey/index.js +1 -0
  161. package/es/components/audioPlayer/zoomSlider/index.js +1 -0
  162. package/es/components/audioPlayer/zoomSlider/index.module.scss.js +1 -0
  163. package/es/components/imageError/index.js +1 -0
  164. package/es/components/invalidPage/index.js +1 -0
  165. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  166. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  167. package/es/components/videoPlayer/components/SpeedController/index.js +1 -0
  168. package/es/components/videoPlayer/components/SpeedController/index.module.scss.js +1 -0
  169. package/es/components/videoPlayer/components/controller/index.js +1 -1
  170. package/es/index.css +721 -0
  171. package/es/store/annotation/reducer.js +1 -1
  172. package/es/utils/StepUtils.js +1 -1
  173. package/es/utils/ToolUtils.js +1 -1
  174. package/es/utils/audio.js +1 -0
  175. package/es/views/MainView/index.js +1 -1
  176. package/es/views/MainView/sidebar/ToolStyle/index.js +1 -1
  177. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/audioText/index.js +1 -0
  178. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/common/index.js +1 -1
  179. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
  180. package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/line/index.js +1 -1
  181. package/es/views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js +1 -1
  182. package/es/views/MainView/toolHeader/headerOption/index.js +1 -1
  183. package/package.json +9 -5
@@ -0,0 +1 @@
1
+ import F from"../../../attributeList/index.js";import _ from"../../../checkboxList/index.js";import{CaretRightOutlined as j}from"@ant-design/icons";import{Collapse as x,Tooltip as B,Badge as N}from"antd";import{cloneDeep as A}from"lodash";import t,{Component as R}from"react";import u from"./index.module.scss.js";import k from"../LabelDetailPopover/index.js";import V from"../labelFilterInput/index.js";import{TagUtils as T}from"@labelbee/lb-annotation";import M from"../../../../assets/annotation/common/icon_clearSmall.svg.js";import O from"../../../../assets/annotation/common/icon_clearSmall_a.svg.js";const $=(i,l)=>K(i,l,"#666FFF"),K=(i,l,s)=>{if(!i||!l)return i;const a=i.indexOf(l);return a===-1?i:t.createElement(t.Fragment,null,i.slice(0,a),t.createElement("span",{style:{color:s}},l),i.slice(a+l.length))},{Panel:U}=x;class H extends R{constructor(l){super(l);this.sideBar=t.createRef(),this.updateScrollTop=s=>{var a;this.sideBar.current&&((a=this.sideBar.current.children[s])==null||a.scrollIntoView({block:"center"}))},this.setExpendKeyList=(s,a,h,m)=>{const o=A(s);o[a]===""||m===!0?o[a]=h:o[a]="",this.setState({expandKeyList:o})},this.setInputValue=s=>{this.setState({inputValue:s.target.value})},this.state={hoverDeleteIndex:-1,expandKeyList:l.labelInfoSet.map(s=>s.value),inputValue:""}}shouldComponentUpdate(l,s){var a;const{labelSelectedList:h,labelInfoSet:m}=l;if((this.props.labelInfoSet.length!==l.labelInfoSet.length||this.state.inputValue!==s.inputValue)&&this.setState({expandKeyList:l.labelInfoSet.map(o=>o.value)}),h[0]!==this.props.labelSelectedList[0]&&l.labelSelectedList.length===1){const o=h[0],d=(a=m.filter((c,E)=>E===o)[0])==null?void 0:a.value;return this.setExpendKeyList(this.state.expandKeyList,o,d,!0),!0}return l.labelSelectedList.length===1&&this.updateScrollTop(h[0]),(this.props.imgIndex!==l.imgIndex||this.props.graphIndex!==l.graphIndex)&&this.updateScrollTop(0),!0}render(){const{labelInfoSet:l,labelSelectedList:s,tagResult:a,clearResult:h,entityMap:m}=this.props,{hoverDeleteIndex:o,expandKeyList:d,inputValue:c}=this.state,E=l;let f=!1;l.forEach(r=>{const{subSelected:p=[]}=r;r.hasShow=!1,p.forEach(e=>{const{key:n}=e;if(!c){e.showLabel=e.key,e.show=!0;return}n.indexOf(c)>-1?(e.showLabel=$(n,c),e.show=!0,r.hasShow=!0):(e.showLabel=e.key,e.show=!1)}),r.hasShow&&(f=!0)});const w=r=>s.length>0&&s[0]===r?t.createElement("span",{className:u.keyDownIconActive},r+1):t.createElement("span",{className:u.keyDownIcon},r+1),D=({isActive:r})=>t.createElement(j,{rotate:r?90:0}),L=(r,p=-1)=>{if(!!r)return r.map((e,n)=>{var y,S,I;if(e.subSelected){if(c&&!e.hasShow)return null;const b=T.judgeResultIsInInputList(e.value,a==null?void 0:a[e.value],E);return t.createElement(x,{bordered:!1,expandIcon:D,key:`collapse_${n}_${p+1}`,onChange:()=>this.setExpendKeyList(d,n,e.value),activeKey:[d[n]]},t.createElement(U,{header:t.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},t.createElement("span",null,e.key,t.createElement(B,{placement:"bottom",title:"\u6E05\u7A7A\u6B64\u9009\u9879"},t.createElement("img",{style:{marginLeft:5,cursor:"pointer"},onClick:g=>{g.stopPropagation(),h(e.value)},src:o===n||b?O:M,onMouseEnter:()=>{this.setState({hoverDeleteIndex:n})},onMouseLeave:()=>{this.setState({hoverDeleteIndex:-1})}})),b&&d[n]===""&&t.createElement(N,{color:"#87d068"})),!c&&this.props.labelInfoSet.length>1&&w(n)),key:e.value},t.createElement("div",{className:u.level,style:{backgroundColor:s.length>0&&s[0]===n?"rgba(158, 158, 158, 0.18)":""}},L(e.subSelected,n))))}else{const b=this.props.labelInfoSet[p]?this.props.labelInfoSet[p].value:0,g=((S=(y=a==null?void 0:a[b])==null?void 0:y.split(";"))==null?void 0:S.indexOf(e.value))>-1?e.value:"",C=m==null?void 0:m.get(e.value);if(((I=this.props.labelInfoSet[p])==null?void 0:I.isMulti)===!0){let v=n+1;return typeof v=="number"&&v<=9&&v>=0||(v="-"),(e==null?void 0:e.show)&&t.createElement("div",{className:u.singleBar},t.createElement(k,{labelDetail:C,visible:this.props.dynamicTag},t.createElement(_,{attributeChanged:()=>this.props.setLabel(p,n),selectedAttribute:[g],list:[{value:e.value,label:e.key,showLabel:e.showLabel}],num:v})))}else return(e==null?void 0:e.show)&&t.createElement("div",{className:u.singleBar},t.createElement(k,{labelDetail:C,visible:this.props.dynamicTag},t.createElement(F,{attributeChanged:()=>this.props.setLabel(p,n),selectedAttribute:g,list:[{value:e.value,label:e.key}],num:n+1})))}})};return l.length===0?t.createElement("div",{style:{padding:20,textAlign:"center"}},"\u6682\u65E0\u4FE1\u606F\u914D\u7F6E"):t.createElement("div",{className:u.filterContainer},t.createElement("div",{className:u.filterInputContainer},t.createElement(V,{value:c,onChange:this.setInputValue})),t.createElement("div",{className:u.filterContent},t.createElement("div",{className:u.main,ref:this.sideBar},L(l),!!c&&!f&&t.createElement("div",{style:{textAlign:"center",color:"#999"}},"\u6682\u65E0\u6570\u636E"))))}}export{H as default,K as highlightKeyword};
@@ -0,0 +1 @@
1
+ var e={optionMenu:"index-module_optionMenu__-aO65",main:"index-module_main__f6-QY",keyDownIcon:"index-module_keyDownIcon__08vzX",keyDownIconActive:"index-module_keyDownIconActive__XIffN",level:"index-module_level__G-0-x",radioOption:"index-module_radioOption__-WpIp",labelMouseClick:"index-module_labelMouseClick__cDRh4",singleBar:"index-module_singleBar__2J-ms",filterContainer:"index-module_filterContainer__LiNrv",filterInputContainer:"index-module_filterInputContainer__SgsUw",filterContent:"index-module_filterContent__C70F2"};export{e as default};
@@ -0,0 +1 @@
1
+ import o,{useState as W,useEffect as U,useMemo as te}from"react";import{AudioPlayer as Ee}from"../audioPlayer/index.js";import{getClassName as _e}from"../../utils/dom.js";import Ce from"../predictTracking/previewResult/index.js";import{Layout as oe}from"antd/es";import{Spin as je}from"antd";import{prefix as Re}from"../../constant/index.js";import{cKeyCode as Te,CommonToolUtils as K,uuid as Pe,TagUtils as Le,cTool as he}from"@labelbee/lb-annotation";import N from"./index.module.scss.js";import we from"./tagResultShow/index.js";import{AudioClipProvider as Ae,useAudioClipStore as Oe}from"./audioContext/index.js";import Ie from"./textInput/index.js";import{connect as Ne}from"react-redux";import{a2MapStateToProps as ke}from"../../store/annotation/map.js";import{LabelBeeContext as $e}from"../../store/ctx.js";import{jsonParser as De}from"../../utils/index.js";import{useCustomToolInstance as Me}from"../../hooks/annotation.js";import{sidebarCls as Q}from"../../views/MainView/sidebar/index.js";import Ve from"./audioSide/labelSidebar/index.js";import Ke from"./audioSide/clipSidebar/index.js";import Be from"../../assets/annotation/audio/tag.svg.js";import Fe from"../../assets/annotation/audio/tagA.svg.js";import We from"../../assets/annotation/audio/clip.svg.js";import Ue from"../../assets/annotation/audio/clipA.svg.js";var Xe=Object.defineProperty,qe=Object.defineProperties,ze=Object.getOwnPropertyDescriptors,ne=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,ie=(e,t,s)=>t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,y=(e,t)=>{for(var s in t||(t={}))Ge.call(t,s)&&ie(e,s,t[s]);if(ne)for(var s of ne(t))He.call(t,s)&&ie(e,s,t[s]);return e},k=(e,t)=>qe(e,ze(t));const{EAudioToolName:Je}=he,le=Te.default,{Sider:Qe,Content:Ye}=oe,se=`${Re}-layout`,Ze=({setSideTab:e,sideTab:t})=>{const s=[{tab:"tag",commonSvg:Be,selectedSvg:Fe},{tab:"clip",commonSvg:We,selectedSvg:Ue}];return o.createElement("div",{className:N.toggleAudioOption},s.map((m,S)=>{const{tab:c,selectedSvg:x,commonSvg:C}=m;return o.createElement("div",{key:S,className:N.option},o.createElement("img",{className:N.icon,src:t===c?x:C,onClick:()=>{t!==c&&e(c)}}))}))},et=({result:e,inputDisabled:t,updateText:s,configList:m,autofocus:S,preContext:c,isCheck:x,clipAttributeConfigurable:C,clipTextConfigurable:$,textConfigurable:p,updateRegion:E,clipAttributeList:d})=>o.createElement("div",{className:N.textareaContainer},o.createElement("div",{className:N.textareaContent},o.createElement(Ie,{isCheck:x,result:e==null?void 0:e.value,textInputDisabled:t,textID:(e==null?void 0:e.id)||0,updateText:s,configList:m,autofocus:!t&&S,preContext:c,regions:e==null?void 0:e.regions,clipAttributeConfigurable:C,clipTextConfigurable:$,textConfigurable:p,updateRegion:E,clipAttributeList:d}))),tt=e=>{var t,s;const{sider:m,config:S,result:c,updateTagResult:x,updateRegion:C,isEdit:$,tagConfigurable:p,clipConfigurable:E}=e;let d=(S==null?void 0:S.inputList)||[],_=(t=c==null?void 0:c.tag)!=null?t:{},r=(s=c==null?void 0:c.regions)!=null?s:[];const[X,h]=W([]),[j,g]=W("tag");U(()=>{if(!p&&E){g("clip");return}g("tag")},[p,E]),U(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}));const D=i=>{if(p&&E)switch(i.keyCode){case le.L:g("tag");break;case le.X:g("clip");break}if(j==="tag"){if(!K.hotkeyFilter(i))return;K.isMoveKey(i==null?void 0:i.keyCode)&&i.preventDefault();let l=i.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const u=X.slice();d.length===1?(R(0,l),h([0,l]),setTimeout(()=>{h([])},500)):u.length===1?(R(u[0],l),h([u[0],l]),setTimeout(()=>{h([])},500)):h([l])}}},R=(i,l)=>{if(i<d.length&&d[i].subSelected&&l<d[i].subSelected.length){const u=d[i].value,v=d[i].isMulti;let T=d[i].subSelected[l].value,q=0;const O=_;for(const I in _)if(I===d[i].value){if(q++,v===!0){const P=O[I].split(";").filter(z=>z!==""),B=P.indexOf(T);B===-1?P.push(T):P.splice(B,1),T=P.join(";")}T===""?delete O[I]:O[I]=T}q===0&&Object.assign(_,{[u]:T}),x(_)}},w=i=>{delete _[i],x(_)},A=p&&E&&o.createElement(Ze,{setSideTab:g,sideTab:j}),M=j==="tag"&&o.createElement(Ve,{labelInfoSet:p?d:[],labelSelectedList:X,setLabel:R,tagResult:_,clearResult:w,isEdit:$,withPanelTab:!1}),V=j==="clip"&&o.createElement(Ke,{regions:r,updateRegion:C,useAudioClipStore:Oe});return m?typeof m=="function"?o.createElement("div",{className:`${Q}`},m({toggleAudioOption:A,labelSidebar:M,clipSidebar:V})):m:o.createElement("div",{className:`${Q}`},o.createElement("div",{className:`${Q}__content`},A,M,V))},ot=e=>{var t,s,m,S,c,x,C,$,p;const E=(s=(t=e.style)==null?void 0:t.sider)==null?void 0:s.width,{step:d,stepList:_,audioContext:r,sider:X,drawLayerSlot:h,imgList:j,imgIndex:g,currentData:D,config:R,stepInfo:w}=e,A=K.getCurrentStepToolAndConfig(d,_),M=De(D.result),{toolInstanceRef:V}=Me({basicInfo:M}),[i,l]=W(!0),[u,v]=W(null),[T,q]=W(!1);U(()=>{l(!0),q(!0)},[g]),U(()=>{i===!1&&me()},[i]),U(()=>{V.current.exportData=()=>[[u],{}],V.current.setResult=Se,V.current.clearResult=xe},[u]);const O=te(()=>{const n=M[`step_${w==null?void 0:w.step}`];return(n==null?void 0:n.result)||[]},[R,M,w]),{tagConfigurable:I,textConfigurable:P=!0,clipConfigurable:B=!1,clipAttributeConfigurable:z=!1,clipAttributeList:Y=[],clipTextConfigurable:G=!1,inputList:re=[],configList:ae=[]}=te(()=>{if(A)return K.jsonParser(A==null?void 0:A.config)},[A]),ue={clipConfigurable:B,clipAttributeConfigurable:z,clipAttributeList:Y,clipTextConfigurable:G},H=r?r==null?void 0:r.valid:!0,ce=(S=(m=K.jsonParser(D.result))==null?void 0:m.duration)!=null?S:0,de=H?ce:0,fe=!H||i||![P,G].includes(!0);let Z={};if(g!==-1&&(j==null?void 0:j.length)){const n=(c=j[g])==null?void 0:c.preResult,a=(r==null?void 0:r.isEdit)?(x=r==null?void 0:r.stepConfig)==null?void 0:x.loadPreStep:w==null?void 0:w.loadPreStep;if(n&&a){const f=K.jsonParser(n),b=($=(C=f==null?void 0:f.config)==null?void 0:C.context)!=null?$:{};Object.keys(b).forEach(L=>{L&&b[L]&&(Z[L]={visible:!0,content:b[L],type:L})})}}const me=()=>{(O==null?void 0:O.length)>0?v(O[0]):v({id:Pe(),sourceID:"",value:ee(),tag:pe(),regions:[]})},ee=(n=!0)=>{const a={};let f=R.configList||[];return f.length>0&&f.forEach(b=>{a[b.key]=n&&b.default||""}),a},pe=()=>Le.getDefaultResultByConfig(R.inputList||[]),ge=({duration:n,hasError:a})=>{l(!1)},ve=n=>{v(a=>k(y({},a),{regions:((a==null?void 0:a.regions)||[]).filter(f=>f.id!==n)}))},J=n=>{v(a=>{var f;const b=(f=a==null?void 0:a.regions)!=null?f:[],{id:L}=n;return b.find(F=>F.id===L)?k(y({},a),{regions:b.map(F=>L===F.id?y(y({},F),n):F)}):k(y({},a),{regions:[...b,n]})})},be=(n,a)=>{v(f=>k(y({},f),{value:k(y({},f.value),{[a]:n})}))},ye=n=>{v(a=>k(y({},a),{tag:n}))},Se=n=>{v(n)},xe=()=>{v(n=>k(y({},n),{value:ee(),tag:{},regions:[]}))};return o.createElement(Ae,null,o.createElement(je,{spinning:i,wrapperClassName:"audio-tool-spinner"},o.createElement(oe,{className:_e("layout","container"),style:{height:"100%"}},e==null?void 0:e.leftSider,o.createElement(Ye,{className:`${se}__content`},o.createElement("div",{className:N.containerWrapper},o.createElement("div",{className:N.audioWrapper},I&&o.createElement(we,{result:u==null?void 0:u.tag,labelInfoSet:re,hasPromptLayer:!!(r==null?void 0:r.promptLayer)}),r==null?void 0:r.promptLayer,o.createElement(Ee,y({context:{isEdit:r==null?void 0:r.isEdit,count:de,toolName:Je.AudioTextTool,imgIndex:g},drawLayerSlot:h,fileData:D,onLoaded:ge,invalid:!H,updateRegion:J,removeRegion:ve,regions:u==null?void 0:u.regions,activeToolPanel:r==null?void 0:r.activeToolPanel,footer:e.footer},ue))),(P||G)&&o.createElement(et,{preContext:Z,result:u,inputDisabled:fe,updateText:be,updateRegion:J,configList:ae,autofocus:T,textConfigurable:P,clipTextConfigurable:G,clipAttributeList:Y,clipAttributeConfigurable:z}))),o.createElement(Qe,{className:`${se}__side`,width:E!=null?E:240,style:(p=e.style)==null?void 0:p.sider},o.createElement(tt,{sider:X,config:R,result:u,updateTagResult:ye,updateRegion:J,isEdit:r==null?void 0:r.isEdit,tagConfigurable:I,clipConfigurable:B})),o.createElement(Ce,null))))};var nt=Ne(ke,null,null,{context:$e})(ot);export{nt as default};
@@ -0,0 +1 @@
1
+ var e={containerWrapper:"index-module_containerWrapper__PX-CC",audioWrapper:"index-module_audioWrapper__XjVIw",textareaContainer:"index-module_textareaContainer__d4FJD",textareaContent:"index-module_textareaContent__S-ZWp",toggleAudioOption:"index-module_toggleAudioOption__eEFXP",option:"index-module_option__f4zaZ"};export{e as default};
@@ -0,0 +1 @@
1
+ import l,{useState as h,useEffect as p}from"react";import r from"./index.module.scss.js";import{EventBus as i,TagUtils as y}from"@labelbee/lb-annotation";const v=u=>{const{result:a,labelInfoSet:n,isCheck:m,hasPromptLayer:c}=u,[b,g]=h(!0),o=c?40:0;if(p(()=>(i.on("toggleShowLabel",e=>{g(e)}),()=>{i.unbindAll("toggleShowLabel")}),[]),!a||!n||!b)return null;const t=y.getTagNameList(a,n);return(t==null?void 0:t.length)===0?null:l.createElement("div",{className:r.labelContainer,style:m?{height:245,top:o}:{bottom:108,top:o}},l.createElement("div",{id:"label",className:r.label,key:`tagSet_${0}`},t.map((e,f)=>{const s=e.value.filter(d=>d);return!(e==null?void 0:e.keyName)||s.length===0?null:l.createElement("div",{key:f},e.keyName,": ",s.join(" \u3001 "))})))};export{v as default};
@@ -0,0 +1 @@
1
+ var e={labelContainer:"index-module_labelContainer__HPFqD",label:"index-module_label__juM3z"};export{e as default};
@@ -0,0 +1 @@
1
+ import e,{useState as $,useRef as U,useEffect as j}from"react";import{Tooltip as X,Radio as R,Switch as re}from"antd";import{QuestionCircleOutlined as ue}from"@ant-design/icons";import{TextareaWithFooter as se}from"../../../views/MainView/sidebar/TextToolSidebar/index.js";import{timeFormat as J,getAttributeColor as ce,getAttributeFontColor as ie,updateColorOpacity as de,getAttributeShowText as me,DEFAULT_TEXT_CONFIG_ITEM as Ee}from"../../../utils/audio.js";import{cKeyCode as pe}from"@labelbee/lb-annotation";import W from"classnames";import Y,{useAudioClipStore as fe}from"../audioContext/index.js";import o from"./index.module.scss.js";var ve=Object.defineProperty,Fe=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,ee=(u,n,r)=>n in u?ve(u,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):u[n]=r,te=(u,n)=>{for(var r in n||(n={}))ge.call(n,r)&&ee(u,r,n[r]);if(Z)for(var r of Z(n))Ce.call(n,r)&&ee(u,r,n[r]);return u},be=(u,n)=>Fe(u,xe(n));const m=pe.default,ae=({onClick:u,title:n,disabled:r})=>e.createElement(X,{placement:"bottom",title:n},e.createElement("span",{className:W({[o.clearIcon]:!0,[o.disabled]:r}),onClick:u})),z=u=>{var n;const r=U(null),[h,F]=$(!1),[M,E]=$(!1),{disabled:c,config:s,result:y,updateText:A,index:x,switchToNextTextarea:g,hasMultiple:q,textID:D,addPlaceholder:i,onFocus:T,onBlur:w,onFocusStyle:B={},extra:P}=u,{maxLength:C}=s,N=y?y[s.key]:"",k=(n=N==null?void 0:N.length)!=null?n:0,I=a=>{A&&(A(a,s.key),s.required&&E(!a))},O=q&&g,p={id:`textInput-${x}`,ref:r,disabled:c,value:N,maxLength:C,autoSize:{minRows:2,maxRows:6},onChange:a=>{const d=a.target.value;I(d)},onFocus:a=>{F(!0),T==null||T(a),a.target.value&&E(!1)},onBlur:a=>{F(!1),w==null||w(a),s.required&&E(!a.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:a=>{const{keyCode:d}=a;if(a.ctrlKey){if(d===m.Enter&&a.preventDefault(),i&&[m.One,m.Two,m.Three].includes(d))switch(a.preventDefault(),d){case m.One:i("\u4986");break;case m.Two:i("\u652B");break;case m.Three:i("\u7383");break}}else d===m.Tab&&O?(a.preventDefault(),a.nativeEvent.stopImmediatePropagation(),g(x)):a.nativeEvent.stopPropagation()}},f=e.createElement("div",{className:o.textAreaFooter},e.createElement("div",{className:o.hotkeyTip},O&&e.createElement("span",null,"[\u5207\u6362]Tab"),e.createElement("span",null,"[\u7FFB\u9875]Ctrl+Enter")),e.createElement("div",{className:o.wordCount},e.createElement("span",{className:k>=C?o.warning:""},k),"/",e.createElement("span",null,C)));return j(()=>{c&&F(!1)},[c]),j(()=>{E(!1)},[D]),e.createElement("div",{className:o.textField},e.createElement("div",{className:o.label},e.createElement("span",{className:W({[o.required]:s.required})},s.label),e.createElement(ae,{onClick:()=>{c||I("")},title:"",disabled:c}),e.createElement("div",{className:o.extra},P)),e.createElement("div",{className:W({disabled:c,"textarea-outline":!0,"ant-input-focused":h,[o.textareaContainer]:!0,[o.focus]:h,[o.invalid]:M}),style:h?B:{}},e.createElement(se,{footer:f,textareaProps:p})))},he=u=>{const{configList:n,autofocus:r,textID:h,result:F,showText:M,updateText:E,toggleShowText:c,textInputDisabled:s,isCheck:y,isEdit:A,config:x,preContext:g,regions:q=[],textConfigurable:D=!0,clipTextConfigurable:i,clipAttributeConfigurable:T,updateRegion:w,clipAttributeList:B=[]}=u,[P,C]=$(0),[N,k]=$(""),I=U(null),{audioClipState:O}=fe(),p=n||[te({},Ee)];let f=q;if(i&&!y){const t=O.selectedRegion.id;f=f.filter(l=>l.id===t)}const a=t=>{setTimeout(()=>{const l=document.getElementById(`textInput-${t}`);l&&(C(t),l.focus(),l.select(),l.scrollIntoView({behavior:"smooth",block:"center"}))})},d=t=>{const l=D?p.length:0,v=i?f.length:0,b=l+v,S=(t+1)%b;a(S)},G=t=>{t.keyCode===m.Tab&&(t.preventDefault(),p.length>0&&a(0))},L=t=>{const l=document.getElementById(`textInput-${P}`);if(!(x==null?void 0:x.enablePlaceholderHotkey)||!l||!E)return;const{value:v,selectionStart:b,selectionEnd:S}=l,_=`${v.slice(0,b)}${t}${v.slice(S)}`;E(_,p[P].key),k(t),setTimeout(()=>{l.setSelectionRange(b+1,b+1),l.focus()},0),clearTimeout(I.current),I.current=setTimeout(()=>{k("")},400)};j(()=>(A||document.addEventListener("keydown",G),()=>{document.removeEventListener("keydown",G)}),[n]),j(()=>{r&&!s&&a(0)},[h]);let K=p;y&&(K=p.filter(t=>(F==null?void 0:F[t.key])!==void 0));let Q={};return i&&f&&f.forEach(t=>{const{id:l,text:v}=t;Q[l]=v}),e.createElement(e.Fragment,null,(x==null?void 0:x.enablePlaceholderHotkey)&&e.createElement("div",{className:o.placeholderHotkey},e.createElement("div",{className:o.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",e.createElement(X,{overlayStyle:{maxWidth:240},title:e.createElement("div",null,e.createElement("div",null,"\u4986\uFF08Ctrl+1\uFF09\uFF1A"),e.createElement("div",{style:{marginBottom:12}},"\u6587\u5B57\u5F02\u5E38\uFF0C\u4F46\u53EA\u6839\u636E\u8FD9\u4E2A\u5B57\u7684\u5F62\u72B6\u5C31\u53EF\u4EE5\u731C\u51FA\u662F\u4EC0\u4E48\u5B57"),e.createElement("div",null,"\u652B\uFF08Ctrl+2\uFF09\uFF1A"),e.createElement("div",{style:{marginBottom:12}},"\u6587\u5B57\u5F02\u5E38\uFF0C\u4E14\u65E0\u6CD5\u6839\u636E\u5F62\u72B6\u731C\u5B57\uFF0C\u4F46\u80FD\u7ED3\u5408\u4E0A\u4E0B\u6587\u8BED\u4E49\u5224\u65AD\u51FA\u662F\u4EC0\u4E48\u5B57"),e.createElement("div",null,"\u7383\uFF08Ctrl+3\uFF09\uFF1A"),e.createElement("div",null,"\u5B8C\u5168\u65E0\u6CD5\u5224\u65AD\u662F\u4EC0\u4E48\u5B57")),placement:"bottom"},e.createElement(ue,{className:o.questionIcon}))),e.createElement(R.Group,{value:N},e.createElement(R.Button,{value:"\u4986",onClick:t=>L(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u4986 (\u89C6\u89C9)"),e.createElement("div",{className:"hotkey"},"Ctrl+1"))),e.createElement(R.Button,{value:"\u652B",onClick:t=>L(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u652B (\u8BED\u4E49)"),e.createElement("div",{className:"hotkey"},"Ctrl+2"))),e.createElement(R.Button,{value:"\u7383",onClick:t=>L(t.target.value)},e.createElement("div",{className:"label"},e.createElement("div",{className:"text"},"\u7383 (\u65E0\u6548)"),e.createElement("div",{className:"hotkey"},"Ctrl+3"))))),e.createElement("div",{className:o.textInputContainer},e.createElement(Y,{audioContext:g==null?void 0:g.before}),D&&K.map((t,l)=>e.createElement(z,{config:t,key:l,index:l,result:F,updateText:E,switchToNextTextarea:d,hasMultiple:p.length>1,disabled:s,textID:h,addPlaceholder:L,onFocus:()=>C(l)})),i&&f.map((t,l)=>{const{id:v,start:b,end:S,attribute:_}=t,le={label:`\u6587\u672C\uFF08${J(b,"ss.SSS")} - ${J(S,"ss.SSS")}\uFF09`,key:v,maxLength:3e3},H=K.length+l,V=ce(_,B),ne={color:ie(_,B),backgroundColor:V};return e.createElement(z,{config:le,key:l,index:H,disabled:s,result:Q,updateText:oe=>{w==null||w(be(te({},t),{text:oe}))},switchToNextTextarea:()=>{d(H)},hasMultiple:!0,onFocus:()=>C(H),onFocusStyle:T?{borderColor:V,boxShadow:`0 0 0 2px ${de(V,.4)}`}:{},extra:T?e.createElement("div",{style:ne,className:o.attribute},me(_,[{value:"",key:"\u65E0\u5C5E\u6027"},...B])):null})}),e.createElement(Y,{audioContext:g==null?void 0:g.after}),c&&e.createElement("div",{className:o.switchItem},"\u6587\u672C\u5BF9\u7167\u663E\u793A",e.createElement(re,{style:{alignSelf:"center"},checked:M,onChange:t=>{c(t)}}))))};export{ae as ClearIcon,z as SingleTextInput,he as default};
@@ -0,0 +1 @@
1
+ var e={textInputContainer:"index-module_textInputContainer__ES6X3",textField:"index-module_textField__uRcb7",label:"index-module_label__xE6hM",required:"index-module_required__iElYl",extra:"index-module_extra__PW5Qk",textareaContainer:"index-module_textareaContainer__dTIv4",textAreaFooter:"index-module_textAreaFooter__h1Vv-",warning:"index-module_warning__NKpW6",hotkeyTip:"index-module_hotkeyTip__BSJ6A",wordCount:"index-module_wordCount__OD4eL",focus:"index-module_focus__H07-Y",invalid:"index-module_invalid__F9RC5",inputCount:"index-module_inputCount__--XiT",notify:"index-module_notify__rYuqq",switchItem:"index-module_switchItem__Q256x",placeholderHotkey:"index-module_placeholderHotkey__0SKPo",title:"index-module_title__YRpw9",questionIcon:"index-module_questionIcon__oK1HK",attribute:"index-module_attribute__g8Vbl",clearIcon:"index-module_clearIcon__ZBZqI",disabled:"index-module_disabled__zqh8C"};export{e as default};
@@ -0,0 +1 @@
1
+ var d=(n,i,e)=>new Promise((r,u)=>{var o=a=>{try{t(e.next(a))}catch(c){u(c)}},f=a=>{try{t(e.throw(a))}catch(c){u(c)}},t=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,f);t((e=e.apply(n,i)).next())});const s=n=>d(void 0,null,function*(){return yield fetch(n).then(i=>i.arrayBuffer())}),y=n=>d(void 0,null,function*(){const i=yield s(n);return A(i,16e3,16,1)}),l=(n,i,e)=>{for(let r=0;r<e.length;r++)n.setUint8(i+r,e.charCodeAt(r))},h=(n,i,e)=>{let r=new Int32Array(e),u=i;for(let o=0;o<r.length;o++,u+=4)n.setInt32(u,r[o],!0)},v=(n,i,e)=>{let r=new Int16Array(e),u=i;for(let o=0;o<r.length;o++,u+=2)n.setInt16(u,r[o],!0)},w=(n,i,e)=>{let r=new Int8Array(e),u=i;for(let o=0;o<r.length;o++,u++)n.setInt8(u,r[o])},A=(n,i,e,r)=>{let u=n.byteLength,o=new ArrayBuffer(44+u),f=new DataView(o),t=0;return l(f,t,"RIFF"),t+=4,f.setUint32(t,36+u,!0),t+=4,l(f,t,"WAVE"),t+=4,l(f,t,"fmt "),t+=4,f.setUint32(t,16,!0),t+=4,f.setUint16(t,1,!0),t+=2,f.setUint16(t,r,!0),t+=2,f.setUint32(t,i,!0),t+=4,f.setUint32(t,i*r*(e/8),!0),t+=4,f.setUint16(t,r*(e/8),!0),t+=2,f.setUint16(t,e,!0),t+=2,l(f,t,"data"),t+=4,f.setUint32(t,u,!0),t+=4,e===16?v(f,44,n):e===8?w(f,44,n):h(f,44,n),f.buffer},U=n=>d(void 0,null,function*(){let i=yield y(n);return`data:audio/wav;base64,${btoa(new Uint8Array(i).reduce((e,r)=>e+String.fromCharCode(r),""))}`});export{U as getWebPcm2WavBase64};
@@ -0,0 +1 @@
1
+ import t,{useRef as k}from"react";import S from"react-dom";import{useAudioClipStore as $}from"../../audioAnnotate/audioContext/index.js";import{getAttributeColor as w,getAttributeFontColor as N,updateColorOpacity as O,getAttributeShowText as T}from"../../../utils/audio.js";import F from"../../../assets/annotation/audio/loop.svg.js";import{Typography as P}from"antd";import{useClickAway as D}from"ahooks";import{classnames as I}from"../../../utils/index.js";import r from"./index.module.scss.js";const{Paragraph:M}=P,q=m=>{const{audioClipState:f,setAudioClipState:g}=$(),{clipAttributeList:i,clipAttributeConfigurable:b,clipTextConfigurable:x,selectedRegion:n}=f,c=k(null),{el:C,region:h,edgeAdsorption:y,clipping:A,instance:d}=m,{attribute:s="",text:v="",id:l,start:E,end:R}=h,{id:a}=n,o=w(s,i),u={color:N(s,i),backgroundColor:o},e={border:`2px solid ${o}`};if(l===a)e.backgroundColor=O(o,.6),e.borderLeft=`2px solid ${o}`,e.borderRight=`2px solid ${o}`;else if(d==null||d.setLoop(!1),e.borderLeft=`2px solid ${o}`,e.borderRight=`2px solid ${o}`,A){const p=Object.values(y);p.includes(E)&&(e.borderLeft="3px dashed #fff"),p.includes(R)&&(e.borderRight="3px dashed #fff")}D(()=>{l===a&&g({selectedRegion:{}})},c,["contextmenu"]);const j=l===a&&n.loop,L=t.createElement("div",{style:e,ref:c,className:I({[r.container]:!0})},j&&t.createElement("div",{className:r.loop},t.createElement("img",{src:F})),b&&t.createElement("div",null,t.createElement("div",{style:u,className:r.attribute},T(s,[{value:"",key:"\u65E0\u5C5E\u6027"},...i]))),x&&t.createElement(M,{ellipsis:{rows:2},className:r.text,style:u},"\u6587\u672C:",v));return t.createElement(t.Fragment,null,S.createPortal(L,C))};export{q as default};
@@ -0,0 +1 @@
1
+ var e={container:"index-module_container__gTeNm",loop:"index-module_loop__FHsHY",attribute:"index-module_attribute__SfHOe",text:"index-module_text__nwfmm"};export{e as default};
@@ -0,0 +1 @@
1
+ import g,{useRef as R,useEffect as v}from"react";import{useAudioClipStore as C}from"../../audioAnnotate/audioContext/index.js";import{timeFormat as d}from"../../../utils/audio.js";import x from"../index.module.scss.js";const y=a=>{var e,n,o,l;const s=R(null),{getRegionInstanceById:i,clipping:m}=a,{audioClipState:f}=C(),{selectedRegion:p}=f,{id:t}=p,{start:r,end:u}=(e=i==null?void 0:i(t!=null?t:""))!=null?e:{};if(v(()=>{s.current=document.querySelector(`[data-id=${t}]`)},[t]),[t,m,r,u].some(c=>!c&&c!==0))return null;const S=(l=(o=(n=s.current)==null?void 0:n.getBoundingClientRect())==null?void 0:o.left)!=null?l:0;return g.createElement("div",{className:x.tips,style:{left:S,top:75}},d(r,"ss.SSS")," - ",d(u,"ss.SSS"))};export{y as default};
@@ -0,0 +1 @@
1
+ import r from"react";import{useAudioClipStore as s}from"../../audioAnnotate/audioContext/index.js";import{useMouse as c,useHover as a}from"ahooks";const l=e=>{const{container:o}=e,{audioClipState:u}=s(),{combined:n}=u,t=c(o),i=a(o);return!o||!n||!i?null:r.createElement("div",{style:{left:t.clientX+20,top:t.clientY-20}},"\u8BF7\u70B9\u51FB\u5E0C\u671B\u5408\u5E76\u7684\u533A\u95F4")};export{l as default};
@@ -0,0 +1 @@
1
+ import i,{useState as b,useRef as z,useEffect as A}from"react";import{getWebPcm2WavBase64 as Kt}from"../audioAnnotate/utils/getWebPcm2Wac.js";import Vt,{debounce as Gt,sortBy as Yt}from"lodash";import{PauseOutlined as Jt,CaretRightOutlined as Qt}from"@ant-design/icons";import{cKeyCode as er,cTool as tr,EventBus as _}from"@labelbee/lb-annotation";import{Button as rr}from"antd";import or from"../invalidPage/index.js";import nr from"../imageError/index.js";import{classnames as $}from"../../utils/index.js";import ir,{EPlayerType as lr}from"../videoPlayer/components/SpeedController/index.js";import sr from"@labelbee/wavesurfer";import ar from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import cr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import ur,{audioZoomInfo as Xe}from"./zoomSlider/index.js";import dr from"./labelDisplayToggle/index.js";import mr from"./clipRegion/index.js";import{useAudioClipStore as pr}from"../audioAnnotate/audioContext/index.js";import{useLatest as H,useUpdate as fr,useDeepCompareEffect as Ze,useThrottleFn as vr}from"ahooks";import gr from"./useAudioScroll/index.js";import f from"./index.module.scss.js";import{getAttributeColor as br,formatTime as qe,timeFormat as Ke,dispatchResizeEvent as yr,precisionMinus as Ve,isDoubleClick as _r,getCanMoveRange as Er}from"../../utils/audio.js";import hr from"./progressDot/index.js";import Pr from"./clipTip/index.js";import Sr from"./useSwitchHotkey/index.js";import Cr from"./useAudioCombine/index.js";import Rr from"./useAudioSegment/index.js";import wr from"./combineTip/index.js";import Tr from"./segmentTip/index.js";import Ar from"../../views/MainView/toolFooter/index.js";import{decimalReserved as U}from"../videoPlayer/utils.js";var jr=Object.defineProperty,xr=Object.defineProperties,Dr=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Ye=(v,a,c)=>a in v?jr(v,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):v[a]=c,Je=(v,a)=>{for(var c in a||(a={}))Mr.call(a,c)&&Ye(v,c,a[c]);if(Ge)for(var c of Ge(a))kr.call(a,c)&&Ye(v,c,a[c]);return v},Qe=(v,a)=>xr(v,Dr(a));const{EToolName:et}=tr,X=er.default,tt=.1,rt=i.createContext({count:0,isEdit:!1,toolName:et.Empty,imgIndex:0}),Ir=({fileData:v={},onLoaded:a,context:c,invalid:ot,height:nt,hideError:it,onError:ue,updateRegion:j,removeRegion:L,regions:x=[],activeToolPanel:lt,clipConfigurable:st,clipTextConfigurable:at,clipAttributeList:ct,clipAttributeConfigurable:de,isCheck:S,hoverRegionId:Z,footer:ut,drawLayerSlot:me})=>{var pe,fe;const{url:O,path:ve}=v,[q,K]=b(!1),[ge,be]=b(!1),[C,dt]=b(0),[mt,ye]=b(!1),[N,_e]=b(0),n=z(null),R=z(null),Ee=z(C),V=e=>{Ee.current=e,dt(e)},[he,pt]=b(0),[F,ft]=b(1),G=z(null),[Pe,vt]=b({}),{audioClipState:Y,setAudioClipState:k}=pr(),[J,Q]=b(!1),u=H(Y),Se=H(Pe),gt=H(q),D=H(x),Ce=fr(),[Re,bt]=b([]),[we,yt]=b({}),_t=Gt(()=>{_.emit("audioZoom")},500),Te=e=>{e<Xe.min||e>Xe.max||(ft(e),yr(),_t())};gr({container:G.current,target:document.querySelector(`[data-id=${(fe=(pe=u.current)==null?void 0:pe.selectedRegion)==null?void 0:fe.id}]`),clipping:J,zoom:F,zoomHandler:Te});const W=()=>{let e=D.current;const{attributeLockList:r}=u.current;r.length&&(e=e.filter(t=>r.includes(t.attribute))),te(),e.forEach(t=>{var o;(o=n.current)==null||o.addRegion(Qe(Je({},t),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),Ce()},m=e=>{var r,t,o,l,s,p,E;const{id:d,loop:g=!0,playImmediately:P=!1}=e;if(d){const M=(o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{};Object.entries(M).forEach(([,y])=>{const{id:T}=y;d===T?y.select():y.cancelSelect()}),k({selectedRegion:{id:d,loop:g},selectedAttribute:(p=(s=(l=D.current)==null?void 0:l.find(y=>y.id===d))==null?void 0:s.attribute)!=null?p:""}),g&&P&&((E=I(d))==null||E.playLoop())}else k({selectedRegion:{}})},{combineInstance:Et}=Cr({waveRef:n,sortByStartRegions:Re,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),{segmentInstance:ht,onRegionMouseMove:Pt,segmentTimeTip:St}=Rr({waveRef:n,regionMap:we,updateRegion:j,removeRegion:L,generateRegions:W,setSelectedRegion:m}),Ae={clipTextConfigurable:at,clipAttributeList:ct,clipAttributeConfigurable:de,clipConfigurable:st};A(()=>{k({selectedAttribute:""})},[de]),A(()=>{ee()},[Y.selectedAttribute]),A(()=>{W()},[Y.attributeLockList]),Ze(()=>{k(Ae),setTimeout(()=>{je()})},[Ae]),Ze(()=>{bt(Yt(x,["start"])),yt(x.reduce((e,r)=>{const{id:t}=r;return Qe(Je({},e),{[t]:r})},{}))},[x]),A(()=>{if(Z){const e=gt.current;m({id:Z,loop:e,playImmediately:!0})}else m({})},[Z]);const je=()=>{var e,r;u.current.clipConfigurable?(!S&&n.current&&((e=n.current)==null||e.enableDragSelection({slop:5})),W()):((r=n.current)==null||r.disableDragSelection(),te()),ee()},ee=()=>{var e,r,t,o,l;let s="";u.current.clipConfigurable?s=br(u.current.selectedAttribute,(e=u.current.clipAttributeList)!=null?e:[]):s="transparent",((t=(r=n==null?void 0:n.current)==null?void 0:r.cursor)==null?void 0:t.cursor)&&((l=(o=n==null?void 0:n.current)==null?void 0:o.cursor)==null||l.setStyle({border:`2px dashed ${s}`}))},I=e=>{var r,t,o;return((o=(t=(r=n.current)==null?void 0:r.regions)==null?void 0:t.list)!=null?o:{})[e]},xe=()=>{var e,r;if(O){const t=((r=(e=ve==null?void 0:ve.split("."))==null?void 0:e.pop())==null?void 0:r.toLowerCase())==="pcm";ye(!1),t?Kt(O).then(o=>{De(o)}):De(O)}},De=e=>{var r;e&&(be(!0),V(0),_e(0),(r=n==null?void 0:n.current)==null||r.load(e))},te=()=>{var e;(e=n.current)==null||e.clearRegions()},re=e=>{const r=I(e);r&&(Q(!1),r==null||r.remove(),L==null||L(e),m({}))},{run:Me}=vr(m,{wait:500});Sr({sortByStartRegions:Re,setSelectedRegion:m});const Ct=e=>{const{start:r,end:t}=Se.current;return(r||t)&&e.update(Se.current),e},Rt=({action:e,id:r,eventDownTime:t})=>{var o,l;if(!u.current.clipConfigurable)return;r&&m({id:r});const s=I((r!=null?r:(o=u.current.selectedRegion)==null?void 0:o.id)||""),p=[];(e==="create"?D.current:(l=D.current)==null?void 0:l.filter(g=>g.id!==s.id)).forEach(g=>{const{start:P,end:M,attribute:y}=g;y===u.current.selectedAttribute&&[P,M].forEach(T=>{p.includes(T)||p.push(T)})});const d=Er(p.sort((g,P)=>g-P),t);n.current.range=d},wt=e=>{ee(),setTimeout(()=>{Q(!1)});const r=Ct(e),{id:t,start:o,end:l}=r;m({id:t,playImmediately:!0});const s={id:t,start:U(o,3),end:U(l,3),attribute:"",text:""};j==null||j(s),Ce()},Tt=()=>{const e=sr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:nt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[ar.create({regions:x,dragSelection:{slop:5},canMove:!1}),cr.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),r=()=>{var t;V(((t=n==null?void 0:n.current)==null?void 0:t.getCurrentTime())||0)};e.on("ready",()=>{var t;const o=((t=n==null?void 0:n.current)==null?void 0:t.getDuration())||0;_e(o),r(),a==null||a({duration:Math.round(o)}),be(!1),B(),_.on("setCurrentTimeByPosition",ne),_.on("clearRegions",te),_.on("removeRegionById",re),_.on("setSelectedRegion",Me),e.on("regions-eventDown",Rt),je()}),e.on("audioprocess",()=>{r()}),e.on("play",()=>{K(!0)}),e.on("pause",()=>{K(!1)}),e.on("finish",()=>{K(!1)}),e.on("seek",()=>{r()}),e.on("error",()=>{ye(!0),a==null||a({hasError:!0}),ue==null||ue()}),e.on("region-created",t=>{const{id:o,start:l,end:s}=t;if(D.current.find(E=>E.id===o))return;const p={id:o,start:U(l,3),end:U(s,3),attribute:u.current.selectedAttribute,text:""};j==null||j(p)}),e.on("region-updated",(t,o)=>{var l,s,p,E,d,g,P,M,y,T;const We=o==null?void 0:o.action;k({combined:!1,segment:!1}),We==="resize"&&((s=(l=n==null?void 0:n.current)==null?void 0:l.cursor)==null||s.setStyle({borderStyle:"solid"})),We==="drag"&&((E=(p=n==null?void 0:n.current)==null?void 0:p.cursor)==null||E.setStyle({borderColor:"transparent"}));const ie={},le=[],se={},Ft=(d=D.current)==null?void 0:d.filter(h=>h.id!==t.id),Wt=(M=(P=(g=n.current)==null?void 0:g.regions)==null?void 0:P.list)!=null?M:{};Ft.forEach(h=>{var $e,He;const{element:ae}=($e=Wt[h.id])!=null?$e:{},{start:Ht,end:Ut}=h;if(ae){const{x:Ue,width:Xt}=((He=ae.getBoundingClientRect)==null?void 0:He.call(ae))||{},Zt=Ue+Xt;[Ue,Zt].forEach((ce,qt)=>{le.includes(ce)||(le.push(ce),se[ce]=qt===0?Ht:Ut)})}});const{x:ze,width:zt}=((T=(y=t.element).getBoundingClientRect)==null?void 0:T.call(y))||{},$t=ze+zt;le.forEach(h=>{Math.abs(Ve(h,ze))<5&&(ie.start=se[h]),Math.abs(Ve(h,$t))<5&&(ie.end=se[h])}),vt(ie),Me({id:t.id}),Q(!0)}),e.on("region-update-end",t=>{wt(t)}),e.on("region-contextmenu",(t,o)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),_r(o)){re(t.id);return}m({id:t.id,playImmediately:!0})}}),e.on("region-click",(t,o,l)=>{if(!S){if(o.preventDefault(),o.stopPropagation(),u.current.combined){Et(t);return}if(u.current.segment){ht(t,l);return}m({id:t.id,playImmediately:!0})}}),e.on("region-mousemove",Pt),n.current=e},At=q?i.createElement(Jt,null):i.createElement(Qt,null),ke=e=>e?`${parseFloat((e/N*100).toFixed(4))}%`:"0%",Ie=ke(C),jt=ke(he),w=()=>{if(!ge)return n==null?void 0:n.current},xt=()=>{var e;(e=w())==null||e.skipForward(tt)},Dt=()=>{var e;(e=w())==null||e.skipBackward(tt)},B=()=>{var e;(e=w())==null||e.playPause(),m({})},Be=e=>{var r;switch(e.keyCode){case X.Right:xt();break;case X.Left:Dt();break;case X.Space:e.preventDefault(),B();break;case X.Delete:if(!S){const{id:t}=((r=u.current)==null?void 0:r.selectedRegion)||{};t&&re(t)}break}},Mt=e=>{ne(e)},Le=Vt.throttle(Mt,50);let oe=!1;const Oe=()=>{oe&&(B(),oe=!1),document.removeEventListener("mousemove",Le),document.removeEventListener("mouseup",Oe)},kt=e=>{ne(e),q&&(oe=!0,B()),document.addEventListener("mousemove",Le),document.addEventListener("mouseup",Oe)},It=()=>{xe()};A(()=>(Tt(),()=>{var e;(e=n==null?void 0:n.current)==null||e.destroy(),n.current=null,_.unbindAll("setCurrentTimeByPosition"),_.unbindAll("clearRegions"),_.unbindAll("removeRegionById"),_.unbindAll("setSelectedRegion")}),[]);const Bt=e=>{var r,t,o;(r=w())==null||r.playPause(),(t=w())==null||t.setPlaybackRate(e),(o=w())==null||o.playPause()};A(()=>(document.addEventListener("keydown",Be),()=>{document.removeEventListener("keydown",Be)})),A(()=>{m({}),xe()},[O]);const Ne=e=>{var r,t,o,l;if((n==null?void 0:n.current)&&(R==null?void 0:R.current)){const s=(t=(r=n==null?void 0:n.current)==null?void 0:r.getDuration())!=null?t:0,p=(o=R==null?void 0:R.current)==null?void 0:o.getBoundingClientRect();let d=(e.clientX-p.left)/(((l=R==null?void 0:R.current)==null?void 0:l.clientWidth)||0)*s;return d>s&&(d=s),d}return 0},ne=e=>{var r;const t=Ne(e);(r=n==null?void 0:n.current)==null||r.skip(t-Ee.current),V(t)},Lt=e=>{pt(Ne(e))},Ot=N?Math.max(N-C,0):0,Nt=(c==null?void 0:c.toolName)!==et.Empty&&(c==null?void 0:c.isEdit)!==!0&&(lt==="remark"||S),Fe=i.createElement("div",{className:f.audioPlayer},mt&&!it&&i.createElement(nr,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:It,backgroundColor:"#ffffffbb"}),i.createElement(Pr,{getRegionInstanceById:I,clipping:J}),i.createElement(wr,{container:G.current}),i.createElement(Tr,{segmentTimeTip:St}),i.createElement("div",{className:f.waveformContainer,ref:G},i.createElement("div",{id:"waveform",style:{width:`${F*100}%`},className:$({[f.waveform]:!0,[f.combined]:u.current.combined,[f.clip]:u.current.clipConfigurable})},ot&&i.createElement(or,{isAudio:!0}),i.createElement("div",{ref:R,className:f.progress,onMouseDown:kt,onMouseMove:Lt},i.createElement("div",{className:$({[f.radioTooltip]:!0}),style:{left:Ie}},qe(C)),i.createElement("div",{className:$({[f.radioTooltip]:!0,[f.mouseTooltip]:!0}),style:{left:jt}},qe(he)),i.createElement(hr,{playPercentage:Ie})),Nt&&(me==null?void 0:me({currentTime:C,remainingTime:Ot,audioPlayer:w()})))),i.createElement("div",{className:f.controlBar},i.createElement(rr,{type:"link",icon:At,onClick:()=>{B()},className:$({[f.playButton]:!0,[f.playButtonDisabled]:ge})}),i.createElement("span",{className:f.time},`${Ke(C,"ss.SSS")} / -${Ke(N-C,"ss.SSS")}`),i.createElement(ir,{playerType:lr.Audio,onChange:e=>{Bt(e)}}),i.createElement(ur,{onChange:e=>{Te(e)},zoom:F}),i.createElement(dr,{EventBus:_})));return c?i.createElement(rt.Provider,{value:c},Fe,x.map(e=>{const{id:r}=e,t=document.querySelector(`[data-id=${r}]`);return t?i.createElement(mr,{el:t,key:r,region:e,edgeAdsorption:Pe,clipping:J,zoom:F,instance:I(r)}):null}),i.createElement(Ar,{footer:ut})):Fe};export{Ir as AudioPlayer,rt as AudioPlayerContext};
@@ -0,0 +1 @@
1
+ var e={audioPlayer:"index-module_audioPlayer__OVF-0",wave:"index-module_wave__l4NcI",controlBar:"index-module_controlBar__akamG",playButton:"index-module_playButton__11yyR",playButtonDisabled:"index-module_playButtonDisabled__fX0pu",progress:"index-module_progress__s9y-A",radioTooltip:"index-module_radioTooltip__EiW7s",mouseTooltip:"index-module_mouseTooltip__kSGHB",time:"index-module_time__mrKjI",audioFooter:"index-module_audioFooter__MYrrN",waveformContainer:"index-module_waveformContainer__rVhq9",waveform:"index-module_waveform__e4P3w",tips:"index-module_tips__2gqDh"};export{e as default};
@@ -0,0 +1 @@
1
+ import{Switch as c}from"antd";import e,{useState as m}from"react";import a from"./index.module.scss.js";const i=l=>{const{EventBus:o}=l,[t,r]=m(!0),n=s=>{o.emit("toggleShowLabel",s),r(s)};return e.createElement("span",{className:a.remarkDisplayToggle},e.createElement("span",{className:a.text},"\u6807\u7B7E\u5BF9\u7167\u663E\u793A"),e.createElement(c,{checked:t,onChange:n,size:"small",style:{minWidth:32,backgroundColor:t?"#6371ff":"rgb(204, 204, 204)"}}))};export{i as default};
@@ -0,0 +1 @@
1
+ var e={text:"index-module_text__ID8ig"};export{e as default};
@@ -0,0 +1 @@
1
+ import e,{useRef as a}from"react";import m from"../../../assets/annotation/audio/progressDot.svg.js";import n from"../../../assets/annotation/audio/progressDotA.svg.js";import i from"./index.module.scss.js";import{useHover as g}from"ahooks";const l=o=>{const s=a(null),t=g(s),{playPercentage:r}=o;return e.createElement("div",{className:i.progressDot,style:{left:r},ref:s},e.createElement("img",{src:t?n:m,draggable:!1}))};export{l as default};
@@ -0,0 +1 @@
1
+ var e={progressDot:"index-module_progressDot__-oYYt"};export{e as default};
@@ -0,0 +1 @@
1
+ import r,{useRef as s}from"react";import{timeFormat as m}from"../../../utils/audio.js";import{useMouse as n}from"ahooks";const i=t=>{const u=s(null),{segmentTimeTip:e}=t,o=n(u.current);return e?r.createElement("div",{style:{left:o.clientX,top:75,marginLeft:-130}},"\u8BF7\u9009\u62E9\u5E0C\u671B\u622A\u53D6\u7684\u65F6\u95F4\u70B9\uFF08",m(e,"ss.SSS"),"\uFF09"):null};export{i as default};
@@ -0,0 +1,2 @@
1
+ import{message as a}from"antd";import{cKeyCode as k}from"@labelbee/lb-annotation";import{useAudioClipStore as w}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as b,useEventListener as $}from"ahooks";import{useEffect as K}from"react";const _=k.default,j=g=>{const{waveRef:p,sortByStartRegions:x,regionMap:d,updateRegion:c,removeRegion:u,generateRegions:C,setSelectedRegion:B}=g,{audioClipState:E,setAudioClipState:s}=w(),{selectedRegion:v,clipConfigurable:y,combined:R}=E,{id:n}=v,A=b(i=>{var l;if(!n)return;const e=d[n],o=d[i.id];if(e.attribute!==o.attribute){a.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const f=x.filter(t=>t.attribute===e.attribute),F=f.findIndex(t=>t.id===n),I=f.findIndex(t=>t.id===i.id);if(Math.abs(F-I)!==1){a.info("\u8BF7\u9009\u62E9\u76F8\u90BB\u540C\u5C5E\u6027\u7247\u6BB5");return}const r=[];["start","end"].forEach(t=>{r.push(e[t]),r.push(o[t])});const M=Math.min(...r),S=Math.max(...r),m={id:(l=p.current)==null?void 0:l.util.getId("combined_"),start:M,end:S,attribute:e.attribute,text:[e.text,o.text].includes("")?`${e.text}${o.text}`:`${e.text}
2
+ ${o.text}`};c==null||c(m),u==null||u(n),u==null||u(o.id),C(),s({combined:!1}),B({id:m.id,playImmediately:!0})}),h=b(i=>{if(!!y&&i.altKey&&i.keyCode===_.Z){if(!n){a.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5408\u5E76\u7684\u533A\u95F4");return}s({combined:!0,segment:!1})}});return K(()=>{R&&s({combined:!1})},[n]),$("keydown",h),{combineInstance:A}};export{j as default};
@@ -0,0 +1 @@
1
+ import{useEffect as w}from"react";import{precisionAdd as B,precisionMinus as C}from"../../../utils/audio.js";import{useLatest as d}from"ahooks";import{audioZoomInfo as s}from"../zoomSlider/index.js";const v=u=>{const{container:t,target:i,bufferWidth:o=10,clipping:f=!1,zoom:r=1,zoomHandler:c}=u,g=d(t),l=d(r),a=e=>{var n;e.ctrlKey&&((n=g.current)==null?void 0:n.contains(e.target))&&(e.deltaY>0?c(B(l.current,s.ratio)):c(C(l.current,s.ratio)))};if(w(()=>(document.addEventListener("wheel",a),()=>{document.removeEventListener("wheel",a)}),[]),t&&i&&f&&r>1){const{scrollLeft:e}=t,{right:n,left:m,width:h}=i.getBoundingClientRect(),{right:R,left:p,width:L}=t.getBoundingClientRect();if(h>L)return;p+o>m&&window.requestAnimationFrame(()=>{t.scrollLeft=e-20}),n+o>R&&window.requestAnimationFrame(()=>{t.scrollLeft=e+20})}};export{v as default};
@@ -0,0 +1 @@
1
+ import{useRef as _,useEffect as R}from"react";import{message as y}from"antd";import{cKeyCode as h}from"@labelbee/lb-annotation";import{useAudioClipStore as K}from"../../audioAnnotate/audioContext/index.js";import{useMemoizedFn as v,useEventListener as D}from"ahooks";const L=h.default,j=C=>{const{waveRef:o,regionMap:p,updateRegion:s,removeRegion:b,generateRegions:E,setSelectedRegion:x}=C,{audioClipState:A,setAudioClipState:c}=K(),{selectedRegion:F,clipConfigurable:S,segment:g}=A,{id:e}=F,m=_(null),a=_(null);R(()=>{var t,u,r,i,n,l,d;if(a.current&&o.current&&g&&e){const f=(l=(r=(u=(t=o.current)==null?void 0:t.regions)==null?void 0:u.util)==null?void 0:r.getRegionSnapToGridValue)==null?void 0:l.call(r,((i=o.current)==null?void 0:i.drawer.handleEvent(a.current))*((n=o.current)==null?void 0:n.getDuration())),B=(d=p[e])!=null?d:{},{start:I,end:M}=B;if(f>I&&f<M){m.current=f;return}}m.current=null},[a.current,g]);const T=v((t,u)=>{var r,i;if(!e||e!==t.id){y.info("\u8BF7\u70B9\u51FB\u6240\u9009\u533A\u95F4");return}const n=p[e],l={id:(r=o.current)==null?void 0:r.util.getId("segment_"),start:n.start,end:u,attribute:n.attribute,text:n.text},d={id:(i=o.current)==null?void 0:i.util.getId("segment_"),start:u,end:n.end,attribute:n.attribute,text:""};s==null||s(l),s==null||s(d),b==null||b(e),E(),c({segment:!1}),x({id:l.id,playImmediately:!0})}),k=v(t=>{if(!!S&&t.altKey&&t.keyCode===L.X){if(!e){y.info("\u8BF7\u5148\u9009\u62E9\u9700\u8981\u5206\u5272\u7684\u533A\u95F4");return}c({segment:!0,combined:!1})}}),w=v((t,u)=>{a.current=u});return D("keydown",k),R(()=>{g&&c({segment:!1})},[e]),{segmentInstance:T,onRegionMouseMove:w,segmentTimeTip:m.current}};export{j as default};
@@ -0,0 +1 @@
1
+ import{useMemoizedFn as m,useEventListener as x}from"ahooks";import{cKeyCode as k}from"@labelbee/lb-annotation";import{useAudioClipStore as v}from"../../audioAnnotate/audioContext/index.js";const a=k.default,C=c=>{const{sortByStartRegions:t=[],setSelectedRegion:i}=c,{audioClipState:u}=v(),{selectedRegion:f,clipConfigurable:p}=u,s=m(n=>{var d;const{id:l}=f;let e=0;const r=t.length;if(l){const o=t.findIndex(y=>y.id===l);n==="prev"&&(o===0?e=r-1:e=o-1),n==="next"&&(o===r-1?e=0:e=o+1)}i==null||i({id:(d=t[e])==null?void 0:d.id,playImmediately:!0})});x("keydown",n=>{if(!(!p||t.length===0))switch(n.keyCode){case a.W:s("prev");break;case a.S:s("next");break}})};export{C as default};
@@ -0,0 +1 @@
1
+ import o,{useEffect as f}from"react";import{ZoomOutOutlined as p,ZoomInOutlined as y}from"@ant-design/icons";import{Slider as E}from"antd";import{precisionAdd as k,precisionMinus as v}from"../../../utils/audio.js";import{cKeyCode as x}from"@labelbee/lb-annotation";import{useLatest as C}from"ahooks";import h from"./index.module.scss.js";const l=x.default,t={min:1,max:150,ratio:1},Z=d=>{const{onChange:u,zoom:r}=d,i=C(r),n=e=>{u(e)},s={fontSize:14,margin:"0 8px",cursor:"pointer"},a=()=>{const e=k(i.current,t.ratio);n(e)},m=()=>{const e=v(i.current,t.ratio);n(e)},c=e=>{switch(e.keyCode){case l.I:e.ctrlKey&&a();break;case l.O:e.ctrlKey&&(e.preventDefault(),m());break}};return f(()=>(document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c)}),[]),o.createElement("div",{className:h.sliderContainer},o.createElement("div",null,"\u7F29\u653E"),o.createElement(p,{style:s,onClick:m}),o.createElement("div",{style:{width:120}},o.createElement(E,{min:t.min,max:t.max,step:t.ratio,onChange:n,value:r})),o.createElement(y,{style:s,onClick:a}))};export{t as audioZoomInfo,Z as default};
@@ -0,0 +1 @@
1
+ var e={sliderContainer:"index-module_sliderContainer__zMe0K"};export{e as default};
@@ -0,0 +1 @@
1
+ import{ReloadOutlined as d}from"@ant-design/icons";import{Button as f}from"antd";import e from"react";const g=n=>{const{width:o,height:i,reloadImage:a,hideSetInvalidTips:u,ignoreOffsetY:s,backgroundColor:l,fileTypeName:r="\u56FE\u7247"}=n,c=s?0:40,t=n.layerStyle||{position:"absolute",left:0,top:c,cursor:"initial",zIndex:22,fontSize:12};o&&i?Object.assign(t,{width:o,height:i}):Object.assign(t,{bottom:0,right:0}),l&&Object.assign(t,{backgroundColor:l});const m={position:"absolute",top:"30%",left:"50%",transform:"translate(-50%, -50%)"};return e.createElement("div",{style:t},e.createElement("div",{style:m},e.createElement("div",{style:{textAlign:"center",marginBottom:10}},e.createElement(f,{type:"primary",shape:"circle",icon:e.createElement(d,null),onClick:a})),e.createElement("div",null,`${r}\u52A0\u8F7D\u5931\u8D25, \u8BF7\u91CD\u65B0\u52A0\u8F7D${u?"":` \u6216 \u5C06${r}\u6807\u4E3A\u65E0\u6548`}`)))};export{g as default};
@@ -0,0 +1 @@
1
+ import a from"react";const r=o=>{const{width:e,height:i,isVideo:n,isAudio:s}=o,u=n?"\u89C6\u9891":s?"\u97F3\u9891":"\u56FE\u7247",t={position:"absolute",left:0,top:0,background:"rgba(255, 87, 34, 1)",overflow:"hidden",color:"white",display:"flex",justifyContent:"center",alignItems:"center",fontSize:30,opacity:.7,zIndex:10,cursor:"initial"};return e&&i?Object.assign(t,{width:e,height:i}):Object.assign(t,{bottom:0,right:0}),a.createElement("div",{style:t},`\u65E0\u6548${u}\uFF0C\u8BF7\u8DF3\u8FC7`)};export{r as default};
@@ -1 +1 @@
1
- import{useLatest as z}from"ahooks";import{Spin as B}from"antd/es";import f,{useContext as M,useRef as N,useState as U,useEffect as u}from"react";import{connect as F}from"react-redux";import{usePointCloudViews as T}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as $}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as q}from"../../store/annotation/map.js";import{LabelBeeContext as A}from"../../store/ctx.js";import{PointCloud2DRectOperation as G,ImgUtils as H}from"@labelbee/lb-annotation";var J=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,O=(n,e,t)=>e in n?J(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,m=(n,e)=>{for(var t in e||(e={}))W.call(e,t)&&O(n,t,e[t]);if(D)for(var t of D(e))X.call(e,t)&&O(n,t,e[t]);return n},b=(n,e)=>K(n,Q(e));const Y=n=>{var e;const{mappingData:t,size:s,config:C,checkMode:R,afterImgOnLoad:I}=n,l=(e=t==null?void 0:t.url)!=null?e:"",{pointCloudBoxList:v,setPointCloudResult:h,selectedID:c}=M($),{update2DViewRect:x}=T(),d=f.useRef(null),a=N(null),_=z(x),[y,V]=U(!0),P=r=>{var o;const i=(o=_.current)==null?void 0:o.call(_,r);h(i)},j=()=>{var r;let o=[];v.forEach(i=>{const{rects:p=[],id:g,attribute:S,trackID:E}=i,w=p.find(k=>k.imageName===(t==null?void 0:t.path)),L=g+"_"+(t==null?void 0:t.path);w&&(o=[...o,b(m({},w),{boxID:g,id:L,attribute:S,order:E})])}),(r=a.current)==null||r.setResult(o)};return u(()=>{if(d.current){const r=new G({container:d.current,size:s,config:b(m({},C),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:R});return a.current=r,a.current.init(),a.current.on("updateDragResult",P),()=>{var o,i;(o=a.current)==null||o.unbind("updateDragResult",P),(i=a.current)==null||i.destroy()}}},[]),u(()=>{a.current&&l&&H.load(l).then(r=>{a.current.setImgNode(r),I(r),V(!1)})},[l]),u(()=>{var r;(r=a.current)==null||r.setSize(s)},[s]),u(()=>{var r,o;if(j(),c){const i=(r=a.current)==null?void 0:r.rectList.find(p=>p.boxID===c);i&&((o=a.current)==null||o.setSelectedID(i.id))}},[v,c,l]),f.createElement(B,{spinning:y},f.createElement("div",{ref:d,style:m({position:"relative"},s)}))};var Z=F(q,null,null,{context:A})(Y);export{Z as default};
1
+ import{useLatest as B}from"ahooks";import{Spin as M}from"antd/es";import d,{useContext as N,useRef as w,useState as U,useEffect as u}from"react";import{connect as F}from"react-redux";import{usePointCloudViews as T}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as $}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as q}from"../../store/annotation/map.js";import{LabelBeeContext as A}from"../../store/ctx.js";import{PointCloud2DRectOperation as G,ImgUtils as H}from"@labelbee/lb-annotation";var J=Object.defineProperty,K=Object.defineProperties,Q=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,O=(o,e,t)=>e in o?J(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,f=(o,e)=>{for(var t in e||(e={}))W.call(e,t)&&O(o,t,e[t]);if(C)for(var t of C(e))X.call(e,t)&&O(o,t,e[t]);return o},R=(o,e)=>K(o,Q(e));const Y=o=>{var e;const{mappingData:t,size:l,config:b,checkMode:D,afterImgOnLoad:h}=o,s=(e=t==null?void 0:t.url)!=null?e:"",{pointCloudBoxList:c,setPointCloudResult:x}=N($),{update2DViewRect:y}=T(),p=d.useRef(null),n=w(null),m=B(y),v=w(null),[I,V]=U(!0),_=r=>{var a;const i=(a=m.current)==null?void 0:a.call(m,r);v.current=i,x(i)},j=()=>{var r;let a=[];c.forEach(i=>{const{rects:S=[],id:P,attribute:E,trackID:L}=i,g=S.find(z=>z.imageName===(t==null?void 0:t.path)),k=P+"_"+(t==null?void 0:t.path);g&&(a=[...a,R(f({},g),{boxID:P,id:k,attribute:E,order:L})])}),(r=n.current)==null||r.setResult(a)};return u(()=>{if(p.current){const r=new G({container:p.current,size:l,config:R(f({},b),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:D});return n.current=r,n.current.init(),n.current.on("updateDragResult",_),()=>{var a,i;(a=n.current)==null||a.unbind("updateDragResult",_),(i=n.current)==null||i.destroy()}}},[]),u(()=>{n.current&&s&&H.load(s).then(r=>{n.current.setImgNode(r),h(r),V(!1)})},[s]),u(()=>{var r;(r=n.current)==null||r.setSize(l)},[l]),u(()=>{c!==v.current&&j()},[c,s]),d.createElement(M,{spinning:I},d.createElement("div",{ref:p,style:f({position:"relative"},l)}))};var Z=F(q,null,null,{context:A})(Y);export{Z as default};
@@ -1 +1 @@
1
- import{EPointCloudName as nt,MathUtils as B,getCuboidFromPointCloudBox as Qt}from"@labelbee/lb-annotation";import{EPerspectiveView as Q,PointCloudUtils as V,DEFAULT_SPHERE_PARAMS as Xt}from"@labelbee/lb-utils";import{useContext as Yt}from"react";import{PointCloudContext as qt}from"../PointCloudContext.js";import{useSingleBox as Jt}from"./useSingleBox.js";import{useSphere as Kt}from"./useSphere.js";import{useSelector as $t,useDispatch as to}from"../../../store/ctx.js";import oo from"../../../utils/StepUtils.js";import{jsonParser as Ct,getRectPointCloudBox as eo}from"../../../utils/index.js";import{PreDataProcess as it,SetPointCloudLoading as Pt,SetLoadPCDFileLoading as mt}from"../../../store/annotation/actionCreators.js";import{message as no}from"antd";import{useTranslation as io}from"react-i18next";import{useHistory as so}from"./useHistory.js";import{usePolygon as ro}from"./usePolygon.js";var lo=Object.defineProperty,ao=Object.defineProperties,co=Object.getOwnPropertyDescriptors,xt=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,ht=(e,t,i)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))uo.call(t,i)&&ht(e,i,t[i]);if(xt)for(var i of xt(t))po.call(t,i)&&ht(e,i,t[i]);return e},O=(e,t)=>ao(e,co(t)),st=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(P){o(P)}},g=u=>{try{c(i.throw(u))}catch(P){o(P)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const J=5,K=90,Lt=.01,v={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},rt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Xt,u={center:{x:a,y:g,z:c},id:e.id},P=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},lt=(e,t,i,d,o,a)=>{let g=e.pointList.map(w=>V.transferCanvas2World(w,t)),c=0,u=1,P={};if(i){const w=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&w.fittedCoordinates.length>0&&(g=w.fittedCoordinates),c=(w.maxZ+w.minZ)/2,u=w.maxZ-w.minZ,P={count:w.zCount}}const[h,D,F]=g,z=B.getLineCenterPoint([h,F]),R=B.getLineLength(h,D),k=B.getLineLength(D,F),N=B.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:z.x,y:z.y,z:c},width:a?k+Lt:k,height:a?R+Lt:R,depth:u,rotation:N,id:e.id},j=L(d?L(L({},d),T):O(L({},T),{attribute:"",valid:!0}),P);o&&Object.assign(j,o);const E=g.map(w=>V.transferWorld2Canvas(w,t));return{boxParams:j,newPointList:E}},yt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},vt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=B.getLineCenterPoint([o,g]),D=B.getLineCenterPoint([c,P]),z={x:{x:h.x-D.x,y:h.y-D.y}.x,y:0,z:h.y-D.y},R=B.getLineLength(o,a),k=B.getLineLength(c,u),N=R-k,T=B.getLineLength(a,g),j=B.getLineLength(u,P),E=T-j,{newBoxParams:w}=d.getNewBoxBySideUpdate(z,E,N,i);return w},go=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},fo=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=B.getLineCenterPoint([o,g]),D=B.getLineCenterPoint([c,P]),z={x:{x:h.x-D.x,y:h.y-D.y}.x,y:0,z:h.y-D.y},R=B.getLineLength(o,a),k=B.getLineLength(c,u),N=R-k,T=B.getLineLength(a,g),j=B.getLineLength(u,P),E=T-j;let{newBoxParams:w}=d.getNewBoxByBackUpdate(z,E,N,i);return w},Bt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Left);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},wt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},bt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Back);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},It=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},St=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,Q.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},dt=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),P=[...g.polygonList],h=P.find(D=>D.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):P.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(P,t.id)},Co=()=>{const e=Yt(qt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:D,setHighlight2DDataList:F,cuboidBoxIn2DView:z,imageSizes:R}=e,{addHistory:k,initHistory:N,pushHistoryUnderUpdatePolygon:T,pushHistoryUnderUpdateLine:j}=so(),{selectedPolygon:E}=ro(),{getPointCloudSphereByID:w,updatePointCloudSphere:at,selectedSphere:X}=Kt(),{currentData:W,config:b}=$t(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:Ct(oo.getCurrentStepInfo(p,s).config)}}),H=to(),$=n=>{if(!z){const{mappingImgList:s=[]}=W,p=s.map(r=>eo({pointCloudBox:n,mappingData:r,imageSizes:R}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:Dt,updateSelectedBoxes:tt,getPointCloudByID:_t}=Jt({generateRects:$}),{t:Vt}=io(),ct=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Ot=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},Ut=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},kt=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=rt(n,s,ot,void 0,f);c(n.id);const m=g(C);Y(v.Top,n,C,p,m,b),k({newSphereParams:C})},At=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var C,m;const x={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(x,{trackID:V.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const I=t==null?void 0:t.toolInstance,S=L({},n);let{boxParams:y,newPointList:A}=lt(S,s,ot,void 0,x,f);if(y=H(it({tool:nt.PointCloud,dataList:[y],stepConfig:b,action:"viewUpdateBox"}))[0],(b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<b.lowerLimitPointsNumInBox){no.info(Vt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),I.deletePolygon(y.id);return}f&&(A==null?void 0:A.length)&&(S.pointList=A);const U=D.includes(S.attribute);$(y);const G=a(y),et=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(G!=null?G:[],et),U?c([]):(c(y.id),I.selection.setSelectedIDs(S.id),M({omitView:v.Top,polygon:S,boxParams:y,zoom:l,newPointCloudBoxList:G}),f&&dt(y,S,t,o)),k({newBoxParams:y})},zt=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:C}=n,m=P.find(x=>x.id===s);if(m==null?void 0:m.rects){const{rects:x=[]}=m,I=x.find(S=>S.imageName===p);if(I){let S=x;const y=O(L({},I),{width:r,height:l,x:f,y:C});S=x.map(U=>U===I?y:U);const A=O(L({},m),{rects:S}),Z=P.map(U=>U===m?A:U);return t==null||t.updatePolygonList(Z!=null?Z:[]),Z}}},Rt=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const C=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const m=f.selectedPolygon;if(u.length===1&&C){M({omitView:v.Top,polygon:m,boxParams:C,newPointCloudBoxList:s});return}}if((p||X)&&u.length===1){const C=p!=null?p:X;f.setSelectedID(u[0]);const m=f.selectedPoint;C&&Y(v.Top,m,C,void 0,r,b)}}},ut=(n,s,p)=>{if(ct){let r,l;switch(p){case v.Back:r=fo;break;case v.Side:r=vt;break;default:r=vt;break}l=r(n,s,ct,i.pointCloudInstance);const C=H(it({tool:nt.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;if(l=C,o){const{count:I}=o.getSensesPointZAxisInPolygon(Qt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:I})}const x=Dt(l);return l=x.find(I=>I.id===l.id),M({omitView:m?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},pt=(n,s,p)=>{if(X){let r,l;switch(p){case v.Back:r=go;break;case v.Side:r=yt;break;default:r=yt;break}l=r(n,s,X);const f=at(l);return Y(p,n,l,void 0,f,b),f}},Tt=(n,s)=>{pt(n,s,v.Side)},jt=(n,s)=>{pt(n,s,v.Back)},Nt=(n,s)=>{ut(n,s,v.Side)},Et=(n,s)=>{ut(n,s,v.Back)},Ht=(n,s)=>{j(n)},Ft=(n,s)=>{const p=w(n.id),r=rt(n,s,ot,p),l=at(r);Y(v.Top,n,r,void 0,l,b)},Wt=(n,s)=>{if(E){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),T(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=_t(r.id),{boxParams:f}=lt(r,s,t.pointCloudInstance,l);return f});if(p=H(it({tool:nt.PointCloud,dataList:p,stepConfig:b,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=tt(p);M({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=tt(p);r&&e.syncAllViewPointCloudColor(r)}},Zt=n=>{var s,p,r,l,f;if(_){const C=Number(n.widthDefault),m=Number(n.depthDefault),x=Number(n.heightDefault),I=_==null?void 0:_.info.trackID,y=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(q=>(q==null?void 0:q.trackID)===I),A={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},Z=y.pointList.map(q=>V.transferCanvas2World(q,A)),U=B.getModifiedRectangleCoordinates(Z,x,C),G=U[0],et=U[2],gt=B.getLineCenterPoint([G,et]),Mt=_.info.center.z-_.info.depth/2,ft=O(L({},_.info),{center:{x:gt.x,y:gt.y,z:Mt+m/2},width:C,height:x,depth:m,valid:!0}),Gt=tt([ft]);M({omitView:v["3D"],polygon:y,boxParams:ft,newPointCloudBoxList:Gt})}},Y=(n,s,p,r,l,f)=>st(void 0,null,function*(){const C=W==null?void 0:W.url,m={[v.Side]:()=>{Bt(p,s,i,C,f)},[v.Back]:()=>{d&&bt(p,s,d,C,f)},[v.Top]:()=>{St(p,s,t,o)}};Object.keys(m).forEach(x=>{x!==n&&m[x]()}),r&&(o==null||o.updateCameraZoom(r)),Ut(p)}),M=n=>st(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,C=W==null?void 0:W.url;f&&(yield e.syncAllViewPointCloudColor(f));const m={[v.Side]:()=>{wt(r,p,i,C)},[v.Back]:()=>{d&&It(r,p,d,C)},[v.Top]:()=>{dt(r,p,t,o)}};Object.keys(m).forEach(x=>{x!==s&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Ot(r)});return{topViewAddSphere:kt,topViewAddBox:At,topViewSelectedChanged:Rt,topViewUpdatePoint:Ft,sideViewUpdatePoint:Tt,backViewUpdatePoint:jt,topViewUpdateBox:Wt,topViewUpdateLine:Ht,sideViewUpdateBox:Nt,backViewUpdateBox:Et,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>st(void 0,[...n],function*(s=W){var p,r,l,f,C,m;if(!(s==null?void 0:s.url)||!o)return;F([]),Pt(H,!0),mt(H,!0),yield o.loadPCDFile(s.url,(p=b==null?void 0:b.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],I=[],S=[],y=[];o.updateTopCamera();const A=(l=(r=Ct(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(A),(f=e.sideViewInstance)==null||f.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),t.updateData(s.url,s.result,{radius:(m=b==null?void 0:b.radius)!=null?m:K}),s.result&&(x=V.getBoxParamsFromResultList(s.result),S=V.getPolygonListFromResultList(s.result),I=V.getLineListFromResultList(s.result),y=V.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),N({pointCloudBoxList:x,polygonList:S,lineList:I,pointCloudSphereList:y}),Pt(H,!1),mt(H,!1)}),updateViewsByDefaultSize:Zt,generateRects:$,update2DViewRect:zt}};export{bt as syncBackViewByPoint,Bt as syncSideViewByPoint,St as syncTopViewByPoint,It as synchronizeBackView,wt as synchronizeSideView,dt as synchronizeTopView,rt as topViewPoint2PointCloud,lt as topViewPolygon2PointCloud,Co as usePointCloudViews};
1
+ import{EPointCloudName as nt,MathUtils as w,getCuboidFromPointCloudBox as Gt}from"@labelbee/lb-annotation";import{EPerspectiveView as Q,PointCloudUtils as V,DEFAULT_SPHERE_PARAMS as Qt}from"@labelbee/lb-utils";import{useContext as Xt}from"react";import{PointCloudContext as Yt}from"../PointCloudContext.js";import{useSingleBox as qt}from"./useSingleBox.js";import{useSphere as Jt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as ft,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as it,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{message as eo}from"antd";import{useTranslation as no}from"react-i18next";import{useHistory as io}from"./useHistory.js";import{usePolygon as so}from"./usePolygon.js";import{useLatest as ro}from"ahooks";var lo=Object.defineProperty,ao=Object.defineProperties,co=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))uo.call(t,i)&&xt(e,i,t[i]);if(mt)for(var i of mt(t))po.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ao(e,co(t)),st=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(P){o(P)}},g=u=>{try{c(i.throw(u))}catch(P){o(P)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const J=5,K=90,ht=.01,v={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},rt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Qt,u={center:{x:a,y:g,z:c},id:e.id},P=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},lt=(e,t,i,d,o,a)=>{let g=e.pointList.map(B=>V.transferCanvas2World(B,t)),c=0,u=1,P={};if(i){const B=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,u=B.maxZ-B.minZ,P={count:B.zCount}}const[h,S,F]=g,R=w.getLineCenterPoint([h,F]),z=w.getLineLength(h,S),A=w.getLineLength(S,F),N=w.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:R.x,y:R.y,z:c},width:a?A+ht:A,height:a?z+ht:z,depth:u,rotation:N,id:e.id},j=L(d?L(L({},d),T):O(L({},T),{attribute:"",valid:!0}),P);o&&Object.assign(j,o);const E=g.map(B=>V.transferWorld2Canvas(B,t));return{boxParams:j,newPointList:E}},Lt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},yt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j,{newBoxParams:B}=d.getNewBoxBySideUpdate(R,E,N,i);return B},go=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},fo=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j;let{newBoxParams:B}=d.getNewBoxByBackUpdate(R,E,N,i);return B},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Left);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},wt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Back);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,Q.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},dt=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),P=[...g.polygonList],h=P.find(S=>S.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):P.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(P,t.id)},Co=()=>{const e=Xt(Yt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:S,setHighlight2DDataList:F,cuboidBoxIn2DView:R,imageSizes:z}=e,{addHistory:A,initHistory:N,pushHistoryUnderUpdatePolygon:T}=io(),{selectedPolygon:j}=so(),{getPointCloudSphereByID:E,updatePointCloudSphere:B,selectedSphere:X}=Jt(),{currentData:W,config:b}=Kt(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:ft(to.getCurrentStepInfo(p,s).config)}}),H=$t(),Dt=ro(R),$=n=>{if(!Dt.current){const{mappingImgList:s=[]}=W,p=s.map(r=>oo({pointCloudBox:n,mappingData:r,imageSizes:z}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:St,updateSelectedBoxes:tt,getPointCloudByID:_t}=qt({generateRects:$}),{t:Vt}=no(),at=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Ot=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},kt=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},At=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=rt(n,s,ot,void 0,f);c(n.id);const m=g(C);Y(v.Top,n,C,p,m,b),A({newSphereParams:C})},Ut=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var C,m;const x={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(x,{trackID:V.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const I=t==null?void 0:t.toolInstance,D=L({},n);let{boxParams:y,newPointList:U}=lt(D,s,ot,void 0,x,f);if(y=H(it({tool:nt.PointCloud,dataList:[y],stepConfig:b,action:"viewUpdateBox"}))[0],(b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<b.lowerLimitPointsNumInBox){eo.info(Vt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),I.deletePolygon(y.id);return}f&&(U==null?void 0:U.length)&&(D.pointList=U);const k=S.includes(D.attribute);$(y);const G=a(y),et=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(y.id),I.selection.setSelectedIDs(D.id),M({omitView:v.Top,polygon:D,boxParams:y,zoom:l,newPointCloudBoxList:G}),f&&dt(y,D,t,o)),A({newBoxParams:y})},Rt=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:C}=n,m=P.find(x=>x.id===s);if(m==null?void 0:m.rects){const{rects:x=[]}=m,I=x.find(D=>D.imageName===p);if(I){let D=x;const y=O(L({},I),{width:r,height:l,x:f,y:C});D=x.map(k=>k===I?y:k);const U=O(L({},m),{rects:D}),Z=P.map(k=>k===m?U:k);return t==null||t.updatePolygonList(Z!=null?Z:[]),Z}}},zt=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const C=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const m=f.selectedPolygon;if(u.length===1&&C){M({omitView:v.Top,polygon:m,boxParams:C,newPointCloudBoxList:s});return}}if((p||X)&&u.length===1){const C=p!=null?p:X;f.setSelectedID(u[0]);const m=f.selectedPoint;C&&Y(v.Top,m,C,void 0,r,b)}}},ct=(n,s,p)=>{if(at){let r,l;switch(p){case v.Back:r=fo;break;case v.Side:r=yt;break;default:r=yt;break}l=r(n,s,at,i.pointCloudInstance);const C=H(it({tool:nt.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;if(l=C,o){const{count:I}=o.getSensesPointZAxisInPolygon(Gt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:I})}const x=St(l);return l=x.find(I=>I.id===l.id),M({omitView:m?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},ut=(n,s,p)=>{if(X){let r,l;switch(p){case v.Back:r=go;break;case v.Side:r=Lt;break;default:r=Lt;break}l=r(n,s,X);const f=B(l);return Y(p,n,l,void 0,f,b),f}},Tt=(n,s)=>{ut(n,s,v.Side)},jt=(n,s)=>{ut(n,s,v.Back)},Nt=(n,s)=>{ct(n,s,v.Side)},Et=(n,s)=>{ct(n,s,v.Back)},Ht=(n,s)=>{const p=E(n.id),r=rt(n,s,ot,p),l=B(r);Y(v.Top,n,r,void 0,l,b)},Ft=(n,s)=>{if(j){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),T(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=_t(r.id),{boxParams:f}=lt(r,s,t.pointCloudInstance,l);return f});if(p=H(it({tool:nt.PointCloud,dataList:p,stepConfig:b,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=tt(p);M({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=tt(p);r&&e.syncAllViewPointCloudColor(r)}},Wt=n=>{var s,p,r,l,f;if(_){const C=Number(n.widthDefault),m=Number(n.depthDefault),x=Number(n.heightDefault),I=_==null?void 0:_.info.trackID,y=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(q=>(q==null?void 0:q.trackID)===I),U={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},Z=y.pointList.map(q=>V.transferCanvas2World(q,U)),k=w.getModifiedRectangleCoordinates(Z,x,C),G=k[0],et=k[2],pt=w.getLineCenterPoint([G,et]),Zt=_.info.center.z-_.info.depth/2,gt=O(L({},_.info),{center:{x:pt.x,y:pt.y,z:Zt+m/2},width:C,height:x,depth:m,valid:!0}),Mt=tt([gt]);M({omitView:v["3D"],polygon:y,boxParams:gt,newPointCloudBoxList:Mt})}},Y=(n,s,p,r,l,f)=>st(void 0,null,function*(){const C=W==null?void 0:W.url,m={[v.Side]:()=>{vt(p,s,i,C,f)},[v.Back]:()=>{d&&wt(p,s,d,C,f)},[v.Top]:()=>{It(p,s,t,o)}};Object.keys(m).forEach(x=>{x!==n&&m[x]()}),r&&(o==null||o.updateCameraZoom(r)),kt(p)}),M=n=>st(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,C=W==null?void 0:W.url;f&&(yield e.syncAllViewPointCloudColor(f));const m={[v.Side]:()=>{Bt(r,p,i,C)},[v.Back]:()=>{d&&bt(r,p,d,C)},[v.Top]:()=>{dt(r,p,t,o)}};Object.keys(m).forEach(x=>{x!==s&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Ot(r)});return{topViewAddSphere:At,topViewAddBox:Ut,topViewSelectedChanged:zt,topViewUpdatePoint:Ht,sideViewUpdatePoint:Tt,backViewUpdatePoint:jt,topViewUpdateBox:Ft,sideViewUpdateBox:Nt,backViewUpdateBox:Et,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>st(void 0,[...n],function*(s=W){var p,r,l,f,C,m;if(!(s==null?void 0:s.url)||!o)return;F([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(s.url,(p=b==null?void 0:b.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],I=[],D=[],y=[];o.updateTopCamera();const U=(l=(r=ft(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(U),(f=e.sideViewInstance)==null||f.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),t.updateData(s.url,s.result,{radius:(m=b==null?void 0:b.radius)!=null?m:K}),s.result&&(x=V.getBoxParamsFromResultList(s.result),D=V.getPolygonListFromResultList(s.result),I=V.getLineListFromResultList(s.result),y=V.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),N({pointCloudBoxList:x,polygonList:D,lineList:I,pointCloudSphereList:y}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Wt,generateRects:$,update2DViewRect:Rt}};export{wt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,bt as synchronizeBackView,Bt as synchronizeSideView,dt as synchronizeTopView,rt as topViewPoint2PointCloud,lt as topViewPolygon2PointCloud,Co as usePointCloudViews};
@@ -0,0 +1 @@
1
+ import{CaretUpOutlined as w,CaretDownOutlined as k}from"@ant-design/icons";import t,{useState as I,useEffect as K}from"react";import d from"./index.module.scss.js";import{cKeyCode as L,CommonToolUtils as x}from"@labelbee/lb-annotation";const E=L.default,m=[.5,1,1.5,2,4,6,8,16],A=[.5,.75,1,1.25,1.5,1.75,2];var c;(function(e){e[e.Video=0]="Video",e[e.Audio=1]="Audio"})(c||(c={}));var u;(function(e){e[e.Increase=0]="Increase",e[e.Reduce=1]="Reduce"})(u||(u={}));const f={[0]:m,[1]:A},S=e=>{const{onChange:C,playerType:_}=e,o=f[_],P=o.slice(-1)[0],R=o[0],[s,p]=I(1),r=n=>{const a=n===0?1:-1;if(a===1&&s===P||a===-1&&s===R)return;const y=o.findIndex(D=>D===s)+a,l=o[y];p(l),C(l)},i=n=>{!x.hotkeyFilter(n)||(n.keyCode===E.Up&&r(0),n.keyCode===E.Down&&r(1))};return K(()=>(window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i))),t.createElement("div",{className:d.speedControllerWrap},t.createElement("span",{style:{display:"flex",alignItems:"center"}},t.createElement("span",{style:{fontSize:12}},"\u500D\u901F"),s,"x"),t.createElement("span",{className:d.speedController},t.createElement(w,{onClick:()=>r(0)}),t.createElement(k,{onClick:()=>r(1)})))};export{A as AUDIO_PLAYBACK_RATE_SPEED,c as EPlayerType,f as PLAYER_TYPE_RATE_SPEED,m as VIDEO_PLAYBACK_RATE_SPEED,S as default};
@@ -0,0 +1 @@
1
+ var e={speedControllerWrap:"index-module_speedControllerWrap__aFz7r",speedController:"index-module_speedController__zBRST"};export{e as default};
@@ -1 +1 @@
1
- import e from"react";import{getClassName as o}from"../../../../utils/dom.js";import{PauseOutlined as y,CaretRightOutlined as N,CaretUpOutlined as C,CaretDownOutlined as T}from"@ant-design/icons";import{VideoPlayerCtx as c}from"../../index.js";import{Pagination as x}from"../../../../views/MainView/toolFooter/Pagination.js";import P from"../../../../assets/annotation/video/icon_keyboard_h.svg.js";import h from"../../../../views/MainView/toolFooter/FooterTips/ToolHotKey/index.js";import{useTranslation as u}from"react-i18next";import{decimalReserved as d}from"../../utils.js";import{cTool as w}from"@labelbee/lb-annotation";const{EVideoToolName:V}=w,p=t=>{const n=Math.floor(t/60),r=~~(t%60).toFixed(),a=(t*10).toString().split("").pop(),l=s=>s<10?`0${s}`:s;return`${l(n)}:${l(r)}:${a}`},k=()=>{const{currentTime:t,duration:n,buffered:r,setCurrentTime:a}=e.useContext(c),l=e.useRef(null),s=`${d(r/n*100,1)}%`,m=`${d(t/n*100,1)}%`,v=i=>{if(l.current){const E=i.clientX,f=l.current.clientWidth,g=d(E/f*n,1);a(g)}};return e.createElement("div",{className:o("video-progress"),ref:l,onClick:i=>{i.stopPropagation(),i.nativeEvent.stopImmediatePropagation(),v(i)}},e.createElement("div",{className:o("video-slider")},e.createElement("div",{className:o("video-slider","played"),style:{width:m}}),e.createElement("div",{className:o("video-slider","loaded"),style:{width:s}}),e.createElement("div",{className:o("video-slider","played"),style:{width:m}})),e.createElement("div",{className:o("video-slider-bar"),style:{left:m}}))},b=()=>{const{updateNextPlaybackRate:t,playbackRate:n}=e.useContext(c),{t:r}=u();return e.createElement("span",{className:o("video-controller","speed")},e.createElement("span",null,r("Speed")),e.createElement("span",{className:o("video-controller","speedNum")},`${n}x`),e.createElement("span",{className:o("video-controller","speedButton")},e.createElement(C,{onClick:()=>{t()}}),e.createElement(T,{onClick:()=>{t(!1)}})))},$=()=>{const{t}=u();return e.createElement(h,{title:e.createElement("span",{className:o("video-controller","hotkey")},e.createElement("img",{src:P}),t("Hotkeys")),style:{},toolName:V.VideoTagTool})},R=()=>{const{imgIndex:t,imgList:n,pageBackward:r,pageJump:a,pageForward:l}=e.useContext(c);return e.createElement(x,{isVideo:!0,pageBackward:r,imgIndex:t,pageJump:a,totalPage:n.length,pageForward:l,footerCls:o("video-controller")})},j=()=>{const{currentTime:t,duration:n}=e.useContext(c),r=n*10-t*10,a=(r>0?r:0)/10;return e.createElement("div",{className:o("video-controller","time")},`${p(t)} / -${p(a)}`)},F=()=>{const{playPause:t,isPlay:n}=e.useContext(c);return e.createElement("div",{className:o("video-controller","wrapper")},e.createElement(k,null),e.createElement("div",{className:o("video-controller")},e.createElement("span",{onClick:()=>{t()},className:o("video-controller","playButton")},n?e.createElement(y,null):e.createElement(N,null)),e.createElement(j,null),e.createElement(b,null),e.createElement("div",{className:o("video-controller","holder")}),e.createElement(R,null),e.createElement($,null)))};export{F as default};
1
+ import e from"react";import{getClassName as o}from"../../../../utils/dom.js";import{PauseOutlined as C,CaretRightOutlined as y,CaretUpOutlined as x,CaretDownOutlined as T}from"@ant-design/icons";import{VideoPlayerCtx as c}from"../../index.js";import{Pagination as V}from"../../../../views/MainView/toolFooter/Pagination.js";import h from"../../../../assets/annotation/video/icon_keyboard_h.svg.js";import w from"../../../../views/MainView/toolFooter/FooterTips/ToolHotKey/index.js";import{useTranslation as v}from"react-i18next";import{decimalReserved as m}from"../../utils.js";import{cTool as P}from"@labelbee/lb-annotation";const{EVideoToolName:k}=P,u=t=>{const n=Math.floor(t/60),r=~~(t%60).toFixed(),a=(t*10).toString().split("").pop(),l=s=>s<10?`0${s}`:s;return`${l(n)}:${l(r)}:${a}`};var p;(function(t){t[t.Video=0]="Video",t[t.Audio=1]="Audio"})(p||(p={}));const b=()=>{const{currentTime:t,duration:n,buffered:r,setCurrentTime:a}=e.useContext(c),l=e.useRef(null),s=`${m(r/n*100,1)}%`,d=`${m(t/n*100,1)}%`,E=i=>{if(l.current){const f=i.clientX,g=l.current.clientWidth,N=m(f/g*n,1);a(N)}};return e.createElement("div",{className:o("video-progress"),ref:l,onClick:i=>{i.stopPropagation(),i.nativeEvent.stopImmediatePropagation(),E(i)}},e.createElement("div",{className:o("video-slider")},e.createElement("div",{className:o("video-slider","played"),style:{width:d}}),e.createElement("div",{className:o("video-slider","loaded"),style:{width:s}}),e.createElement("div",{className:o("video-slider","played"),style:{width:d}})),e.createElement("div",{className:o("video-slider-bar"),style:{left:d}}))},$=()=>{const{updateNextPlaybackRate:t,playbackRate:n}=e.useContext(c),{t:r}=v();return e.createElement("span",{className:o("video-controller","speed")},e.createElement("span",null,r("Speed")),e.createElement("span",{className:o("video-controller","speedNum")},`${n}x`),e.createElement("span",{className:o("video-controller","speedButton")},e.createElement(x,{onClick:()=>{t()}}),e.createElement(T,{onClick:()=>{t(!1)}})))},R=()=>{const{t}=v();return e.createElement(w,{title:e.createElement("span",{className:o("video-controller","hotkey")},e.createElement("img",{src:h}),t("Hotkeys")),style:{},toolName:k.VideoTagTool})},j=()=>{const{imgIndex:t,imgList:n,pageBackward:r,pageJump:a,pageForward:l}=e.useContext(c);return e.createElement(V,{isVideo:!0,pageBackward:r,imgIndex:t,pageJump:a,totalPage:n.length,pageForward:l,footerCls:o("video-controller")})},F=()=>{const{currentTime:t,duration:n}=e.useContext(c),r=n*10-t*10,a=(r>0?r:0)/10;return e.createElement("div",{className:o("video-controller","time")},`${u(t)} / -${u(a)}`)},B=()=>{const{playPause:t,isPlay:n}=e.useContext(c);return e.createElement("div",{className:o("video-controller","wrapper")},e.createElement(b,null),e.createElement("div",{className:o("video-controller")},e.createElement("span",{onClick:()=>{t()},className:o("video-controller","playButton")},n?e.createElement(C,null):e.createElement(y,null)),e.createElement(F,null),e.createElement($,null),e.createElement("div",{className:o("video-controller","holder")}),e.createElement(j,null),e.createElement(R,null)))};export{p as EPlayerType,B as default,u as videoTimeFormat};