@labelbee/lb-components 1.24.0-alpha.1 → 1.24.0-alpha.11

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 (54) hide show
  1. package/dist/_virtual/2DViewWorker.js +1 -1
  2. package/dist/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
  3. package/dist/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
  4. package/dist/components/LLMMultiWheelView/index.js +1 -1
  5. package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
  6. package/dist/components/attributeList/index.js +1 -1
  7. package/dist/components/audioAnnotate/index.js +1 -1
  8. package/dist/components/audioAnnotate/textInput/index.js +1 -1
  9. package/dist/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  10. package/dist/components/audioPlayer/index.js +1 -1
  11. package/dist/components/pointCloud2DRectOperationView/index.js +1 -1
  12. package/dist/components/pointCloudView/PointCloud3DView.js +1 -1
  13. package/dist/components/pointCloudView/PointCloudListener.js +1 -1
  14. package/dist/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
  15. package/dist/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
  16. package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  17. package/dist/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -1
  18. package/dist/components/pointCloudView/index.js +1 -1
  19. package/dist/index.css +18 -0
  20. package/dist/store/annotation/actionCreators.js +1 -1
  21. package/dist/store/annotation/reducer.js +1 -1
  22. package/dist/types/components/pointCloudView/hooks/usePointCloudAttribute.d.ts +3 -0
  23. package/dist/types/store/annotation/actionCreators.d.ts +1 -1
  24. package/dist/types/store/annotation/map.d.ts +1 -0
  25. package/dist/types/store/annotation/reducer.d.ts +4 -0
  26. package/dist/types/store/annotation/types.d.ts +3 -2
  27. package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -1
  28. package/dist/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  29. package/dist/views/MainView/sidebar/ToolIcons.js +1 -1
  30. package/es/_virtual/2DViewWorker.js +1 -1
  31. package/es/assets/annotation/rectTool/three_points_rect.svg.js +1 -0
  32. package/es/assets/annotation/rectTool/two_points_rect.svg.js +1 -0
  33. package/es/components/LLMMultiWheelView/index.js +1 -1
  34. package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
  35. package/es/components/attributeList/index.js +1 -1
  36. package/es/components/audioAnnotate/index.js +1 -1
  37. package/es/components/audioAnnotate/textInput/index.js +1 -1
  38. package/es/components/audioAnnotate/textInput/index.module.scss.js +1 -1
  39. package/es/components/audioPlayer/index.js +1 -1
  40. package/es/components/pointCloud2DRectOperationView/index.js +1 -1
  41. package/es/components/pointCloudView/PointCloud3DView.js +1 -1
  42. package/es/components/pointCloudView/PointCloudListener.js +1 -1
  43. package/es/components/pointCloudView/components/UnifyParamsModal/index.js +1 -1
  44. package/es/components/pointCloudView/hooks/usePointCloudAttribute.js +1 -0
  45. package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
  46. package/es/components/pointCloudView/hooks/useUpdatePointCloudColor.js +1 -1
  47. package/es/components/pointCloudView/index.js +1 -1
  48. package/es/index.css +18 -0
  49. package/es/store/annotation/actionCreators.js +1 -1
  50. package/es/store/annotation/reducer.js +1 -1
  51. package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -1
  52. package/es/views/MainView/sidebar/PointCloudToolSidebar/index.js +1 -1
  53. package/es/views/MainView/sidebar/ToolIcons.js +1 -1
  54. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ import*as t from"react";var l,o,v,c,m,z;function a(){return a=Object.assign?Object.assign.bind():function(h){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(h[n]=r[n])}return h},a.apply(null,arguments)}var i=function(e){return t.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=t.createElement("path",{fill:"currentColor",d:"M17 5h-1.571V3H17zm-3.143 0h-1.571V3h1.571zm-3.143 0H9.143V3h1.571zM7.571 5H6V3h1.571z"})),o||(o=t.createElement("path",{fill:"currentColor",d:"M17 17h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2zm0-4h-2V3h2z"})),v||(v=t.createElement("path",{fill:"currentColor",d:"M17 17h-1.571v-2H17zm-3.143 0h-1.571v-2h1.571zm-3.143 0H9.143v-2h1.571zm-3.143 0H6v-2h1.571zM6 2H2v4h4zM18 2h-4v4h4zM6 14H2v4h4z"})),c||(c=t.createElement("path",{fill:"currentColor",d:"M18 14h-4v4h4z"})),m||(m=t.createElement("path",{fill:"#fff",d:"M5 6H3v9h2z"})),z||(z=t.createElement("path",{fill:"currentColor",d:"M3 6h2v9H3zM15 3v2H5V3zM15 15v2H5v-2zM15 6h2v9h-2z"})))};export{i as ReactComponent};
@@ -0,0 +1 @@
1
+ import*as t from"react";var l,o,v,c;function a(){return a=Object.assign?Object.assign.bind():function(h){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(h[n]=r[n])}return h},a.apply(null,arguments)}var m=function(e){return t.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none"},e),l||(l=t.createElement("path",{fill:"currentColor",d:"M17 5h-1.571V3H17zm-3.143 0h-1.571V3h1.571zm-3.143 0H9.143V3h1.571zM7.571 5H6V3h1.571z"})),o||(o=t.createElement("path",{fill:"currentColor",d:"M17 17h-2v-2h2zm0-4h-2v-2h2zm0-4h-2V7h2zm0-4h-2V3h2z"})),v||(v=t.createElement("path",{fill:"currentColor",d:"M17 17h-1.571v-2H17zm-3.143 0h-1.571v-2h1.571zm-3.143 0H9.143v-2h1.571zm-3.143 0H6v-2h1.571z"})),c||(c=t.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 2H2v4h1v11h11v1h4v-4h-1V3H6zm9 3H6v1H5v9h9v-1h1z",clipRule:"evenodd"})))};export{m as ReactComponent};
@@ -1 +1 @@
1
- import i,{useEffect as M,useState as E}from"react";import{ELLMDataType as W}from"../../constant/index.js";import{getStepConfig as Y}from"../../store/annotation/reducer.js";import{LabelBeeContext as Z}from"../../store/ctx.js";import{jsonParser as ee}from"../../utils/index.js";import{connect as te}from"react-redux";import A from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as $}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as ne}from"../LLMToolView/questionView/components/header/index.js";import oe from"./dialogView/index.js";import re from"../messageMaskLayer/index.js";import ie from"../../views/MainView/annotationTips/index.js";import{I18nextProvider as ae,useTranslation as se}from"react-i18next";import{LLMViewCls as le}from"../LLMToolView/questionView/index.js";import{Layout as ue}from"antd";import{i18n as F}from"@labelbee/lb-utils";var ce=Object.defineProperty,de=Object.defineProperties,pe=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,k=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))me.call(e,n)&&k(t,n,e[n]);if(N)for(var n of N(e))Le.call(e,n)&&k(t,n,e[n]);return t},h=(t,e)=>de(t,pe(e));const R=t=>{const{questionIsImg:e,answerIsImg:n,LLMConfig:l,dialogList:p,lang:u="cn"}=t,{dataFormatType:c,setDataFormatType:a}=A();return M(()=>{var o;u&&((o=F)==null||o.changeLanguage(u))},[u]),i.createElement(ae,{i18n:F},i.createElement("div",{className:`${$}`},i.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},i.createElement(ne,{dataFormatType:c,setDataFormatType:a})),i.createElement("div",{className:`${$}-container`},p==null?void 0:p.map((o,d)=>i.createElement(oe,h(y({},o),{key:d,index:d,questionIsImg:e,answerIsImg:n,LLMConfig:l}))))))},U=({type:t,questionIndex:e,answerIndex:n,llmFile:l})=>{if(t==="question")return l==null?void 0:l.find((u,c)=>e===c);let p=null;return l==null||l.forEach((u,c)=>{var a;(a=u.answerList)==null||a.forEach((o,d)=>{c===e&&n===d&&(p=o)})}),p},fe=t=>{var e,n;const{annotation:l,tips:p,showTips:u,drawLayerSlot:c}=t,{imgIndex:a,imgList:o,stepList:d,step:x,toolInstance:v}=l,[w,B]=E(),{setSelectedID:Q,newAnswerListMap:I}=A(),[z,T]=E([]),j=((e=w==null?void 0:w.dataType)==null?void 0:e.prompt)===W.Picture,P=((n=w==null?void 0:w.dataType)==null?void 0:n.response)===W.Picture,{t:G}=se(),[,H]=E(0);return M(()=>{var r,m,L;if(!o[a])return;const g=(r=o[a])!=null?r:{},f=(L=(m=g==null?void 0:g.questionList)==null?void 0:m.textList)!=null?L:[];T(f),(f==null?void 0:f.length)&&Q(f[0].id)},[a]),M(()=>{var r,m;const L=(r=o[a])!=null?r:{},g=L==null?void 0:L.questionList,f=(m=L==null?void 0:L.llmFile)==null?void 0:m.textList,V=g==null?void 0:g.textList,J=V==null?void 0:V.map((s,b)=>{var D;return h(y({},s),{question:j&&U({type:"question",questionIndex:b,llmFile:f})||(s==null?void 0:s.question),answerList:(D=s==null?void 0:s.answerList)==null?void 0:D.map((_,O)=>{var S,q,C;const K=`${(S=s==null?void 0:s.id)!=null?S:""}-${(q=_==null?void 0:_.id)!=null?q:""}`,X=P?U({type:"answer",questionIndex:b,answerIndex:O,llmFile:f})||{}:{};return y(h(y({},_),{answer:_.answer,newAnswer:(C=I[K])!=null?C:_.answer,order:O+1}),X)})})});T(J)},[I,j,P]),M(()=>{var r;if(d&&x){const m=(r=Y(d,x))==null?void 0:r.config;B(ee(m))}},[d,x]),M(()=>{if(v)return v.on("validUpdated",()=>{H(r=>r+1)}),()=>{v.unbindAll("validUpdated")}},[v]),i.createElement(ue,{className:le},!(v==null?void 0:v.valid)&&i.createElement(re,{message:G("InvalidQuestionAndSkip")}),c==null?void 0:c({}),u===!0&&i.createElement(ie,{tips:p}),i.createElement(R,{questionIsImg:j,answerIsImg:P,LLMConfig:w,dialogList:z}))},ve=t=>({annotation:t.annotation});var we=te(ve,null,null,{context:Z})(fe);export{R as LLMMultiWheelSourceView,we as default};
1
+ import i,{useEffect as M,useState as E}from"react";import{ELLMDataType as W}from"../../constant/index.js";import{getStepConfig as Y}from"../../store/annotation/reducer.js";import{LabelBeeContext as Z}from"../../store/ctx.js";import{jsonParser as ee}from"../../utils/index.js";import{connect as te}from"react-redux";import A from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as $}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as ne}from"../LLMToolView/questionView/components/header/index.js";import oe from"./dialogView/index.js";import re from"../messageMaskLayer/index.js";import ie from"../../views/MainView/annotationTips/index.js";import{I18nextProvider as ae,useTranslation as se}from"react-i18next";import{LLMViewCls as le}from"../LLMToolView/questionView/index.js";import{Layout as ue}from"antd";import{i18n as F}from"@labelbee/lb-utils";var ce=Object.defineProperty,de=Object.defineProperties,pe=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,k=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))me.call(e,n)&&k(t,n,e[n]);if(N)for(var n of N(e))Le.call(e,n)&&k(t,n,e[n]);return t},h=(t,e)=>de(t,pe(e));const R=t=>{const{questionIsImg:e,answerIsImg:n,LLMConfig:l,dialogList:p,lang:u="cn"}=t,{dataFormatType:c,setDataFormatType:a}=A();return M(()=>{var o;u&&((o=F)==null||o.changeLanguage(u))},[u]),i.createElement(ae,{i18n:F},i.createElement("div",{className:`${$}`},i.createElement("div",{style:{display:"flex",justifyContent:"flex-end",margin:"10px"}},i.createElement(ne,{dataFormatType:c,setDataFormatType:a})),i.createElement("div",{className:`${$}-container`},p==null?void 0:p.map((o,d)=>i.createElement(oe,h(y({},o),{key:d,index:d,questionIsImg:e,answerIsImg:n,LLMConfig:l}))))))},U=({type:t,questionIndex:e,answerIndex:n,llmFile:l})=>{if(t==="question")return l==null?void 0:l.find((u,c)=>e===c);let p=null;return l==null||l.forEach((u,c)=>{var a;(a=u.answerList)==null||a.forEach((o,d)=>{c===e&&n===d&&(p=o)})}),p},fe=t=>{var e,n;const{annotation:l,tips:p,showTips:u,drawLayerSlot:c}=t,{imgIndex:a,imgList:o,stepList:d,step:x,toolInstance:v}=l,[g,B]=E(),{setSelectedID:Q,newAnswerListMap:I}=A(),[z,T]=E([]),j=((e=g==null?void 0:g.dataType)==null?void 0:e.prompt)===W.Picture,P=((n=g==null?void 0:g.dataType)==null?void 0:n.response)===W.Picture,{t:G}=se(),[,H]=E(0);return M(()=>{var r,m,L;if(!o[a])return;const w=(r=o[a])!=null?r:{},f=(L=(m=w==null?void 0:w.questionList)==null?void 0:m.textList)!=null?L:[];T(f),(f==null?void 0:f.length)&&Q(f[0].id)},[a]),M(()=>{var r,m;const L=(r=o[a])!=null?r:{},w=L==null?void 0:L.questionList,f=(m=L==null?void 0:L.llmFile)==null?void 0:m.textList,V=w==null?void 0:w.textList,J=V==null?void 0:V.map((s,b)=>{var D;return h(y({},s),{question:j&&U({type:"question",questionIndex:b,llmFile:f})||(s==null?void 0:s.question),answerList:(D=s==null?void 0:s.answerList)==null?void 0:D.map((_,O)=>{var S,q,C;const K=`${(S=s==null?void 0:s.id)!=null?S:""}-${(q=_==null?void 0:_.id)!=null?q:""}`,X=P?U({type:"answer",questionIndex:b,answerIndex:O,llmFile:f})||{}:{};return y(h(y({},_),{answer:_.answer,newAnswer:(C=I[K])!=null?C:_.answer,order:O+1}),X)})})});T(J)},[I,j,P]),M(()=>{var r;if(d&&x){const m=(r=Y(d,x))==null?void 0:r.config;B(ee(m))}},[d,x]),M(()=>{if(v)return v.on("validUpdated",()=>{H(r=>r+1)}),()=>{v.unbindAll("validUpdated")}},[v]),i.createElement(ue,{className:le},!(v==null?void 0:v.valid)&&i.createElement(re,{message:G("InvalidQuestionAndSkip")}),c==null?void 0:c({}),u===!0&&i.createElement(ie,{tips:p}),i.createElement(R,{questionIsImg:j,answerIsImg:P,LLMConfig:g,dialogList:z}))},ve=t=>({annotation:t.annotation});var ge=te(ve,null,null,{context:Z})(fe);export{R as LLMMultiWheelSourceView,ge as default};
@@ -1 +1 @@
1
- import r,{useState as T,useRef as It,useMemo as N,useEffect as $}from"react";import{LabelBeeContext as Vt}from"../../../store/ctx.js";import{connect as Nt}from"react-redux";import{prefix as $t}from"../../../constant/index.js";import{getStepConfig as Bt}from"../../../store/annotation/reducer.js";import{jsonParser as dt}from"../../../utils/index.js";import Wt,{getSorts as ct}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as Ft}from"react-i18next";import{useCustomToolInstance as kt}from"../../../hooks/annotation.js";import{isBoolean as qt,isString as Gt,isNumber as Kt,isObject as zt,isArray as Ut}from"lodash";import{PageForward as B}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Qt,EToolName as Jt}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Ht,EmptyConfig as Xt}from"../../LLMToolView/sidebar/index.js";import Yt from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as pt}from"antd";import Zt from"../../LLMToolView/sidebar/components/answerList/index.js";import te from"../../../store/LLMMultiWheel/index.js";import ee from"../../../utils/StepUtils.js";import{getRenderDataByResult as ne,getTagResult as oe,getCurrentResultFromResultList as re}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as z}from"ahooks";import le from"../../LLMToolView/sidebar/components/answerSort/index.js";import ie from"../../tagList/components/overall/index.js";var se=Object.defineProperty,ae=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,ft=(p,d,m)=>d in p?se(p,d,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[d]=m,l=(p,d)=>{for(var m in d||(d={}))de.call(d,m)&&ft(p,m,d[m]);if(mt)for(var m of mt(d))ce.call(d,m)&&ft(p,m,d[m]);return p},u=(p,d)=>ae(p,ue(d));const pe=Qt.default,vt=`${$t}-sidebar`,me={sort:[],answerSort:{},textAttribute:[],tagList:{}},fe=p=>{var d,m,U,Q,J,H;const{annotation:Lt,dispatch:R,checkMode:gt}=p,{imgIndex:M,imgList:W,stepList:A,step:h,skipBeforePageTurning:D}=Lt,[c,xt]=T(),{t:S}=Ft(),o=(d=W[M])!=null?d:{},X=dt(o==null?void 0:o.result),{toolInstanceRef:L}=kt({basicInfo:X}),[F,wt]=T(!0),[O,Y]=T({}),[g,Z]=T(me),k=It(),[_,q]=T({}),{selectedID:P,setNewAnswerListMap:tt,newAnswerListMap:et}=te(),b=N(()=>O[P],[P,O]),y=!L.current.valid||gt;$(()=>{var t;if(A&&h){const e=(t=Bt(A,h))==null?void 0:t.config;xt(dt(e))}},[h,JSON.stringify(A)]),$(()=>{!o||M===-1||(L.current.setValid=nt,L.current.clearResult=St,nt(),ot())},[M,c,o==null?void 0:o.id]);const St=()=>{var t,e,n,i;ot((t=o==null?void 0:o.questionList)==null?void 0:t.textList),((e=k.current)==null?void 0:e.clearValue)&&((n=k.current)==null||n.clearValue());const{waitSorts:f}=ct({selectedSort:(i=x==null?void 0:x.sort)!=null?i:[],initSelected:[],modelList:j?V!=null?V:[]:[]});q(u(l({},_),{waitSorts:f,newSort:[]}))},nt=t=>{var e;const n=t!=null?t:X.valid;qt(n)&&(wt(n),L.current.valid=n,(e=L.current)==null||e.emit("validUpdated"))},_t=()=>{const t=ee.getCurrentStepInfo(h,A);return re(o==null?void 0:o.result,t.step)},x=N(()=>_t(),[h,A,o]),ot=z(t=>{var e,n,i,f,s,w,C;const a=x;let E=(e=o==null?void 0:o.questionList)==null?void 0:e.textList;((n=a==null?void 0:a.modelData)==null?void 0:n.length)&&L.current.valid&&(E=a==null?void 0:a.modelData),t&&(E=t,a.sort=[],a.textAttribute=[],a.answerSort=[]);let at={};E==null||E.forEach((v,Dt)=>{var ut;const Ot=ne(c,u(l({},v),{answerList:(ut=v==null?void 0:v.answerList)==null?void 0:ut.map((K,Pt)=>(tt(u(l({},et),{[`${v.id}-${K.id}`]:K.answer})),u(l({},K),{order:Pt+1})))}));at[v.id]=u(l({},Ot),{order:Dt+1,id:v.id})});const{waitSorts:jt,newSort:Ct}=ct({selectedSort:(i=x==null?void 0:x.sort)!=null?i:[],modelList:j?V!=null?V:[]:[]});q({waitSorts:jt,newSort:Ct});const Tt=((f=c==null?void 0:c.inputList)==null?void 0:f.filter(v=>v==null?void 0:v.isOverall))||[],Rt=oe(Tt,a==null?void 0:a.tagList);Z({sort:(s=a==null?void 0:a.sort)!=null?s:[],textAttribute:(w=a==null?void 0:a.textAttribute)!=null?w:[],answerSort:(C=a==null?void 0:a.answerSort)!=null?C:{},tagList:Rt}),Y(at)});$(()=>{bt()},[O,F,g]),$(()=>(window.addEventListener("keydown",rt),()=>{window.removeEventListener("keydown",rt)}),[]);const bt=z(()=>{var t,e;const n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map(f=>{var s;const w=(s=O[f.id])!=null?s:{};return{id:f.id,answerList:w.answerList}}),i=u(l({},g),{modelData:n});L.current.exportData=()=>[[i],{valid:F}],L.current.currentPageResult=u(l({},i),{toolName:Jt.LLMMultiWheel,valid:F})}),rt=t=>{if(t.ctrlKey&&t.keyCode===pe.Enter){if(D){D(()=>R(B()));return}R(B())}},yt=z(({order:t,value:e,key:n})=>{const{answerList:i}=b,f=i==null?void 0:i.map(s=>{var w,C;if((s==null?void 0:s.order)===t){if(n==="textEdit"&&Gt(e))return tt(u(l({},et),{[`${P}-${(w=s==null?void 0:s.id)!=null?w:""}`]:e})),u(l({},s),{newAnswer:e});if(Kt(e))return u(l({},s),{score:e});if(zt(e)&&n){const a={[e==null?void 0:e.key]:e.value},E=(C=s[n])!=null?C:{};return u(l({},s),{[n]:l(l({},E),a)})}}return s});Y(s=>u(l({},s),{[P]:u(l({},b),{answerList:f})}))}),I=(t,e)=>{Z(n=>u(l({},n),{[t]:e}))},{indicatorScore:lt=[],indicatorDetermine:it=[],isTextEdit:Et,dialogSort:j=!1,inputList:G=[],tagInputListConfigurable:st,enableSort:Mt=!1}=c||{},V=N(()=>{var t,e,n;return j?(n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map((i,f)=>u(l({},i),{title:f+1})))!=null?n:[]:[]},[o,j]);if(N(()=>Ht(c),[c]))return r.createElement(Xt,null);const At=st&&((m=G.filter(t=>!t.isOverall))==null?void 0:m.length)>0,ht=(it==null?void 0:it.length)>0||(lt==null?void 0:lt.length)>0||Et||At;return r.createElement("div",{className:`${vt}`},r.createElement("div",{className:`${vt}__content`},r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},S("GlobalAnnotation")),j&&r.createElement(le,{waitSortList:(_==null?void 0:_.waitSorts)||[],sortList:(_==null?void 0:_.newSort)||[],setSortList:t=>{const e=t.map(n=>n.map(i=>i.id));I("sort",e),q(u(l({},_),{newSort:t}))},disabeledAll:y,title:S("SortConversationQuality"),prefixId:"model"}),(c==null?void 0:c.text)&&r.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},r.createElement(Yt,{textAttribute:(U=g==null?void 0:g.textAttribute)!=null?U:[],textConfig:(c==null?void 0:c.text)&&Ut(c.text)?c==null?void 0:c.text:[],setText:t=>I("textAttribute",t),disabeledAll:y})),Mt&&r.createElement(Wt,{modelData:(J=(Q=o==null?void 0:o.questionList)==null?void 0:Q.textList)!=null?J:[],selectedAnswerSort:t=>I("answerSort",t),selectedSort:(H=x==null?void 0:x.answerSort)!=null?H:[],ref:k,disabeledAll:y,imgIndex:M}),st&&G.length&&r.createElement(ie,{inputList:G,selectedTags:(g==null?void 0:g.tagList)||{},updateValue:t=>{const{key:e,value:n}=t,i=(g==null?void 0:g.tagList)||{};I("tagList",u(l({},i),{[e]:n}))},disabeledAll:y}),b&&r.createElement(r.Fragment,null,r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},S("QualifiedAnnotation")),r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},r.createElement(pt,{type:"primary",danger:!0},S("Annotating")),r.createElement("div",{style:{padding:16}},S("Group"),"\uFF1A",b.order)),r.createElement("div",null,ht&&r.createElement(Zt,{list:(b==null?void 0:b.answerList)||[],LLMConfig:c,updateValue:yt,disabeledAll:y})))),r.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(W==null?void 0:W.length)-1!==M&&r.createElement(pt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(D){D(()=>R(B()));return}R(B())},disabled:y},S("Save"))))},ve=p=>({annotation:p.annotation});var Le=Nt(ve,null,null,{context:Vt})(fe);export{Le as default};
1
+ import r,{useState as C,useRef as It,useMemo as N,useEffect as $}from"react";import{LabelBeeContext as Vt}from"../../../store/ctx.js";import{connect as Nt}from"react-redux";import{prefix as $t}from"../../../constant/index.js";import{getStepConfig as Bt}from"../../../store/annotation/reducer.js";import{jsonParser as ct}from"../../../utils/index.js";import Wt,{getSorts as pt}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as Ft}from"react-i18next";import{useCustomToolInstance as kt}from"../../../hooks/annotation.js";import{isBoolean as qt,isString as Gt,isNumber as Kt,isObject as zt,isArray as Ut}from"lodash";import{PageForward as B}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Qt,EToolName as Jt}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Ht,EmptyConfig as Xt}from"../../LLMToolView/sidebar/index.js";import Yt from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as mt}from"antd";import Zt from"../../LLMToolView/sidebar/components/answerList/index.js";import te from"../../../store/LLMMultiWheel/index.js";import ee from"../../../utils/StepUtils.js";import{getRenderDataByResult as ne,getTagResult as oe,getCurrentResultFromResultList as re}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as z}from"ahooks";import le from"../../LLMToolView/sidebar/components/answerSort/index.js";import ie from"../../tagList/components/overall/index.js";var se=Object.defineProperty,ae=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,vt=(p,c,m)=>c in p?se(p,c,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[c]=m,l=(p,c)=>{for(var m in c||(c={}))de.call(c,m)&&vt(p,m,c[m]);if(ft)for(var m of ft(c))ce.call(c,m)&&vt(p,m,c[m]);return p},d=(p,c)=>ae(p,ue(c));const pe=Qt.default,Lt=`${$t}-sidebar`,me={sort:[],answerSort:{},textAttribute:[],tagList:{}},fe=p=>{var c,m,U,Q,J,H;const{annotation:gt,dispatch:R,checkMode:xt}=p,{imgIndex:M,imgList:W,stepList:A,step:T,skipBeforePageTurning:D}=gt,[i,wt]=C(),{t:S}=Ft(),o=(c=W[M])!=null?c:{},X=ct(o==null?void 0:o.result),{toolInstanceRef:L}=kt({basicInfo:X}),[F,St]=C(!0),[O,Y]=C({}),[g,Z]=C(me),k=It(),[_,q]=C({}),{selectedID:P,setNewAnswerListMap:tt,newAnswerListMap:et}=te(),b=N(()=>O[P],[P,O]),y=!L.current.valid||xt;$(()=>{var t;if(A&&T){const e=(t=Bt(A,T))==null?void 0:t.config;wt(ct(e))}},[T,JSON.stringify(A)]),$(()=>{!o||M===-1||(L.current.setValid=nt,L.current.clearResult=_t,nt(),ot())},[M,i,o==null?void 0:o.id]);const _t=()=>{var t,e,n,s;ot((t=o==null?void 0:o.questionList)==null?void 0:t.textList),((e=k.current)==null?void 0:e.clearValue)&&((n=k.current)==null||n.clearValue());const{waitSorts:f}=pt({selectedSort:(s=x==null?void 0:x.sort)!=null?s:[],initSelected:[],modelList:h?V!=null?V:[]:[]});q(d(l({},_),{waitSorts:f,newSort:[]}))},nt=t=>{var e;const n=t!=null?t:X.valid;qt(n)&&(St(n),L.current.valid=n,(e=L.current)==null||e.emit("validUpdated"))},bt=()=>{const t=ee.getCurrentStepInfo(T,A);return re(o==null?void 0:o.result,t.step)},x=N(()=>bt(),[T,A,o]),ot=z(t=>{var e,n,s,f,a,w,j;const u=x;let E=(e=o==null?void 0:o.questionList)==null?void 0:e.textList;((n=u==null?void 0:u.modelData)==null?void 0:n.length)&&L.current.valid&&(E=u==null?void 0:u.modelData),t&&(E=t,u.sort=[],u.textAttribute=[],u.answerSort=[]);let ut={};E==null||E.forEach((v,Dt)=>{var dt;const Ot=ne(i,d(l({},v),{answerList:(dt=v==null?void 0:v.answerList)==null?void 0:dt.map((K,Pt)=>((i==null?void 0:i.isTextEdit)&&tt(d(l({},et),{[`${v.id}-${K.id}`]:K.answer})),d(l({},K),{order:Pt+1})))}));ut[v.id]=d(l({},Ot),{order:Dt+1,id:v.id})});const{waitSorts:ht,newSort:jt}=pt({selectedSort:(s=x==null?void 0:x.sort)!=null?s:[],modelList:h?V!=null?V:[]:[]});q({waitSorts:ht,newSort:jt});const Ct=((f=i==null?void 0:i.inputList)==null?void 0:f.filter(v=>v==null?void 0:v.isOverall))||[],Rt=oe(Ct,u==null?void 0:u.tagList);Z({sort:(a=u==null?void 0:u.sort)!=null?a:[],textAttribute:(w=u==null?void 0:u.textAttribute)!=null?w:[],answerSort:(j=u==null?void 0:u.answerSort)!=null?j:{},tagList:Rt}),Y(ut)});$(()=>{yt()},[O,F,g]),$(()=>(window.addEventListener("keydown",rt),()=>{window.removeEventListener("keydown",rt)}),[]);const yt=z(()=>{var t,e;const n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map(f=>{var a;const w=(a=O[f.id])!=null?a:{};return{id:f.id,answerList:w.answerList}}),s=d(l({},g),{modelData:n});L.current.exportData=()=>[[s],{valid:F}],L.current.currentPageResult=d(l({},s),{toolName:Jt.LLMMultiWheel,valid:F})}),rt=t=>{if(t.ctrlKey&&t.keyCode===pe.Enter){if(D){D(()=>R(B()));return}R(B())}},Et=z(({order:t,value:e,key:n})=>{const{answerList:s}=b,f=s==null?void 0:s.map(a=>{var w,j;if((a==null?void 0:a.order)===t){if(n==="textEdit"&&Gt(e)&&st)return tt(d(l({},et),{[`${P}-${(w=a==null?void 0:a.id)!=null?w:""}`]:e})),d(l({},a),{newAnswer:e});if(Kt(e))return d(l({},a),{score:e});if(zt(e)&&n){const u={[e==null?void 0:e.key]:e.value},E=(j=a[n])!=null?j:{};return d(l({},a),{[n]:l(l({},E),u)})}}return a});Y(a=>d(l({},a),{[P]:d(l({},b),{answerList:f})}))}),I=(t,e)=>{Z(n=>d(l({},n),{[t]:e}))},{indicatorScore:lt=[],indicatorDetermine:it=[],isTextEdit:st,dialogSort:h=!1,inputList:G=[],tagInputListConfigurable:at,enableSort:Mt=!1}=i||{},V=N(()=>{var t,e,n;return h?(n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map((s,f)=>d(l({},s),{title:f+1})))!=null?n:[]:[]},[o,h]);if(N(()=>Ht(i),[i]))return r.createElement(Xt,null);const At=at&&((m=G.filter(t=>!t.isOverall))==null?void 0:m.length)>0,Tt=(it==null?void 0:it.length)>0||(lt==null?void 0:lt.length)>0||st||At;return r.createElement("div",{className:`${Lt}`},r.createElement("div",{className:`${Lt}__content`},r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},S("GlobalAnnotation")),h&&r.createElement(le,{waitSortList:(_==null?void 0:_.waitSorts)||[],sortList:(_==null?void 0:_.newSort)||[],setSortList:t=>{const e=t.map(n=>n.map(s=>s.id));I("sort",e),q(d(l({},_),{newSort:t}))},disabeledAll:y,title:S("SortConversationQuality"),prefixId:"model"}),(i==null?void 0:i.text)&&r.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},r.createElement(Yt,{textAttribute:(U=g==null?void 0:g.textAttribute)!=null?U:[],textConfig:(i==null?void 0:i.text)&&Ut(i.text)?i==null?void 0:i.text:[],setText:t=>I("textAttribute",t),disabeledAll:y})),Mt&&r.createElement(Wt,{modelData:(J=(Q=o==null?void 0:o.questionList)==null?void 0:Q.textList)!=null?J:[],selectedAnswerSort:t=>I("answerSort",t),selectedSort:(H=x==null?void 0:x.answerSort)!=null?H:[],ref:k,disabeledAll:y,imgIndex:M}),at&&G.length&&r.createElement(ie,{inputList:G,selectedTags:(g==null?void 0:g.tagList)||{},updateValue:t=>{const{key:e,value:n}=t,s=(g==null?void 0:g.tagList)||{};I("tagList",d(l({},s),{[e]:n}))},disabeledAll:y}),b&&r.createElement(r.Fragment,null,r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},S("QualifiedAnnotation")),r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},r.createElement(mt,{type:"primary",danger:!0},S("Annotating")),r.createElement("div",{style:{padding:16}},S("Group"),"\uFF1A",b.order)),r.createElement("div",null,Tt&&r.createElement(Zt,{list:(b==null?void 0:b.answerList)||[],LLMConfig:i,updateValue:Et,disabeledAll:y})))),r.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(W==null?void 0:W.length)-1!==M&&r.createElement(mt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(D){D(()=>R(B()));return}R(B())},disabled:y},S("Save"))))},ve=p=>({annotation:p.annotation});var Le=Nt(ve,null,null,{context:Vt})(fe);export{Le as default};
@@ -1 +1 @@
1
- import K from"../../assets/attributeIcon/icon_eyeLock_a.svg.js";import B from"../../assets/attributeIcon/icon_eyeLock_h.svg.js";import{COLORS_ARRAY as b,NULL_COLOR as F}from"../../data/Style.js";import{ColorTag as G}from"../colorTag/index.js";import{Radio as y}from"antd/es";import n,{useState as C,useEffect as H}from"react";import{Popover as M,message as W}from"antd";import Y from"../colorPalette/index.js";import{CloseOutlined as $}from"@ant-design/icons";import{useTranslation as q}from"react-i18next";import J from"./components/limitPopover/index.js";import E from"lodash";import{CommonToolUtils as Q,MathUtils as s}from"@labelbee/lb-annotation";const R=[F].concat(b),X=n.forwardRef((e,_)=>{const w=n.useRef(),{t:g}=q(),A=e.list||[],[P,m]=C(!1),[T,D]=C(void 0),[c,I]=C([]);let d=[...R];e.forbidDefault===!0&&(d=d.slice(1));let k="sensebee-radio-group";e.noHeightLimit&&(k="sensebee-radio-group-no-limit-height");const L=t=>{var l,u;if(!Q.hotkeyFilter(t)||(e==null?void 0:e.forbidColor))return;let o=t.keyCode;e.forbidDefault===!0&&(o=o-1);let i;if(s.isInRange(t.keyCode,[48,57])&&(i=e.list[o-48]),s.isInRange(t.keyCode,[96,105])&&(i=e.list[o-96]),t.shiftKey&&i){if(!(e==null?void 0:e.attributeLockChange))return;f(t,i),t.preventDefault();return}(s.isInRange(t.keyCode,[48,57])||s.isInRange(t.keyCode,[96,105]))&&((u=e==null?void 0:e.attributeChanged)==null||u.call(e,(l=i==null?void 0:i.value)!=null?l:""))};H(()=>(window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)));const O=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)},S=(t,l)=>{if(t.shiftKey&&(e==null?void 0:e.attributeLockChange)){f(t,l);return}e.attributeChanged(t.target.value)},j=E.debounce(S,100),f=(t,l)=>{var u;if(e==null?void 0:e.forbidColor)return;const o=c.includes(l.value);let i=E.cloneDeep(c);o?i=i.filter(a=>a!==l.value):i.push(l.value),I(i),(u=e==null?void 0:e.attributeLockChange)==null||u.call(e,i),o||W.success(g("AttributeLockNotify",{label:l.label})),t.preventDefault()};return n.createElement("div",{className:k,style:e.style},n.createElement(y.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,ref:_},A.map((t,l)=>{var u,o,i;let a=(u=e==null?void 0:e.num)!=null?u:l;const N=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let v=l>8&&!e.forbidDefault?b[(l-1)%b.length]:d[l%d.length];(t==null?void 0:t.color)&&(v=t.color);const{defaultSize:z,logicalCondition:h,sizeRange:U}=((o=t==null?void 0:t.limit)==null?void 0:o.sizeLimit)||{},V=((i=t==null?void 0:t.limit)==null?void 0:i.positionLimit)||z||U||(h==null?void 0:h.length)>0,x=N&&V&&e.forbidShowLimitPopover!==!0;return n.createElement(y,{value:t.value,ref:w,key:t.label+l,onClick:r=>j(r,t)},n.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&n.createElement(M,{content:n.createElement(Y,{defaultColor:v,setColor:r=>O(t.value,r)}),title:n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("span",null,g("Palette")),n.createElement($,{onClick:()=>m(!1)})),visible:P&&T===l,onVisibleChange:r=>{!r||m(r)}},n.createElement(G,{color:v,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(D(l),m(!0))}})),t.label),!(e==null?void 0:e.forbidColor)&&(e==null?void 0:e.attributeLockChange)&&n.createElement("img",{onClick:r=>f(r,t),src:c.includes(t.value)?K:B,style:{display:c.includes(t.value)?"inline-block":""},className:"sensebee-radio-icon"}),x&&n.createElement(J,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),n.createElement("span",{className:"sensebee-radio-num"},a))})))});export{R as ATTRIBUTE_COLORS,X as default};
1
+ import B from"../../assets/attributeIcon/icon_eyeLock_a.svg.js";import F from"../../assets/attributeIcon/icon_eyeLock_h.svg.js";import{COLORS_ARRAY as b,NULL_COLOR as G}from"../../data/Style.js";import{ColorTag as H}from"../colorTag/index.js";import{Radio as y}from"antd/es";import n,{useState as C,useEffect as M}from"react";import{Popover as W,message as Y}from"antd";import $ from"../colorPalette/index.js";import{CloseOutlined as q}from"@ant-design/icons";import{useTranslation as J}from"react-i18next";import Q from"./components/limitPopover/index.js";import X from"lodash";import{CommonToolUtils as Z,MathUtils as s}from"@labelbee/lb-annotation";import{useDebounceFn as E}from"ahooks";const R=[G].concat(b),p=n.forwardRef((e,_)=>{const w=n.useRef(),{t:g}=J(),A=e.list||[],[D,m]=C(!1),[P,T]=C(void 0),[c,I]=C([]);let d=[...R];e.forbidDefault===!0&&(d=d.slice(1));let k="sensebee-radio-group";e.noHeightLimit&&(k="sensebee-radio-group-no-limit-height");const O=t=>{var l,u;if(!Z.hotkeyFilter(t)||(e==null?void 0:e.forbidColor))return;let o=t.keyCode;e.forbidDefault===!0&&(o=o-1);let i;if(s.isInRange(t.keyCode,[48,57])&&(i=e.list[o-48]),s.isInRange(t.keyCode,[96,105])&&(i=e.list[o-96]),t.shiftKey&&i){if(!(e==null?void 0:e.attributeLockChange))return;f(t,i),t.preventDefault();return}(s.isInRange(t.keyCode,[48,57])||s.isInRange(t.keyCode,[96,105]))&&((u=e==null?void 0:e.attributeChanged)==null||u.call(e,(l=i==null?void 0:i.value)!=null?l:""))},{run:L}=E(O,{wait:200});M(()=>(window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)));const S=(t,l)=>{e.updateColorConfig&&e.updateColorConfig(t,l)},j=(t,l)=>{if(t.shiftKey&&(e==null?void 0:e.attributeLockChange)){f(t,l);return}e.attributeChanged(t.target.value)},{run:N}=E(j,{wait:100}),f=(t,l)=>{var u;if(e==null?void 0:e.forbidColor)return;const o=c.includes(l.value);let i=X.cloneDeep(c);o?i=i.filter(a=>a!==l.value):i.push(l.value),I(i),(u=e==null?void 0:e.attributeLockChange)==null||u.call(e,i),o||Y.success(g("AttributeLockNotify",{label:l.label})),t.preventDefault()};return n.createElement("div",{className:k,style:e.style},n.createElement(y.Group,{name:"radiogroup",defaultValue:e==null?void 0:e.selectedAttribute,value:e==null?void 0:e.selectedAttribute,ref:_},A.map((t,l)=>{var u,o,i;let a=(u=e==null?void 0:e.num)!=null?u:l;const z=(t==null?void 0:t.value)===(e==null?void 0:e.selectedAttribute);e.forbidDefault===!0&&typeof a=="number"&&a++,typeof a=="number"&&a<=9&&a>=0||(a="-");let v=l>8&&!e.forbidDefault?b[(l-1)%b.length]:d[l%d.length];(t==null?void 0:t.color)&&(v=t.color);const{defaultSize:U,logicalCondition:h,sizeRange:V}=((o=t==null?void 0:t.limit)==null?void 0:o.sizeLimit)||{},x=((i=t==null?void 0:t.limit)==null?void 0:i.positionLimit)||U||V||(h==null?void 0:h.length)>0,K=z&&x&&e.forbidShowLimitPopover!==!0;return n.createElement(y,{value:t.value,ref:w,key:t.label+l,onClick:r=>N(r,t)},n.createElement("span",{className:"sensebee-radio-label",title:t.label},!(e==null?void 0:e.forbidColor)&&n.createElement(W,{content:n.createElement($,{defaultColor:v,setColor:r=>S(t.value,r)}),title:n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement("span",null,g("Palette")),n.createElement(q,{onClick:()=>m(!1)})),visible:D&&P===l,onVisibleChange:r=>{!r||m(r)}},n.createElement(H,{color:v,style:{cursor:"pointer",marginRight:"8px"},onClick:()=>{(e==null?void 0:e.enableColorPicker)&&(T(l),m(!0))}})),t.label),!(e==null?void 0:e.forbidColor)&&(e==null?void 0:e.attributeLockChange)&&n.createElement("img",{onClick:r=>f(r,t),src:c.includes(t.value)?B:F,style:{display:c.includes(t.value)?"inline-block":""},className:"sensebee-radio-icon"}),K&&n.createElement(Q,{limit:t.limit,updateSize:e==null?void 0:e.updateSize}),n.createElement("span",{className:"sensebee-radio-num"},a))})))});export{R as ATTRIBUTE_COLORS,p as default};
@@ -1 +1 @@
1
- import i,{useState as V,useEffect as B,useMemo as re}from"react";import{AudioPlayer as Oe}from"../audioPlayer/index.js";import{getClassName as ke}from"../../utils/dom.js";import Ne from"../predictTracking/previewResult/index.js";import{Layout as ae}from"antd/es";import{Spin as De}from"antd";import{prefix as $e}from"../../constant/index.js";import{cKeyCode as Me,CommonToolUtils as F,EventBus as ue,uuid as Ve,TagUtils as Be,cTool as Fe}from"@labelbee/lb-annotation";import k from"./index.module.scss.js";import Ke from"./tagResultShow/index.js";import{AudioClipProvider as We,DEFAULT_CLIP_TEXT_CONFIG_ITEM as Ue,useAudioClipStore as Xe}from"./audioContext/index.js";import ze from"./textInput/index.js";import{connect as Ge}from"react-redux";import{a2MapStateToProps as qe}from"../../store/annotation/map.js";import{LabelBeeContext as He}from"../../store/ctx.js";import{jsonParser as Je}from"../../utils/index.js";import{useCustomToolInstance as Qe}from"../../hooks/annotation.js";import{sidebarCls as Z}from"../../views/MainView/sidebar/index.js";import Ye from"./audioSide/labelSidebar/index.js";import Ze from"./audioSide/clipSidebar/index.js";import et from"../../assets/annotation/audio/tag.svg.js";import tt from"../../assets/annotation/audio/tagA.svg.js";import ot from"../../assets/annotation/audio/clip.svg.js";import nt from"../../assets/annotation/audio/clipA.svg.js";import{isImageValue as it}from"../../utils/audio.js";import lt from"./utils/dataTransform.js";import{useMemoizedFn as ce}from"ahooks";var st=Object.defineProperty,rt=Object.defineProperties,at=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,ut=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,fe=(o,n,a)=>n in o?st(o,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[n]=a,R=(o,n)=>{for(var a in n||(n={}))ut.call(n,a)&&fe(o,a,n[a]);if(de)for(var a of de(n))ct.call(n,a)&&fe(o,a,n[a]);return o},K=(o,n)=>rt(o,at(n));const{EAudioToolName:dt}=Fe,me=Me.default,{Sider:ft,Content:mt}=ae,pe=`${$e}-layout`,pt=({setSideTab:o,sideTab:n})=>{const a=[{tab:"tag",commonSvg:et,selectedSvg:tt},{tab:"clip",commonSvg:ot,selectedSvg:nt}];return i.createElement("div",{className:k.toggleAudioOption},a.map((m,y)=>{const{tab:d,selectedSvg:E,commonSvg:T}=m;return i.createElement("div",{key:y,className:k.option},i.createElement("img",{className:k.icon,src:n===d?E:T,onClick:()=>{n!==d&&o(d)}}))}))},gt=({result:o,inputDisabled:n,updateText:a,configList:m,autofocus:y,preContext:d,isCheck:E,clipAttributeConfigurable:T,clipTextConfigurable:N,textConfigurable:b,updateRegion:_,clipAttributeList:f,clipTextList:p})=>i.createElement("div",{className:k.textareaContainer},i.createElement("div",{className:k.textareaContent},i.createElement(ze,{isCheck:E,result:o==null?void 0:o.value,textInputDisabled:n,textID:(o==null?void 0:o.id)||0,updateText:a,configList:m,autofocus:!n&&y,preContext:d,regions:o==null?void 0:o.regions,clipAttributeConfigurable:T,clipTextConfigurable:N,textConfigurable:b,updateRegion:_,clipAttributeList:f,clipTextList:p}))),vt=o=>{var n,a;const{sider:m,config:y,result:d,updateTagResult:E,updateRegion:T,isEdit:N,tagConfigurable:b,clipConfigurable:_}=o;let f=(y==null?void 0:y.inputList)||[],p=(n=d==null?void 0:d.tag)!=null?n:{},u=(a=d==null?void 0:d.regions)!=null?a:[];const[X,w]=V([]),[x,g]=V("tag");B(()=>{if(!b&&_){g("clip");return}g("tag")},[b,_]),B(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}));const D=t=>{if(b&&_)switch(t.keyCode){case me.L:g("tag");break;case me.X:g("clip");break}if(x==="tag"){if(!F.hotkeyFilter(t))return;F.isMoveKey(t==null?void 0:t.keyCode)&&t.preventDefault();let l=t.keyCode;if(l&&(l<=57&&l>=49||l<=105&&l>=97)){l>57?l=l-97:l=l-49;const h=X.slice();f.length===1?(L(0,l),w([0,l]),setTimeout(()=>{w([])},500)):h.length===1?(L(h[0],l),w([h[0],l]),setTimeout(()=>{w([])},500)):w([l])}}},L=(t,l)=>{if(t<f.length&&f[t].subSelected&&l<f[t].subSelected.length){const h=f[t].value,r=f[t].isMulti;let j=f[t].subSelected[l].value,z=0;const W=p;for(const S in p)if(S===f[t].value){if(z++,r===!0){const I=W[S].split(";").filter(q=>q!==""),v=I.indexOf(j);v===-1?I.push(j):I.splice(v,1),j=I.join(";")}j===""?delete W[S]:W[S]=j}z===0&&Object.assign(p,{[h]:j}),E(p)}},P=t=>{delete p[t],E(p)},$=b&&_&&i.createElement(pt,{setSideTab:g,sideTab:x}),A=x==="tag"&&i.createElement(Ye,{labelInfoSet:b?f:[],labelSelectedList:X,setLabel:L,tagResult:p,clearResult:P,isEdit:N,withPanelTab:!1}),M=x==="clip"&&i.createElement(Ze,{regions:u,updateRegion:T,useAudioClipStore:Xe});return m?typeof m=="function"?i.createElement("div",{className:`${Z}`},m({toggleAudioOption:$,labelSidebar:A,clipSidebar:M})):m:i.createElement("div",{className:`${Z}`},i.createElement("div",{className:`${Z}__content`},$,A,M))},bt=o=>{var n,a,m,y,d,E,T,N,b;const _=(a=(n=o.style)==null?void 0:n.sider)==null?void 0:a.width,{step:f,stepList:p,audioContext:u,sider:X,drawLayerSlot:w,imgList:x,imgIndex:g,currentData:D,config:L,stepInfo:P,checkMode:$}=o,A=F.getCurrentStepToolAndConfig(f,p),M=Je(D.result),{toolInstanceRef:t}=Qe({basicInfo:M}),[l,h]=V(!0),[r,j]=V(null),[z,W]=V(0),[S,I]=V(!0),v=e=>{if(!e)return;const s=lt.fixData(e);j(s)};B(()=>{h(!0)},[g]),B(()=>{l===!1&&Re()},[l]),B(()=>{ge()},[]),B(()=>{t.current.exportData=()=>[[r],{duration:z,valid:S}],t.current.setResult=Pe,t.current.clearResult=Ae,t.current.currentPageResult=r==null?void 0:r.regions,t.current.emit("updatePageNumber"),t.current.setSelectedRegion=q,t.current.setValid=Ie},[r,S]);const q=e=>{ue.emit("setSelectedRegion",{id:e,isLoopStatus:!0,playImmediately:!0})},ge=()=>{t.current.emit=e=>{const s=t.current.fns.get(e);s&&s.forEach(c=>{c&&(c==null||c())})},t.current.fns=new Map,t.current.singleOn=(e,s)=>{t.current.fns.set(e,[s])},t.current.on=(e,s)=>{t.current.singleOn(e,s)},t.current.unbindAll=e=>{t.current.fns.delete(e)}},H=re(()=>{const e=M[`step_${P==null?void 0:P.step}`];return(e==null?void 0:e.result)||[]},[L,M,P]),{tagConfigurable:ee,textConfigurable:J=!0,clipConfigurable:te=!1,clipAttributeConfigurable:oe=!1,clipAttributeList:ne=[],clipTextConfigurable:G=!1,subAttributeList:ve=[],secondaryAttributeConfigurable:be=!1,inputList:Se=[],configList:ye=[],clipTextList:ie=Ue}=re(()=>{if(A)return F.jsonParser(A==null?void 0:A.config)},[A]),Ee={clipConfigurable:te,clipAttributeConfigurable:oe,clipAttributeList:ne,clipTextConfigurable:G,subAttributeList:ve,secondaryAttributeConfigurable:be,clipTextList:ie},_e=(y=(m=F.jsonParser(D.result))==null?void 0:m.duration)!=null?y:0,xe=S?_e:0,Ce=!S||l||![J,G].includes(!0)||$;let le={};if(g!==-1&&(x==null?void 0:x.length)){const e=(d=x[g])==null?void 0:d.preResult,s=(u==null?void 0:u.isEdit)?(E=u==null?void 0:u.stepConfig)==null?void 0:E.loadPreStep:P==null?void 0:P.loadPreStep;if(e&&s){const c=F.jsonParser(e),C=(N=(T=c==null?void 0:c.config)==null?void 0:T.context)!=null?N:{};Object.keys(C).forEach(O=>{O&&C[O]&&(le[O]={visible:!0,content:C[O],type:O})})}}const Re=()=>{(H==null?void 0:H.length)>0?v(H[0]):v({id:Ve(),sourceID:"",value:se(),tag:Te(),regions:[]});const e=it(x[g].result||"[]");I(e)},se=(e=!0)=>{const s={};let c=L.configList||[];return c.length>0&&c.forEach(C=>{s[C.key]=e&&C.default||""}),s},Te=()=>Be.getDefaultResultByConfig(L.inputList||[]),Le=({duration:e,hasError:s})=>{(u==null?void 0:u.onLoaded)&&(u==null||u.onLoaded()),h(!1),W(e)},he=ce(e=>{v(K(R({},r||{}),{regions:((r==null?void 0:r.regions)||[]).filter(s=>s.id!==e)}))}),Q=ce(e=>{var s;const c=(s=r==null?void 0:r.regions)!=null?s:[],{id:C}=e,O=c.find(U=>U.id===C);let Y=[];O?Y=c.map(U=>C===U.id?R(R({},U),e):U):Y=[...c,e],v(K(R({},r),{regions:Y}))}),je=(e,s)=>{const c=K(R({},r),{value:K(R({},r.value),{[s]:e})});v(c)},we=e=>{const s=K(R({},r),{tag:e});v(s)},Pe=e=>{v(e)},Ae=()=>{const e=K(R({},r),{value:se(),tag:{},regions:[]});v(e),ue.emit("clearRegions")},Ie=e=>{I(e)};return i.createElement(We,null,i.createElement(De,{spinning:l,wrapperClassName:"audio-tool-spinner"},i.createElement(ae,{className:ke("layout","container"),style:{height:"100%",userSelect:"none"}},o==null?void 0:o.leftSider,i.createElement(mt,{className:`${pe}__content`},i.createElement("div",{className:k.containerWrapper},i.createElement("div",{className:k.audioWrapper},ee&&i.createElement(Ke,{result:r==null?void 0:r.tag,labelInfoSet:Se,hasPromptLayer:!!(u==null?void 0:u.promptLayer)}),u==null?void 0:u.promptLayer,i.createElement(Oe,R({context:{isEdit:u==null?void 0:u.isEdit,count:xe,toolName:dt.AudioTextTool,imgIndex:g},drawLayerSlot:w,fileData:D,onLoaded:Le,invalid:!S,updateRegion:Q,removeRegion:he,regions:r==null?void 0:r.regions,activeToolPanel:u==null?void 0:u.activeToolPanel,footer:o.footer,isCheck:$},Ee))),(J||G)&&i.createElement(gt,{preContext:le,result:r,inputDisabled:Ce,updateText:je,updateRegion:Q,configList:ye,autofocus:!1,textConfigurable:J,clipTextConfigurable:G,clipAttributeList:ne,clipAttributeConfigurable:oe,clipTextList:ie,isCheck:$}))),i.createElement(ft,{className:`${pe}__side`,width:_!=null?_:240,style:(b=o.style)==null?void 0:b.sider},i.createElement(vt,{sider:X,config:L,result:r,updateTagResult:we,updateRegion:Q,isEdit:u==null?void 0:u.isEdit,tagConfigurable:ee,clipConfigurable:te})),i.createElement(Ne,null))))};var St=Ge(qe,null,null,{context:He})(bt);export{St as default};
1
+ import r,{useState as M,useEffect as V,useMemo as re}from"react";import{AudioPlayer as Oe}from"../audioPlayer/index.js";import{getClassName as ke}from"../../utils/dom.js";import Ne from"../predictTracking/previewResult/index.js";import{Layout as ae}from"antd/es";import{Spin as De}from"antd";import{prefix as $e}from"../../constant/index.js";import{cKeyCode as Me,CommonToolUtils as B,EventBus as ue,uuid as Ve,TagUtils as Be,cTool as Fe}from"@labelbee/lb-annotation";import U from"./index.module.scss.js";import Ke from"./tagResultShow/index.js";import{AudioClipProvider as We,DEFAULT_CLIP_TEXT_CONFIG_ITEM as Ue,useAudioClipStore as Xe}from"./audioContext/index.js";import ze from"./textInput/index.js";import{connect as Ge}from"react-redux";import{a2MapStateToProps as qe}from"../../store/annotation/map.js";import{LabelBeeContext as He}from"../../store/ctx.js";import{jsonParser as Je}from"../../utils/index.js";import{useCustomToolInstance as Qe}from"../../hooks/annotation.js";import{sidebarCls as Z}from"../../views/MainView/sidebar/index.js";import Ye from"./audioSide/labelSidebar/index.js";import Ze from"./audioSide/clipSidebar/index.js";import et from"../../assets/annotation/audio/tag.svg.js";import tt from"../../assets/annotation/audio/tagA.svg.js";import ot from"../../assets/annotation/audio/clip.svg.js";import nt from"../../assets/annotation/audio/clipA.svg.js";import{isImageValue as it}from"../../utils/audio.js";import lt from"./utils/dataTransform.js";import{useMemoizedFn as ce}from"ahooks";var st=Object.defineProperty,rt=Object.defineProperties,at=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,ut=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,fe=(o,n,a)=>n in o?st(o,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[n]=a,R=(o,n)=>{for(var a in n||(n={}))ut.call(n,a)&&fe(o,a,n[a]);if(de)for(var a of de(n))ct.call(n,a)&&fe(o,a,n[a]);return o},F=(o,n)=>rt(o,at(n));const{EAudioToolName:dt}=Fe,me=Me.default,{Sider:ft,Content:mt}=ae,pe=`${$e}-layout`,pt=({setSideTab:o,sideTab:n})=>{const a=[{tab:"tag",commonSvg:et,selectedSvg:tt},{tab:"clip",commonSvg:ot,selectedSvg:nt}];return r.createElement("div",{className:U.toggleAudioOption},a.map((m,y)=>{const{tab:d,selectedSvg:_,commonSvg:T}=m;return r.createElement("div",{key:y,className:U.option},r.createElement("img",{className:U.icon,src:n===d?_:T,onClick:()=>{n!==d&&o(d)}}))}))},gt=({result:o,inputDisabled:n,updateText:a,configList:m,autofocus:y,preContext:d,isCheck:_,clipAttributeConfigurable:T,clipTextConfigurable:k,textConfigurable:b,updateRegion:E,clipAttributeList:f,clipTextList:p})=>r.createElement(ze,{isCheck:_,result:o==null?void 0:o.value,textInputDisabled:n,textID:(o==null?void 0:o.id)||0,updateText:a,configList:m,autofocus:!n&&y,preContext:d,regions:o==null?void 0:o.regions,clipAttributeConfigurable:T,clipTextConfigurable:k,textConfigurable:b,updateRegion:E,clipAttributeList:f,clipTextList:p}),vt=o=>{var n,a;const{sider:m,config:y,result:d,updateTagResult:_,updateRegion:T,isEdit:k,tagConfigurable:b,clipConfigurable:E}=o;let f=(y==null?void 0:y.inputList)||[],p=(n=d==null?void 0:d.tag)!=null?n:{},u=(a=d==null?void 0:d.regions)!=null?a:[];const[X,w]=M([]),[x,g]=M("tag");V(()=>{if(!b&&E){g("clip");return}g("tag")},[b,E]),V(()=>(window.addEventListener("keydown",N),()=>{window.removeEventListener("keydown",N)}));const N=t=>{if(b&&E)switch(t.keyCode){case me.L:g("tag");break;case me.X:g("clip");break}if(x==="tag"){if(!B.hotkeyFilter(t))return;B.isMoveKey(t==null?void 0:t.keyCode)&&t.preventDefault();let i=t.keyCode;if(i&&(i<=57&&i>=49||i<=105&&i>=97)){i>57?i=i-97:i=i-49;const h=X.slice();f.length===1?(L(0,i),w([0,i]),setTimeout(()=>{w([])},500)):h.length===1?(L(h[0],i),w([h[0],i]),setTimeout(()=>{w([])},500)):w([i])}}},L=(t,i)=>{if(t<f.length&&f[t].subSelected&&i<f[t].subSelected.length){const h=f[t].value,s=f[t].isMulti;let j=f[t].subSelected[i].value,z=0;const K=p;for(const S in p)if(S===f[t].value){if(z++,s===!0){const I=K[S].split(";").filter(q=>q!==""),v=I.indexOf(j);v===-1?I.push(j):I.splice(v,1),j=I.join(";")}j===""?delete K[S]:K[S]=j}z===0&&Object.assign(p,{[h]:j}),_(p)}},P=t=>{delete p[t],_(p)},D=b&&E&&r.createElement(pt,{setSideTab:g,sideTab:x}),A=x==="tag"&&r.createElement(Ye,{labelInfoSet:b?f:[],labelSelectedList:X,setLabel:L,tagResult:p,clearResult:P,isEdit:k,withPanelTab:!1}),$=x==="clip"&&r.createElement(Ze,{regions:u,updateRegion:T,useAudioClipStore:Xe});return m?typeof m=="function"?r.createElement("div",{className:`${Z}`},m({toggleAudioOption:D,labelSidebar:A,clipSidebar:$})):m:r.createElement("div",{className:`${Z}`},r.createElement("div",{className:`${Z}__content`},D,A,$))},bt=o=>{var n,a,m,y,d,_,T,k,b;const E=(a=(n=o.style)==null?void 0:n.sider)==null?void 0:a.width,{step:f,stepList:p,audioContext:u,sider:X,drawLayerSlot:w,imgList:x,imgIndex:g,currentData:N,config:L,stepInfo:P,checkMode:D}=o,A=B.getCurrentStepToolAndConfig(f,p),$=Je(N.result),{toolInstanceRef:t}=Qe({basicInfo:$}),[i,h]=M(!0),[s,j]=M(null),[z,K]=M(0),[S,I]=M(!0),v=e=>{if(!e)return;const l=lt.fixData(e);j(l)};V(()=>{h(!0)},[g]),V(()=>{i===!1&&Re()},[i]),V(()=>{ge()},[]),V(()=>{t.current.exportData=()=>[[s],{duration:z,valid:S}],t.current.setResult=Pe,t.current.clearResult=Ae,t.current.currentPageResult=s==null?void 0:s.regions,t.current.emit("updatePageNumber"),t.current.setSelectedRegion=q,t.current.setValid=Ie},[s,S]);const q=e=>{ue.emit("setSelectedRegion",{id:e,isLoopStatus:!0,playImmediately:!0})},ge=()=>{t.current.emit=e=>{const l=t.current.fns.get(e);l&&l.forEach(c=>{c&&(c==null||c())})},t.current.fns=new Map,t.current.singleOn=(e,l)=>{t.current.fns.set(e,[l])},t.current.on=(e,l)=>{t.current.singleOn(e,l)},t.current.unbindAll=e=>{t.current.fns.delete(e)}},H=re(()=>{const e=$[`step_${P==null?void 0:P.step}`];return(e==null?void 0:e.result)||[]},[L,$,P]),{tagConfigurable:ee,textConfigurable:J=!0,clipConfigurable:te=!1,clipAttributeConfigurable:oe=!1,clipAttributeList:ne=[],clipTextConfigurable:G=!1,subAttributeList:ve=[],secondaryAttributeConfigurable:be=!1,inputList:Se=[],configList:ye=[],clipTextList:ie=Ue}=re(()=>{if(A)return B.jsonParser(A==null?void 0:A.config)},[A]),_e={clipConfigurable:te,clipAttributeConfigurable:oe,clipAttributeList:ne,clipTextConfigurable:G,subAttributeList:ve,secondaryAttributeConfigurable:be,clipTextList:ie},Ee=(y=(m=B.jsonParser(N.result))==null?void 0:m.duration)!=null?y:0,xe=S?Ee:0,Ce=!S||i||![J,G].includes(!0)||D;let le={};if(g!==-1&&(x==null?void 0:x.length)){const e=(d=x[g])==null?void 0:d.preResult,l=(u==null?void 0:u.isEdit)?(_=u==null?void 0:u.stepConfig)==null?void 0:_.loadPreStep:P==null?void 0:P.loadPreStep;if(e&&l){const c=B.jsonParser(e),C=(k=(T=c==null?void 0:c.config)==null?void 0:T.context)!=null?k:{};Object.keys(C).forEach(O=>{O&&C[O]&&(le[O]={visible:!0,content:C[O],type:O})})}}const Re=()=>{(H==null?void 0:H.length)>0?v(H[0]):v({id:Ve(),sourceID:"",value:se(),tag:Te(),regions:[]});const e=it(x[g].result||"[]");I(e)},se=(e=!0)=>{const l={};let c=L.configList||[];return c.length>0&&c.forEach(C=>{l[C.key]=e&&C.default||""}),l},Te=()=>Be.getDefaultResultByConfig(L.inputList||[]),Le=({duration:e,hasError:l})=>{(u==null?void 0:u.onLoaded)&&(u==null||u.onLoaded()),h(!1),K(e)},he=ce(e=>{v(F(R({},s||{}),{regions:((s==null?void 0:s.regions)||[]).filter(l=>l.id!==e)}))}),Q=ce(e=>{var l;const c=(l=s==null?void 0:s.regions)!=null?l:[],{id:C}=e,O=c.find(W=>W.id===C);let Y=[];O?Y=c.map(W=>C===W.id?R(R({},W),e):W):Y=[...c,e],v(F(R({},s),{regions:Y}))}),je=(e,l)=>{const c=F(R({},s),{value:F(R({},s.value),{[l]:e})});v(c)},we=e=>{const l=F(R({},s),{tag:e});v(l)},Pe=e=>{v(e)},Ae=()=>{const e=F(R({},s),{value:se(),tag:{},regions:[]});v(e),ue.emit("clearRegions")},Ie=e=>{I(e)};return r.createElement(We,null,r.createElement(De,{spinning:i,wrapperClassName:"audio-tool-spinner"},r.createElement(ae,{className:ke("layout","container"),style:{height:"100%",userSelect:"none"}},o==null?void 0:o.leftSider,r.createElement(mt,{className:`${pe}__content`},r.createElement("div",{className:U.containerWrapper},r.createElement("div",{className:U.audioWrapper},ee&&r.createElement(Ke,{result:s==null?void 0:s.tag,labelInfoSet:Se,hasPromptLayer:!!(u==null?void 0:u.promptLayer)}),u==null?void 0:u.promptLayer,r.createElement(Oe,R({context:{isEdit:u==null?void 0:u.isEdit,count:xe,toolName:dt.AudioTextTool,imgIndex:g},drawLayerSlot:w,fileData:N,onLoaded:Le,invalid:!S,updateRegion:Q,removeRegion:he,regions:s==null?void 0:s.regions,activeToolPanel:u==null?void 0:u.activeToolPanel,footer:o.footer,isCheck:D},_e))),(J||G)&&r.createElement(gt,{preContext:le,result:s,inputDisabled:Ce,updateText:je,updateRegion:Q,configList:ye,autofocus:!1,textConfigurable:J,clipTextConfigurable:G,clipAttributeList:ne,clipAttributeConfigurable:oe,clipTextList:ie,isCheck:D}))),r.createElement(ft,{className:`${pe}__side`,width:E!=null?E:240,style:(b=o.style)==null?void 0:b.sider},r.createElement(vt,{sider:X,config:L,result:s,updateTagResult:we,updateRegion:Q,isEdit:u==null?void 0:u.isEdit,tagConfigurable:ee,clipConfigurable:te})),r.createElement(Ne,null))))};var St=Ge(qe,null,null,{context:He})(bt);export{St as default};
@@ -1 +1 @@
1
- import e,{useState as O,useRef as te,useEffect as q,useMemo as Ce}from"react";import{Tooltip as ae,Radio as H,Switch as be}from"antd";import{QuestionCircleOutlined as ye}from"@ant-design/icons";import{TextareaWithFooter as Ne}from"../../../views/MainView/sidebar/TextToolSidebar/index.js";import{timeFormat as ne,getAttributeColor as we,getAttributeFontColor as Be,getAttributeShowText as _e,updateColorOpacity as ke,DEFAULT_TEXT_CONFIG_ITEM as Ie}from"../../../utils/audio.js";import{cKeyCode as Se}from"@labelbee/lb-annotation";import U from"classnames";import oe,{useAudioClipStore as De,DEFAULT_CLIP_TEXT_CONFIG_ITEM as Ae}from"../audioContext/index.js";import l from"./index.module.scss.js";import{useTranslation as le}from"react-i18next";import re from"../../longText/index.js";import Le from"../../../assets/annotation/common/icon_clearSmall_a.svg.js";import Pe from"../../../assets/annotation/common/icon_clearSmall.svg.js";var Oe=Object.defineProperty,$e=Object.defineProperties,je=Object.getOwnPropertyDescriptors,ue=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,se=(u,o,r)=>o in u?Oe(u,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):u[o]=r,X=(u,o)=>{for(var r in o||(o={}))Me.call(o,r)&&se(u,r,o[r]);if(ue)for(var r of ue(o))Re.call(o,r)&&se(u,r,o[r]);return u},ie=(u,o)=>$e(u,je(o));const p=Se.default,ce=({onClick:u,title:o,disabled:r})=>{const[C,i]=O(!1);return e.createElement(ae,{placement:"bottom",title:o},e.createElement("img",{onMouseEnter:()=>{r||i(!0)},onMouseLeave:()=>i(!1),className:U({[l.clearIcon]:!0,[l.disabled]:r}),src:C?Le:Pe,onClick:u}))},Q=u=>{var o;const{t:r}=le(),C=te(null),[i,B]=O(!1),[_,x]=O(!1),{disabled:c,config:m,result:$,updateText:g,index:T,switchToNextTextarea:j,hasMultiple:k,textID:b,addPlaceholder:F,onFocus:I,onBlur:y,onFocusStyle:N={},extra:w,errorText:S}=u,{maxLength:h}=m,D=$?$[m.key]:"",A=(o=D==null?void 0:D.length)!=null?o:0,L=n=>{g&&(g(n,m.key),m.required&&x(!n))},M=k&&j,f={id:`textInput-${T}`,ref:C,disabled:c,value:D,maxLength:h,autoSize:{minRows:2,maxRows:6},onChange:n=>{const E=n.target.value;L(E)},onFocus:n=>{B(!0),I==null||I(n),n.target.value&&x(!1)},onBlur:n=>{B(!1),y==null||y(n),m.required&&x(!n.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:n=>{const{keyCode:E}=n;if(n.ctrlKey){if(E===p.Enter&&n.preventDefault(),F&&[p.One,p.Two,p.Three].includes(E))switch(n.preventDefault(),E){case p.One:F("\u4986");break;case p.Two:F("\u652B");break;case p.Three:F("\u7383");break}}else E===p.Tab&&M?(n.preventDefault(),n.nativeEvent.stopImmediatePropagation(),j(T)):n.nativeEvent.stopPropagation()}},v=e.createElement("div",{className:l.textAreaFooter},e.createElement("div",{className:l.hotkeyTip},M&&e.createElement("span",null,"[",r("Switch"),"]Tab"),e.createElement("span",null,"[",r("TurnPage"),"]Ctrl+Enter")),e.createElement("div",{className:l.wordCount},e.createElement("span",{className:A>=h?l.warning:""},A),"/",e.createElement("span",null,h)));return q(()=>{c&&B(!1)},[c]),q(()=>{x(!1)},[b]),e.createElement("div",{className:l.textField},e.createElement("div",{className:l.label},e.createElement("div",{className:l.labelText},e.createElement("span",{className:U({[l.titleText]:!0,[l.required]:m.required})},e.createElement(re,{text:m.label,openByText:!0,isToolTips:!0})),e.createElement(ce,{onClick:()=>{c||L("")},title:"",disabled:c})),e.createElement("div",{className:l.extra},w)),e.createElement("div",{className:U({disabled:c,"textarea-outline":!0,"ant-input-focused":i,[l.textareaContainer]:!0,[l.focus]:i,[l.invalid]:_}),style:i?N:{}},e.createElement(Ne,{footer:v,textareaProps:f})),S&&e.createElement("span",{style:{color:"#ff4d4f",lineHeight:"22px"}},S))},qe=u=>{const{configList:o,autofocus:r,textID:C,result:i,showText:B,updateText:_,toggleShowText:x,textInputDisabled:c,isCheck:m,isEdit:$,config:g,preContext:T,regions:j=[],textConfigurable:k=!0,clipTextConfigurable:b,clipAttributeConfigurable:F,updateRegion:I,clipAttributeList:y=[],clipTextList:N=Ae}=u,{t:w}=le(),[S,h]=O(0),[D,A]=O(""),L=te(null),{audioClipState:M}=De(),f=o||[X({},Ie)];let v=j;if(b&&!m){const t=M.selectedRegion.id;v=v.filter(a=>a.id===t)}const n=t=>{setTimeout(()=>{const a=document.getElementById(`textInput-${t}`);a&&(h(t),a.focus(),a.select(),a.scrollIntoView({behavior:"smooth",block:"center"}))})},E=t=>{const a=k?f.length:0,d=b?v.length*N.length:0,s=a+d,P=(t+1)%s;n(P)},J=t=>{t.keyCode===p.Tab&&(t.preventDefault(),(f.length>0||b&&N.length>0)&&n(0))},R=t=>{const a=document.getElementById(`textInput-${S}`);if(!(g==null?void 0:g.enablePlaceholderHotkey)||!a||!_)return;const{value:d,selectionStart:s,selectionEnd:P}=a,G=`${d.slice(0,s)}${t}${d.slice(P)}`;_(G,f[S].key),A(t),setTimeout(()=>{a.setSelectionRange(s+1,s+1),a.focus()},0),clearTimeout(L.current),L.current=setTimeout(()=>{A("")},400)};q(()=>($||document.addEventListener("keydown",J),()=>{document.removeEventListener("keydown",J)}),[o]),q(()=>{r&&!c&&n(0)},[C]);let K=f;m&&(K=f.filter(t=>(i==null?void 0:i[t.key])!==void 0));const me=Ce(()=>N.reduce((t,a)=>(v.forEach(d=>{d&&t.push(ie(X({},a),{clipTextResult:d}))}),t),[]),[N,v]);return e.createElement(e.Fragment,null,(g==null?void 0:g.enablePlaceholderHotkey)&&e.createElement("div",{className:l.placeholderHotkey},e.createElement("div",{className:l.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",e.createElement(ae,{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(ye,{className:l.questionIcon}))),e.createElement(H.Group,{value:D},e.createElement(H.Button,{value:"\u4986",onClick:t=>R(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(H.Button,{value:"\u652B",onClick:t=>R(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(H.Button,{value:"\u7383",onClick:t=>R(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:l.textInputContainer},e.createElement(oe,{audioContext:T==null?void 0:T.before}),k&&K.map((t,a)=>e.createElement(Q,{config:t,key:a,index:a,result:i,updateText:_,switchToNextTextarea:E,hasMultiple:f.length>1,disabled:c,textID:C,addPlaceholder:R,onFocus:()=>h(a)})),b&&v.length>0&&me.map((t,a)=>{var d;const{clipTextResult:s}=t,{id:P,start:G,end:de,attribute:V}=s,{maxLength:Ee=3e3,label:Y,key:Z,required:pe}=t,ee=s==null?void 0:s[Z],fe={[s.id]:ee},ve={label:`${Y!=null?Y:w("textTool")}\uFF08${ne(G,"ss.SSS")} - ${ne(de,"ss.SSS")}\uFF09`,key:P,maxLength:Ee},W=(k?K.length:0)+a,z=we(V,y),xe={color:Be(V,y),backgroundColor:z},ge=w("LeastCharacterError",{num:1}),Te=pe&&ee.length<1?ge:void 0,Fe=(d=_e(V,[{value:"",key:w("NoAttribute")},...y]))!=null?d:"";return e.createElement(Q,{config:ve,key:a,index:W,disabled:c,result:fe,updateText:he=>{I==null||I(ie(X({},s),{[Z]:he}))},switchToNextTextarea:()=>{E(W)},hasMultiple:!0,onFocus:()=>h(W),onFocusStyle:F?{borderColor:z,boxShadow:`0 0 0 2px ${ke(z,.4)}`}:{},extra:F?e.createElement("div",{style:xe,className:l.attribute},e.createElement(re,{text:Fe,openByText:!0,isToolTips:!0})):null,errorText:Te})}),e.createElement(oe,{audioContext:T==null?void 0:T.after}),x&&e.createElement("div",{className:l.switchItem},w("toggleShowText"),e.createElement(be,{style:{alignSelf:"center"},checked:B,onChange:t=>{x(t)}}))))};export{ce as ClearIcon,Q as SingleTextInput,qe as default};
1
+ import e,{useState as C,useRef as J,useEffect as H,useMemo as Se}from"react";import{Tooltip as se,Radio as q,Spin as _e,Switch as ke}from"antd";import{QuestionCircleOutlined as Le}from"@ant-design/icons";import{TextareaWithFooter as De}from"../../../views/MainView/sidebar/TextToolSidebar/index.js";import{timeFormat as ue,getAttributeColor as Ae,getAttributeFontColor as Pe,getAttributeShowText as Oe,updateColorOpacity as Me,DEFAULT_TEXT_CONFIG_ITEM as Re}from"../../../utils/audio.js";import{cKeyCode as $e}from"@labelbee/lb-annotation";import Y from"classnames";import ie,{useAudioClipStore as je,DEFAULT_CLIP_TEXT_CONFIG_ITEM as He}from"../audioContext/index.js";import a from"./index.module.scss.js";import{useTranslation as ce}from"react-i18next";import me from"../../longText/index.js";import qe from"../../../assets/annotation/common/icon_clearSmall_a.svg.js";import ze from"../../../assets/annotation/common/icon_clearSmall.svg.js";var Ke=Object.defineProperty,Ve=Object.defineProperties,Ge=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,We=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,Ee=(s,l,r)=>l in s?Ke(s,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[l]=r,Z=(s,l)=>{for(var r in l||(l={}))We.call(l,r)&&Ee(s,r,l[r]);if(de)for(var r of de(l))Ue.call(l,r)&&Ee(s,r,l[r]);return s},pe=(s,l)=>Ve(s,Ge(l));const p=$e.default,fe=({onClick:s,title:l,disabled:r})=>{const[b,c]=C(!1);return e.createElement(se,{placement:"bottom",title:l},e.createElement("img",{onMouseEnter:()=>{r||c(!0)},onMouseLeave:()=>c(!1),className:Y({[a.clearIcon]:!0,[a.disabled]:r}),src:b?qe:ze,onClick:s}))},ee=s=>{var l;const{t:r}=ce(),b=J(null),[c,I]=C(!1),[S,f]=C(!1),{disabled:m,config:u,result:R,updateText:v,index:x,switchToNextTextarea:$,hasMultiple:_,textID:g,addPlaceholder:T,onFocus:k,onBlur:y,onFocusStyle:N={},extra:B,errorText:L}=s,{maxLength:h}=u,D=R?R[u.key]:"",A=(l=D==null?void 0:D.length)!=null?l:0,P=o=>{v&&(v(o,u.key),u.required&&f(!o))},O=_&&$,z={id:`textInput-${x}`,ref:b,disabled:m,value:D,maxLength:h,autoSize:{minRows:2,maxRows:6},onChange:o=>{const E=o.target.value;P(E)},onFocus:o=>{I(!0),k==null||k(o),o.target.value&&f(!1)},onBlur:o=>{I(!1),y==null||y(o),u.required&&f(!o.target.value)},style:{resize:"none",wordBreak:"break-all"},onKeyDownCapture:o=>{const{keyCode:E}=o;if(o.ctrlKey){if(E===p.Enter&&o.preventDefault(),T&&[p.One,p.Two,p.Three].includes(E))switch(o.preventDefault(),E){case p.One:T("\u4986");break;case p.Two:T("\u652B");break;case p.Three:T("\u7383");break}}else E===p.Tab&&O?(o.preventDefault(),o.nativeEvent.stopImmediatePropagation(),$(x)):o.nativeEvent.stopPropagation()}},K=e.createElement("div",{className:a.textAreaFooter},e.createElement("div",{className:a.hotkeyTip},O&&e.createElement("span",null,"[",r("Switch"),"]Tab"),e.createElement("span",null,"[",r("TurnPage"),"]Ctrl+Enter")),e.createElement("div",{className:a.wordCount},e.createElement("span",{className:A>=h?a.warning:""},A),"/",e.createElement("span",null,h)));return H(()=>{m&&I(!1)},[m]),H(()=>{f(!1)},[g]),e.createElement("div",{className:a.textField},e.createElement("div",{className:a.label},e.createElement("div",{className:a.labelText},e.createElement("span",{className:Y({[a.titleText]:!0,[a.required]:u.required})},e.createElement(me,{text:u.label,openByText:!0,isToolTips:!0})),e.createElement(fe,{onClick:()=>{m||P("")},title:"",disabled:m})),e.createElement("div",{className:a.extra},B)),e.createElement("div",{className:Y({disabled:m,"textarea-outline":!0,"ant-input-focused":c,[a.textareaContainer]:!0,[a.focus]:c,[a.invalid]:S}),style:c?N:{}},e.createElement(De,{footer:K,textareaProps:z})),L&&e.createElement("span",{style:{color:"#ff4d4f",lineHeight:"22px"}},L))},Xe=s=>{const{configList:l,autofocus:r,textID:b,result:c,showText:I,updateText:S,toggleShowText:f,textInputDisabled:m,isCheck:u,isEdit:R,config:v,preContext:x,regions:$=[],textConfigurable:_=!0,clipTextConfigurable:g,clipAttributeConfigurable:T,updateRegion:k,clipAttributeList:y=[],clipTextList:N=He}=s,{t:B}=ce(),[L,h]=C(0),[D,A]=C(""),P=J(null),O=J(null),[z,K]=C(5),[o,E]=C(!1),{audioClipState:ve}=je(),w=l||[Z({},Re)];let F=$;if(g&&!u){const t=ve.selectedRegion.id;F=F.filter(n=>n.id===t)}const V=t=>{setTimeout(()=>{const n=document.getElementById(`textInput-${t}`);n&&(h(t),n.focus(),n.select(),n.scrollIntoView({behavior:"smooth",block:"center"}))})},te=t=>{const n=_?w.length:0,d=g?F.length*N.length:0,i=n+d,M=(t+1)%i;V(M)},ne=t=>{t.keyCode===p.Tab&&(t.preventDefault(),(w.length>0||g&&N.length>0)&&V(0))},j=t=>{const n=document.getElementById(`textInput-${L}`);if(!(v==null?void 0:v.enablePlaceholderHotkey)||!n||!S)return;const{value:d,selectionStart:i,selectionEnd:M}=n,W=`${d.slice(0,i)}${t}${d.slice(M)}`;S(W,w[L].key),A(t),setTimeout(()=>{n.setSelectionRange(i+1,i+1),n.focus()},0),clearTimeout(P.current),P.current=setTimeout(()=>{A("")},400)};H(()=>(R||document.addEventListener("keydown",ne),()=>{document.removeEventListener("keydown",ne)}),[l]),H(()=>{r&&!m&&V(0)},[b]);let G=w;u&&(G=w.filter(t=>(c==null?void 0:c[t.key])!==void 0));const ae=Se(()=>N.reduce((t,n)=>(F.forEach(d=>{d&&t.push(pe(Z({},n),{clipTextResult:d}))}),t),[]),[N,F]),xe=()=>{const t=O.current;t&&g&&F.length>0&&u&&t.clientHeight+t.scrollTop+1>=t.scrollHeight&&(E(!0),ge())},ge=()=>{setTimeout(()=>{K(t=>Math.min(t+5,ae.length)),E(!1)},300)};return e.createElement("div",{className:a.textInputBox,ref:O,onScroll:xe},e.createElement("div",{className:a.textInputChild},(v==null?void 0:v.enablePlaceholderHotkey)&&e.createElement("div",{className:a.placeholderHotkey},e.createElement("div",{className:a.title},"\u5360\u4F4D\u7B26\u5FEB\u6377\u8F93\u5165",e.createElement(se,{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(Le,{className:a.questionIcon}))),e.createElement(q.Group,{value:D},e.createElement(q.Button,{value:"\u4986",onClick:t=>j(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(q.Button,{value:"\u652B",onClick:t=>j(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(q.Button,{value:"\u7383",onClick:t=>j(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:a.textInputContainer},e.createElement(ie,{audioContext:x==null?void 0:x.before}),_&&G.map((t,n)=>e.createElement(ee,{config:t,key:n,index:n,result:c,updateText:S,switchToNextTextarea:te,hasMultiple:w.length>1,disabled:m,textID:b,addPlaceholder:j,onFocus:()=>h(n)})),g&&F.length>0&&e.createElement(e.Fragment,null,ae.slice(0,z).map((t,n)=>{var d;const{clipTextResult:i}=t,{id:M,start:W,end:Te,attribute:U}=i,{maxLength:he=3e3,label:le,key:oe,required:Fe}=t,re=i==null?void 0:i[oe],Ce={[i.id]:re},be={label:`${le!=null?le:B("textTool")}\uFF08${ue(W,"ss.SSS")} - ${ue(Te,"ss.SSS")}\uFF09`,key:M,maxLength:he},X=(_?G.length:0)+n,Q=Ae(U,y),ye={color:Pe(U,y),backgroundColor:Q},Ne=B("LeastCharacterError",{num:1}),Be=Fe&&re.length<1?Ne:void 0,we=(d=Oe(U,[{value:"",key:B("NoAttribute")},...y]))!=null?d:"";return e.createElement(ee,{config:be,key:n,index:X,disabled:m,result:Ce,updateText:Ie=>{k==null||k(pe(Z({},i),{[oe]:Ie}))},switchToNextTextarea:()=>{te(X)},hasMultiple:!0,onFocus:()=>h(X),onFocusStyle:T?{borderColor:Q,boxShadow:`0 0 0 2px ${Me(Q,.4)}`}:{},extra:T?e.createElement("div",{style:ye,className:a.attribute},e.createElement(me,{text:we,openByText:!0,isToolTips:!0})):null,errorText:Be})}),o&&e.createElement(_e,{size:"small"})),e.createElement(ie,{audioContext:x==null?void 0:x.after}),f&&e.createElement("div",{className:a.switchItem},B("toggleShowText"),e.createElement(ke,{style:{alignSelf:"center"},checked:I,onChange:t=>{f(t)}})))))};export{fe as ClearIcon,ee as SingleTextInput,Xe as default};
@@ -1 +1 @@
1
- var e={textInputContainer:"index-module_textInputContainer__ES6X3",textField:"index-module_textField__uRcb7",label:"index-module_label__xE6hM",labelText:"index-module_labelText__Zg1c4",titleText:"index-module_titleText__BRM44",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};
1
+ var e={textInputContainer:"index-module_textInputContainer__ES6X3",textField:"index-module_textField__uRcb7",label:"index-module_label__xE6hM",labelText:"index-module_labelText__Zg1c4",titleText:"index-module_titleText__BRM44",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",textInputBox:"index-module_textInputBox__C6pdt",textInputChild:"index-module_textInputChild__SOQT6"};export{e as default};
@@ -1 +1 @@
1
- import i,{useState as v,useRef as U,useMemo as ar,useEffect as P}from"react";import{getWebPcm2WavBase64 as ur}from"../audioAnnotate/utils/getWebPcm2Wac.js";import cr,{debounce as dr,sortBy as mr}from"lodash";import{PauseOutlined as fr,CaretRightOutlined as pr}from"@ant-design/icons";import{cKeyCode as vr,cTool as gr,EventBus as E,TagUtils as br}from"@labelbee/lb-annotation";import{i18n as Je}from"@labelbee/lb-utils";import{Button as yr}from"antd";import _r from"../invalidPage/index.js";import Er from"../imageError/index.js";import{classnames as V}from"../../utils/index.js";import Sr,{EPlayerType as hr}from"../videoPlayer/components/SpeedController/index.js";import Rr from"@labelbee/wavesurfer";import Pr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import Cr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import Tr,{audioZoomInfo as de}from"./zoomSlider/index.js";import wr from"./labelDisplayToggle/index.js";import Ar from"./clipRegion/index.js";import{useAudioClipStore as jr}from"../audioAnnotate/audioContext/index.js";import{useLatest as X,useUpdate as xr,useDeepCompareEffect as Qe,useThrottleFn as et}from"ahooks";import Dr from"./useAudioScroll/index.js";import y from"./index.module.scss.js";import{getAttributeColor as Lr,formatTime as tt,timeFormat as rt,dispatchResizeEvent as Ir,precisionMinus as nt,isDoubleClick as Mr,getCanMoveRange as kr}from"../../utils/audio.js";import Br from"./progressDot/index.js";import Or from"./clipTip/index.js";import Wr from"./useSwitchHotkey/index.js";import Nr from"./useAudioCombine/index.js";import zr from"./useAudioSegment/index.js";import Fr from"./combineTip/index.js";import $r from"./segmentTip/index.js";import Hr from"../../views/MainView/toolFooter/index.js";import{decimalReserved as Z}from"../videoPlayer/utils.js";import{I18nextProvider as Ur}from"react-i18next";import Vr from"../../hooks/useSize.js";var Xr=Object.defineProperty,Zr=Object.defineProperties,qr=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertySymbols,Kr=Object.prototype.hasOwnProperty,Gr=Object.prototype.propertyIsEnumerable,it=(f,u,d)=>u in f?Xr(f,u,{enumerable:!0,configurable:!0,writable:!0,value:d}):f[u]=d,me=(f,u)=>{for(var d in u||(u={}))Kr.call(u,d)&&it(f,d,u[d]);if(ot)for(var d of ot(u))Gr.call(u,d)&&it(f,d,u[d]);return f},lt=(f,u)=>Zr(f,qr(u));const{EToolName:st}=gr,q=vr.default,at=.1,ut=i.createContext({count:0,isEdit:!1,toolName:st.Empty,imgIndex:0}),ct=({fileData:f={},onLoaded:u,context:d,invalid:dt,height:mt,hideError:ft,onError:fe,updateRegion:L,removeRegion:$,regions:A=[],activeToolPanel:pt,clipConfigurable:vt,clipTextConfigurable:pe,clipAttributeList:gt,clipAttributeConfigurable:ve,secondaryAttributeConfigurable:bt,subAttributeList:yt,isCheck:S,hoverRegionId:K,footer:_t,drawLayerSlot:ge,clipTextList:Et,lang:be})=>{var ye,_e;const{url:H,path:Ee}=f,[G,Y]=v(!1),[Se,he]=v(!1),[j,St]=v(0),[ht,Re]=v(!1),[C,Pe]=v(0),o=U(null),x=U(null),Ce=U(j),J=e=>{Ce.current=e,St(e)},[Te,Rt]=v(0),[k,Pt]=v(de.defaultValue),h=U(null),[we,Ct]=v({}),{audioClipState:Q,setAudioClipState:B}=jr(),[ee,te]=v(!1),c=X(Q),Ae=X(we);X(G);const I=X(A),je=xr(),[xe,Tt]=v([]),[De,wt]=v({}),[At,Le]=v(""),[Ie,jt]=v({start:0,end:0}),xt=Vr(h),Dt=ar(()=>A.filter(e=>{const{start:t,end:r}=Ie;return e.start>=t&&e.start<=r||e.end>=t&&e.end<=r||e.id===At}),[A,Ie]),Lt=dr(()=>{E.emit("audioZoom")},500),Me=e=>{e<de.min||e>de.max||(Pt(e),Ir(),Lt())};Dr({container:h.current,target:document.querySelector(`[data-id=${(_e=(ye=c.current)==null?void 0:ye.selectedRegion)==null?void 0:_e.id}]`),clipping:ee,zoom:k,zoomHandler:Me});const O=()=>{let e=I.current;const{attributeLockList:t}=c.current;t.length&&(e=e.filter(r=>t.includes(r.attribute))),ne(),e.forEach(r=>{var n;(n=o.current)==null||n.addRegion(lt(me({},r),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),je()},g=e=>{var t,r,n,l,a,p,b;const{id:s,loop:m=!0,playImmediately:_=!1,isLoopStatus:z}=e,M=!1;if(s){const D=(n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{};Object.entries(D).forEach(([,w])=>{const{id:F}=w;s===F?w.select():w.cancelSelect()}),B({selectedRegion:{id:s,loop:M},selectedAttribute:(p=(a=(l=I.current)==null?void 0:l.find(w=>w.id===s))==null?void 0:a.attribute)!=null?p:""}),_&&((b=W(s))==null||b.play())}else B({selectedRegion:{}})},{combineInstance:It}=Nr({waveRef:o,sortByStartRegions:xe,regionMap:De,updateRegion:L,removeRegion:$,generateRegions:O,setSelectedRegion:g}),{segmentInstance:Mt,onRegionMouseMove:kt,segmentTimeTip:Bt}=zr({waveRef:o,regionMap:De,updateRegion:L,removeRegion:$,generateRegions:O,setSelectedRegion:g}),ke={clipTextConfigurable:pe,clipAttributeList:gt,clipAttributeConfigurable:ve,clipConfigurable:vt,secondaryAttributeConfigurable:bt,subAttributeList:yt,clipTextList:Et};P(()=>{var e;be&&((e=Je)==null||e.changeLanguage(be))},[]),P(()=>{B({selectedAttribute:""})},[ve]),P(()=>{re()},[Q.selectedAttribute]),P(()=>{O()},[Q.attributeLockList]),Qe(()=>{B(ke),setTimeout(()=>{Be()})},[ke]),Qe(()=>{Tt(mr(A,["start"])),wt(A.reduce((e,t)=>{const{id:r}=t;return lt(me({},e),{[r]:t})},{})),S&&O()},[A]),P(()=>{g(K?{id:K,loop:!1,playImmediately:!0}:{})},[K]);const Be=()=>{var e,t;c.current.clipConfigurable?(!S&&o.current&&((e=o.current)==null||e.enableDragSelection({slop:5})),O()):((t=o.current)==null||t.disableDragSelection(),ne()),re()},re=()=>{var e,t,r,n,l;let a="";c.current.clipConfigurable?a=Lr(c.current.selectedAttribute,(e=c.current.clipAttributeList)!=null?e:[]):a="transparent",((r=(t=o==null?void 0:o.current)==null?void 0:t.cursor)==null?void 0:r.cursor)&&((l=(n=o==null?void 0:o.current)==null?void 0:n.cursor)==null||l.setStyle({border:`2px dashed ${a}`}))},W=e=>{var t,r,n;return((n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{})[e]},Oe=()=>{var e,t;if(H){const r=((t=(e=Ee==null?void 0:Ee.split("."))==null?void 0:e.pop())==null?void 0:t.toLowerCase())==="pcm";Re(!1),r?ur(H).then(n=>{We(n)}):We(H)}},We=e=>{var t;e&&(he(!0),J(0),Pe(0),(t=o==null?void 0:o.current)==null||t.load(e))},ne=()=>{var e;(e=o.current)==null||e.clearRegions()},oe=e=>{const t=W(e);t&&(te(!1),t==null||t.remove(),$==null||$(e),g({}))},{run:Ne}=et(g,{wait:100});Wr({sortByStartRegions:xe,setSelectedRegion:g});const Ot=e=>{const{start:t,end:r}=Ae.current;return(t||r)&&e.update(Ae.current),e},Wt=({action:e,id:t,eventDownTime:r})=>{var n,l;if(!c.current.clipConfigurable)return;t&&g({id:t});const a=W((t!=null?t:(n=c.current.selectedRegion)==null?void 0:n.id)||""),p=[];(e==="create"?I.current:(l=I.current)==null?void 0:l.filter(m=>m.id!==a.id)).forEach(m=>{const{start:_,end:z,attribute:M}=m;M===c.current.selectedAttribute&&[_,z].forEach(D=>{p.includes(D)||p.push(D)})});const s=kr(p.sort((m,_)=>m-_),r);o.current.range=s},Nt=e=>{re(),setTimeout(()=>{te(!1)});const t=Ot(e),{id:r,start:n,end:l}=t;g({id:r,playImmediately:!0});const a={id:r,start:Z(n,3),end:Z(l,3)};L==null||L(a),je()},zt=()=>{const e=Rr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:mt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[Pr.create({regions:A,dragSelection:{slop:5},canMove:!1}),Cr.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),t=()=>{var r;J(((r=o==null?void 0:o.current)==null?void 0:r.getCurrentTime())||0)};e.on("ready",()=>{var r;const n=((r=o==null?void 0:o.current)==null?void 0:r.getDuration())||0;Pe(n),t(),u==null||u({duration:Math.round(n)}),he(!1),N(),E.on("setCurrentTimeByPosition",le),E.on("clearRegions",ne),E.on("removeRegionById",oe),E.on("setSelectedRegion",Ne),e.on("regions-eventDown",Wt),Be()}),e.on("audioprocess",()=>{t()}),e.on("play",()=>{Y(!0)}),e.on("pause",()=>{Y(!1)}),e.on("finish",()=>{Y(!1)}),e.on("seek",()=>{t()}),e.on("error",()=>{Re(!0),u==null||u({hasError:!0}),fe==null||fe()}),e.on("region-created",r=>{var n;const{id:l,start:a,end:p}=r;if(I.current.find(s=>s.id===l))return;Le(l);const b={id:l,start:Z(a,3),end:Z(p,3),attribute:c.current.selectedAttribute,text:""};if(c.current.secondaryAttributeConfigurable){const s=br.getDefaultResultByConfig((n=c.current.subAttributeList)!=null?n:[]);b.subAttribute=s!=null?s:{}}pe&&c.current.clipTextList.forEach((m,_)=>{_===0?Object.assign(b,{text:m==null?void 0:m.default}):Object.assign(b,{[m.key]:m==null?void 0:m.default})}),L==null||L(b)}),e.on("region-updated",(r,n)=>{var l,a,p,b,s,m,_,z,M,D;const w=n==null?void 0:n.action;B({combined:!1,segment:!1}),w==="resize"&&((a=(l=o==null?void 0:o.current)==null?void 0:l.cursor)==null||a.setStyle({borderStyle:"solid"})),w==="drag"&&((b=(p=o==null?void 0:o.current)==null?void 0:p.cursor)==null||b.setStyle({borderColor:"transparent"}));const F={},se=[],ae={},Qt=(s=I.current)==null?void 0:s.filter(R=>R.id!==r.id),er=(z=(_=(m=o.current)==null?void 0:m.regions)==null?void 0:_.list)!=null?z:{};Qt.forEach(R=>{var Ke,Ge;const{element:ue}=(Ke=er[R.id])!=null?Ke:{},{start:nr,end:or}=R;if(ue){const{x:Ye,width:ir}=((Ge=ue.getBoundingClientRect)==null?void 0:Ge.call(ue))||{},lr=Ye+ir;[Ye,lr].forEach((ce,sr)=>{se.includes(ce)||(se.push(ce),ae[ce]=sr===0?nr:or)})}});const{x:qe,width:tr}=((D=(M=r.element).getBoundingClientRect)==null?void 0:D.call(M))||{},rr=qe+tr;se.forEach(R=>{Math.abs(nt(R,qe))<5&&(F.start=ae[R]),Math.abs(nt(R,rr))<5&&(F.end=ae[R])}),Ct(F),Ne({id:r.id}),te(!0)}),e.on("region-update-end",r=>{Nt(r),Le("")}),e.on("region-contextmenu",(r,n)=>{if(!S){if(n.preventDefault(),n.stopPropagation(),Mr(n)){oe(r.id);return}g({id:r.id,playImmediately:!0})}}),e.on("region-click",(r,n,l)=>{if(!S){if(n.preventDefault(),n.stopPropagation(),c.current.combined){It(r);return}if(c.current.segment){Mt(r,l);return}g({id:r.id,playImmediately:!0})}}),e.on("region-mousemove",kt),o.current=e},Ft=G?i.createElement(fr,null):i.createElement(pr,null),ze=e=>e?`${parseFloat((e/C*100).toFixed(4))}%`:"0%",Fe=ze(j),$t=ze(Te),T=()=>{if(!Se)return o==null?void 0:o.current},Ht=()=>{var e;(e=T())==null||e.skipForward(at)},Ut=()=>{var e;(e=T())==null||e.skipBackward(at)},N=()=>{var e;(e=T())==null||e.playPause()},$e=e=>{var t;switch(e.keyCode){case q.Right:Ht();break;case q.Left:Ut();break;case q.Space:e.preventDefault(),N();break;case q.Delete:if(!S){const{id:r}=((t=c.current)==null?void 0:t.selectedRegion)||{};r&&oe(r)}break}},Vt=e=>{le(e)},He=cr.throttle(Vt,50);let ie=!1;const Ue=()=>{ie&&(N(),ie=!1),document.removeEventListener("mousemove",He),document.removeEventListener("mouseup",Ue)},Xt=e=>{le(e),G&&(ie=!0,N()),document.addEventListener("mousemove",He),document.addEventListener("mouseup",Ue)},Zt=()=>{Oe()};P(()=>(zt(),()=>{var e;(e=o==null?void 0:o.current)==null||e.destroy(),o.current=null,E.unbindAll("setCurrentTimeByPosition"),E.unbindAll("clearRegions"),E.unbindAll("removeRegionById"),E.unbindAll("setSelectedRegion")}),[]);const qt=e=>{var t,r,n;(t=T())==null||t.playPause(),(r=T())==null||r.setPlaybackRate(e),(n=T())==null||n.playPause()};P(()=>(document.addEventListener("keydown",$e),()=>{document.removeEventListener("keydown",$e)})),P(()=>{g({}),Oe()},[H]),P(()=>{Ve()},[xt,C,k]);const Kt=()=>{if(h.current&&C){const e=h.current.scrollLeft,t=h.current.clientWidth,r=e/h.current.scrollWidth*C,n=(e+t)/h.current.scrollWidth*C;jt({start:r,end:n})}},{run:Ve}=et(Kt,{wait:300}),Xe=e=>{var t,r,n,l;if((o==null?void 0:o.current)&&(x==null?void 0:x.current)){const a=(r=(t=o==null?void 0:o.current)==null?void 0:t.getDuration())!=null?r:0,p=(n=x==null?void 0:x.current)==null?void 0:n.getBoundingClientRect();let s=(e.clientX-p.left)/(((l=x==null?void 0:x.current)==null?void 0:l.clientWidth)||0)*a;return s>a&&(s=a),s}return 0},le=e=>{var t;const r=Xe(e);(t=o==null?void 0:o.current)==null||t.skip(r-Ce.current),J(r)},Gt=e=>{Rt(Xe(e))},Yt=C?Math.max(C-j,0):0,Jt=(d==null?void 0:d.toolName)!==st.Empty&&(d==null?void 0:d.isEdit)!==!0&&(pt==="remark"||S),Ze=i.createElement("div",{className:y.audioPlayer},ht&&!ft&&i.createElement(Er,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:Zt,backgroundColor:"#ffffffbb"}),i.createElement(Or,{getRegionInstanceById:W,clipping:ee}),i.createElement(Fr,{container:h.current}),i.createElement($r,{segmentTimeTip:Bt}),i.createElement("div",{className:y.waveformContainer,ref:h,onScroll:()=>Ve()},i.createElement("div",{id:"waveform",style:{width:`${k*100}%`},className:V({[y.waveform]:!0,"bee-audio-combined":c.current.combined,"bee-audio-clip":c.current.clipConfigurable})},dt&&i.createElement(_r,{isAudio:!0}),i.createElement("div",{ref:x,className:y.progress,onMouseDown:Xt,onMouseMove:Gt},i.createElement("div",{className:V({[y.radioTooltip]:!0}),style:{left:Fe}},tt(j)),i.createElement("div",{className:V({[y.radioTooltip]:!0,[y.mouseTooltip]:!0}),style:{left:$t}},tt(Te)),i.createElement(Br,{playPercentage:Fe})),Jt&&(ge==null?void 0:ge({currentTime:j,remainingTime:Yt,audioPlayer:T()})))),i.createElement("div",{className:y.controlBar},i.createElement(yr,{type:"link",icon:Ft,onClick:()=>{N()},className:V({[y.playButton]:!0,[y.playButtonDisabled]:Se})}),i.createElement("span",{className:y.time},`${rt(j,"ss.SSS")} / -${rt(C-j,"ss.SSS")}`),i.createElement(Sr,{playerType:hr.Audio,onChange:e=>{qt(e)}}),i.createElement(Tr,{onChange:e=>{var t;(t=T())==null||t.pause(),Me(e)},zoom:k}),i.createElement(wr,{EventBus:E})));return d?i.createElement(ut.Provider,{value:d},Ze,Dt.map(e=>{const{id:t}=e,r=document.querySelector(`[data-id=${t}]`);return r?i.createElement(Ar,{el:r,key:t,region:e,edgeAdsorption:we,clipping:ee,zoom:k,instance:W(t),isCheck:S}):null}),i.createElement(Hr,{footer:_t})):Ze},Yr=f=>i.createElement(Ur,{i18n:Je},i.createElement(ct,me({},f)));export{ct as AudioPlayer,ut as AudioPlayerContext,Yr as WrapAudioPlayer};
1
+ import i,{useState as v,useRef as U,useMemo as ar,useEffect as P}from"react";import{getWebPcm2WavBase64 as ur}from"../audioAnnotate/utils/getWebPcm2Wac.js";import cr,{debounce as dr,sortBy as mr}from"lodash";import{PauseOutlined as fr,CaretRightOutlined as pr}from"@ant-design/icons";import{cKeyCode as vr,cTool as gr,EventBus as E,TagUtils as br}from"@labelbee/lb-annotation";import{i18n as Je}from"@labelbee/lb-utils";import{Button as yr}from"antd";import _r from"../invalidPage/index.js";import Er from"../imageError/index.js";import{classnames as V}from"../../utils/index.js";import Sr,{EPlayerType as hr}from"../videoPlayer/components/SpeedController/index.js";import Rr from"@labelbee/wavesurfer";import Pr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.regions.js";import Cr from"@labelbee/wavesurfer/dist/plugin/wavesurfer.cursor.js";import Tr,{audioZoomInfo as me}from"./zoomSlider/index.js";import wr from"./labelDisplayToggle/index.js";import Ar from"./clipRegion/index.js";import{useAudioClipStore as jr}from"../audioAnnotate/audioContext/index.js";import{useLatest as X,useUpdate as xr,useDeepCompareEffect as Qe,useThrottleFn as et}from"ahooks";import Dr from"./useAudioScroll/index.js";import y from"./index.module.scss.js";import{getAttributeColor as Lr,formatTime as tt,timeFormat as rt,dispatchResizeEvent as Ir,precisionMinus as nt,isDoubleClick as Mr,getCanMoveRange as kr}from"../../utils/audio.js";import Br from"./progressDot/index.js";import Or from"./clipTip/index.js";import Wr from"./useSwitchHotkey/index.js";import Nr from"./useAudioCombine/index.js";import zr from"./useAudioSegment/index.js";import Fr from"./combineTip/index.js";import $r from"./segmentTip/index.js";import Hr from"../../views/MainView/toolFooter/index.js";import{decimalReserved as Z}from"../videoPlayer/utils.js";import{I18nextProvider as Ur}from"react-i18next";import Vr from"../../hooks/useSize.js";var Xr=Object.defineProperty,Zr=Object.defineProperties,qr=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertySymbols,Kr=Object.prototype.hasOwnProperty,Gr=Object.prototype.propertyIsEnumerable,it=(f,u,d)=>u in f?Xr(f,u,{enumerable:!0,configurable:!0,writable:!0,value:d}):f[u]=d,fe=(f,u)=>{for(var d in u||(u={}))Kr.call(u,d)&&it(f,d,u[d]);if(ot)for(var d of ot(u))Gr.call(u,d)&&it(f,d,u[d]);return f},lt=(f,u)=>Zr(f,qr(u));const{EToolName:st}=gr,q=vr.default,at=.1,ut=i.createContext({count:0,isEdit:!1,toolName:st.Empty,imgIndex:0}),ct=({fileData:f={},onLoaded:u,context:d,invalid:dt,height:mt,hideError:ft,onError:pe,updateRegion:L,removeRegion:$,regions:A=[],activeToolPanel:pt,clipConfigurable:vt,clipTextConfigurable:ve,clipAttributeList:gt,clipAttributeConfigurable:ge,secondaryAttributeConfigurable:bt,subAttributeList:yt,isCheck:S,hoverRegionId:K,footer:_t,drawLayerSlot:be,clipTextList:Et,lang:ye})=>{var _e,Ee;const{url:H,path:Se}=f,[G,Y]=v(!1),[he,J]=v(!1),[j,St]=v(0),[ht,Re]=v(!1),[C,Pe]=v(0),o=U(null),x=U(null),Ce=U(j),Q=e=>{Ce.current=e,St(e)},[Te,Rt]=v(0),[k,Pt]=v(me.defaultValue),h=U(null),[we,Ct]=v({}),{audioClipState:ee,setAudioClipState:B}=jr(),[te,re]=v(!1),c=X(ee),Ae=X(we);X(G);const I=X(A),je=xr(),[xe,Tt]=v([]),[De,wt]=v({}),[At,Le]=v(""),[Ie,jt]=v({start:0,end:0}),xt=Vr(h),Dt=ar(()=>A.filter(e=>{const{start:t,end:r}=Ie;return e.start>=t&&e.start<=r||e.end>=t&&e.end<=r||e.id===At}),[A,Ie]),Lt=dr(()=>{E.emit("audioZoom")},500),Me=e=>{e<me.min||e>me.max||(Pt(e),Ir(),Lt())};Dr({container:h.current,target:document.querySelector(`[data-id=${(Ee=(_e=c.current)==null?void 0:_e.selectedRegion)==null?void 0:Ee.id}]`),clipping:te,zoom:k,zoomHandler:Me});const O=()=>{let e=I.current;const{attributeLockList:t}=c.current;t.length&&(e=e.filter(r=>t.includes(r.attribute))),oe(),e.forEach(r=>{var n;(n=o.current)==null||n.addRegion(lt(fe({},r),{drag:!S,resize:!S,color:"rgba(0, 0, 0, 0)"}))}),je()},g=e=>{var t,r,n,l,a,p,b;const{id:s,loop:m=!0,playImmediately:_=!1,isLoopStatus:z}=e,M=!1;if(s){const D=(n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{};Object.entries(D).forEach(([,w])=>{const{id:F}=w;s===F?w.select():w.cancelSelect()}),B({selectedRegion:{id:s,loop:M},selectedAttribute:(p=(a=(l=I.current)==null?void 0:l.find(w=>w.id===s))==null?void 0:a.attribute)!=null?p:""}),_&&((b=W(s))==null||b.play())}else B({selectedRegion:{}})},{combineInstance:It}=Nr({waveRef:o,sortByStartRegions:xe,regionMap:De,updateRegion:L,removeRegion:$,generateRegions:O,setSelectedRegion:g}),{segmentInstance:Mt,onRegionMouseMove:kt,segmentTimeTip:Bt}=zr({waveRef:o,regionMap:De,updateRegion:L,removeRegion:$,generateRegions:O,setSelectedRegion:g}),ke={clipTextConfigurable:ve,clipAttributeList:gt,clipAttributeConfigurable:ge,clipConfigurable:vt,secondaryAttributeConfigurable:bt,subAttributeList:yt,clipTextList:Et};P(()=>{var e;ye&&((e=Je)==null||e.changeLanguage(ye))},[]),P(()=>{B({selectedAttribute:""})},[ge]),P(()=>{ne()},[ee.selectedAttribute]),P(()=>{O()},[ee.attributeLockList]),Qe(()=>{B(ke),setTimeout(()=>{Be()})},[ke]),Qe(()=>{Tt(mr(A,["start"])),wt(A.reduce((e,t)=>{const{id:r}=t;return lt(fe({},e),{[r]:t})},{})),S&&O()},[A]),P(()=>{g(K?{id:K,loop:!1,playImmediately:!0}:{})},[K]);const Be=()=>{var e,t;c.current.clipConfigurable?(!S&&o.current&&((e=o.current)==null||e.enableDragSelection({slop:5})),O()):((t=o.current)==null||t.disableDragSelection(),oe()),ne()},ne=()=>{var e,t,r,n,l;let a="";c.current.clipConfigurable?a=Lr(c.current.selectedAttribute,(e=c.current.clipAttributeList)!=null?e:[]):a="transparent",((r=(t=o==null?void 0:o.current)==null?void 0:t.cursor)==null?void 0:r.cursor)&&((l=(n=o==null?void 0:o.current)==null?void 0:n.cursor)==null||l.setStyle({border:`2px dashed ${a}`}))},W=e=>{var t,r,n;return((n=(r=(t=o.current)==null?void 0:t.regions)==null?void 0:r.list)!=null?n:{})[e]},Oe=()=>{var e,t;if(H){const r=((t=(e=Se==null?void 0:Se.split("."))==null?void 0:e.pop())==null?void 0:t.toLowerCase())==="pcm";Re(!1),r?ur(H).then(n=>{We(n)}):We(H)}},We=e=>{var t;e&&(J(!0),Q(0),Pe(0),(t=o==null?void 0:o.current)==null||t.load(e))},oe=()=>{var e;(e=o.current)==null||e.clearRegions()},ie=e=>{const t=W(e);t&&(re(!1),t==null||t.remove(),$==null||$(e),g({}))},{run:Ne}=et(g,{wait:100});Wr({sortByStartRegions:xe,setSelectedRegion:g});const Ot=e=>{const{start:t,end:r}=Ae.current;return(t||r)&&e.update(Ae.current),e},Wt=({action:e,id:t,eventDownTime:r})=>{var n,l;if(!c.current.clipConfigurable)return;t&&g({id:t});const a=W((t!=null?t:(n=c.current.selectedRegion)==null?void 0:n.id)||""),p=[];(e==="create"?I.current:(l=I.current)==null?void 0:l.filter(m=>m.id!==a.id)).forEach(m=>{const{start:_,end:z,attribute:M}=m;M===c.current.selectedAttribute&&[_,z].forEach(D=>{p.includes(D)||p.push(D)})});const s=kr(p.sort((m,_)=>m-_),r);o.current.range=s},Nt=e=>{ne(),setTimeout(()=>{re(!1)});const t=Ot(e),{id:r,start:n,end:l}=t;g({id:r,playImmediately:!0});const a={id:r,start:Z(n,3),end:Z(l,3)};L==null||L(a),je()},zt=()=>{const e=Rr.create({container:"#waveform",waveColor:"#999",progressColor:"#999",height:mt||245,normalize:!0,cursorWidth:2,cursorColor:"white",responsive:0,hideScrollbar:!0,plugins:[Pr.create({regions:A,dragSelection:{slop:5},canMove:!1}),Cr.create({opacity:1,customStyle:{border:"2px dashed transparent"}})]}),t=()=>{var r;Q(((r=o==null?void 0:o.current)==null?void 0:r.getCurrentTime())||0)};e.on("ready",()=>{var r;const n=((r=o==null?void 0:o.current)==null?void 0:r.getDuration())||0;Pe(n),t(),u==null||u({duration:Math.round(n)}),J(!1),N(),E.on("setCurrentTimeByPosition",se),E.on("clearRegions",oe),E.on("removeRegionById",ie),E.on("setSelectedRegion",Ne),e.on("regions-eventDown",Wt),Be()}),e.on("audioprocess",()=>{t()}),e.on("play",()=>{Y(!0)}),e.on("pause",()=>{Y(!1)}),e.on("finish",()=>{Y(!1)}),e.on("seek",()=>{t()}),e.on("error",()=>{Re(!0),J(!1),u==null||u({hasError:!0}),pe==null||pe()}),e.on("region-created",r=>{var n;const{id:l,start:a,end:p}=r;if(I.current.find(s=>s.id===l))return;Le(l);const b={id:l,start:Z(a,3),end:Z(p,3),attribute:c.current.selectedAttribute,text:""};if(c.current.secondaryAttributeConfigurable){const s=br.getDefaultResultByConfig((n=c.current.subAttributeList)!=null?n:[]);b.subAttribute=s!=null?s:{}}ve&&c.current.clipTextList.forEach((m,_)=>{_===0?Object.assign(b,{text:m==null?void 0:m.default}):Object.assign(b,{[m.key]:m==null?void 0:m.default})}),L==null||L(b)}),e.on("region-updated",(r,n)=>{var l,a,p,b,s,m,_,z,M,D;const w=n==null?void 0:n.action;B({combined:!1,segment:!1}),w==="resize"&&((a=(l=o==null?void 0:o.current)==null?void 0:l.cursor)==null||a.setStyle({borderStyle:"solid"})),w==="drag"&&((b=(p=o==null?void 0:o.current)==null?void 0:p.cursor)==null||b.setStyle({borderColor:"transparent"}));const F={},ae=[],ue={},Qt=(s=I.current)==null?void 0:s.filter(R=>R.id!==r.id),er=(z=(_=(m=o.current)==null?void 0:m.regions)==null?void 0:_.list)!=null?z:{};Qt.forEach(R=>{var Ke,Ge;const{element:ce}=(Ke=er[R.id])!=null?Ke:{},{start:nr,end:or}=R;if(ce){const{x:Ye,width:ir}=((Ge=ce.getBoundingClientRect)==null?void 0:Ge.call(ce))||{},lr=Ye+ir;[Ye,lr].forEach((de,sr)=>{ae.includes(de)||(ae.push(de),ue[de]=sr===0?nr:or)})}});const{x:qe,width:tr}=((D=(M=r.element).getBoundingClientRect)==null?void 0:D.call(M))||{},rr=qe+tr;ae.forEach(R=>{Math.abs(nt(R,qe))<5&&(F.start=ue[R]),Math.abs(nt(R,rr))<5&&(F.end=ue[R])}),Ct(F),Ne({id:r.id}),re(!0)}),e.on("region-update-end",r=>{Nt(r),Le("")}),e.on("region-contextmenu",(r,n)=>{if(!S){if(n.preventDefault(),n.stopPropagation(),Mr(n)){ie(r.id);return}g({id:r.id,playImmediately:!0})}}),e.on("region-click",(r,n,l)=>{if(!S){if(n.preventDefault(),n.stopPropagation(),c.current.combined){It(r);return}if(c.current.segment){Mt(r,l);return}g({id:r.id,playImmediately:!0})}}),e.on("region-mousemove",kt),o.current=e},Ft=G?i.createElement(fr,null):i.createElement(pr,null),ze=e=>e?`${parseFloat((e/C*100).toFixed(4))}%`:"0%",Fe=ze(j),$t=ze(Te),T=()=>{if(!he)return o==null?void 0:o.current},Ht=()=>{var e;(e=T())==null||e.skipForward(at)},Ut=()=>{var e;(e=T())==null||e.skipBackward(at)},N=()=>{var e;(e=T())==null||e.playPause()},$e=e=>{var t;switch(e.keyCode){case q.Right:Ht();break;case q.Left:Ut();break;case q.Space:e.preventDefault(),N();break;case q.Delete:if(!S){const{id:r}=((t=c.current)==null?void 0:t.selectedRegion)||{};r&&ie(r)}break}},Vt=e=>{se(e)},He=cr.throttle(Vt,50);let le=!1;const Ue=()=>{le&&(N(),le=!1),document.removeEventListener("mousemove",He),document.removeEventListener("mouseup",Ue)},Xt=e=>{se(e),G&&(le=!0,N()),document.addEventListener("mousemove",He),document.addEventListener("mouseup",Ue)},Zt=()=>{Oe()};P(()=>(zt(),()=>{var e;(e=o==null?void 0:o.current)==null||e.destroy(),o.current=null,E.unbindAll("setCurrentTimeByPosition"),E.unbindAll("clearRegions"),E.unbindAll("removeRegionById"),E.unbindAll("setSelectedRegion")}),[]);const qt=e=>{var t,r,n;(t=T())==null||t.playPause(),(r=T())==null||r.setPlaybackRate(e),(n=T())==null||n.playPause()};P(()=>(document.addEventListener("keydown",$e),()=>{document.removeEventListener("keydown",$e)})),P(()=>{g({}),Oe()},[H]),P(()=>{Ve()},[xt,C,k]);const Kt=()=>{if(h.current&&C){const e=h.current.scrollLeft,t=h.current.clientWidth,r=e/h.current.scrollWidth*C,n=(e+t)/h.current.scrollWidth*C;jt({start:r,end:n})}},{run:Ve}=et(Kt,{wait:300}),Xe=e=>{var t,r,n,l;if((o==null?void 0:o.current)&&(x==null?void 0:x.current)){const a=(r=(t=o==null?void 0:o.current)==null?void 0:t.getDuration())!=null?r:0,p=(n=x==null?void 0:x.current)==null?void 0:n.getBoundingClientRect();let s=(e.clientX-p.left)/(((l=x==null?void 0:x.current)==null?void 0:l.clientWidth)||0)*a;return s>a&&(s=a),s}return 0},se=e=>{var t;const r=Xe(e);(t=o==null?void 0:o.current)==null||t.skip(r-Ce.current),Q(r)},Gt=e=>{Rt(Xe(e))},Yt=C?Math.max(C-j,0):0,Jt=(d==null?void 0:d.toolName)!==st.Empty&&(d==null?void 0:d.isEdit)!==!0&&(pt==="remark"||S),Ze=i.createElement("div",{className:y.audioPlayer},ht&&!ft&&i.createElement(Er,{fileTypeName:"\u97F3\u9891",ignoreOffsetY:!0,reloadImage:Zt,backgroundColor:"#ffffffbb"}),i.createElement(Or,{getRegionInstanceById:W,clipping:te}),i.createElement(Fr,{container:h.current}),i.createElement($r,{segmentTimeTip:Bt}),i.createElement("div",{className:y.waveformContainer,ref:h,onScroll:()=>Ve()},i.createElement("div",{id:"waveform",style:{width:`${k*100}%`},className:V({[y.waveform]:!0,"bee-audio-combined":c.current.combined,"bee-audio-clip":c.current.clipConfigurable})},dt&&i.createElement(_r,{isAudio:!0}),i.createElement("div",{ref:x,className:y.progress,onMouseDown:Xt,onMouseMove:Gt},i.createElement("div",{className:V({[y.radioTooltip]:!0}),style:{left:Fe}},tt(j)),i.createElement("div",{className:V({[y.radioTooltip]:!0,[y.mouseTooltip]:!0}),style:{left:$t}},tt(Te)),i.createElement(Br,{playPercentage:Fe})),Jt&&(be==null?void 0:be({currentTime:j,remainingTime:Yt,audioPlayer:T()})))),i.createElement("div",{className:y.controlBar},i.createElement(yr,{type:"link",icon:Ft,onClick:()=>{N()},className:V({[y.playButton]:!0,[y.playButtonDisabled]:he})}),i.createElement("span",{className:y.time},`${rt(j,"ss.SSS")} / -${rt(C-j,"ss.SSS")}`),i.createElement(Sr,{playerType:hr.Audio,onChange:e=>{qt(e)}}),i.createElement(Tr,{onChange:e=>{var t;(t=T())==null||t.pause(),Me(e)},zoom:k}),i.createElement(wr,{EventBus:E})));return d?i.createElement(ut.Provider,{value:d},Ze,Dt.map(e=>{const{id:t}=e,r=document.querySelector(`[data-id=${t}]`);return r?i.createElement(Ar,{el:r,key:t,region:e,edgeAdsorption:we,clipping:te,zoom:k,instance:W(t),isCheck:S}):null}),i.createElement(Hr,{footer:_t})):Ze},Yr=f=>i.createElement(Ur,{i18n:Je},i.createElement(ct,fe({},f)));export{ct as AudioPlayer,ut as AudioPlayerContext,Yr as WrapAudioPlayer};
@@ -1 +1 @@
1
- import{useLatest as oe,useMemoizedFn as q,useDebounceEffect as he}from"ahooks";import{Spin as Ie}from"antd/es";import J,{useContext as _e,useRef as $,useState as O,useMemo as De,useCallback as be,useEffect as p}from"react";import{connect as Ce}from"react-redux";import{usePointCloudViews as we}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as xe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as ye}from"../../store/annotation/map.js";import{LabelBeeContext as Pe}from"../../store/ctx.js";import{PointCloud2DRectOperation as Se,MathUtils as Le,ImgUtils as Oe}from"@labelbee/lb-annotation";import{selectSpecifiedRectsFromTopViewSelectedIds as Ve}from"./util.js";import{useUpdateRectList as Ee}from"./useUpdateRectList.js";import je from"lodash";import{useToolStyleContext as ke}from"../../hooks/useToolStyle.js";import Be from"../../store/toolConfig/index.js";var Ne=Object.defineProperty,Ue=Object.defineProperties,Me=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,le=(d,c,s)=>c in d?Ne(d,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[c]=s,v=(d,c)=>{for(var s in c||(c={}))ze.call(c,s)&&le(d,s,c[s]);if(ie)for(var s of ie(c))Ae.call(c,s)&&le(d,s,c[s]);return d},C=(d,c)=>Ue(d,Me(c)),G=(d,c,s)=>new Promise((a,g)=>{var D=f=>{try{b(s.next(f))}catch(R){g(R)}},V=f=>{try{b(s.throw(f))}catch(R){g(R)}},b=f=>f.done?a(f.value):Promise.resolve(f.value).then(D,V);b((s=s.apply(d,c)).next())});const Te=d=>{var c,s;const{mappingData:a,size:g,config:D,checkMode:V,afterImgOnLoad:b,shouldExcludePointCloudBoxListUpdate:f}=d,{selectBoxVisibleSwitch:R}=Be(),E=(c=a==null?void 0:a.url)!=null?c:"",w=(s=a==null?void 0:a.fallbackUrl)!=null?s:"",{pointCloudBoxList:j,setPointCloudResult:k,defaultAttribute:B,rectList:N,addRectIn2DView:ce,updateRectIn2DView:se,removeRectIn2DView:ue,updateRectListByReducer:de,selectedIDs:m,setSelectedIDs:U,selectedID:x}=_e(xe),{value:M}=ke(),ae=oe(m),{update2DViewRect:fe,remove2DViewRect:pe}=we(),z=J.useRef(null),n=$(null),K=q(fe),y=q(pe),P=$(null),[me,Q]=O(!0),[W,X]=O(""),[ve,A]=O(!1),[ge,S]=O(!0),h=De(()=>N==null?void 0:N.filter(e=>e.imageName===(a==null?void 0:a.path)),[a==null?void 0:a.path,N]),Y=$(h),L=oe(a==null?void 0:a.path),T=be(e=>G(void 0,null,function*(){try{const o=ae.current.slice(0),r=yield Promise.resolve(e());if(!r||r.length===0)return r;if(o.length){const t=new Set(o),i=r.filter(l=>t.has(l.id)).map(l=>l.id);U(i)}return r}catch(o){}}),[U]),Z=e=>{const{boxID:o}=e;if(S(!1),!f&&o){T(()=>{const r=K==null?void 0:K(e);return r?(P.current=r,k(r),r):null});return}se(e,!0)},ee=e=>{L.current&&ce(C(v({},e),{imageName:L.current}))},te=e=>{if(e.length===0)return;if(!f){const r=e.find(t=>t.boxID);if(r){T(()=>{const t=y==null?void 0:y(r);return t?(P.current=t,k(t),I(),t):null});return}}const o=e.find(r=>r.extId);o&&T(()=>{const{imageName:r,extId:t}=o,i=y==null?void 0:y({boxID:t,imageName:r});return i?(P.current=i,k(i),i):null}),ue(e)},Re=q(()=>{let e=[];return j.forEach(o=>{const{rects:r=[],id:t,attribute:i,trackID:l}=o,u=r.find(F=>F.imageName===L.current),_=t+"_"+L.current;u&&(e=[...e,C(v({},u),{boxID:t,id:_,attribute:i,order:l})])}),e}),I=Ee(()=>{var e,o,r,t,i;const l=f?[]:Re(),u=(e=n.current)==null?void 0:e.selectedRectID,_=m.slice(0),F=R?Ve(_,l,h):[...l,...h];let ne=[];!R&&(m==null?void 0:m.length)&&(ne=l.filter(H=>u?m.includes(H.boxID)&&!u.includes(H.boxID):m.includes(H.boxID))),(o=n.current)==null||o.setHighLightRectList(ne),(r=n.current)==null||r.setResult(F),W?((t=n.current)==null||t.setSelectedRectID(W),X("")):ve&&u&&((i=n.current)==null||i.setSelectedRectID(u),A(!1))}),re=({targetId:e,id:o})=>{S(!1),U(e),X(o)};return p(()=>{if(z.current){const e=new Se({container:z.current,size:g,config:C(v({},D),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return n.current=e,n.current.init(),n.current.on("updateDragResult",Z),n.current.on("afterAddingDrawingRect",ee),n.current.on("deleteSelectedRects",te),n.current.on("onRightClick",re),()=>{var o,r,t,i,l;(o=n.current)==null||o.unbind("updateDragResult",Z),(r=n.current)==null||r.unbind("afterAddingDrawingRect",ee),(t=n.current)==null||t.unbind("deleteSelectedRects",te),(i=n.current)==null||i.unbind("onRightClick",re),(l=n.current)==null||l.destroy()}}},[]),p(()=>{const e=r=>G(void 0,null,function*(){try{return yield Oe.load(r)}catch(t){return console.error("Error loading image:",t),null}}),o=()=>G(void 0,null,function*(){var r;Q(!0);let t=yield e(E);!t&&w&&(t=yield e(w)),t&&((r=n.current)==null||r.setImgNode(t),b(t)),Q(!1)});n.current&&(E||w)&&o()},[E,w]),p(()=>{var e;(e=n.current)==null||e.setSize(g)},[g]),p(()=>{j!==P.current&&I()},[j]),p(()=>{var e,o;const r=h.find(t=>t.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,B),r&&de(t=>{var i;const l=[];let u=null;return t.forEach(_=>{_.id!==n.current.selectedRectID?l.push(_):u=_}),r.extId===void 0&&(u=(i=n.current)==null?void 0:i.selectedRect),[...l,C(v({},u||{}),{attribute:B})]}),A(!0),I()},[B]),p(()=>{const e=Y.current;je.isEqual(e,h)||(A(!0),I(),Y.current=h)},[h]),p(()=>{I()},[f]),p(()=>{var e,o,r,t;const i=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},l=C(v({},i),{attributeList:(r=D.attributeList)!=null?r:[]});(t=n.current)==null||t.setConfig(JSON.stringify(l))},[D.attributeList]),p(()=>{var e;(e=n.current)==null||e.setEnableAddRect(m.length===0),I()},[m]),he(()=>{if(!x||!ge){S(!0);return}const{rectList:e,size:o,zoom:r}=n.current,t=e.find(u=>u.boxID===x||u.extId===x);if(!t){S(!0);return}const i={x:t.x+t.width/2,y:t.y+t.height/2},l=Le.getCurrentPosFromRectCenter(o,i,r);n.current.setHoverRectID(t.id),n.current.setCurrentPos(l),n.current.renderBasicCanvas(),n.current.render()},[x],{wait:200}),p(()=>{const{hiddenText:e}=M||{};if(e===void 0)return;const o=n.current;if(!o)return;const r=v(v({},o.style),M);o.setStyle(r)},[M]),p(()=>{I()},[R]),J.createElement(Ie,{spinning:me},J.createElement("div",{ref:z,style:v({position:"relative"},g)}))};var Fe=Ce(ye,null,null,{context:Pe})(Te);export{Fe as default};
1
+ import{useLatest as oe,useMemoizedFn as Z,useDebounceEffect as Ie}from"ahooks";import{Spin as he}from"antd/es";import q,{useContext as De,useRef as J,useState as O,useMemo as _e,useCallback as be,useEffect as p}from"react";import{connect as Ce}from"react-redux";import{usePointCloudViews as we}from"../pointCloudView/hooks/usePointCloudViews.js";import{PointCloudContext as xe}from"../pointCloudView/PointCloudContext.js";import{a2MapStateToProps as ye}from"../../store/annotation/map.js";import{LabelBeeContext as Pe}from"../../store/ctx.js";import{PointCloud2DRectOperation as Se,ImgUtils as Le}from"@labelbee/lb-annotation";import{ImgPosUtils as Oe}from"@labelbee/lb-utils";import{selectSpecifiedRectsFromTopViewSelectedIds as Ve}from"./util.js";import{useUpdateRectList as Ee}from"./useUpdateRectList.js";import je from"lodash";import{useToolStyleContext as Be}from"../../hooks/useToolStyle.js";import Ne from"../../store/toolConfig/index.js";var ke=Object.defineProperty,Ue=Object.defineProperties,ze=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,le=(a,c,s)=>c in a?ke(a,c,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[c]=s,v=(a,c)=>{for(var s in c||(c={}))Ae.call(c,s)&&le(a,s,c[s]);if(ie)for(var s of ie(c))Me.call(c,s)&&le(a,s,c[s]);return a},C=(a,c)=>Ue(a,ze(c)),$=(a,c,s)=>new Promise((f,g)=>{var _=u=>{try{b(s.next(u))}catch(R){g(R)}},V=u=>{try{b(s.throw(u))}catch(R){g(R)}},b=u=>u.done?f(u.value):Promise.resolve(u.value).then(_,V);b((s=s.apply(a,c)).next())});const Te=a=>{var c,s;const{mappingData:f,size:g,config:_,checkMode:V,afterImgOnLoad:b,shouldExcludePointCloudBoxListUpdate:u}=a,{selectBoxVisibleSwitch:R}=Ne(),E=(c=f==null?void 0:f.url)!=null?c:"",w=(s=f==null?void 0:f.fallbackUrl)!=null?s:"",{pointCloudBoxList:j,setPointCloudResult:B,defaultAttribute:N,rectList:k,addRectIn2DView:ce,updateRectIn2DView:se,removeRectIn2DView:ue,updateRectListByReducer:de,selectedIDs:m,setSelectedIDs:U,selectedID:x}=De(xe),{value:z}=Be(),ae=oe(m),{update2DViewRect:fe,remove2DViewRect:pe}=we(),A=q.useRef(null),n=J(null),G=Z(fe),y=Z(pe),P=J(null),[me,K]=O(!0),[Q,W]=O(""),[ve,M]=O(!1),[ge,S]=O(!0),I=_e(()=>k==null?void 0:k.filter(e=>e.imageName===(f==null?void 0:f.path)),[f==null?void 0:f.path,k]),X=J(I),L=oe(f==null?void 0:f.path),T=be(e=>$(void 0,null,function*(){try{const o=ae.current.slice(0),t=yield Promise.resolve(e());if(!t||t.length===0)return t;if(o.length){const r=new Set(o),i=t.filter(l=>r.has(l.id)).map(l=>l.id);U(i)}return t}catch(o){}}),[U]),Y=e=>{const{boxID:o}=e;if(S(!1),!u&&o){T(()=>{const t=G==null?void 0:G(e);return t?(P.current=t,B(t),t):null});return}se(e,!0)},ee=e=>{L.current&&ce(C(v({},e),{imageName:L.current}))},te=e=>{if(e.length===0)return;if(!u){const t=e.find(r=>r.boxID);if(t){T(()=>{const r=y==null?void 0:y(t);return r?(P.current=r,B(r),h(),r):null});return}}const o=e.find(t=>t.extId);o&&T(()=>{const{imageName:t,extId:r}=o,i=y==null?void 0:y({boxID:r,imageName:t});return i?(P.current=i,B(i),i):null}),ue(e)},Re=Z(()=>{let e=[];return j.forEach(o=>{const{rects:t=[],id:r,attribute:i,trackID:l}=o,d=t.find(F=>F.imageName===L.current),D=r+"_"+L.current;d&&(e=[...e,C(v({},d),{boxID:r,id:D,attribute:i,order:l})])}),e}),h=Ee(()=>{var e,o,t,r,i;const l=u?[]:Re(),d=(e=n.current)==null?void 0:e.selectedRectID,D=m.slice(0),F=R?Ve(D,l,I):[...l,...I];let ne=[];!R&&(m==null?void 0:m.length)&&(ne=l.filter(H=>d?m.includes(H.boxID)&&!d.includes(H.boxID):m.includes(H.boxID))),(o=n.current)==null||o.setHighLightRectList(ne),(t=n.current)==null||t.setResult(F),Q?((r=n.current)==null||r.setSelectedRectID(Q),W("")):ve&&d&&((i=n.current)==null||i.setSelectedRectID(d),M(!1))}),re=({targetId:e,id:o})=>{S(!1),U(e),W(o)};return p(()=>{if(A.current){const e=new Se({container:A.current,size:g,config:C(v({},_),{isShowOrder:!0,attributeConfigurable:!0}),checkMode:V});return n.current=e,n.current.init(),n.current.on("updateDragResult",Y),n.current.on("afterAddingDrawingRect",ee),n.current.on("deleteSelectedRects",te),n.current.on("onRightClick",re),()=>{var o,t,r,i,l;(o=n.current)==null||o.unbind("updateDragResult",Y),(t=n.current)==null||t.unbind("afterAddingDrawingRect",ee),(r=n.current)==null||r.unbind("deleteSelectedRects",te),(i=n.current)==null||i.unbind("onRightClick",re),(l=n.current)==null||l.destroy()}}},[]),p(()=>{const e=t=>$(void 0,null,function*(){try{return yield Le.load(t)}catch(r){return console.error("Error loading image:",r),null}}),o=()=>$(void 0,null,function*(){var t;K(!0);let r=yield e(E);!r&&w&&(r=yield e(w)),r&&((t=n.current)==null||t.setImgNode(r),b(r)),K(!1)});n.current&&(E||w)&&o()},[E,w]),p(()=>{var e;(e=n.current)==null||e.setSize(g)},[g]),p(()=>{j!==P.current&&h()},[j]),p(()=>{var e,o;const t=I.find(r=>r.id===n.current.selectedRectID);(o=(e=n.current)==null?void 0:e.setDefaultAttribute)==null||o.call(e,N),t&&de(r=>{var i;const l=[];let d=null;return r.forEach(D=>{D.id!==n.current.selectedRectID?l.push(D):d=D}),t.extId===void 0&&(d=(i=n.current)==null?void 0:i.selectedRect),[...l,C(v({},d||{}),{attribute:N})]}),M(!0),h()},[N]),p(()=>{const e=X.current;je.isEqual(e,I)||(M(!0),h(),X.current=I)},[I]),p(()=>{h()},[u]),p(()=>{var e,o,t,r;const i=(o=(e=n.current)==null?void 0:e.config)!=null?o:{},l=C(v({},i),{attributeList:(t=_.attributeList)!=null?t:[]});(r=n.current)==null||r.setConfig(JSON.stringify(l))},[_.attributeList]),p(()=>{var e;(e=n.current)==null||e.setEnableAddRect(m.length===0),h()},[m]),Ie(()=>{if(!x||!ge){S(!0),u&&(n.current.setHoverRectID(""),n.current.render());return}const{rectList:e,size:o,zoom:t,imgNode:r}=n.current,i=e.find(d=>d.boxID===x||d.extId===x),l=Oe.getBasicRecPos(r,i,o,.5);if(!l){S(!0);return}u&&n.current.setHoverRectID(i.id),n.current.setCurrentPos(l.currentPos),n.current.setZoom(l.innerZoom),n.current.renderBasicCanvas(),n.current.render()},[x],{wait:200}),p(()=>{const{hiddenText:e}=z||{};if(e===void 0)return;const o=n.current;if(!o)return;const t=v(v({},o.style),z);o.setStyle(t)},[z]),p(()=>{h()},[R]),q.createElement(he,{spinning:me},q.createElement("div",{ref:A,style:v({position:"relative"},g)}))};var Fe=Ce(ye,null,null,{context:Pe})(Te);export{Fe as default};
@@ -1 +1 @@
1
- import{getClassName as d}from"../../utils/dom.js";import{cKeyCode as J,PointCloud as Q}from"@labelbee/lb-annotation";import{PointCloudUtils as T,toolStyleConverter as W,EPerspectiveView as E}from"@labelbee/lb-utils";import N from"classnames";import o,{useContext as b,useState as y,useRef as X,useEffect as u,useMemo as Y}from"react";import{PointCloudContainer as $}from"./PointCloudLayout.js";import{PointCloudContext as ee}from"./PointCloudContext.js";import{a2MapStateToProps as te}from"../../store/annotation/map.js";import{connect as oe}from"react-redux";import{jsonParser as ne}from"../../utils/index.js";import{useSingleBox as ie}from"./hooks/useSingleBox.js";import{useSphere as le}from"./hooks/useSphere.js";import{Switch as re,Tooltip as ae}from"antd";import se from"../../hooks/useSize.js";import{usePointCloudViews as ce}from"./hooks/usePointCloudViews.js";import{useTranslation as k}from"react-i18next";import{LabelBeeContext as de}from"../../store/ctx.js";import me from"./components/PointCloudSizeSlider/index.js";import ue from"./components/TitleButton/index.js";import{LeftOutlined as pe}from"@ant-design/icons";import{useToolStyleContext as ve}from"../../hooks/useToolStyle.js";var we=Object.defineProperty,fe=Object.defineProperties,Ce=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,Ve=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,F=(n,l,r)=>l in n?we(n,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[l]=r,A=(n,l)=>{for(var r in l||(l={}))Ve.call(l,r)&&F(n,r,l[r]);if(R)for(var r of R(l))ge.call(l,r)&&F(n,r,l[r]);return n},Pe=(n,l)=>fe(n,Ce(l));const he=J.default,Ee="LABELBEE-POINTCLOUD",_=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),v=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:r}=b(_),w=t=>N({[d("point-cloud-3d-view",t)]:!0,active:l});return o.createElement("span",{onClick:()=>{r(E[n])},className:w(n.toLocaleLowerCase())})},H=({isEnlarge:n})=>{const{reset3DView:l,followTopView:r}=b(_),{t:w}=k(),t=o.createElement(o.Fragment,null,o.createElement(v,{perspectiveView:"Top"}),o.createElement(v,{perspectiveView:"Front"}),o.createElement(v,{perspectiveView:"Left"}),o.createElement(v,{perspectiveView:"Back"}),o.createElement(v,{perspectiveView:"Right"}),o.createElement(v,{perspectiveView:"LFT"}),o.createElement(v,{perspectiveView:"RBT"})),g=o.createElement(o.Fragment,null,o.createElement(ae,{title:w("CameraFollowTopView")},o.createElement("span",{onClick:()=>{r()},className:d("point-cloud-3d-view","followTop")})),o.createElement("span",{onClick:()=>{l()},className:d("point-cloud-3d-view","reset")}));return n?o.createElement("div",{className:d("point-cloud-3d-sidebarZoom")},g,t):o.createElement("div",{className:d("point-cloud-3d-sidebar")},t,g)},_e=({currentData:n,config:l,highlightAttribute:r})=>{var w;const t=b(ee),[g,U]=y(!0),[f,x]=y(!1),C=X(null),{initPointCloud3d:B}=ce(),V=se(C),{t:I}=k(),{value:L}=ve(),{hiddenText:j}=L||{};u(()=>{let e=t.mainViewInstance;e&&e.updateHiddenTextAndRender(j,t.pointCloudBoxList)},[L]),u(()=>{!t.mainViewInstance||B==null||B(V)},[V]);const{selectedBox:m}=ie(),{selectedSphere:P}=le(),[K,O]=y(!0),S=e=>{var i,a;const s=m==null?void 0:m.info;if(s){const c=A({},s.center);c.x=c.x-.01,c.z=1e3;const p=e===E.Top;(i=t.mainViewInstance)==null||i.updateCameraByBox(s,e,p?c:void 0)}P&&((a=t.mainViewInstance)==null||a.updateCameraBySphere(P,e))},M=()=>{var e;(e=t.mainViewInstance)==null||e.resetCamera()},Z=()=>{var e,i;const a=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance.camera;a&&((i=t.mainViewInstance)==null||i.applyCameraTarget(a))};u(()=>{if(C.current&&(n==null?void 0:n.url)){let e=t.mainViewInstance;!e&&V.width&&(e=new Q({container:C.current,isOrthographicCamera:!0,orthographicParams:T.getDefaultOrthographicParams(V),config:l,hiddenText:j}),e.setHandlerPipe({setSelectedIDs:t.setSelectedIDs,setNeedUpdateCenter:O}),t.setMainViewInstance(e))}},[V,n]),u(()=>{var e;if(C.current&&(n==null?void 0:n.url)&&n.result&&t.mainViewInstance){let i=t.mainViewInstance;const a=T.getBoxParamsFromResultList(n.result);a.forEach(c=>{var p;const h=(p=W.getColorFromConfig({attribute:c.attribute},Pe(A({},l),{attributeConfigurable:!0}),{}))==null?void 0:p.hex;i==null||i.addBoxToSense(c,h)}),i.render(),t.setPointCloudResult(a);const s=T.getRectParamsFromResultList(n.result);t.setRectList(s),t.setPointCloudValid((e=ne(n.result))==null?void 0:e.valid)}},[n,t.mainViewInstance]),u(()=>{var e,i,a,s,c,p;const h=(e=m==null?void 0:m.info)==null?void 0:e.id;if(!K){O(!0);return}if(h!==void 0){S(E.Top);const G=(s=(a=(i=t.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:a.camera.zoom)!=null?s:1;(c=t.mainViewInstance)==null||c.updateCameraZoom(G),(p=t.mainViewInstance)==null||p.setHighlightColor(h)}},[(w=m==null?void 0:m.info)==null?void 0:w.id]),u(()=>{var e,i,a,s;if(P){S(E.Top);const c=(a=(i=(e=t.topViewInstance)==null?void 0:e.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?a:1;(s=t.mainViewInstance)==null||s.updateCameraZoom(c)}},[P]),u(()=>(window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D)}),[]);const D=e=>{if(e.keyCode===he.Esc){x(!1);return}},z=Y(()=>({reset3DView:M,setTarget3DView:S,isActive:!!m,followTopView:Z}),[m,t.mainViewInstance]);u(()=>{var e,i,a;const s=t.pointCloudBoxList.filter(c=>c.attribute===r);(s==null?void 0:s.length)>0&&((e=t.mainViewInstance)==null||e.clearHighlightBoxes(),(i=t.mainViewInstance)==null||i.highlightBoxes(s)),s.length===0&&((a=t.mainViewInstance)==null||a.clearHighlightBoxesAndRender())},[r,t.mainViewInstance]);const q=o.createElement(o.Fragment,null,o.createElement(me,{onChange:e=>{var i;(i=t.mainViewInstance)==null||i.updatePointSize({customSize:e})}}),o.createElement("span",{style:{marginRight:8}},I("ShowArrows")),o.createElement(re,{size:"small",checked:g,onChange:e=>{var i;U(e),(i=t.mainViewInstance)==null||i.setShowDirection(e)}}),f&&o.createElement(_.Provider,{value:z},o.createElement(H,{isEnlarge:f})));return o.createElement($,{className:N({[d("point-cloud-3d-container")]:!0,[d("point-cloud-container","zoom")]:f}),title:f?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(pe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{x(!1)}}),I("3DView")):o.createElement(ue,{title:I("3DView"),onClick:()=>{x(!0)}}),toolbar:q},o.createElement("div",{className:d("point-cloud-3d-content")},!f&&o.createElement(_.Provider,{value:z},o.createElement(H,null)),o.createElement("div",{className:d("point-cloud-3d-view"),id:Ee,ref:C})))};var xe=oe(te,null,null,{context:de})(_e);export{xe as default};
1
+ import{getClassName as u}from"../../utils/dom.js";import{cKeyCode as $,PointCloud as ee}from"@labelbee/lb-annotation";import{PointCloudUtils as T,EPerspectiveView as E}from"@labelbee/lb-utils";import R from"classnames";import o,{useContext as b,useState as y,useRef as te,useEffect as p,useMemo as oe}from"react";import{PointCloudContainer as ne}from"./PointCloudLayout.js";import{PointCloudContext as ie}from"./PointCloudContext.js";import{a2MapStateToProps as le}from"../../store/annotation/map.js";import{connect as re}from"react-redux";import{jsonParser as se}from"../../utils/index.js";import{useSingleBox as O}from"./hooks/useSingleBox.js";import{useSphere as ae}from"./hooks/useSphere.js";import{Switch as ce,Tooltip as de}from"antd";import ue from"../../hooks/useSize.js";import{usePointCloudViews as me}from"./hooks/usePointCloudViews.js";import{useTranslation as A}from"react-i18next";import{LabelBeeContext as pe}from"../../store/ctx.js";import we from"./components/PointCloudSizeSlider/index.js";import ve from"./components/TitleButton/index.js";import{LeftOutlined as fe}from"@ant-design/icons";import{useToolStyleContext as Ce}from"../../hooks/useToolStyle.js";import{usePointCloudAttribute as Ve}from"./hooks/usePointCloudAttribute.js";var ge=Object.defineProperty,F=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,H=(n,l,r)=>l in n?ge(n,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[l]=r,Ee=(n,l)=>{for(var r in l||(l={}))Ie.call(l,r)&&H(n,r,l[r]);if(F)for(var r of F(l))Pe.call(l,r)&&H(n,r,l[r]);return n};const he=$.default,xe="LABELBEE-POINTCLOUD",h=o.createContext({isActive:!1,setTarget3DView:()=>{},reset3DView:()=>{},followTopView:()=>{}}),v=({perspectiveView:n})=>{const{isActive:l,setTarget3DView:r}=b(h),f=w=>R({[u("point-cloud-3d-view",w)]:!0,active:l});return o.createElement("span",{onClick:()=>{r(E[n])},className:f(n.toLocaleLowerCase())})},U=({isEnlarge:n})=>{const{reset3DView:l,followTopView:r}=b(h),{t:f}=A(),w=o.createElement(o.Fragment,null,o.createElement(v,{perspectiveView:"Top"}),o.createElement(v,{perspectiveView:"Front"}),o.createElement(v,{perspectiveView:"Left"}),o.createElement(v,{perspectiveView:"Back"}),o.createElement(v,{perspectiveView:"Right"}),o.createElement(v,{perspectiveView:"LFT"}),o.createElement(v,{perspectiveView:"RBT"})),e=o.createElement(o.Fragment,null,o.createElement(de,{title:f("CameraFollowTopView")},o.createElement("span",{onClick:()=>{r()},className:u("point-cloud-3d-view","followTop")})),o.createElement("span",{onClick:()=>{l()},className:u("point-cloud-3d-view","reset")}));return n?o.createElement("div",{className:u("point-cloud-3d-sidebarZoom")},e,w):o.createElement("div",{className:u("point-cloud-3d-sidebar")},w,e)},_e=({currentData:n,config:l,highlightAttribute:r,setResourceLoading:f})=>{var w;const e=b(ie),[K,M]=y(!0),[C,x]=y(!1),V=te(null),{initPointCloud3d:B,generateRects:Z}=me(),g=ue(V),{t:_}=A(),{value:L}=Ce(),{hiddenText:j}=L||{},{updatePointCloudAttribute:q}=Ve(f,l),{updateSelectedBox:G}=O({generateRects:Z});p(()=>{let t=e.mainViewInstance;t&&t.updateHiddenTextAndRender(j,e.pointCloudBoxList)},[L]),p(()=>{!e.mainViewInstance||B==null||B(g)},[g]);const{selectedBox:m}=O(),{selectedSphere:I}=ae(),[J,D]=y(!0),S=t=>{var i,s;const a=m==null?void 0:m.info;if(a){const c=Ee({},a.center);c.x=c.x-.01,c.z=1e3;const d=t===E.Top;(i=e.mainViewInstance)==null||i.updateCameraByBox(a,t,d?c:void 0)}I&&((s=e.mainViewInstance)==null||s.updateCameraBySphere(I,t))},Q=()=>{var t;(t=e.mainViewInstance)==null||t.resetCamera()},W=()=>{var t,i;const s=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance.camera;s&&((i=e.mainViewInstance)==null||i.applyCameraTarget(s))};p(()=>{if(V.current&&(n==null?void 0:n.url)){let t=e.mainViewInstance;!t&&g.width&&(t=new ee({container:V.current,isOrthographicCamera:!0,orthographicParams:T.getDefaultOrthographicParams(g),config:l,hiddenText:j}),t.setHandlerPipe({setSelectedIDs:e.setSelectedIDs,setNeedUpdateCenter:D}),e.setMainViewInstance(t))}},[g,n]),p(()=>{var t,i;if(V.current&&(n==null?void 0:n.url)&&n.result&&e.mainViewInstance){let s=e.mainViewInstance;const a=T.getRectParamsFromResultList(n.result),c=T.getBoxParamsFromResultList(n.result),d=c.find(P=>P.id===e.selectedID);d&&((t=e.topViewInstance)==null||t.updatePolygonList(c,void 0),q(d.attribute),G(d),e.setSelectedIDs(d.id)),e.setPointCloudValid((i=se(n.result))==null?void 0:i.valid),e.setPointCloudResult(c),e.setRectList(a),s.generateBoxes(c)}},[n.result,e.mainViewInstance]),p(()=>{var t,i,s,a,c,d,P;const N=(t=m==null?void 0:m.info)==null?void 0:t.id;if(!J){D(!0);return}if(N!==void 0){S(E.Top);const Y=(a=(s=(i=e.topViewInstance)==null?void 0:i.pointCloudInstance)==null?void 0:s.camera.zoom)!=null?a:1;(c=e.mainViewInstance)==null||c.updateCameraZoom(Y)}(d=e.mainViewInstance)==null||d.setHighlightColor(N),(P=e.mainViewInstance)==null||P.render()},[(w=m==null?void 0:m.info)==null?void 0:w.id]),p(()=>{var t,i,s,a;if(I){S(E.Top);const c=(s=(i=(t=e.topViewInstance)==null?void 0:t.pointCloudInstance)==null?void 0:i.camera.zoom)!=null?s:1;(a=e.mainViewInstance)==null||a.updateCameraZoom(c)}},[I]),p(()=>(window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)}),[]);const z=t=>{if(t.keyCode===he.Esc){x(!1);return}},k=oe(()=>({reset3DView:Q,setTarget3DView:S,isActive:!!m,followTopView:W}),[m,e.mainViewInstance]);p(()=>{var t,i,s;const a=e.pointCloudBoxList.filter(c=>c.attribute===r);(a==null?void 0:a.length)>0&&((t=e.mainViewInstance)==null||t.clearHighlightBoxes(),(i=e.mainViewInstance)==null||i.highlightBoxes(a)),a.length===0&&((s=e.mainViewInstance)==null||s.clearHighlightBoxesAndRender())},[r,e.mainViewInstance]);const X=o.createElement(o.Fragment,null,o.createElement(we,{onChange:t=>{var i;(i=e.mainViewInstance)==null||i.updatePointSize({customSize:t})}}),o.createElement("span",{style:{marginRight:8}},_("ShowArrows")),o.createElement(ce,{size:"small",checked:K,onChange:t=>{var i;M(t),(i=e.mainViewInstance)==null||i.setShowDirection(t)}}),C&&o.createElement(h.Provider,{value:k},o.createElement(U,{isEnlarge:C})));return o.createElement(ne,{className:R({[u("point-cloud-3d-container")]:!0,[u("point-cloud-container","zoom")]:C}),title:C?o.createElement("div",{style:{display:"flex",alignItems:"center"}},o.createElement(fe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{x(!1)}}),_("3DView")):o.createElement(ve,{title:_("3DView"),onClick:()=>{x(!0)}}),toolbar:X},o.createElement("div",{className:u("point-cloud-3d-content")},!C&&o.createElement(h.Provider,{value:k},o.createElement(U,null)),o.createElement("div",{className:u("point-cloud-3d-view"),id:xe,ref:V})))};var Se=re(le,null,null,{context:pe})(_e);export{Se as default};
@@ -1 +1 @@
1
- import{PointCloudContext as re}from"./PointCloudContext.js";import{useRotate as se}from"./hooks/useRotate.js";import{useRotateEdge as ne}from"./hooks/useRotateEdge.js";import{useBoxes as ie}from"./hooks/useBoxes.js";import{useSingleBox as ae}from"./hooks/useSingleBox.js";import{useSphere as ue}from"./hooks/useSphere.js";import{useContext as le,useEffect as d}from"react";import{CommonToolUtils as ce,AttributeUtils as de,EToolName as f,cTool as pe}from"@labelbee/lb-annotation";import{message as g}from"antd";import{connect as me}from"react-redux";import{a2MapStateToProps as be}from"../../store/annotation/map.js";import{useStatus as fe}from"./hooks/useStatus.js";import{usePointCloudViews as Pe}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as ye}from"../../store/ctx.js";import{useHistory as ve}from"./hooks/useHistory.js";import{useAttribute as we}from"./hooks/useAttribute.js";import{useConfig as Ce}from"./hooks/useConfig.js";import{usePolygon as he}from"./hooks/usePolygon.js";import{useLine as ge}from"./hooks/useLine.js";import{useUpdatePointCloudColor as Se}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as ke}from"react-i18next";import{useLatest as j}from"ahooks";var xe=Object.defineProperty,_e=Object.defineProperties,Ve=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,A=(n,r,a)=>r in n?xe(n,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[r]=a,P=(n,r)=>{for(var a in r||(r={}))Be.call(r,a)&&A(n,a,r[a]);if(I)for(var a of I(r))Le.call(r,a)&&A(n,a,r[a]);return n},y=(n,r)=>_e(n,Ve(r));const{EPolygonPattern:Oe}=pe,je=({currentData:n,config:r,checkMode:a,configString:E,imgIndex:S,toolInstanceRef:i,setResourceLoading:k})=>{const e=le(re),{changeSelectedBoxValid:T,selectNextBox:D,selectPrevBox:H,updateSelectedBox:K,deleteSelectedPointCloudBoxAndPolygon:N}=ae(),{selectedSphere:v,updatePointCloudSphere:U}=ue(),{clearAllResult:w,updatePointCloudPattern:z}=fe(),{copySelectedBoxes:R,pasteSelectedBoxes:F,copiedBoxes:Ae}=ie({config:r,currentData:n}),{updateRotate:x}=se({currentData:n}),{updateRotateEdge:q}=ne({currentData:n}),{updatePointCloudData:m,topViewSelectedChanged:G}=Pe({setResourceLoading:k}),{redo:_,undo:V,pushHistoryWithList:M,pushHistoryUnderUpdatePolygon:W,pushHistoryUnderUpdateLine:Y}=ve(),{syncThreeViewsAttribute:B}=we(),{syncAllViewsConfig:$,reRenderTopViewRange:J}=Ce(),{selectedPolygon:L}=he(),{selectedLine:O}=ge(),{t:C}=ke(),{updatePointCloudColor:Q}=Se(k,r),X=j(n),b=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Z=(t,o)=>{var s,u;const{topViewInstance:c,mainViewInstance:l}=e;if(!c)return;const{pointCloud2dOperation:h}=c;switch(t){case"q":{x(e.rectRotateSensitivity);break}case"e":x(-Number(e.rectRotateSensitivity));break;case"g":q(-90);break;case"u":{const p=h.pattern===Oe.Normal?f.Rect:f.Polygon;z(p);const oe={[f.Polygon]:C("PolygonPattern"),[f.Rect]:C("RectPattern")};g.success(C("ChangePatternMsg",{pattern:oe[p]})),h.clearActiveStatus(),h.clearDrawingStatus()}break;case"+":l==null||l.updatePointSize({zoomIn:!0});break;case"-":l==null||l.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){H();break}D(),o.preventDefault();break;case"f":T();break;case"arrowup":b({y:-1});break;case"arrowdown":b({y:1});break;case"arrowleft":b({x:-1});break;case"arrowright":b({x:1});break;case"delete":N(X.current);break;default:{if(((s=r.attributeList)==null?void 0:s.length)>0){const p=de.getAttributeByKeycode(o.keyCode,r.attributeList);p!==void 0&&((u=i.current)==null||u.setDefaultAttribute(p))}return}}},ee=(t,o)=>{switch(t){case"c":R();break;case"v":F();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?_():V();break}}},te=j(t=>{if(!ce.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){ee(o,t);return}Z(o,t)});return d(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(c=>te.current(c))},[e,e.topViewInstance,e.windowKeydownListenerHook]),d(()=>{$(r)},[E]),d(()=>{(r==null?void 0:r.radius)&&J(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),d(()=>{m==null||m()},[S,e.mainViewInstance]),d(()=>{e.setHideAttributes([])},[S]),d(()=>{i.current.setDefaultAttribute=t=>{var o;if(B(t),Q(t),L&&W(y(P({},L),{attribute:t})),O&&Y(y(P({},O),{attribute:t})),v){const s=U(y(P({},v),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),G({newSelectedSphere:v,newSphereList:s}))}},i.current.setSubAttribute=(t,o)=>{var s;const u=e.selectedPointCloudBox;if(u){const c=(s=u==null?void 0:u.subAttribute)!=null?s:{};u.subAttribute=y(P({},c),{[t]:o}),K(u),e.mainViewInstance&&e.selectedPointCloudBox&&e.mainViewInstance.generateBox(e.selectedPointCloudBox)}},i.current.clearResult=()=>{w==null||w()},i.current.redo=()=>{_()},i.current.undo=()=>{V()},i.current.setValid=t=>{i.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&w()})},i.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},i.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},i.current.asyncData=t=>{setTimeout(()=>{m==null||m(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),d(()=>{i.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},i.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),d(()=>{i.current.history={pushHistory:t=>{M({pointCloudBoxList:t})},initRecord:()=>{}}},[]),d(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=l=>{B(l)},u=l=>{g.error(l)},c=l=>{g.info(l)};return o.on("syncAttribute",s),o.on("messageError",u),o.on("messageInfo",c),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",u),o.unbind("messageInfo",c)}},[e.topViewInstance]),null};var Ie=me(be,null,null,{context:ye})(je);export{Ie as default};
1
+ import{PointCloudContext as te}from"./PointCloudContext.js";import{useRotate as oe}from"./hooks/useRotate.js";import{useRotateEdge as re}from"./hooks/useRotateEdge.js";import{useBoxes as se}from"./hooks/useBoxes.js";import{useSingleBox as ne}from"./hooks/useSingleBox.js";import{useSphere as ie}from"./hooks/useSphere.js";import{useContext as ae,useEffect as c}from"react";import{CommonToolUtils as ue,EToolName as P,cTool as le}from"@labelbee/lb-annotation";import{message as C}from"antd";import{connect as ce}from"react-redux";import{a2MapStateToProps as de}from"../../store/annotation/map.js";import{useStatus as pe}from"./hooks/useStatus.js";import{usePointCloudViews as me}from"./hooks/usePointCloudViews.js";import{LabelBeeContext as Pe}from"../../store/ctx.js";import{useHistory as fe}from"./hooks/useHistory.js";import{useAttribute as we}from"./hooks/useAttribute.js";import{useConfig as be}from"./hooks/useConfig.js";import{usePolygon as ye}from"./hooks/usePolygon.js";import{useLine as ve}from"./hooks/useLine.js";import{useUpdatePointCloudColor as Ce}from"./hooks/useUpdatePointCloudColor.js";import{useTranslation as he}from"react-i18next";import{useLatest as B}from"ahooks";var ge=Object.defineProperty,Se=Object.defineProperties,ke=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,j=(i,r,a)=>r in i?ge(i,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[r]=a,f=(i,r)=>{for(var a in r||(r={}))xe.call(r,a)&&j(i,a,r[a]);if(O)for(var a of O(r))Ve.call(r,a)&&j(i,a,r[a]);return i},w=(i,r)=>Se(i,ke(r));const{EPolygonPattern:_e}=le,Ie=({currentData:i,config:r,checkMode:a,configString:L,imgIndex:h,toolInstanceRef:u,setResourceLoading:g})=>{const e=ae(te),{changeSelectedBoxValid:E,selectNextBox:A,selectPrevBox:T,updateSelectedBox:D,deleteSelectedPointCloudBoxAndPolygon:H}=ne(),{selectedSphere:b,updatePointCloudSphere:K}=ie(),{clearAllResult:y,updatePointCloudPattern:N}=pe(),{copySelectedBoxes:U,pasteSelectedBoxes:z,copiedBoxes:Oe}=se({config:r,currentData:i}),{updateRotate:S}=oe({currentData:i}),{updateRotateEdge:R}=re({currentData:i}),{updatePointCloudData:p,topViewSelectedChanged:F}=me({setResourceLoading:g}),{redo:k,undo:x,pushHistoryWithList:q,pushHistoryUnderUpdatePolygon:G,pushHistoryUnderUpdateLine:M}=fe(),{syncThreeViewsAttribute:V}=we(),{syncAllViewsConfig:W,reRenderTopViewRange:Y}=be(),{selectedPolygon:_}=ye(),{selectedLine:I}=ve(),{t:v}=he(),{updatePointCloudColor:$}=Ce(g,r),J=B(i),m=t=>{var o;const{topViewInstance:s}=e;!s||(o=s.pointCloud2dOperation)==null||o.updateSelectedPolygonsPoints(t)},Q=(t,o)=>{const{topViewInstance:s,mainViewInstance:n}=e;if(!s)return;const{pointCloud2dOperation:l}=s;switch(t){case"q":{S(e.rectRotateSensitivity);break}case"e":S(-Number(e.rectRotateSensitivity));break;case"g":R(-90);break;case"u":{const d=l.pattern===_e.Normal?P.Rect:P.Polygon;N(d);const ee={[P.Polygon]:v("PolygonPattern"),[P.Rect]:v("RectPattern")};C.success(v("ChangePatternMsg",{pattern:ee[d]})),l.clearActiveStatus(),l.clearDrawingStatus()}break;case"+":n==null||n.updatePointSize({zoomIn:!0});break;case"-":n==null||n.updatePointSize({zoomIn:!1});break;case"v":e.setPointCloudValid(!e.valid);break;case"tab":if(o.shiftKey){T();break}A(),o.preventDefault();break;case"f":E();break;case"arrowup":m({y:-1});break;case"arrowdown":m({y:1});break;case"arrowleft":m({x:-1});break;case"arrowright":m({x:1});break;case"delete":H(J.current);break}},X=(t,o)=>{switch(t){case"c":U();break;case"v":z();break;case"a":o.preventDefault(),e.selectedAllBoxes();break;case"z":{o.shiftKey?k():x();break}}},Z=B(t=>{if(!ue.hotkeyFilter(t)||a===!0)return;const o=t.key.toLocaleLowerCase();if(t.ctrlKey){X(o,t);return}Q(o,t)});return c(()=>{if(!e.topViewInstance)return;const{addEventListener:o}=e.windowKeydownListenerHook;return o(l=>Z.current(l))},[e,e.topViewInstance,e.windowKeydownListenerHook]),c(()=>{W(r)},[L]),c(()=>{(r==null?void 0:r.radius)&&Y(r==null?void 0:r.radius)},[r==null?void 0:r.radius]),c(()=>{p==null||p()},[h,e.mainViewInstance]),c(()=>{e.setHideAttributes([])},[h]),c(()=>{u.current.setDefaultAttribute=t=>{var o;if(V(t),$(t),_&&G(w(f({},_),{attribute:t})),I&&M(w(f({},I),{attribute:t})),b){const s=K(w(f({},b),{attribute:t}));e.mainViewInstance&&((o=e.mainViewInstance)==null||o.generateSpheres(s),F({newSelectedSphere:b,newSphereList:s}))}},u.current.setSubAttribute=(t,o)=>{var s;const n=e.selectedPointCloudBox;if(n){const l=(s=n==null?void 0:n.subAttribute)!=null?s:{};n.subAttribute=w(f({},l),{[t]:o}),D(n),e.mainViewInstance&&e.selectedPointCloudBox&&(e.mainViewInstance.generateBox(e.selectedPointCloudBox),e.mainViewInstance.setHighlightColor(n.id),e.mainViewInstance.render())}},u.current.clearResult=()=>{y==null||y()},u.current.redo=()=>{k()},u.current.undo=()=>{x()},u.current.setValid=t=>{u.current.valid=t,setTimeout(()=>{e.setPointCloudValid(t),t===!1&&y()})},u.current.setForbidOperation=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setForbidOperation(t),t===!0&&e.setSelectedIDs(void 0)},u.current.setShowDefaultCursor=t=>{var o,s;(s=(o=e.topViewInstance)==null?void 0:o.pointCloud2dOperation)==null||s.setShowDefaultCursor(t)},u.current.asyncData=t=>{setTimeout(()=>{p==null||p(t)})}},[e.pointCloudBoxList,e.pointCloudSphereList,e.selectedID,e.selectedIDs,e.valid,e.polygonList,e.lineList,e.mainViewInstance,e.ptSegmentInstance]),c(()=>{u.current.updateSegmentTool=t=>{var o;(o=e.ptSegmentInstance)==null||o.emit(t)},u.current.segmentInstance=e.ptSegmentInstance},[e.ptSegmentInstance]),c(()=>{u.current.history={pushHistory:t=>{q({pointCloudBoxList:t})},initRecord:()=>{}}},[]),c(()=>{var t;const o=(t=e.topViewInstance)==null?void 0:t.toolInstance;if(!o||a)return;const s=d=>{V(d)},n=d=>{C.error(d)},l=d=>{C.info(d)};return o.on("syncAttribute",s),o.on("messageError",n),o.on("messageInfo",l),()=>{o.unbind("syncAttribute",s),o.unbind("messageError",n),o.unbind("messageInfo",l)}},[e.topViewInstance]),null};var Be=ce(de,null,null,{context:Pe})(Ie);export{Be as default};
@@ -1 +1 @@
1
- import{ESubmitType as L}from"../../../../constant/index.js";import{ToSubmitFileData as z,BatchUpdateResultByTrackID as R}from"../../../../store/annotation/actionCreators.js";import{LabelBeeContext as T,useDispatch as M}from"../../../../store/ctx.js";import{Form as u,Modal as q,InputNumber as _,Select as g,Popover as N,message as V}from"antd";import e,{useState as H,useEffect as K,useCallback as Q}from"react";import{useTranslation as W}from"react-i18next";import{QuestionCircleOutlined as $}from"@ant-design/icons";import{PointCloudUtils as F}from"@labelbee/lb-utils";import{connect as G}from"react-redux";import{useSingleBox as J}from"../../hooks/useSingleBox.js";import{MathUtils as X}from"@labelbee/lb-annotation";var Y=Object.defineProperty,Z=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,w=(r,n,a)=>n in r?Y(r,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[n]=a,v=(r,n)=>{for(var a in n||(n={}))te.call(n,a)&&w(r,a,n[a]);if(B)for(var a of B(n))re.call(n,a)&&w(r,a,n[a]);return r},ne=(r,n)=>Z(r,ee(n));const ae={labelCol:{span:8},wrapperCol:{span:16}},O=[{required:!0,message:"\u8BF7\u586B\u5199\u4E00\u4E2A\u6570\u5B57"}],le=[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u5C5E\u6027"}],h=2,k=({text:r})=>e.createElement("span",{style:{borderRadius:"4px 0px 0px 4px",padding:"0px 12px",background:"#FAFAFA",border:"1px solid rgb(217 217 217)",borderRight:"0",display:"flex",alignItems:"center",height:32}},r),ie=({id:r,visible:n,onCancel:a,config:m,imgList:y,imgIndex:A})=>{const P=M(),{selectedBox:i}=J(),[p,E]=H(),[d]=u.useForm(),{t:o}=W();K(()=>{n===!1?(d.resetFields(),E(void 0)):b()},[n]);const C=t=>{var s;if(!r)return;if(!p){V.info("\u8BE5\u8303\u56F4\u4E0D\u5B58\u5728\u66F4\u6539\u6570\u636E, \u8BF7\u66F4\u6539\u7EDF\u4E00\u8303\u56F4");return}P(z(L.SyncImgList));const l={attribute:t.attribute};if(m.secondaryAttributeConfigurable){const c={};(s=m.inputList)==null||s.forEach(f=>{const x=t[f.value];x!==void 0&&Object.assign(c,{[f.value]:x})}),Object.keys(c).length>0&&Object.assign(l,{subAttribute:c})}p&&Object.assign(l,p),P(R(r,l,[t.prevPage-1,t.nextPage-1])),a()},b=Q(()=>{var t;const{prevPage:s,nextPage:l}=d.getFieldsValue(["prevPage","nextPage"]),c=y.filter((x,U)=>X.isInRange(U,[s-1,l-1]));if(!((c==null?void 0:c.length)>0)||!(i==null?void 0:i.info)||((t=i==null?void 0:i.info)==null?void 0:t.trackID)===void 0){E(void 0);return}const f=F.getMaxSizeFromBox({trackID:i.info.trackID,imgList:c});E(f)},[y,i,A]),D=()=>d.submit(),j=()=>{if(!p||!(i==null?void 0:i.info))return;const t={marginRight:16},{length:s,width:l,height:c}=F.transferBox2Kitti(v(v({},i==null?void 0:i.info),p));return e.createElement("div",null,e.createElement("span",{style:t},o("Length"),": ",s.toFixed(h)),e.createElement("span",{style:t},o("Width"),": ",l.toFixed(h)),e.createElement("span",{style:t},o("Height"),": ",c.toFixed(h)),e.createElement(N,{placement:"rightBottom",content:"\u7EDF\u4E00\u5C3A\u5BF8\u4E3A\u8BE5ID\u7684\u6240\u6709\u6807\u6CE8\u6846\u4E2D\u6700\u5927\u7684\u5C3A\u5BF8"},e.createElement($,null)))},S={width:"200px"},I={marginBottom:"24px",display:"flex",alignItems:"center"};return e.createElement(q,{title:o("UnifyParams"),visible:n,onCancel:a,onOk:D,wrapClassName:"labelbee-custom-modal"},e.createElement(u,ne(v({},ae),{form:d,onFinish:C}),e.createElement(u.Item,{name:"id",label:o("UnifyTrackID")},r),e.createElement(u.Item,{label:o("UnifyAttributeRange"),required:!0},e.createElement(u.Item,{style:{display:"inline-block"},rules:O,name:"prevPage",noStyle:!0,initialValue:1},e.createElement(_,{precision:0,min:1,style:{width:"80px"},onChange:()=>b()})),e.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),e.createElement(u.Item,{style:{display:"inline-block"},rules:O,name:"nextPage",noStyle:!0,initialValue:y.length},e.createElement(_,{precision:0,min:1,style:{width:"80px"},onChange:()=>b()})),e.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},o("Page"))),e.createElement(u.Item,{name:"UnifySize",label:o("UnifySize")},j()),e.createElement(u.Item,{label:o("UnifyTag"),required:!0},e.createElement("div",{style:I},e.createElement(k,{text:o("Attribute")}),e.createElement(u.Item,{name:"attribute",noStyle:!0,rules:le},e.createElement(g,{style:S},m.attributeList.map(t=>e.createElement(g.Option,{key:t.value,value:t.value},t.key))))),m.secondaryAttributeConfigurable&&m.inputList.map(t=>{var s;return e.createElement("div",{key:t.value,style:I},e.createElement(k,{text:t.key}),e.createElement(u.Item,{name:t.value,noStyle:!0,required:!1},e.createElement(g,{style:S},(s=t.subSelected)==null?void 0:s.map(l=>e.createElement(g.Option,{key:l.value,value:l.value},l.key)))))}))))},oe=r=>({imgIndex:r.annotation.imgIndex});var ue=G(oe,null,null,{context:T})(ie);export{ue as default};
1
+ import{BatchUpdateResultByTrackID as z}from"../../../../store/annotation/actionCreators.js";import{LabelBeeContext as M,useDispatch as R}from"../../../../store/ctx.js";import{Form as u,Modal as L,InputNumber as S,Select as E,Popover as T,message as q}from"antd";import e,{useState as N,useEffect as V,useCallback as H}from"react";import{useTranslation as K}from"react-i18next";import{QuestionCircleOutlined as Q}from"@ant-design/icons";import{PointCloudUtils as F}from"@labelbee/lb-utils";import{connect as W}from"react-redux";import{useSingleBox as $}from"../../hooks/useSingleBox.js";import{MathUtils as G}from"@labelbee/lb-annotation";var J=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,w=(r,n,a)=>n in r?J(r,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[n]=a,h=(r,n)=>{for(var a in n||(n={}))Z.call(n,a)&&w(r,a,n[a]);if(B)for(var a of B(n))ee.call(n,a)&&w(r,a,n[a]);return r},te=(r,n)=>X(r,Y(n));const re={labelCol:{span:8},wrapperCol:{span:16}},A=[{required:!0,message:"\u8BF7\u586B\u5199\u4E00\u4E2A\u6570\u5B57"}],ne=[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u5C5E\u6027"}],P=2,O=({text:r})=>e.createElement("span",{style:{borderRadius:"4px 0px 0px 4px",padding:"0px 12px",background:"#FAFAFA",border:"1px solid rgb(217 217 217)",borderRight:"0",display:"flex",alignItems:"center",height:32}},r),ae=({id:r,visible:n,onCancel:a,config:m,imgList:f,imgIndex:k})=>{const C=R(),{selectedBox:i}=$(),[p,b]=N(),[y]=u.useForm(),{t:o}=K();V(()=>{n===!1?(y.resetFields(),b(void 0)):x()},[n]);const D=t=>{var s;if(!r)return;if(!p){q.info("\u8BE5\u8303\u56F4\u4E0D\u5B58\u5728\u66F4\u6539\u6570\u636E, \u8BF7\u66F4\u6539\u7EDF\u4E00\u8303\u56F4");return}const l={attribute:t.attribute};if(m.secondaryAttributeConfigurable){const c={};(s=m.inputList)==null||s.forEach(g=>{const d=t[g.value];if(d!==void 0){const v=Array.isArray(d)?d.join(";"):d;Object.assign(c,{[g.value]:v})}}),Object.keys(c).length>0&&Object.assign(l,{subAttribute:c})}p&&Object.assign(l,p),C(z(r,l,[t.prevPage-1,t.nextPage-1],f)),a()},x=H(()=>{var t;const{prevPage:s,nextPage:l}=y.getFieldsValue(["prevPage","nextPage"]),c=f.filter((d,v)=>G.isInRange(v,[s-1,l-1]));if(!((c==null?void 0:c.length)>0)||!(i==null?void 0:i.info)||((t=i==null?void 0:i.info)==null?void 0:t.trackID)===void 0){b(void 0);return}const g=F.getMaxSizeFromBox({trackID:i.info.trackID,imgList:c});b(g)},[f,i,k]),j=()=>y.submit(),U=()=>{if(!p||!(i==null?void 0:i.info))return;const t={marginRight:16},{length:s,width:l,height:c}=F.transferBox2Kitti(h(h({},i==null?void 0:i.info),p));return e.createElement("div",null,e.createElement("span",{style:t},o("Length"),": ",s.toFixed(P)),e.createElement("span",{style:t},o("Width"),": ",l.toFixed(P)),e.createElement("span",{style:t},o("Height"),": ",c.toFixed(P)),e.createElement(T,{placement:"rightBottom",content:"\u7EDF\u4E00\u5C3A\u5BF8\u4E3A\u8BE5ID\u7684\u6240\u6709\u6807\u6CE8\u6846\u4E2D\u6700\u5927\u7684\u5C3A\u5BF8"},e.createElement(Q,null)))},_={width:"200px"},I={marginBottom:"24px",display:"flex",alignItems:"center"};return e.createElement(L,{title:o("UnifyParams"),visible:n,onCancel:a,onOk:j,wrapClassName:"labelbee-custom-modal"},e.createElement(u,te(h({},re),{form:y,onFinish:D}),e.createElement(u.Item,{name:"id",label:o("UnifyTrackID")},r),e.createElement(u.Item,{label:o("UnifyAttributeRange"),required:!0},e.createElement(u.Item,{style:{display:"inline-block"},rules:A,name:"prevPage",noStyle:!0,initialValue:1},e.createElement(S,{precision:0,min:1,style:{width:"80px"},onChange:()=>x()})),e.createElement("span",{style:{display:"inline-block",width:"24px",textAlign:"center"}},"-"),e.createElement(u.Item,{style:{display:"inline-block"},rules:A,name:"nextPage",noStyle:!0,initialValue:f.length},e.createElement(S,{precision:0,min:1,style:{width:"80px"},onChange:()=>x()})),e.createElement("span",{style:{display:"inline-block",width:"40x",marginLeft:"10px",textAlign:"center"}},o("Page"))),e.createElement(u.Item,{name:"UnifySize",label:o("UnifySize")},U()),e.createElement(u.Item,{label:o("UnifyTag"),required:!0},e.createElement("div",{style:I},e.createElement(O,{text:o("Attribute")}),e.createElement(u.Item,{name:"attribute",noStyle:!0,rules:ne},e.createElement(E,{style:_},m.attributeList.map(t=>e.createElement(E.Option,{key:t.value,value:t.value},t.key))))),m.secondaryAttributeConfigurable&&m.inputList.map(t=>{var s;return e.createElement("div",{key:t.value,style:I},e.createElement(O,{text:t.key}),e.createElement(u.Item,{name:t.value,noStyle:!0,required:!1},e.createElement(E,{style:_,mode:t.isMulti?"multiple":void 0},(s=t.subSelected)==null?void 0:s.map(l=>e.createElement(E.Option,{key:l.value,value:l.value},l.key)))))}))))},le=r=>({imgIndex:r.annotation.imgIndex});var ie=W(le,null,null,{context:M})(ae);export{ie as default};
@@ -0,0 +1 @@
1
+ import{useContext as j}from"react";import{PointCloudContext as v}from"../PointCloudContext.js";import{useUpdatePointCloudColor as O}from"./useUpdatePointCloudColor.js";import{useAttribute as g}from"./useAttribute.js";import{usePolygon as w}from"./usePolygon.js";import{useLine as S}from"./useLine.js";import{useSphere as c}from"./useSphere.js";import{useHistory as b}from"./useHistory.js";import{usePointCloudViews as V}from"./usePointCloudViews.js";var U=Object.defineProperty,x=Object.defineProperties,L=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,m=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,n=(o,e)=>{for(var t in e||(e={}))H.call(e,t)&&m(o,t,e[t]);if(P)for(var t of P(e))I.call(e,t)&&m(o,t,e[t]);return o},i=(o,e)=>x(o,L(e));const A=(o,e)=>{const{updatePointCloudColor:t}=O(o,e),{syncThreeViewsAttribute:f}=g(),{selectedPolygon:p}=w(),{selectedLine:u}=S(),{selectedSphere:s}=c(),{updatePointCloudSphere:C}=c(),{pushHistoryUnderUpdatePolygon:_,pushHistoryUnderUpdateLine:y}=b(),{topViewSelectedChanged:h}=V(),a=j(v);return{updatePointCloudAttribute:r=>{var l;if(f(r),t(r),p&&_(i(n({},p),{attribute:r})),u&&y(i(n({},u),{attribute:r})),s){const d=C(i(n({},s),{attribute:r}));a.mainViewInstance&&((l=a.mainViewInstance)==null||l.generateSpheres(d),h({newSelectedSphere:s,newSphereList:d}))}}}};export{A as usePointCloudAttribute};