quantum-component-library 1.4.45-qa.10 → 1.4.45-qa.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.
- package/dist/components.cjs +2 -2
- package/dist/components.js +5 -5
- package/dist/{dnd-core-vendor-v1lqdeP1.cjs → dnd-core-vendor-2Ve0kqUN.cjs} +1 -1
- package/dist/{dnd-core-vendor-ISBP7hu7.js → dnd-core-vendor-CErAmYu_.js} +2 -2
- package/dist/emotion-react-vendor-CHdBBD18.cjs +1 -0
- package/dist/emotion-react-vendor-CSrsXjBq.js +81 -0
- package/dist/emotion-vendor-D6PQH2K8.cjs +1 -0
- package/dist/emotion-vendor-DNnoMT20.js +546 -0
- package/dist/{graphql-vendor-CB3hZGUf.js → graphql-vendor-BWnD0b-j.js} +1 -1
- package/dist/{graphql-vendor-Dz6LvBOT.cjs → graphql-vendor-CL0XsjHb.cjs} +1 -1
- package/dist/hoist-non-react-statics-vendor-C5vG1oEE.cjs +1 -0
- package/dist/hoist-non-react-statics-vendor-DJU3S3cV.js +68 -0
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +1 -1
- package/dist/providers.cjs +1 -1
- package/dist/providers.js +2 -2
- package/dist/react-dnd-vendor-BPzSDojS.cjs +2 -0
- package/dist/{react-dnd-vendor-344hHSU8.js → react-dnd-vendor-D4nn9Mqx.js} +3 -3
- package/dist/react-is-vendor-CosIbvzW.cjs +15 -0
- package/dist/react-is-vendor-DpFLFzFZ.js +174 -0
- package/dist/react-jsx-runtime-vendor-Dszzpdy0.cjs +22 -0
- package/dist/react-jsx-runtime-vendor-OVHDjVDe.js +284 -0
- package/dist/react-select-vendor-BPaBUHFp.cjs +4 -0
- package/dist/{react-select-vendor-C9Yj5nBL.js → react-select-vendor-C_DuqfB7.js} +7 -6
- package/dist/stylis-vendor-CdCMw5Aa.js +334 -0
- package/dist/stylis-vendor-DzcTLVj9.cjs +1 -0
- package/dist/tailwind-vendor-B4y94WzT.js +2740 -0
- package/dist/tailwind-vendor-C0M23-WD.cjs +1 -0
- package/dist/ufuzzy-vendor-7qHa_k39.cjs +1 -0
- package/dist/ufuzzy-vendor-Dl0ZI6Av.js +456 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +3 -3
- package/dist/vendor-BjLvygDR.cjs +1 -0
- package/dist/vendor-VALJ9W3p.js +526 -0
- package/package.json +3 -1
- package/dist/other-react-vendor-Bks_g6Ah.js +0 -598
- package/dist/other-react-vendor-CDYjxKA1.cjs +0 -36
- package/dist/react-dnd-vendor-Clvo2okR.cjs +0 -2
- package/dist/react-select-vendor-Di9DcmX5.cjs +0 -4
- package/dist/vendor-BnSpIYqA.cjs +0 -1
- package/dist/vendor-BnU6I1mv.js +0 -4562
package/dist/components.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./react-jsx-runtime-vendor-Dszzpdy0.cjs"),t=require("@chakra-ui/react"),o=require("react"),Re=require("./ufuzzy-vendor-7qHa_k39.cjs"),xe=require("./styled-components-vendor-D09ATioU.cjs"),H=require("./react-select-vendor-BPaBUHFp.cjs"),de=require("./react-icons-vendor-D2s8zw9h.cjs"),G=require("./graphql-vendor-CL0XsjHb.cjs"),R=require("./generated-ChsGaiYd.cjs"),w=require("./graphql-CqPvuCvr.cjs"),oe=require("./react-dnd-vendor-BPzSDojS.cjs"),K=require("./services.cjs"),J=require("./types.cjs"),X=require("./utils.cjs"),fe=require("./hooks.cjs"),be=({setSearch:n,actions:s,updateUseCases:a})=>{const m=o.useMemo(()=>s?.flatMap(c=>c.useCases).filter((c,u,h)=>h.findIndex(f=>f.id===c.id)===u).map(c=>({label:c.name,value:c.id}))||[],[s]);return e.jsxRuntimeExports.jsxs(t.Flex,{width:"100%",alignContent:"space-evenly",gap:4,children:[e.jsxRuntimeExports.jsxs(t.InputGroup,{size:"md",children:[e.jsxRuntimeExports.jsx(t.InputLeftElement,{children:e.jsxRuntimeExports.jsx(t.Icon,{as:de.FaSearch,color:"gray.300"})}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"Search by name...",maxW:"30rem",onChange:c=>n(c.target.value)})]}),e.jsxRuntimeExports.jsx(t.InputGroup,{size:"md",children:e.jsxRuntimeExports.jsx(H.st,{size:"md",chakraStyles:{container:c=>({...c,width:"100%"})},menuPortalTarget:document.body,placeholder:"Filter use case",isMulti:!0,options:m,onChange:c=>a(c.map(u=>u.value))})})]})},V=({children:n})=>e.jsxRuntimeExports.jsx(t.FormLabel,{fontWeight:"bold",fontFamily:"sans-serif",fontSize:"large",children:n}),Ce=({value:n,onChange:s})=>{const a=o.useState(()=>Math.random().toString(36).substring(2,15))[0],m=o.useCallback((c,u)=>{s(h=>{const f=[...h],[b]=f.splice(c,1);return f.splice(u,0,b),f})},[s]);return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsx(oe.DndProvider,{backend:oe.HTML5Backend,children:e.jsxRuntimeExports.jsx(t.TableContainer,{children:e.jsxRuntimeExports.jsxs(t.Table,{variant:"simple",size:"md",children:[e.jsxRuntimeExports.jsx(t.Thead,{children:e.jsxRuntimeExports.jsxs(t.Tr,{children:[e.jsxRuntimeExports.jsx(t.Th,{children:"Order"}),e.jsxRuntimeExports.jsx(t.Th,{children:"Name"})]})}),e.jsxRuntimeExports.jsx(t.Tbody,{children:n.map((c,u)=>e.jsxRuntimeExports.jsx(Se,{listKey:a,index:u,id:c.id,name:c.name,move:m},c.id))})]})})})})},Se=({listKey:n,index:s,id:a,name:m,move:c})=>{const u=o.useRef(null),[{handlerId:h},f]=oe.useDrop({accept:n,collect:E=>({handlerId:E.getHandlerId()?.toString()??""}),hover:(E,A)=>{if(!u.current)return;const d=E.index,l=s;if(d===l)return;const T=u.current?.getBoundingClientRect(),C=(T.bottom-T.top)/2,p=A.getClientOffset().y-T.top;d<l&&p<C||d>l&&p>C||(c(d,l),E.index=l)}}),[{isDragging:b},v]=oe.useDrag({type:n,item:()=>({id:a,index:s}),collect:E=>({isDragging:E.isDragging()})}),F=b?.6:1,g=b?"grabbing":"grab";return v(f(u)),e.jsxRuntimeExports.jsxs(t.Tr,{ref:u,style:{opacity:F,cursor:g},"data-handler-id":h,children:[e.jsxRuntimeExports.jsx(t.Td,{children:s+1}),e.jsxRuntimeExports.jsx(t.Td,{children:m})]})},le=({items:n,onChange:s,selectedItem:a,isDisabled:m,selectedProps:c,buttonProps:u})=>{const h=b=>b===a||b.value===a,f=b=>h(b)?{...u,...c}:u;return e.jsxRuntimeExports.jsx(t.ButtonGroup,{isAttached:!0,isDisabled:m,children:n.map((b,v)=>e.jsxRuntimeExports.jsx(t.Tooltip,{label:b.tooltip,openDelay:50,closeDelay:200,placement:"top",visibility:b.tooltip?"visible":"hidden",hasArrow:!0,children:e.jsxRuntimeExports.jsx(t.Button,{onClick:()=>h(b)?null:s(b,v),isDisabled:b.disabled,...f(b),children:b.label})},v))})},se=(n,s)=>s<0?-1*Math.abs(n):Math.abs(n),ye=({isReversed:n,min:s,max:a,value:m,onChange:c,inputProps:u,size:h,zeroMarker:f,formatValue:b,valueLabel:v,positiveNegativeLabels:F,isDisabled:g,...E})=>{const[A,d]=o.useState([void 0,void 0]),l=A[0],T=A[1],C=f&&s<-5&&a>5,S=Number(m?.[0]??T??s)>0?1:-1,p=Number(m?.[1]??T??a)<0?-1:1,j=F?.[0]===F?.[1],M=m?.[0],D=m?.[1];o.useEffect(()=>{M!==void 0&&D!==void 0&&d([M.toFixed(0),D.toFixed(0)])},[M,D,d]);const I=o.useCallback(([i,y])=>{i<y&&d([i.toFixed(0),y.toFixed(0)])},[d]),z=o.useCallback(([i,y])=>{i<y&&c([i,y])},[c]),k=o.useCallback(()=>{d(([i,y])=>{const L=isNaN(Number(i))?s:Number(i),_=isNaN(Number(y))?a:Number(y),W=se(Number(L),S),O=se(Number(_),p),q=S<0?Math.max(W,s):Math.min(W,a),B=p<0?Math.max(O,s):Math.min(O,a);return q>B?(c([B,q]),[B.toFixed(0),q.toFixed(0)]):(c([q,B]),[q.toFixed(0),B.toFixed(0)])})},[c,d,S,p,s,a]),U=o.useCallback(i=>{const y=i===""||isNaN(Number(i))?i:se(Number(i),S);d(([L,_])=>[y.toString(),_])},[d,S]),P=o.useCallback(i=>{const y=i===""||isNaN(Number(i))?i:se(Number(i),p);d(([L,_])=>[L,y.toString()])},[d,p]),x=o.useMemo(()=>h==="xs"?"0.75rem":void 0,[h]),r=o.useCallback((i,y)=>{const L=Number(y.target.value);if(!l||!T||![-1,1].includes(L))return;const _=q=>L<0?-1*Math.abs(q):Math.abs(q),W=i?_(Number(l)):Number(l),O=i?Number(T):_(Number(T));W>O?c([O,W]):c([W,O])},[l,T,c]);return e.jsxRuntimeExports.jsxs(t.Flex,{direction:"column",...E,children:[e.jsxRuntimeExports.jsx(t.Box,{pt:"1em",mb:"-0.5em",children:e.jsxRuntimeExports.jsxs(t.RangeSlider,{"aria-label":["min","max"],isReversed:n,value:[Number(l??s),Number(T??a)],max:a,min:s,minStepsBetweenThumbs:3,step:1,onChange:I,onChangeEnd:z,isDisabled:g,children:[e.jsxRuntimeExports.jsx(t.RangeSliderMark,{value:s,top:"-1em",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:h??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:b?b?.(s):s})}),e.jsxRuntimeExports.jsx(t.RangeSliderMark,{value:a,top:"-1em",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:h??"sm",fontWeight:"semibold",style:{transform:"translateX(-100%)"},whiteSpace:"nowrap",children:b?b(a):a})}),C&&e.jsxRuntimeExports.jsxs(t.RangeSliderMark,{value:0,top:"-1em",pos:"relative",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:h,fontWeight:"semibold",children:b?.(0)??"0"}),e.jsxRuntimeExports.jsx(ve,{})]}),e.jsxRuntimeExports.jsx(t.RangeSliderTrack,{children:e.jsxRuntimeExports.jsx(t.RangeSliderFilledTrack,{})}),e.jsxRuntimeExports.jsx(t.RangeSliderThumb,{index:0,w:x,h:x}),e.jsxRuntimeExports.jsx(t.RangeSliderThumb,{index:1,w:x,h:x})]})}),v&&e.jsxRuntimeExports.jsxs(t.Flex,{direction:n?"row-reverse":"row",justifyContent:"space-between",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:h??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:v(s)}),e.jsxRuntimeExports.jsx(t.Text,{fontSize:h??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:v(a)})]}),e.jsxRuntimeExports.jsxs(t.Flex,{direction:n?"row-reverse":"row",justifyContent:"center",alignItems:"center",gap:"0.125em",children:[F&&e.jsxRuntimeExports.jsxs(t.Select,{width:"auto",size:h,fontWeight:"bold",value:S,onChange:i=>r(!0,i),isDisabled:j||g,children:[e.jsxRuntimeExports.jsx("option",{value:-1,children:F[0]}),e.jsxRuntimeExports.jsx("option",{value:1,children:F[1]})]}),e.jsxRuntimeExports.jsx(t.NumberInput,{precision:0,size:h??"sm",min:0,max:S<0?Math.abs(s):D??a,value:l===""?"":Math.abs(Number(l??s)),onChange:U,onBlur:k,borderWidth:1,borderRadius:3,borderColor:"#ccc",isDisabled:g,...u,children:e.jsxRuntimeExports.jsx(t.NumberInputField,{backgroundColor:"#fff",paddingRight:0,width:"4em"})}),e.jsxRuntimeExports.jsx(t.NumberInput,{size:h??"sm",min:0,max:p<0?Math.abs(M??s):a,precision:0,value:T===""?"":Math.abs(Number(T??a)),onChange:P,onBlur:k,borderWidth:1,borderRadius:3,borderColor:"#ccc",isDisabled:g,...u,children:e.jsxRuntimeExports.jsx(t.NumberInputField,{backgroundColor:"#fff",paddingRight:0,width:"4em"})}),F&&e.jsxRuntimeExports.jsxs(t.Select,{width:"auto",size:h,fontWeight:"bold",value:p,onChange:i=>r(!1,i),isDisabled:j||g,children:[e.jsxRuntimeExports.jsx("option",{value:-1,children:F[0]}),e.jsxRuntimeExports.jsx("option",{value:1,children:F[1]})]})]})]})},ve=xe.dt(t.Box)`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 2px;
|
|
4
4
|
height: 1em;
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
background-color: ${n=>n.disableMultiSelect&&!n.selected?"#f7f7f7":void 0};
|
|
11
11
|
}
|
|
12
12
|
cursor: ${n=>n.disableMultiSelect?"pointer":"default"};
|
|
13
|
-
`,Ie=({onSave:n,onCancel:s,onError:a,hideButtons:m=!1,setButtonDisabled:c,setButtonOnClick:u,quantumOwned:h})=>{const f=t.useToast(),[b,v]=o.useState(""),[F,g]=o.useState([]),[E,A]=o.useState(!1),[d]=G.useQuery({query:w.GET_GROUPS}),[l]=G.useQuery({query:w.GET_ACTIONS_BY_GROUP,variables:{groupId:b},pause:!b}),[,T]=G.useMutation(w.CREATE_ACTION),C=o.useMemo(()=>d.data?.groups?d.data.groups.map(x=>R.getFragmentData(w.GROUP_FRAGMENT,x)):[],[d.data]),S=o.useMemo(()=>l.data?l.data.actions.map(r=>R.getFragmentData(w.ACTION_FRAGMENT,r)):[],[l.data]),p=o.useMemo(()=>S.filter(x=>F.includes(x.id)),[S,F]),j=o.useCallback(x=>{const r=x?.value||"";v(r),g([])},[]),M=o.useCallback(x=>{const r=x.map(i=>i.value);g(r)},[]),D=o.useCallback(async()=>{if(A(!0),!p.length){const x=new Error("No activities selected for copying");a?.(x),A(!1);return}try{const x=[];let r=0;for(const i of p)try{const y={...i,name:`${i.name} (Copy)`,description:i.description||void 0,instructionsPointOfInterest:i.instructionsPointOfInterest||void 0,instructionsMovementReport:i.instructionsMovementReport||void 0,laterality:i.laterality,activityKind:i.activityKind,sensorLocations:i.sensorLocations,thresholds:i.thresholds.map(_=>({..._,id:void 0})),quantumOwned:h,id:void 0},L=await T({fields:y});if(L.error)throw new Error(L.error.message);if(L.data?.createAction){const _=R.getFragmentData(w.ACTION_FRAGMENT,L.data.createAction);x.push(_)}}catch(y){console.error(`Failed to copy activity "${i.name}":`,y),r++}if(x.length>0){const i=x.length,y=p.length;f({title:r>0?"Partial copy completed":"Activities copied successfully",description:r>0?`${i} of ${y} activities copied successfully`:`${i} activit${i>1?"ies":"y"} copied successfully`,status:r>0?"warning":"success",duration:3e3,isClosable:!0}),n?.(),v(""),g([])}else throw new Error("Failed to copy any activities")}catch(x){const r=x instanceof Error?x.message:"Failed to copy activities";f({title:"Copy failed",description:r,status:"error",duration:5e3,isClosable:!0}),a?.(x instanceof Error?x:new Error(r))}finally{A(!1)}},[p,T,f,n,a,h]),I=o.useCallback(()=>{v(""),g([]),s?.()},[s]);o.useEffect(()=>{c&&c({cancelButton:!1,saveButton:p.length===0||E})},[p.length,E,c]),o.useEffect(()=>{u&&u({cancelButton:I,saveButton:D})},[u,I,D]);const z=o.useMemo(()=>C.map(x=>({value:x.id,label:x.name})),[C]),k=o.useMemo(()=>S.map(x=>({value:x.id,label:x.name,isQuantumOwned:x.quantumOwned})),[S]),U=d.fetching,P=l.fetching;return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsxs(t.VStack,{spacing:6,align:"stretch",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(Y,{children:"Select Source Group"}),e.jsxRuntimeExports.jsx(H.st,{placeholder:"Choose a group...",options:z,value:z.find(x=>x.value===b)||null,onChange:j,isLoading:U,isDisabled:U,isClearable:!0}),d.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load groups: ",d.error.message]})]})]}),b&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(Y,{children:"Select Activities to Copy"}),P?e.jsxRuntimeExports.jsxs(t.HStack,{children:[e.jsxRuntimeExports.jsx(t.Spinner,{size:"sm"}),e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.600",children:"Loading activities..."})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(H.st,{placeholder:"Choose activities to copy...",options:k,value:k.filter(x=>F.includes(x.value)),onChange:M,isDisabled:k.length===0,isClearable:!0,isMulti:!0,closeMenuOnSelect:!1,formatOptionLabel:(x,{context:r})=>e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",w:"100%",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(t.Text,{children:x.label}),r==="value"&&x.isQuantumOwned&&e.jsxRuntimeExports.jsx(t.Text,{color:"blue",fontSize:"xs",children:"(Quantum Owned)"})]}),x.isQuantumOwned&&r==="menu"&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]})}),k.length===0&&e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",mt:2,children:"No activities found"})]}),l.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load activities: ",l.error.message]})]})]}),p.length>0&&e.jsxRuntimeExports.jsxs(t.Box,{p:4,bg:"gray.50",borderRadius:"md",children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"semibold",mb:3,children:p.length===1?"Activity to Copy:":`${p.length} Activities to Copy:`}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:3,children:[p.map((x,r)=>e.jsxRuntimeExports.jsxs(t.Box,{w:"100%",p:3,bg:"white",borderRadius:"md",border:"1px solid",borderColor:"gray.200",children:[e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"start",mb:2,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",fontSize:"sm",children:[r+1,". ",x.name]}),x.quantumOwned&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,fontSize:"sm",color:"gray.600",children:[x.description&&e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Description:"})," ",x.description]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Type:"})," ",x.activityKind]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Laterality:"})," ",x.laterality]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Sensor Locations:"})," ",x.sensorLocations.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Thresholds:"})," ",x.thresholds.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Use Cases:"})," ",x.useCases.map(i=>i.name).join(", ")||"None"]})]})]},x.id)),p.length>1&&e.jsxRuntimeExports.jsx(t.Box,{w:"100%",p:2,bg:"blue.50",borderRadius:"md",border:"1px solid",borderColor:"blue.200",children:e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",fontWeight:"medium",color:"blue.800",children:["Total: ",p.length," activities will be copied"]})})]})]}),!m&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{spacing:4,justifyContent:"flex-end",children:[e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:I,isDisabled:E,children:"Cancel"}),e.jsxRuntimeExports.jsxs(t.Button,{colorScheme:"blue",onClick:D,isDisabled:p.length===0||E,isLoading:E,loadingText:"Copying...",children:["Copy"," ",p.length===1?"Activity":`${p.length} Activities`]})]})]})})},Ne=({onSave:n,onCancel:s,onError:a,hideButtons:m=!1,setButtonDisabled:c,setButtonOnClick:u,quantumOwned:h})=>{const f=t.useToast(),[b,v]=o.useState(""),[F,g]=o.useState([]),[E,A]=o.useState(!1),[d]=G.useQuery({query:w.GET_GROUPS}),[l]=G.useQuery({query:w.GET_MODULES_BY_GROUP,variables:{groupId:b},pause:!b}),[,T]=G.useMutation(w.CREATE_MODULE),[,C]=G.useMutation(w.CREATE_ACTION),S=o.useMemo(()=>d.data?.groups?d.data.groups.map(r=>R.getFragmentData(w.GROUP_FRAGMENT,r)):[],[d.data]),p=o.useMemo(()=>l.data?.modules?R.getFragmentData(w.ACTION_MODULE_FRAGMENT,l.data?.modules).map(i=>{const y=R.getFragmentData(w.MODULE_ACTION_FRAGMENT,i.moduleActions);return{...i,moduleActions:y.map(L=>({...L,action:R.getFragmentData(w.ACTION_FRAGMENT,L.action)})),categories:R.getFragmentData(w.MODULE_CATEGORY_FRAGMENT,i.categories)}}):[],[l.data]),j=o.useMemo(()=>p.filter(r=>F.includes(r.id)),[p,F]),M=o.useCallback(r=>{const i=r?.value||"";v(i),g([])},[]),D=o.useCallback(r=>{const i=r.map(y=>y.value);g(i)},[]),I=o.useCallback(async()=>{if(A(!0),!j.length){A(!1);const r=new Error("No modules selected for copying");a?.(r);return}try{const r=[];let i=0;for(const y of j)try{let L=y.moduleActions.map(O=>O.actionId);if(h){const O=y.moduleActions.map(B=>B.action);L=(await Promise.all(O.map(async B=>{if(B.quantumOwned)return Promise.resolve(B);const Z={...B,quantumOwned:h,thresholds:B.thresholds.map(Q=>({...Q,id:void 0})),id:void 0};return await C({fields:Z}).then(Q=>Q.error||!Q.data?.createAction?null:R.getFragmentData(w.ACTION_FRAGMENT,Q.data.createAction))}))).filter(B=>!!B).map(B=>B.id)}const _={name:`${y.name} (Copy)`,description:y.description||void 0,actions:L,categories:y.categories.map(O=>O.id),quantumOwned:h},W=await T({input:_});if(W.error)throw new Error(W.error.message);if(W.data?.createModule){const O=R.getFragmentData(w.ACTION_MODULE_FRAGMENT,W.data.createModule);r.push(O)}}catch(L){console.error(`Failed to copy module "${y.name}":`,L),i++}if(r.length>0){const y=r.length,L=j.length;f({title:i>0?"Partial copy completed":"Modules copied successfully",description:i>0?`${y} of ${L} modules copied successfully`:`${y} module${y>1?"s":""} copied successfully`,status:i>0?"warning":"success",duration:3e3,isClosable:!0}),r.length>0&&n?.(),v(""),g([])}else throw new Error("Failed to copy any modules")}catch(r){const i=r instanceof Error?r.message:"Failed to copy modules";f({title:"Copy failed",description:i,status:"error",duration:5e3,isClosable:!0}),a?.(r instanceof Error?r:new Error(i))}finally{A(!1)}},[j,T,f,n,a,h,C]),z=o.useCallback(()=>{v(""),g([]),s?.()},[s]);o.useEffect(()=>{c&&c({cancelButton:!1,saveButton:j.length===0||E})},[j.length,E,c]),o.useEffect(()=>{u&&u({cancelButton:z,saveButton:I})},[u,z,I]);const k=o.useMemo(()=>S.map(r=>({value:r.id,label:r.name})),[S]),U=o.useMemo(()=>p.map(r=>({value:r.id,label:r.name,isQuantumOwned:r.quantumOwned})),[p]),P=d.fetching,x=l.fetching;return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsxs(t.VStack,{spacing:6,align:"stretch",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(Y,{children:"Select Source Group"}),e.jsxRuntimeExports.jsx(H.st,{placeholder:"Choose a group...",options:k,value:k.find(r=>r.value===b)||null,onChange:M,isLoading:P,isDisabled:P,isClearable:!0}),d.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load groups: ",d.error.message]})]})]}),b&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(Y,{children:"Select Module to Copy"}),x?e.jsxRuntimeExports.jsxs(t.HStack,{children:[e.jsxRuntimeExports.jsx(t.Spinner,{size:"sm"}),e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.600",children:"Loading modules..."})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(H.st,{placeholder:"Choose modules to copy...",options:U,value:U.filter(r=>F.includes(r.value)),onChange:D,isDisabled:U.length===0,isClearable:!0,isMulti:!0,closeMenuOnSelect:!1,formatOptionLabel:(r,{context:i})=>e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",w:"100%",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(t.Text,{children:r.label}),i==="value"&&r.isQuantumOwned&&e.jsxRuntimeExports.jsx(t.Text,{color:"blue",fontSize:"xs",children:"(Quantum Owned)"})]}),r.isQuantumOwned&&i==="menu"&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]})}),U.length===0&&e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",mt:2,children:"No modules found in this group"})]}),l.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load modules: ",l.error.message]})]})]}),j.length>0&&e.jsxRuntimeExports.jsxs(t.Box,{p:4,bg:"gray.50",borderRadius:"md",children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"semibold",mb:3,children:j.length===1?"Module to Copy:":`${j.length} Modules to Copy:`}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:3,children:[j.map((r,i)=>e.jsxRuntimeExports.jsxs(t.Box,{w:"100%",p:3,bg:"white",borderRadius:"md",border:"1px solid",borderColor:"gray.200",children:[e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"start",mb:2,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",fontSize:"sm",children:[i+1,". ",r.name]}),r.quantumOwned&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,fontSize:"sm",color:"gray.600",children:[r.description&&e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Description:"})," ",r.description]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Actions:"})," ",r.moduleActions.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Categories:"})," ",r.categories.map(y=>y.name).join(", ")||"None"]})]})]},r.id)),j.length>1&&e.jsxRuntimeExports.jsx(t.Box,{w:"100%",p:2,bg:"blue.50",borderRadius:"md",border:"1px solid",borderColor:"blue.200",children:e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",fontWeight:"medium",color:"blue.800",children:["Total: ",j.length," modules will be copied"]})}),h&&j.filter(r=>r.moduleActions.some(i=>!i.action.quantumOwned)).length>0&&e.jsxRuntimeExports.jsx(t.Box,{p:2,bg:"yellow.50",borderRadius:"md",border:"1px solid",borderColor:"yellow.200",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",fontWeight:"medium",color:"yellow.800",children:"Copying Modules with Non QM-Owned Actions will create corresponding QM-Owned Actions"})})]})]}),!m&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{spacing:4,justifyContent:"flex-end",children:[e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:z,isDisabled:E,children:"Cancel"}),e.jsxRuntimeExports.jsxs(t.Button,{colorScheme:"blue",onClick:I,isDisabled:j.length===0||E,isLoading:E,loadingText:"Copying...",children:["Copy"," ",j.length===1?"Module":`${j.length} Modules`]})]})]})})},pe=({name:n,setName:s,actions:a,selectedActionIds:m,setSelectedActionIds:c,availableCategories:u,selectedCategoryIds:h,setSelectedCategoryIds:f,description:b,setDescription:v,...F})=>{const g=t.useDisclosure(),E=o.useMemo(()=>a.map(S=>({...S,selected:m.includes(S.id)})),[a,m]),A=o.useMemo(()=>a.reduce((S,p)=>(S[p.id]=p,S),{}),[a]),d=o.useMemo(()=>m.map(S=>A[S]),[E,m]),l=o.useCallback((S,p)=>{c(p?[...m,S.id]:m.filter(j=>j!==S.id))},[m,c]),T=o.useCallback(S=>{s(S.target.value)},[s]),C=o.useCallback(S=>{v?.(S.target.value)},[v]);return e.jsxRuntimeExports.jsxs(t.Box,{...F,children:[e.jsxRuntimeExports.jsxs(t.HStack,{gap:"2rem",children:[e.jsxRuntimeExports.jsx(ke,{name:n??"",onInputChange:T}),e.jsxRuntimeExports.jsx(Le,{availableCategories:u,value:h,onChange:f})]}),e.jsxRuntimeExports.jsx(Oe,{description:b??"",onInputChange:C}),e.jsxRuntimeExports.jsx(De,{value:d,onChange:c,onAdjustActivities:()=>g.onOpen()}),e.jsxRuntimeExports.jsxs(t.Modal,{isOpen:g.isOpen,onClose:g.onClose,size:"6xl",children:[e.jsxRuntimeExports.jsx(t.ModalOverlay,{}),e.jsxRuntimeExports.jsxs(t.ModalContent,{children:[e.jsxRuntimeExports.jsx(t.ModalHeader,{children:"Select Activities"}),e.jsxRuntimeExports.jsx(t.ModalCloseButton,{}),e.jsxRuntimeExports.jsx(t.ModalBody,{children:e.jsxRuntimeExports.jsx(me,{actions:E,onSelected:l,disableCreate:!0,disableDelete:!0,tableProps:{height:"28rem",overflowY:"auto"}})}),e.jsxRuntimeExports.jsx(t.ModalFooter,{children:e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",onClick:g.onClose,isDisabled:m.length===0,children:"Done"})})]})]})]})},ke=o.memo(({name:n,onInputChange:s})=>e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(Y,{children:"Module Name"}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"i.e. ACL RTP Test Battery",value:n,onChange:s,isRequired:!0})]})),Le=o.memo(({availableCategories:n,value:s,onChange:a})=>{const m=o.useMemo(()=>[...n,{id:"other",name:"Other"}],[n]),c=o.useMemo(()=>m.map(u=>({value:u.id,label:u.name})),[m]);return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(Y,{children:"Module Category"}),e.jsxRuntimeExports.jsx(H.st,{isDisabled:n.length===0,isClearable:!0,options:c,value:m.filter(u=>s.includes(u.id)).map(u=>({value:u.id,label:u.name})),onChange:u=>a(u?[u.value]:[]),placeholder:"Select category"})]})}),Oe=o.memo(({description:n,onInputChange:s})=>e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(Y,{children:e.jsxRuntimeExports.jsxs("span",{children:["Description",e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",children:"Briefly describe the objective of this module. Max 40 words."})]})}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"i.e. Assess readiness to return to play post-ACL reconstruction",value:n,onChange:s})]})),De=o.memo(({value:n,onChange:s,onAdjustActivities:a})=>{const m=o.useMemo(()=>n.map(c=>({id:c.id,name:c.name})),[n]);return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsxs(t.HStack,{justifyContent:"space-between",children:[e.jsxRuntimeExports.jsx(Y,{children:e.jsxRuntimeExports.jsxs("span",{children:["Activities",e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",children:"Drag and drop to reorder the activities in this module."})]})}),e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"solid",colorScheme:"blue",onClick:a,children:"Add / Remove Activities"})]}),m.length===0?e.jsxRuntimeExports.jsx(t.VStack,{children:e.jsxRuntimeExports.jsxs(t.Text,{color:"gray.500",fontSize:"lg",mb:"4rem",mt:"4rem",children:["No activities selected for this module.",e.jsxRuntimeExports.jsx(t.Button,{ml:"0.5em",size:"sm",variant:"link",colorScheme:"blue",onClick:a,children:"Add activities."})]})}):e.jsxRuntimeExports.jsx(Ce,{value:m,onChange:c=>{const u=c(m);s(u.map(h=>h.id))}})]})}),he=({value:n,onChange:s,forceKind:a,disableRemove:m,disableKind:c,lockRanges:u,...h})=>{const f=o.useMemo(()=>[...n].sort((g,E)=>{const A=J.availablePlanes.indexOf(g.plane),d=J.availablePlanes.indexOf(E.plane);return A-d}),[n]),b=o.useCallback(g=>"segment"in g.id?V.getSegmentNameWithPlane(g.id.segment,g.plane,!0)??"Unknown":V.getJointNameWithPlane(g.id.joint,g.plane,!0)??"Unknown",[]),v=o.useCallback((g,E)=>{const A=f.findIndex(l=>l.id===E.id&&l.plane===E.plane);let d=[...f];a&&(E={...E,kind:a}),d[A]=E,u&&(d=d.map(l=>({...l,min:E.min,max:E.max}))),s(d)},[s,f,a,u]),F=o.useCallback(g=>{const E=f.filter(A=>A.id!==g.id||A.plane!==g.plane);s(E)},[s,f]);return e.jsxRuntimeExports.jsx(t.VStack,{alignItems:"flex-start",overflowY:"auto",...h,children:f.map((g,E)=>e.jsxRuntimeExports.jsx(_e,{label:b(g),parameter:g,onChange:A=>v(E,A),onRemove:m?void 0:()=>F(g),forceKind:a,disableKind:c},`${JSON.stringify(g.id)}-${g.plane}`))})},_e=({label:n,parameter:s,onChange:a,onRemove:m,forceKind:c,disableKind:u})=>{const h=o.useCallback(v=>"joint"in s.id?V.getJointAngleDirectionName(s.id.joint,s.plane,v<0?-1:1):V.getSegmentAngleDirectionName(s.id.segment,s.plane,v<0?-1:1),[s]),{min:f,max:b}="joint"in s.id?V.getNormativeJointRange(s.id.joint,s.plane):{min:-180,max:180};return e.jsxRuntimeExports.jsxs(t.VStack,{borderRadius:"md",p:2,px:4,bg:"gray.100",w:"100%",overflow:"hidden",flexShrink:"0",children:[e.jsxRuntimeExports.jsxs(t.HStack,{w:"100%",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",flex:1,textTransform:"capitalize",fontWeight:"semibold",children:n}),m&&e.jsxRuntimeExports.jsx(t.IconButton,{size:"xs",variant:"ghost","aria-label":"delete",icon:e.jsxRuntimeExports.jsx(t.Icon,{as:de.FaTrash}),onClick:m}),!c&&e.jsxRuntimeExports.jsx(le,{selectedItem:s?.kind??R.ThresholdKind.Limit,onChange:({value:v})=>a({...s,kind:v}),isDisabled:u,buttonProps:{size:"sm",variant:"outline",colorScheme:"gray"},selectedProps:{variant:"solid",colorScheme:"teal"},items:[{value:R.ThresholdKind.Limit,label:"limit"},{value:R.ThresholdKind.Target,label:"target"}]})]}),e.jsxRuntimeExports.jsx(ye,{w:"100%",size:"xs",min:f,max:b,zeroMarker:!0,value:[s.min,s.max],onChange:v=>a({...s,min:v[0],max:v[1]}),formatValue:v=>`${Math.abs(v)}°`,valueLabel:v=>h(v)??"",positiveNegativeLabels:h(0)?[h(-1)??"",h(1)??""]:void 0})]})},ne=(n,s)=>"segment"in n&&"segment"in s&&n.segment===s.segment||"joint"in n&&"joint"in s&&n.joint===s.joint,je=({options:n,value:s,onChange:a,forceKind:m,singleValue:c,singleValueSideless:u,editOnly:h,disableKind:f,maxParameters:b,...v})=>{const F=u?2:b,g=o.useMemo(()=>n.map(l=>({label:"segment"in l.id?V.getSegmentNameWithPlane(l.id.segment,l.plane,!0)??"Unknown":V.getJointNameWithPlane(l.id.joint,l.plane,!0)??"Unknown",value:l.id,plane:l.plane})),[n]),E=o.useMemo(()=>{if(!u||s.length===0)return g;const l=s[0];return g.filter(T=>J.getAnalysisPartIdNoSide(T.value)===J.getAnalysisPartIdNoSide(l.id)&&T.plane===l.plane)},[g,s,u]),A=o.useMemo(()=>g.filter(l=>s.some(T=>ne(T.id,l.value)&&T.plane===l.plane)),[g,s]),d=o.useCallback(l=>{const T=l.map(C=>{const S=s.find(I=>ne(I.id,C.value)&&I.plane===C.plane),p=n.find(I=>ne(I.id,C.value)&&I.plane===C.plane),j=u?s.find(I=>J.getAnalysisPartIdNoSide(I.id)===J.getAnalysisPartIdNoSide(C.value)&&I.plane===C.plane):void 0,M=j&&!S?j.min:p&&p.min?p.min:0,D=j&&!S?j.max:p&&p.max?p.max:0;return S??{id:C.value,plane:C.plane,min:M,max:D,kind:m??R.ThresholdKind.Limit}});a(T)},[a,s,n,m,u]);return o.useEffect(()=>{const l=s.filter(T=>n.some(C=>ne(C.id,T.id)&&C.plane===T.plane));l.length!==s.length&&a(l)},[n,a]),e.jsxRuntimeExports.jsxs(t.Box,{...v,children:[e.jsxRuntimeExports.jsx(H.st,{isMulti:!c,placeholder:s.length?`${s.length} selected`:"Search...",value:A,isDisabled:h||A.length>=(F??1/0),onChange:l=>Array.isArray(l)?d([...l]):d(l!==null?[l]:[]),options:E,controlShouldRenderValue:!1}),e.jsxRuntimeExports.jsx(he,{marginTop:2,maxH:"28rem",value:s,onChange:a,forceKind:m,disableKind:f,lockRanges:u})]})},ge=n=>{switch(n){case R.SensorLocation.Thorax:return"Thorax";case R.SensorLocation.CenterBack:return"Center Back";case R.SensorLocation.Pelvis:return"Pelvis";case R.SensorLocation.LeftThigh:return"Left Thigh";case R.SensorLocation.RightThigh:return"Right Thigh";case R.SensorLocation.LeftShank:return"Left Shank";case R.SensorLocation.RightShank:return"Right Shank";case R.SensorLocation.LeftFoot:return"Left Foot";case R.SensorLocation.RightFoot:return"Right Foot";case R.SensorLocation.LeftUpperArm:return"Left Upper Arm";case R.SensorLocation.RightUpperArm:return"Right Upper Arm";case R.SensorLocation.LeftForearm:return"Left Forearm";case R.SensorLocation.RightForearm:return"Right Forearm";case R.SensorLocation.Head:return"Head"}return console.warn(`Unknown sensor location: ${n}`),"Unknown"},Be=6,Pe=[R.SensorLocation.LeftFoot,R.SensorLocation.LeftShank,R.SensorLocation.LeftThigh,R.SensorLocation.Pelvis,R.SensorLocation.RightFoot,R.SensorLocation.RightShank,R.SensorLocation.RightThigh,R.SensorLocation.Thorax,R.SensorLocation.CenterBack,R.SensorLocation.Head],Ge=Pe.map(n=>({label:ge(n),value:n})),ae=n=>n.map(s=>s.__isNew__?{name:s.label}:{id:s.value,name:s.label}),Ue=({id:n,onError:s,onCancel:a,onSave:m,hideButtons:c,setButtonOnClick:u,setButtonDisabled:h,quantumOwned:f})=>{const b=G.useClient(),[{fetching:v},F]=G.useMutation(w.CREATE_ACTION),[{fetching:g},E]=G.useMutation(w.UPDATE_ACTION),[{data:A}]=G.useQuery({query:w.GET_ACTION_BY_ID,variables:{id:n??""},pause:!n}),d=R.getFragmentData(w.ACTION_FRAGMENT,A?.getActionById),l=v||g,T=!!d&&!!n,[C,S]=o.useState(""),[p,j]=o.useState(""),[M,D]=o.useState(""),[I,z]=o.useState(""),[k,U]=o.useState(R.ActionLaterality.Either),[P,x]=o.useState(R.ActionActivityKind.Action),[r,i]=o.useState([]),[y,L]=o.useState([]),_=o.useMemo(()=>r.map(N=>N.value),[r]),W=fe.usePartOptionsForSensorLocations(_),[O,q]=o.useState([]),[B,Z]=o.useState(!1),Q=C.length&&k;o.useEffect(()=>{d&&(S(d.name),x(d.activityKind),j(d.description||""),U(d.laterality),L(d.useCases.map(N=>({id:N.id,value:N.id,label:N.name,__isNew__:!1}))),D(d.instructionsPointOfInterest||""),z(d.instructionsMovementReport||""),i(d.sensorLocations.map(N=>({label:ge(N),value:N}))),q(X.thresholdsToParameters(d.thresholds)))},[d]);const Ee=o.useCallback(async N=>(await b.query(f?w.SEARCH_QUANTUM_OWNED_USE_CASES:w.SEARCH_USE_CASES,{query:N,limit:10}).then(K=>{const te=K.data;return te?te?.quantumOwnedUseCases?te.quantumOwnedUseCases:te.useCases:[]})??[]).map(K=>({label:K.name,value:K.id})),[b,f]),[ce,ue]=o.useState({});o.useEffect(()=>{ue({name:C,laterality:k,description:p,instructionsPointOfInterest:M,instructionsMovementReport:I,sensorLocations:_,thresholds:X.parametersToThresholds(O),useCases:ae(y),activityKind:P})},[ue,d]);const re=o.useMemo(()=>JSON.stringify(ce)!==JSON.stringify({name:C,laterality:k,description:p,instructionsPointOfInterest:M,instructionsMovementReport:I,sensorLocations:_,thresholds:X.parametersToThresholds(O),useCases:ae(y),activityKind:P}),[ce,C,k,_,p,I,M,O,y,P]),ie=o.useCallback(()=>{const N={name:C,laterality:k,description:p,instructionsPointOfInterest:M,instructionsMovementReport:I,sensorLocations:_,thresholds:X.parametersToThresholds(O),useCases:ae(y),activityKind:P,quantumOwned:f};let ee;T&&n?ee=E({id:n,fields:N}):ee=F({fields:N}),ee.then(({error:K})=>{K?s(K):m()})},[f,F,E,n,C,k,_,m,p,I,M,T,O,y,P,s]);return o.useEffect(()=>{h&&h({cancelButton:l,saveButton:l||!Q||!re})},[l,h,Q,re]),o.useEffect(()=>{u&&u({cancelButton:a,saveButton:ie})},[u,a,ie]),e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-4 w-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"col-span-2 lg:col-span-1 flex flex-col gap-8",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Name"}),e.jsxRuntimeExports.jsx(t.Input,{value:C,onChange:N=>S(N.target.value),type:"text",placeholder:"i.e. Lunge & Return"})]}),e.jsxRuntimeExports.jsxs(t.HStack,{m:"0",p:"0",w:"100%",justifyItems:"space-between",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Activity Type"}),e.jsxRuntimeExports.jsx(le,{selectedItem:P,onChange:N=>x(N.value),buttonProps:{size:"sm",variant:"outline",colorScheme:"gray"},selectedProps:{variant:"solid",colorScheme:"teal"},items:[{value:R.ActionActivityKind.Action,label:"Action"},{value:R.ActionActivityKind.Movement,label:"Movement"}]})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Laterality"}),e.jsxRuntimeExports.jsx(le,{selectedItem:k,onChange:N=>U(N.value),buttonProps:{size:"sm",variant:"outline",colorScheme:"gray"},selectedProps:{variant:"solid",colorScheme:"teal"},items:[{value:R.ActionLaterality.Unilateral,label:"unilateral"},{value:R.ActionLaterality.Bilateral,label:"bilateral"},{value:R.ActionLaterality.Either,label:"either / or"}]})]})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Use Cases"}),e.jsxRuntimeExports.jsx(t.Tooltip,{isOpen:B,label:"Type to search for existing use cases",placement:"top-end",children:e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsx(H.yt,{value:y,onChange:N=>L([...N]),isMulti:!0,cacheOptions:!0,defaultOptions:!0,onFocus:()=>Z(!0),onBlur:()=>Z(!1),loadOptions:Ee,placeholder:"(optional) Search for & select use cases…"})})})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Description"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:p,onChange:N=>j(N.target.value),rows:2,placeholder:"(optional) Describe how to perform the test or exercise"})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Instructions for General Movement Report"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:I,onChange:N=>z(N.target.value),rows:2,placeholder:"(optional) Describe how to setup or generate the movement report"})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Instructions for Point of Interest Report"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:M,onChange:N=>D(N.target.value),rows:2,placeholder:"(optional) Describe how to setup or generate the point of interest report"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"col-span-2 lg:col-span-1 flex flex-col gap-8",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Sensor Locations"}),e.jsxRuntimeExports.jsx(H.st,{isMulti:!0,value:r,onChange:N=>i([...N]),options:Ge,isOptionDisabled:()=>r.length>=Be})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Default Parameters"}),e.jsxRuntimeExports.jsx(je,{options:W,value:O,onChange:q})]})]}),e.jsxRuntimeExports.jsx("div",{className:X.cn("col-span-2 flex justify-end",c&&"hidden"),children:e.jsxRuntimeExports.jsxs(t.ButtonGroup,{mt:16,gap:4,children:[e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:l,onClick:a,children:"Cancel"}),e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",isDisabled:l||!Q||!re,isLoading:l,onClick:ie,children:"Save changes"})]})})]})},$=({children:n})=>e.jsxRuntimeExports.jsx(t.FormLabel,{fontWeight:"bold",fontFamily:"sans-serif",fontSize:"large",children:n}),ze=({id:n,onCancel:s,onSave:a,onError:m,hideButtons:c,quantumOwned:u,setButtonOnClick:h,setButtonDisabled:f})=>{const[{data:b}]=G.useQuery({query:u?w.GET_QUANTUM_OWNED_ACTIONS:w.GET_ACTIONS}),[{data:v}]=G.useQuery({query:w.GET_MODULE_BY_ID,variables:{id:n},pause:!n}),[{data:F}]=G.useQuery({query:w.GET_ALL_MODULE_CATEGORIES}),g=R.getFragmentData(w.MODULE_CATEGORY_FRAGMENT,F?.moduleCategories),[{fetching:E},A]=G.useMutation(w.UPDATE_MODULE),[{fetching:d},l]=G.useMutation(w.CREATE_MODULE),T=R.getFragmentData(w.ACTION_FRAGMENT,u?b?.quantumOwnedActions:b?.actions)??[],C=R.getFragmentData(w.ACTION_MODULE_FRAGMENT,v?.module),S=R.getFragmentData(w.MODULE_ACTION_FRAGMENT,C?.moduleActions)??[],[p,j]=o.useState([...S.map(x=>x.actionId)??[]]),[M,D]=o.useState(C?.name??""),[I,z]=o.useState([]),[k,U]=o.useState(C?.description??"");o.useEffect(()=>{C&&(j(S.map(x=>x.actionId)),D(C.name),U(C.description??""),z(C.categories.map(x=>R.getFragmentData(w.MODULE_CATEGORY_FRAGMENT,x).id)??[]))},[C,S]);const P=o.useCallback(()=>{let x;const r={actions:p,name:M,categories:I.filter(i=>i!=="other"),description:k,quantumOwned:u};C?x=A({id:C.id,input:r}):x=l({input:r}),x.then(({error:i})=>{i?m(i):a()})},[l,A,p,M,k,I,C,a,m]);return o.useEffect(()=>{f&&f({cancelButton:E||d,saveButton:E||d||!M||k.trim().split(/\s+/).filter(Boolean).length>40})},[f,E,d,p,M,k]),o.useEffect(()=>{h&&h({cancelButton:s,saveButton:P})},[h,s,P]),e.jsxRuntimeExports.jsxs(t.Box,{width:"100%",children:[e.jsxRuntimeExports.jsx(pe,{name:M,setName:D,actions:T,selectedActionIds:p,setSelectedActionIds:j,availableCategories:g??[],selectedCategoryIds:I,setSelectedCategoryIds:z,description:k,setDescription:U}),!c&&e.jsxRuntimeExports.jsx(t.HStack,{justifyContent:"flex-start",children:e.jsxRuntimeExports.jsxs(t.ButtonGroup,{mt:16,gap:4,children:[e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:E||d,onClick:s,children:"Cancel"}),e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",isDisabled:E||d||!M||k.trim().split(/\s+/).filter(Boolean).length>40,isLoading:E||d,onClick:P,children:"Save"})]})})]})};exports.ActivityList=me;exports.CopyActivityForm=Ie;exports.CopyModuleForm=Ne;exports.ModuleForm=pe;exports.ParameterEditList=he;exports.ParameterEditSelect=je;exports.UpsertActivityForm=Ue;exports.UpsertModuleForm=ze;
|
|
13
|
+
`,Ie=({onSave:n,onCancel:s,onError:a,hideButtons:m=!1,setButtonDisabled:c,setButtonOnClick:u,quantumOwned:h})=>{const f=t.useToast(),[b,v]=o.useState(""),[F,g]=o.useState([]),[E,A]=o.useState(!1),[d]=G.useQuery({query:w.GET_GROUPS}),[l]=G.useQuery({query:w.GET_ACTIONS_BY_GROUP,variables:{groupId:b},pause:!b}),[,T]=G.useMutation(w.CREATE_ACTION),C=o.useMemo(()=>d.data?.groups?d.data.groups.map(x=>R.getFragmentData(w.GROUP_FRAGMENT,x)):[],[d.data]),S=o.useMemo(()=>l.data?l.data.actions.map(r=>R.getFragmentData(w.ACTION_FRAGMENT,r)):[],[l.data]),p=o.useMemo(()=>S.filter(x=>F.includes(x.id)),[S,F]),j=o.useCallback(x=>{const r=x?.value||"";v(r),g([])},[]),M=o.useCallback(x=>{const r=x.map(i=>i.value);g(r)},[]),D=o.useCallback(async()=>{if(A(!0),!p.length){const x=new Error("No activities selected for copying");a?.(x),A(!1);return}try{const x=[];let r=0;for(const i of p)try{const y={...i,name:`${i.name} (Copy)`,description:i.description||void 0,instructionsPointOfInterest:i.instructionsPointOfInterest||void 0,instructionsMovementReport:i.instructionsMovementReport||void 0,laterality:i.laterality,activityKind:i.activityKind,sensorLocations:i.sensorLocations,thresholds:i.thresholds.map(_=>({..._,id:void 0})),quantumOwned:h,id:void 0},L=await T({fields:y});if(L.error)throw new Error(L.error.message);if(L.data?.createAction){const _=R.getFragmentData(w.ACTION_FRAGMENT,L.data.createAction);x.push(_)}}catch(y){console.error(`Failed to copy activity "${i.name}":`,y),r++}if(x.length>0){const i=x.length,y=p.length;f({title:r>0?"Partial copy completed":"Activities copied successfully",description:r>0?`${i} of ${y} activities copied successfully`:`${i} activit${i>1?"ies":"y"} copied successfully`,status:r>0?"warning":"success",duration:3e3,isClosable:!0}),n?.(),v(""),g([])}else throw new Error("Failed to copy any activities")}catch(x){const r=x instanceof Error?x.message:"Failed to copy activities";f({title:"Copy failed",description:r,status:"error",duration:5e3,isClosable:!0}),a?.(x instanceof Error?x:new Error(r))}finally{A(!1)}},[p,T,f,n,a,h]),I=o.useCallback(()=>{v(""),g([]),s?.()},[s]);o.useEffect(()=>{c&&c({cancelButton:!1,saveButton:p.length===0||E})},[p.length,E,c]),o.useEffect(()=>{u&&u({cancelButton:I,saveButton:D})},[u,I,D]);const z=o.useMemo(()=>C.map(x=>({value:x.id,label:x.name})),[C]),k=o.useMemo(()=>S.map(x=>({value:x.id,label:x.name,isQuantumOwned:x.quantumOwned})),[S]),U=d.fetching,P=l.fetching;return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsxs(t.VStack,{spacing:6,align:"stretch",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(V,{children:"Select Source Group"}),e.jsxRuntimeExports.jsx(H.st,{placeholder:"Choose a group...",options:z,value:z.find(x=>x.value===b)||null,onChange:j,isLoading:U,isDisabled:U,isClearable:!0}),d.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load groups: ",d.error.message]})]})]}),b&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(V,{children:"Select Activities to Copy"}),P?e.jsxRuntimeExports.jsxs(t.HStack,{children:[e.jsxRuntimeExports.jsx(t.Spinner,{size:"sm"}),e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.600",children:"Loading activities..."})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(H.st,{placeholder:"Choose activities to copy...",options:k,value:k.filter(x=>F.includes(x.value)),onChange:M,isDisabled:k.length===0,isClearable:!0,isMulti:!0,closeMenuOnSelect:!1,formatOptionLabel:(x,{context:r})=>e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",w:"100%",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(t.Text,{children:x.label}),r==="value"&&x.isQuantumOwned&&e.jsxRuntimeExports.jsx(t.Text,{color:"blue",fontSize:"xs",children:"(Quantum Owned)"})]}),x.isQuantumOwned&&r==="menu"&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]})}),k.length===0&&e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",mt:2,children:"No activities found"})]}),l.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load activities: ",l.error.message]})]})]}),p.length>0&&e.jsxRuntimeExports.jsxs(t.Box,{p:4,bg:"gray.50",borderRadius:"md",children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"semibold",mb:3,children:p.length===1?"Activity to Copy:":`${p.length} Activities to Copy:`}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:3,children:[p.map((x,r)=>e.jsxRuntimeExports.jsxs(t.Box,{w:"100%",p:3,bg:"white",borderRadius:"md",border:"1px solid",borderColor:"gray.200",children:[e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"start",mb:2,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",fontSize:"sm",children:[r+1,". ",x.name]}),x.quantumOwned&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,fontSize:"sm",color:"gray.600",children:[x.description&&e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Description:"})," ",x.description]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Type:"})," ",x.activityKind]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Laterality:"})," ",x.laterality]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Sensor Locations:"})," ",x.sensorLocations.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Thresholds:"})," ",x.thresholds.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Use Cases:"})," ",x.useCases.map(i=>i.name).join(", ")||"None"]})]})]},x.id)),p.length>1&&e.jsxRuntimeExports.jsx(t.Box,{w:"100%",p:2,bg:"blue.50",borderRadius:"md",border:"1px solid",borderColor:"blue.200",children:e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",fontWeight:"medium",color:"blue.800",children:["Total: ",p.length," activities will be copied"]})})]})]}),!m&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{spacing:4,justifyContent:"flex-end",children:[e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:I,isDisabled:E,children:"Cancel"}),e.jsxRuntimeExports.jsxs(t.Button,{colorScheme:"blue",onClick:D,isDisabled:p.length===0||E,isLoading:E,loadingText:"Copying...",children:["Copy"," ",p.length===1?"Activity":`${p.length} Activities`]})]})]})})},Ne=({onSave:n,onCancel:s,onError:a,hideButtons:m=!1,setButtonDisabled:c,setButtonOnClick:u,quantumOwned:h})=>{const f=t.useToast(),[b,v]=o.useState(""),[F,g]=o.useState([]),[E,A]=o.useState(!1),[d]=G.useQuery({query:w.GET_GROUPS}),[l]=G.useQuery({query:w.GET_MODULES_BY_GROUP,variables:{groupId:b},pause:!b}),[,T]=G.useMutation(w.CREATE_MODULE),[,C]=G.useMutation(w.CREATE_ACTION),S=o.useMemo(()=>d.data?.groups?d.data.groups.map(r=>R.getFragmentData(w.GROUP_FRAGMENT,r)):[],[d.data]),p=o.useMemo(()=>l.data?.modules?R.getFragmentData(w.ACTION_MODULE_FRAGMENT,l.data?.modules).map(i=>{const y=R.getFragmentData(w.MODULE_ACTION_FRAGMENT,i.moduleActions);return{...i,moduleActions:y.map(L=>({...L,action:R.getFragmentData(w.ACTION_FRAGMENT,L.action)})),categories:R.getFragmentData(w.MODULE_CATEGORY_FRAGMENT,i.categories)}}):[],[l.data]),j=o.useMemo(()=>p.filter(r=>F.includes(r.id)),[p,F]),M=o.useCallback(r=>{const i=r?.value||"";v(i),g([])},[]),D=o.useCallback(r=>{const i=r.map(y=>y.value);g(i)},[]),I=o.useCallback(async()=>{if(A(!0),!j.length){A(!1);const r=new Error("No modules selected for copying");a?.(r);return}try{const r=[];let i=0;for(const y of j)try{let L=y.moduleActions.map(O=>O.actionId);if(h){const O=y.moduleActions.map(B=>B.action);L=(await Promise.all(O.map(async B=>{if(B.quantumOwned)return Promise.resolve(B);const Z={...B,quantumOwned:h,thresholds:B.thresholds.map(Q=>({...Q,id:void 0})),id:void 0};return await C({fields:Z}).then(Q=>Q.error||!Q.data?.createAction?null:R.getFragmentData(w.ACTION_FRAGMENT,Q.data.createAction))}))).filter(B=>!!B).map(B=>B.id)}const _={name:`${y.name} (Copy)`,description:y.description||void 0,actions:L,categories:y.categories.map(O=>O.id),quantumOwned:h},W=await T({input:_});if(W.error)throw new Error(W.error.message);if(W.data?.createModule){const O=R.getFragmentData(w.ACTION_MODULE_FRAGMENT,W.data.createModule);r.push(O)}}catch(L){console.error(`Failed to copy module "${y.name}":`,L),i++}if(r.length>0){const y=r.length,L=j.length;f({title:i>0?"Partial copy completed":"Modules copied successfully",description:i>0?`${y} of ${L} modules copied successfully`:`${y} module${y>1?"s":""} copied successfully`,status:i>0?"warning":"success",duration:3e3,isClosable:!0}),r.length>0&&n?.(),v(""),g([])}else throw new Error("Failed to copy any modules")}catch(r){const i=r instanceof Error?r.message:"Failed to copy modules";f({title:"Copy failed",description:i,status:"error",duration:5e3,isClosable:!0}),a?.(r instanceof Error?r:new Error(i))}finally{A(!1)}},[j,T,f,n,a,h,C]),z=o.useCallback(()=>{v(""),g([]),s?.()},[s]);o.useEffect(()=>{c&&c({cancelButton:!1,saveButton:j.length===0||E})},[j.length,E,c]),o.useEffect(()=>{u&&u({cancelButton:z,saveButton:I})},[u,z,I]);const k=o.useMemo(()=>S.map(r=>({value:r.id,label:r.name})),[S]),U=o.useMemo(()=>p.map(r=>({value:r.id,label:r.name,isQuantumOwned:r.quantumOwned})),[p]),P=d.fetching,x=l.fetching;return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsxs(t.VStack,{spacing:6,align:"stretch",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(V,{children:"Select Source Group"}),e.jsxRuntimeExports.jsx(H.st,{placeholder:"Choose a group...",options:k,value:k.find(r=>r.value===b)||null,onChange:M,isLoading:P,isDisabled:P,isClearable:!0}),d.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load groups: ",d.error.message]})]})]}),b&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(V,{children:"Select Module to Copy"}),x?e.jsxRuntimeExports.jsxs(t.HStack,{children:[e.jsxRuntimeExports.jsx(t.Spinner,{size:"sm"}),e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.600",children:"Loading modules..."})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(H.st,{placeholder:"Choose modules to copy...",options:U,value:U.filter(r=>F.includes(r.value)),onChange:D,isDisabled:U.length===0,isClearable:!0,isMulti:!0,closeMenuOnSelect:!1,formatOptionLabel:(r,{context:i})=>e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",w:"100%",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(t.Text,{children:r.label}),i==="value"&&r.isQuantumOwned&&e.jsxRuntimeExports.jsx(t.Text,{color:"blue",fontSize:"xs",children:"(Quantum Owned)"})]}),r.isQuantumOwned&&i==="menu"&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]})}),U.length===0&&e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",mt:2,children:"No modules found in this group"})]}),l.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load modules: ",l.error.message]})]})]}),j.length>0&&e.jsxRuntimeExports.jsxs(t.Box,{p:4,bg:"gray.50",borderRadius:"md",children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"semibold",mb:3,children:j.length===1?"Module to Copy:":`${j.length} Modules to Copy:`}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:3,children:[j.map((r,i)=>e.jsxRuntimeExports.jsxs(t.Box,{w:"100%",p:3,bg:"white",borderRadius:"md",border:"1px solid",borderColor:"gray.200",children:[e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"start",mb:2,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",fontSize:"sm",children:[i+1,". ",r.name]}),r.quantumOwned&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,fontSize:"sm",color:"gray.600",children:[r.description&&e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Description:"})," ",r.description]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Actions:"})," ",r.moduleActions.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Categories:"})," ",r.categories.map(y=>y.name).join(", ")||"None"]})]})]},r.id)),j.length>1&&e.jsxRuntimeExports.jsx(t.Box,{w:"100%",p:2,bg:"blue.50",borderRadius:"md",border:"1px solid",borderColor:"blue.200",children:e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",fontWeight:"medium",color:"blue.800",children:["Total: ",j.length," modules will be copied"]})}),h&&j.filter(r=>r.moduleActions.some(i=>!i.action.quantumOwned)).length>0&&e.jsxRuntimeExports.jsx(t.Box,{p:2,bg:"yellow.50",borderRadius:"md",border:"1px solid",borderColor:"yellow.200",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",fontWeight:"medium",color:"yellow.800",children:"Copying Modules with Non QM-Owned Actions will create corresponding QM-Owned Actions"})})]})]}),!m&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{spacing:4,justifyContent:"flex-end",children:[e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:z,isDisabled:E,children:"Cancel"}),e.jsxRuntimeExports.jsxs(t.Button,{colorScheme:"blue",onClick:I,isDisabled:j.length===0||E,isLoading:E,loadingText:"Copying...",children:["Copy"," ",j.length===1?"Module":`${j.length} Modules`]})]})]})})},pe=({name:n,setName:s,actions:a,selectedActionIds:m,setSelectedActionIds:c,availableCategories:u,selectedCategoryIds:h,setSelectedCategoryIds:f,description:b,setDescription:v,...F})=>{const g=t.useDisclosure(),E=o.useMemo(()=>a.map(S=>({...S,selected:m.includes(S.id)})),[a,m]),A=o.useMemo(()=>a.reduce((S,p)=>(S[p.id]=p,S),{}),[a]),d=o.useMemo(()=>m.map(S=>A[S]),[E,m]),l=o.useCallback((S,p)=>{c(p?[...m,S.id]:m.filter(j=>j!==S.id))},[m,c]),T=o.useCallback(S=>{s(S.target.value)},[s]),C=o.useCallback(S=>{v?.(S.target.value)},[v]);return e.jsxRuntimeExports.jsxs(t.Box,{...F,children:[e.jsxRuntimeExports.jsxs(t.HStack,{gap:"2rem",children:[e.jsxRuntimeExports.jsx(ke,{name:n??"",onInputChange:T}),e.jsxRuntimeExports.jsx(Le,{availableCategories:u,value:h,onChange:f})]}),e.jsxRuntimeExports.jsx(Oe,{description:b??"",onInputChange:C}),e.jsxRuntimeExports.jsx(De,{value:d,onChange:c,onAdjustActivities:()=>g.onOpen()}),e.jsxRuntimeExports.jsxs(t.Modal,{isOpen:g.isOpen,onClose:g.onClose,size:"6xl",children:[e.jsxRuntimeExports.jsx(t.ModalOverlay,{}),e.jsxRuntimeExports.jsxs(t.ModalContent,{children:[e.jsxRuntimeExports.jsx(t.ModalHeader,{children:"Select Activities"}),e.jsxRuntimeExports.jsx(t.ModalCloseButton,{}),e.jsxRuntimeExports.jsx(t.ModalBody,{children:e.jsxRuntimeExports.jsx(me,{actions:E,onSelected:l,disableCreate:!0,disableDelete:!0,tableProps:{height:"28rem",overflowY:"auto"}})}),e.jsxRuntimeExports.jsx(t.ModalFooter,{children:e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",onClick:g.onClose,isDisabled:m.length===0,children:"Done"})})]})]})]})},ke=o.memo(({name:n,onInputChange:s})=>e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(V,{children:"Module Name"}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"i.e. ACL RTP Test Battery",value:n,onChange:s,isRequired:!0})]})),Le=o.memo(({availableCategories:n,value:s,onChange:a})=>{const m=o.useMemo(()=>[...n,{id:"other",name:"Other"}],[n]),c=o.useMemo(()=>m.map(u=>({value:u.id,label:u.name})),[m]);return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(V,{children:"Module Category"}),e.jsxRuntimeExports.jsx(H.st,{isDisabled:n.length===0,isClearable:!0,options:c,value:m.filter(u=>s.includes(u.id)).map(u=>({value:u.id,label:u.name})),onChange:u=>a(u?[u.value]:[]),placeholder:"Select category"})]})}),Oe=o.memo(({description:n,onInputChange:s})=>e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(V,{children:e.jsxRuntimeExports.jsxs("span",{children:["Description",e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",children:"Briefly describe the objective of this module. Max 40 words."})]})}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"i.e. Assess readiness to return to play post-ACL reconstruction",value:n,onChange:s})]})),De=o.memo(({value:n,onChange:s,onAdjustActivities:a})=>{const m=o.useMemo(()=>n.map(c=>({id:c.id,name:c.name})),[n]);return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsxs(t.HStack,{justifyContent:"space-between",children:[e.jsxRuntimeExports.jsx(V,{children:e.jsxRuntimeExports.jsxs("span",{children:["Activities",e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",children:"Drag and drop to reorder the activities in this module."})]})}),e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"solid",colorScheme:"blue",onClick:a,children:"Add / Remove Activities"})]}),m.length===0?e.jsxRuntimeExports.jsx(t.VStack,{children:e.jsxRuntimeExports.jsxs(t.Text,{color:"gray.500",fontSize:"lg",mb:"4rem",mt:"4rem",children:["No activities selected for this module.",e.jsxRuntimeExports.jsx(t.Button,{ml:"0.5em",size:"sm",variant:"link",colorScheme:"blue",onClick:a,children:"Add activities."})]})}):e.jsxRuntimeExports.jsx(Ce,{value:m,onChange:c=>{const u=c(m);s(u.map(h=>h.id))}})]})}),he=({value:n,onChange:s,forceKind:a,disableRemove:m,disableKind:c,lockRanges:u,...h})=>{const f=o.useMemo(()=>[...n].sort((g,E)=>{const A=J.availablePlanes.indexOf(g.plane),d=J.availablePlanes.indexOf(E.plane);return A-d}),[n]),b=o.useCallback(g=>"segment"in g.id?K.getSegmentNameWithPlane(g.id.segment,g.plane,!0)??"Unknown":K.getJointNameWithPlane(g.id.joint,g.plane,!0)??"Unknown",[]),v=o.useCallback((g,E)=>{const A=f.findIndex(l=>l.id===E.id&&l.plane===E.plane);let d=[...f];a&&(E={...E,kind:a}),d[A]=E,u&&(d=d.map(l=>({...l,min:E.min,max:E.max}))),s(d)},[s,f,a,u]),F=o.useCallback(g=>{const E=f.filter(A=>A.id!==g.id||A.plane!==g.plane);s(E)},[s,f]);return e.jsxRuntimeExports.jsx(t.VStack,{alignItems:"flex-start",overflowY:"auto",...h,children:f.map((g,E)=>e.jsxRuntimeExports.jsx(_e,{label:b(g),parameter:g,onChange:A=>v(E,A),onRemove:m?void 0:()=>F(g),forceKind:a,disableKind:c},`${JSON.stringify(g.id)}-${g.plane}`))})},_e=({label:n,parameter:s,onChange:a,onRemove:m,forceKind:c,disableKind:u})=>{const h=o.useCallback(v=>"joint"in s.id?K.getJointAngleDirectionName(s.id.joint,s.plane,v<0?-1:1):K.getSegmentAngleDirectionName(s.id.segment,s.plane,v<0?-1:1),[s]),{min:f,max:b}="joint"in s.id?K.getNormativeJointRange(s.id.joint,s.plane):{min:-180,max:180};return e.jsxRuntimeExports.jsxs(t.VStack,{borderRadius:"md",p:2,px:4,bg:"gray.100",w:"100%",overflow:"hidden",flexShrink:"0",children:[e.jsxRuntimeExports.jsxs(t.HStack,{w:"100%",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",flex:1,textTransform:"capitalize",fontWeight:"semibold",children:n}),m&&e.jsxRuntimeExports.jsx(t.IconButton,{size:"xs",variant:"ghost","aria-label":"delete",icon:e.jsxRuntimeExports.jsx(t.Icon,{as:de.FaTrash}),onClick:m}),!c&&e.jsxRuntimeExports.jsx(le,{selectedItem:s?.kind??R.ThresholdKind.Limit,onChange:({value:v})=>a({...s,kind:v}),isDisabled:u,buttonProps:{size:"sm",variant:"outline",colorScheme:"gray"},selectedProps:{variant:"solid",colorScheme:"teal"},items:[{value:R.ThresholdKind.Limit,label:"limit"},{value:R.ThresholdKind.Target,label:"target"}]})]}),e.jsxRuntimeExports.jsx(ye,{w:"100%",size:"xs",min:f,max:b,zeroMarker:!0,value:[s.min,s.max],onChange:v=>a({...s,min:v[0],max:v[1]}),formatValue:v=>`${Math.abs(v)}°`,valueLabel:v=>h(v)??"",positiveNegativeLabels:h(0)?[h(-1)??"",h(1)??""]:void 0})]})},ne=(n,s)=>"segment"in n&&"segment"in s&&n.segment===s.segment||"joint"in n&&"joint"in s&&n.joint===s.joint,je=({options:n,value:s,onChange:a,forceKind:m,singleValue:c,singleValueSideless:u,editOnly:h,disableKind:f,maxParameters:b,...v})=>{const F=u?2:b,g=o.useMemo(()=>n.map(l=>({label:"segment"in l.id?K.getSegmentNameWithPlane(l.id.segment,l.plane,!0)??"Unknown":K.getJointNameWithPlane(l.id.joint,l.plane,!0)??"Unknown",value:l.id,plane:l.plane})),[n]),E=o.useMemo(()=>{if(!u||s.length===0)return g;const l=s[0];return g.filter(T=>J.getAnalysisPartIdNoSide(T.value)===J.getAnalysisPartIdNoSide(l.id)&&T.plane===l.plane)},[g,s,u]),A=o.useMemo(()=>g.filter(l=>s.some(T=>ne(T.id,l.value)&&T.plane===l.plane)),[g,s]),d=o.useCallback(l=>{const T=l.map(C=>{const S=s.find(I=>ne(I.id,C.value)&&I.plane===C.plane),p=n.find(I=>ne(I.id,C.value)&&I.plane===C.plane),j=u?s.find(I=>J.getAnalysisPartIdNoSide(I.id)===J.getAnalysisPartIdNoSide(C.value)&&I.plane===C.plane):void 0,M=j&&!S?j.min:p&&p.min?p.min:0,D=j&&!S?j.max:p&&p.max?p.max:0;return S??{id:C.value,plane:C.plane,min:M,max:D,kind:m??R.ThresholdKind.Limit}});a(T)},[a,s,n,m,u]);return o.useEffect(()=>{const l=s.filter(T=>n.some(C=>ne(C.id,T.id)&&C.plane===T.plane));l.length!==s.length&&a(l)},[n,a]),e.jsxRuntimeExports.jsxs(t.Box,{...v,children:[e.jsxRuntimeExports.jsx(H.st,{isMulti:!c,placeholder:s.length?`${s.length} selected`:"Search...",value:A,isDisabled:h||A.length>=(F??1/0),onChange:l=>Array.isArray(l)?d([...l]):d(l!==null?[l]:[]),options:E,controlShouldRenderValue:!1}),e.jsxRuntimeExports.jsx(he,{marginTop:2,maxH:"28rem",value:s,onChange:a,forceKind:m,disableKind:f,lockRanges:u})]})},ge=n=>{switch(n){case R.SensorLocation.Thorax:return"Thorax";case R.SensorLocation.CenterBack:return"Center Back";case R.SensorLocation.Pelvis:return"Pelvis";case R.SensorLocation.LeftThigh:return"Left Thigh";case R.SensorLocation.RightThigh:return"Right Thigh";case R.SensorLocation.LeftShank:return"Left Shank";case R.SensorLocation.RightShank:return"Right Shank";case R.SensorLocation.LeftFoot:return"Left Foot";case R.SensorLocation.RightFoot:return"Right Foot";case R.SensorLocation.LeftUpperArm:return"Left Upper Arm";case R.SensorLocation.RightUpperArm:return"Right Upper Arm";case R.SensorLocation.LeftForearm:return"Left Forearm";case R.SensorLocation.RightForearm:return"Right Forearm";case R.SensorLocation.Head:return"Head"}return console.warn(`Unknown sensor location: ${n}`),"Unknown"},Be=6,Pe=[R.SensorLocation.LeftFoot,R.SensorLocation.LeftShank,R.SensorLocation.LeftThigh,R.SensorLocation.Pelvis,R.SensorLocation.RightFoot,R.SensorLocation.RightShank,R.SensorLocation.RightThigh,R.SensorLocation.Thorax,R.SensorLocation.CenterBack,R.SensorLocation.Head],Ge=Pe.map(n=>({label:ge(n),value:n})),ae=n=>n.map(s=>s.__isNew__?{name:s.label}:{id:s.value,name:s.label}),Ue=({id:n,onError:s,onCancel:a,onSave:m,hideButtons:c,setButtonOnClick:u,setButtonDisabled:h,quantumOwned:f})=>{const b=G.useClient(),[{fetching:v},F]=G.useMutation(w.CREATE_ACTION),[{fetching:g},E]=G.useMutation(w.UPDATE_ACTION),[{data:A}]=G.useQuery({query:w.GET_ACTION_BY_ID,variables:{id:n??""},pause:!n}),d=R.getFragmentData(w.ACTION_FRAGMENT,A?.getActionById),l=v||g,T=!!d&&!!n,[C,S]=o.useState(""),[p,j]=o.useState(""),[M,D]=o.useState(""),[I,z]=o.useState(""),[k,U]=o.useState(R.ActionLaterality.Either),[P,x]=o.useState(R.ActionActivityKind.Action),[r,i]=o.useState([]),[y,L]=o.useState([]),_=o.useMemo(()=>r.map(N=>N.value),[r]),W=fe.usePartOptionsForSensorLocations(_),[O,q]=o.useState([]),[B,Z]=o.useState(!1),Q=C.length&&k;o.useEffect(()=>{d&&(S(d.name),x(d.activityKind),j(d.description||""),U(d.laterality),L(d.useCases.map(N=>({id:N.id,value:N.id,label:N.name,__isNew__:!1}))),D(d.instructionsPointOfInterest||""),z(d.instructionsMovementReport||""),i(d.sensorLocations.map(N=>({label:ge(N),value:N}))),q(X.thresholdsToParameters(d.thresholds)))},[d]);const Ee=o.useCallback(async N=>(await b.query(f?w.SEARCH_QUANTUM_OWNED_USE_CASES:w.SEARCH_USE_CASES,{query:N,limit:10}).then(Y=>{const te=Y.data;return te?te?.quantumOwnedUseCases?te.quantumOwnedUseCases:te.useCases:[]})??[]).map(Y=>({label:Y.name,value:Y.id})),[b,f]),[ce,ue]=o.useState({});o.useEffect(()=>{ue({name:C,laterality:k,description:p,instructionsPointOfInterest:M,instructionsMovementReport:I,sensorLocations:_,thresholds:X.parametersToThresholds(O),useCases:ae(y),activityKind:P})},[ue,d]);const re=o.useMemo(()=>JSON.stringify(ce)!==JSON.stringify({name:C,laterality:k,description:p,instructionsPointOfInterest:M,instructionsMovementReport:I,sensorLocations:_,thresholds:X.parametersToThresholds(O),useCases:ae(y),activityKind:P}),[ce,C,k,_,p,I,M,O,y,P]),ie=o.useCallback(()=>{const N={name:C,laterality:k,description:p,instructionsPointOfInterest:M,instructionsMovementReport:I,sensorLocations:_,thresholds:X.parametersToThresholds(O),useCases:ae(y),activityKind:P,quantumOwned:f};let ee;T&&n?ee=E({id:n,fields:N}):ee=F({fields:N}),ee.then(({error:Y})=>{Y?s(Y):m()})},[f,F,E,n,C,k,_,m,p,I,M,T,O,y,P,s]);return o.useEffect(()=>{h&&h({cancelButton:l,saveButton:l||!Q||!re})},[l,h,Q,re]),o.useEffect(()=>{u&&u({cancelButton:a,saveButton:ie})},[u,a,ie]),e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-4 w-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"col-span-2 lg:col-span-1 flex flex-col gap-8",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Name"}),e.jsxRuntimeExports.jsx(t.Input,{value:C,onChange:N=>S(N.target.value),type:"text",placeholder:"i.e. Lunge & Return"})]}),e.jsxRuntimeExports.jsxs(t.HStack,{m:"0",p:"0",w:"100%",justifyItems:"space-between",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Activity Type"}),e.jsxRuntimeExports.jsx(le,{selectedItem:P,onChange:N=>x(N.value),buttonProps:{size:"sm",variant:"outline",colorScheme:"gray"},selectedProps:{variant:"solid",colorScheme:"teal"},items:[{value:R.ActionActivityKind.Action,label:"Action"},{value:R.ActionActivityKind.Movement,label:"Movement"}]})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Laterality"}),e.jsxRuntimeExports.jsx(le,{selectedItem:k,onChange:N=>U(N.value),buttonProps:{size:"sm",variant:"outline",colorScheme:"gray"},selectedProps:{variant:"solid",colorScheme:"teal"},items:[{value:R.ActionLaterality.Unilateral,label:"unilateral"},{value:R.ActionLaterality.Bilateral,label:"bilateral"},{value:R.ActionLaterality.Either,label:"either / or"}]})]})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Use Cases"}),e.jsxRuntimeExports.jsx(t.Tooltip,{isOpen:B,label:"Type to search for existing use cases",placement:"top-end",children:e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsx(H.yt,{value:y,onChange:N=>L([...N]),isMulti:!0,cacheOptions:!0,defaultOptions:!0,onFocus:()=>Z(!0),onBlur:()=>Z(!1),loadOptions:Ee,placeholder:"(optional) Search for & select use cases…"})})})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Description"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:p,onChange:N=>j(N.target.value),rows:2,placeholder:"(optional) Describe how to perform the test or exercise"})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Instructions for General Movement Report"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:I,onChange:N=>z(N.target.value),rows:2,placeholder:"(optional) Describe how to setup or generate the movement report"})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Instructions for Point of Interest Report"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:M,onChange:N=>D(N.target.value),rows:2,placeholder:"(optional) Describe how to setup or generate the point of interest report"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"col-span-2 lg:col-span-1 flex flex-col gap-8",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Sensor Locations"}),e.jsxRuntimeExports.jsx(H.st,{isMulti:!0,value:r,onChange:N=>i([...N]),options:Ge,isOptionDisabled:()=>r.length>=Be})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx($,{children:"Default Parameters"}),e.jsxRuntimeExports.jsx(je,{options:W,value:O,onChange:q})]})]}),e.jsxRuntimeExports.jsx("div",{className:X.cn("col-span-2 flex justify-end",c&&"hidden"),children:e.jsxRuntimeExports.jsxs(t.ButtonGroup,{mt:16,gap:4,children:[e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:l,onClick:a,children:"Cancel"}),e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",isDisabled:l||!Q||!re,isLoading:l,onClick:ie,children:"Save changes"})]})})]})},$=({children:n})=>e.jsxRuntimeExports.jsx(t.FormLabel,{fontWeight:"bold",fontFamily:"sans-serif",fontSize:"large",children:n}),ze=({id:n,onCancel:s,onSave:a,onError:m,hideButtons:c,quantumOwned:u,setButtonOnClick:h,setButtonDisabled:f})=>{const[{data:b}]=G.useQuery({query:u?w.GET_QUANTUM_OWNED_ACTIONS:w.GET_ACTIONS}),[{data:v}]=G.useQuery({query:w.GET_MODULE_BY_ID,variables:{id:n},pause:!n}),[{data:F}]=G.useQuery({query:w.GET_ALL_MODULE_CATEGORIES}),g=R.getFragmentData(w.MODULE_CATEGORY_FRAGMENT,F?.moduleCategories),[{fetching:E},A]=G.useMutation(w.UPDATE_MODULE),[{fetching:d},l]=G.useMutation(w.CREATE_MODULE),T=R.getFragmentData(w.ACTION_FRAGMENT,u?b?.quantumOwnedActions:b?.actions)??[],C=R.getFragmentData(w.ACTION_MODULE_FRAGMENT,v?.module),S=R.getFragmentData(w.MODULE_ACTION_FRAGMENT,C?.moduleActions)??[],[p,j]=o.useState([...S.map(x=>x.actionId)??[]]),[M,D]=o.useState(C?.name??""),[I,z]=o.useState([]),[k,U]=o.useState(C?.description??"");o.useEffect(()=>{C&&(j(S.map(x=>x.actionId)),D(C.name),U(C.description??""),z(C.categories.map(x=>R.getFragmentData(w.MODULE_CATEGORY_FRAGMENT,x).id)??[]))},[C,S]);const P=o.useCallback(()=>{let x;const r={actions:p,name:M,categories:I.filter(i=>i!=="other"),description:k,quantumOwned:u};C?x=A({id:C.id,input:r}):x=l({input:r}),x.then(({error:i})=>{i?m(i):a()})},[l,A,p,M,k,I,C,a,m]);return o.useEffect(()=>{f&&f({cancelButton:E||d,saveButton:E||d||!M||k.trim().split(/\s+/).filter(Boolean).length>40})},[f,E,d,p,M,k]),o.useEffect(()=>{h&&h({cancelButton:s,saveButton:P})},[h,s,P]),e.jsxRuntimeExports.jsxs(t.Box,{width:"100%",children:[e.jsxRuntimeExports.jsx(pe,{name:M,setName:D,actions:T,selectedActionIds:p,setSelectedActionIds:j,availableCategories:g??[],selectedCategoryIds:I,setSelectedCategoryIds:z,description:k,setDescription:U}),!c&&e.jsxRuntimeExports.jsx(t.HStack,{justifyContent:"flex-start",children:e.jsxRuntimeExports.jsxs(t.ButtonGroup,{mt:16,gap:4,children:[e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:E||d,onClick:s,children:"Cancel"}),e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",isDisabled:E||d||!M||k.trim().split(/\s+/).filter(Boolean).length>40,isLoading:E||d,onClick:P,children:"Save"})]})})]})};exports.ActivityList=me;exports.CopyActivityForm=Ie;exports.CopyModuleForm=Ne;exports.ModuleForm=pe;exports.ParameterEditList=he;exports.ParameterEditSelect=je;exports.UpsertActivityForm=Ue;exports.UpsertModuleForm=ze;
|
package/dist/components.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { j as e } from "./
|
|
1
|
+
import { j as e } from "./react-jsx-runtime-vendor-OVHDjVDe.js";
|
|
2
2
|
import { Flex as le, InputGroup as Pe, InputLeftElement as ls, Icon as We, Input as ye, FormLabel as $e, Box as B, TableContainer as Qe, Table as qe, Thead as He, Tr as Ce, Th as ie, Tbody as Ye, Td as re, ButtonGroup as ce, Tooltip as Je, Button as $, RangeSlider as as, RangeSliderMark as Ae, Text as M, RangeSliderTrack as cs, RangeSliderFilledTrack as ds, RangeSliderThumb as _e, Select as ze, NumberInput as Ue, NumberInputField as Ge, HStack as K, Tag as de, Checkbox as us, useToast as Ke, VStack as V, FormControl as G, Alert as be, AlertIcon as ve, Spinner as Xe, useDisclosure as hs, Modal as ms, ModalOverlay as gs, ModalContent as ps, ModalHeader as xs, ModalCloseButton as fs, ModalBody as js, ModalFooter as bs, IconButton as vs, Textarea as Ie } from "@chakra-ui/react";
|
|
3
3
|
import { useMemo as D, useState as F, useCallback as O, useRef as ys, useEffect as Y, memo as Se } from "react";
|
|
4
|
-
import { u as Cs } from "./vendor-
|
|
4
|
+
import { u as Cs } from "./ufuzzy-vendor-Dl0ZI6Av.js";
|
|
5
5
|
import { d as Ze } from "./styled-components-vendor-Bvwhddj9.js";
|
|
6
|
-
import { s as se, y as Ss } from "./react-select-vendor-
|
|
6
|
+
import { s as se, y as Ss } from "./react-select-vendor-C_DuqfB7.js";
|
|
7
7
|
import { F as ws, a as Ms } from "./react-icons-vendor-TETORdU9.js";
|
|
8
|
-
import { u as ee, a as oe, b as As } from "./graphql-vendor-
|
|
8
|
+
import { u as ee, a as oe, b as As } from "./graphql-vendor-BWnD0b-j.js";
|
|
9
9
|
import { g as W, T as je, S as k, A as ge, a as Te } from "./generated-GfcSQz21.js";
|
|
10
10
|
import { A as ae, G as Ve, a as Is, C as De, b as es, c as Re, M as ss, d as Le, e as Ts, f as ts, S as Ns, g as Os, U as Rs, h as Ls, i as Fs, j as Ds, k as ks, l as Es, m as Ps } from "./graphql-DZp5ePcc.js";
|
|
11
|
-
import { D as _s, H as zs, u as Us, a as Gs } from "./react-dnd-vendor-
|
|
11
|
+
import { D as _s, H as zs, u as Us, a as Gs } from "./react-dnd-vendor-D4nn9Mqx.js";
|
|
12
12
|
import { getSegmentNameWithPlane as ns, getJointNameWithPlane as is, getJointAngleDirectionName as Bs, getSegmentAngleDirectionName as Ws, getNormativeJointRange as $s } from "./services.js";
|
|
13
13
|
import { availablePlanes as Be, getAnalysisPartIdNoSide as pe } from "./types.js";
|
|
14
14
|
import { thresholdsToParameters as Qs, parametersToThresholds as Ne, cn as qs } from "./utils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const M=require("./vendor-BnSpIYqA.cjs"),s=require("./react-dnd-vendor-Clvo2okR.cjs");function j(t,e,r){return e.split(".").reduce((n,i)=>n&&n[i]?n[i]:r||null,t)}function H(t,e){return t.filter(r=>r!==e)}function U(t){return typeof t=="object"}function N(t,e){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};t.forEach(n),e.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function L(t,e){return t.filter(r=>e.indexOf(r)>-1)}const E="dnd-core/INIT_COORDS",p="dnd-core/BEGIN_DRAG",I="dnd-core/PUBLISH_DRAG_SOURCE",h="dnd-core/HOVER",y="dnd-core/DROP",S="dnd-core/END_DRAG";function _(t,e){return{type:E,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const V={type:E,payload:{clientOffset:null,sourceClientOffset:null}};function k(t){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,c=t.getMonitor(),l=t.getRegistry();t.dispatch(_(o)),q(r,c,l);const f=X(r,c);if(f==null){t.dispatch(V);return}let D=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");B(a),D=a(f)}t.dispatch(_(o,D));const b=l.getSource(f).beginDrag(c,f);if(b==null)return;F(b),l.pinSource(f);const $=l.getSourceType(f);return{type:p,payload:{itemType:$,item:b,sourceId:f,clientOffset:o||null,sourceClientOffset:D||null,isSourcePublic:!!i}}}}function q(t,e,r){s.invariant(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach(function(n){s.invariant(r.getSource(n),"Expected sourceIds to be registered.")})}function B(t){s.invariant(typeof t=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function F(t){s.invariant(U(t),"Item must be an object.")}function X(t,e){let r=null;for(let n=t.length-1;n>=0;n--)if(e.canDragSource(t[n])){r=t[n];break}return r}function W(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){W(t,i,r[i])})}return t}function J(t){return function(r={}){const n=t.getMonitor(),i=t.getRegistry();Q(n),K(n).forEach((a,c)=>{const l=Y(a,c,i,n),f={type:y,payload:{dropResult:z({},r,l)}};t.dispatch(f)})}}function Q(t){s.invariant(t.isDragging(),"Cannot call drop while not dragging."),s.invariant(!t.didDrop(),"Cannot call drop twice during one drag operation.")}function Y(t,e,r,n){const i=r.getTarget(t);let o=i?i.drop(n,t):void 0;return Z(o),typeof o>"u"&&(o=e===0?{}:n.getDropResult()),o}function Z(t){s.invariant(typeof t>"u"||U(t),"Drop result must either be an object or undefined.")}function K(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}function ee(t){return function(){const r=t.getMonitor(),n=t.getRegistry();te(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:S}}}function te(t){s.invariant(t.isDragging(),"Cannot call endDrag while not dragging.")}function v(t,e){return e===null?t===null:Array.isArray(t)?t.some(r=>r===e):t===e}function re(t){return function(r,{clientOffset:n}={}){ne(r);const i=r.slice(0),o=t.getMonitor(),a=t.getRegistry(),c=o.getItemType();return oe(i,a,c),ie(i,o,a),se(i,o,a),{type:h,payload:{targetIds:i,clientOffset:n||null}}}}function ne(t){s.invariant(Array.isArray(t),"Expected targetIds to be an array.")}function ie(t,e,r){s.invariant(e.isDragging(),"Cannot call hover while not dragging."),s.invariant(!e.didDrop(),"Cannot call hover after drop.");for(let n=0;n<t.length;n++){const i=t[n];s.invariant(t.lastIndexOf(i)===n,"Expected targetIds to be unique in the passed array.");const o=r.getTarget(i);s.invariant(o,"Expected targetIds to be registered.")}}function oe(t,e,r){for(let n=t.length-1;n>=0;n--){const i=t[n],o=e.getTargetType(i);v(o,r)||t.splice(n,1)}}function se(t,e,r){t.forEach(function(n){r.getTarget(n).hover(e,n)})}function ae(t){return function(){if(t.getMonitor().isDragging())return{type:I}}}function ce(t){return{beginDrag:k(t),publishDragSource:ae(t),hover:re(t),drop:J(t),endDrag:ee(t)}}class ue{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const c=o.apply(e,a);typeof c<"u"&&r(c)}}const i=ce(this);return Object.keys(i).reduce((o,a)=>{const c=i[a];return o[a]=n(c),o},{})}dispatch(e){this.store.dispatch(e)}constructor(e,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=r,e.subscribe(this.handleRefCountChange)}}function fe(t,e){return{x:t.x+e.x,y:t.y+e.y}}function G(t,e){return{x:t.x-e.x,y:t.y-e.y}}function le(t){const{clientOffset:e,initialClientOffset:r,initialSourceClientOffset:n}=t;return!e||!r||!n?null:G(fe(e,n),r)}function de(t){const{clientOffset:e,initialClientOffset:r}=t;return!e||!r?null:G(e,r)}const g=[],m=[];g.__IS_NONE__=!0;m.__IS_ALL__=!0;function ge(t,e){return t===g?!1:t===m||typeof e>"u"?!0:L(e,t).length>0}class pe{subscribeToStateChange(e,r={}){const{handlerIds:n}=r;s.invariant(typeof e=="function","listener must be a function."),s.invariant(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),c=a.stateId;try{c===i||c===i+1&&!ge(a.dirtyHandlerIds,n)||e()}finally{i=c}};return this.store.subscribe(o)}subscribeToOffsetChange(e){s.invariant(typeof e=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,e())};return this.store.subscribe(n)}canDragSource(e){if(!e)return!1;const r=this.registry.getSource(e);return s.invariant(r,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:r.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const r=this.registry.getTarget(e);if(s.invariant(r,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(e),i=this.getItemType();return v(n,i)&&r.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;const r=this.registry.getSource(e,!0);if(s.invariant(r,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(e),i=this.getItemType();return n!==i?!1:r.isDragging(this,e)}isOverTarget(e,r={shallow:!1}){if(!e)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(e),o=this.getItemType();if(o&&!v(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const c=a.indexOf(e);return n?c===a.length-1:c>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return le(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return de(this.store.getState().dragOffset)}constructor(e,r){this.store=e,this.registry=r}}const C="dnd-core/ADD_SOURCE",R="dnd-core/ADD_TARGET",x="dnd-core/REMOVE_SOURCE",O="dnd-core/REMOVE_TARGET";function he(t){return{type:C,payload:{sourceId:t}}}function ye(t){return{type:R,payload:{targetId:t}}}function Se(t){return{type:x,payload:{sourceId:t}}}function Oe(t){return{type:O,payload:{targetId:t}}}function De(t){s.invariant(typeof t.canDrag=="function","Expected canDrag to be a function."),s.invariant(typeof t.beginDrag=="function","Expected beginDrag to be a function."),s.invariant(typeof t.endDrag=="function","Expected endDrag to be a function.")}function be(t){s.invariant(typeof t.canDrop=="function","Expected canDrop to be a function."),s.invariant(typeof t.hover=="function","Expected hover to be a function."),s.invariant(typeof t.drop=="function","Expected beginDrag to be a function.")}function T(t,e){if(e&&Array.isArray(t)){t.forEach(r=>T(r,!1));return}s.invariant(typeof t=="string"||typeof t=="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var u;(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(u||(u={}));let ve=0;function Te(){return ve++}function Ee(t){const e=Te().toString();switch(t){case u.SOURCE:return`S${e}`;case u.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}function w(t){switch(t[0]){case"S":return u.SOURCE;case"T":return u.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function P(t,e){const r=t.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===e)return!0;n=!!i}while(!n);return!1}class Ie{addSource(e,r){T(e),De(r);const n=this.addHandler(u.SOURCE,e,r);return this.store.dispatch(he(n)),n}addTarget(e,r){T(e,!0),be(r);const n=this.addHandler(u.TARGET,e,r);return this.store.dispatch(ye(n)),n}containsHandler(e){return P(this.dragSources,e)||P(this.dropTargets,e)}getSource(e,r=!1){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),r&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return w(e)===u.SOURCE}isTargetId(e){return w(e)===u.TARGET}removeSource(e){s.invariant(this.getSource(e),"Expected an existing source."),this.store.dispatch(Se(e)),s.asap(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){s.invariant(this.getTarget(e),"Expected an existing target."),this.store.dispatch(Oe(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const r=this.getSource(e);s.invariant(r,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=r}unpinSource(){s.invariant(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,r,n){const i=Ee(e);return this.types.set(i,r),e===u.SOURCE?this.dragSources.set(i,n):e===u.TARGET&&this.dropTargets.set(i,n),i}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const me=(t,e)=>t===e;function Ce(t,e){return!t&&!e?!0:!t||!e?!1:t.x===e.x&&t.y===e.y}function Re(t,e,r=me){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!r(t[n],e[n]))return!1;return!0}function xe(t=g,e){switch(e.type){case h:break;case C:case R:case O:case x:return g;case p:case I:case S:case y:default:return m}const{targetIds:r=[],prevTargetIds:n=[]}=e.payload,i=N(r,n);if(!(i.length>0||!Re(r,n)))return g;const a=n[n.length-1],c=r[r.length-1];return a!==c&&(a&&i.push(a),c&&i.push(c)),i}function _e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function we(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){_e(t,i,r[i])})}return t}const A={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Pe(t=A,e){const{payload:r}=e;switch(e.type){case E:case p:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case h:return Ce(t.clientOffset,r.clientOffset)?t:we({},t,{clientOffset:r.clientOffset});case S:case y:return A;default:return t}}function Ae(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){Ae(t,i,r[i])})}return t}const Ue={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ge(t=Ue,e){const{payload:r}=e;switch(e.type){case p:return d({},t,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case I:return d({},t,{isSourcePublic:!0});case h:return d({},t,{targetIds:r.targetIds});case O:return t.targetIds.indexOf(r.targetId)===-1?t:d({},t,{targetIds:H(t.targetIds,r.targetId)});case y:return d({},t,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case S:return d({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}}function $e(t=0,e){switch(e.type){case C:case R:return t+1;case x:case O:return t-1;default:return t}}function Me(t=0){return t+1}function je(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function He(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){je(t,i,r[i])})}return t}function Ne(t={},e){return{dirtyHandlerIds:xe(t.dirtyHandlerIds,{type:e.type,payload:He({},e.payload,{prevTargetIds:j(t,"dragOperation.targetIds",[])})}),dragOffset:Pe(t.dragOffset,e),refCount:$e(t.refCount,e),dragOperation:Ge(t.dragOperation,e),stateId:Me(t.stateId)}}function Le(t,e=void 0,r={},n=!1){const i=Ve(n),o=new pe(i,new Ie(i)),a=new ue(i,o),c=t(a,e,r);return a.receiveBackend(c),a}function Ve(t){const e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return M.createStore(Ne,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}exports.createDragDropManager=Le;
|
|
1
|
+
"use strict";const M=require("./vendor-BjLvygDR.cjs"),s=require("./react-dnd-vendor-BPzSDojS.cjs");function j(t,e,r){return e.split(".").reduce((n,i)=>n&&n[i]?n[i]:r||null,t)}function H(t,e){return t.filter(r=>r!==e)}function U(t){return typeof t=="object"}function N(t,e){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};t.forEach(n),e.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function L(t,e){return t.filter(r=>e.indexOf(r)>-1)}const E="dnd-core/INIT_COORDS",p="dnd-core/BEGIN_DRAG",I="dnd-core/PUBLISH_DRAG_SOURCE",h="dnd-core/HOVER",y="dnd-core/DROP",S="dnd-core/END_DRAG";function _(t,e){return{type:E,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const V={type:E,payload:{clientOffset:null,sourceClientOffset:null}};function k(t){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,c=t.getMonitor(),l=t.getRegistry();t.dispatch(_(o)),q(r,c,l);const f=X(r,c);if(f==null){t.dispatch(V);return}let D=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");B(a),D=a(f)}t.dispatch(_(o,D));const b=l.getSource(f).beginDrag(c,f);if(b==null)return;F(b),l.pinSource(f);const $=l.getSourceType(f);return{type:p,payload:{itemType:$,item:b,sourceId:f,clientOffset:o||null,sourceClientOffset:D||null,isSourcePublic:!!i}}}}function q(t,e,r){s.invariant(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach(function(n){s.invariant(r.getSource(n),"Expected sourceIds to be registered.")})}function B(t){s.invariant(typeof t=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function F(t){s.invariant(U(t),"Item must be an object.")}function X(t,e){let r=null;for(let n=t.length-1;n>=0;n--)if(e.canDragSource(t[n])){r=t[n];break}return r}function W(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){W(t,i,r[i])})}return t}function J(t){return function(r={}){const n=t.getMonitor(),i=t.getRegistry();Q(n),K(n).forEach((a,c)=>{const l=Y(a,c,i,n),f={type:y,payload:{dropResult:z({},r,l)}};t.dispatch(f)})}}function Q(t){s.invariant(t.isDragging(),"Cannot call drop while not dragging."),s.invariant(!t.didDrop(),"Cannot call drop twice during one drag operation.")}function Y(t,e,r,n){const i=r.getTarget(t);let o=i?i.drop(n,t):void 0;return Z(o),typeof o>"u"&&(o=e===0?{}:n.getDropResult()),o}function Z(t){s.invariant(typeof t>"u"||U(t),"Drop result must either be an object or undefined.")}function K(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}function ee(t){return function(){const r=t.getMonitor(),n=t.getRegistry();te(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:S}}}function te(t){s.invariant(t.isDragging(),"Cannot call endDrag while not dragging.")}function v(t,e){return e===null?t===null:Array.isArray(t)?t.some(r=>r===e):t===e}function re(t){return function(r,{clientOffset:n}={}){ne(r);const i=r.slice(0),o=t.getMonitor(),a=t.getRegistry(),c=o.getItemType();return oe(i,a,c),ie(i,o,a),se(i,o,a),{type:h,payload:{targetIds:i,clientOffset:n||null}}}}function ne(t){s.invariant(Array.isArray(t),"Expected targetIds to be an array.")}function ie(t,e,r){s.invariant(e.isDragging(),"Cannot call hover while not dragging."),s.invariant(!e.didDrop(),"Cannot call hover after drop.");for(let n=0;n<t.length;n++){const i=t[n];s.invariant(t.lastIndexOf(i)===n,"Expected targetIds to be unique in the passed array.");const o=r.getTarget(i);s.invariant(o,"Expected targetIds to be registered.")}}function oe(t,e,r){for(let n=t.length-1;n>=0;n--){const i=t[n],o=e.getTargetType(i);v(o,r)||t.splice(n,1)}}function se(t,e,r){t.forEach(function(n){r.getTarget(n).hover(e,n)})}function ae(t){return function(){if(t.getMonitor().isDragging())return{type:I}}}function ce(t){return{beginDrag:k(t),publishDragSource:ae(t),hover:re(t),drop:J(t),endDrag:ee(t)}}class ue{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const c=o.apply(e,a);typeof c<"u"&&r(c)}}const i=ce(this);return Object.keys(i).reduce((o,a)=>{const c=i[a];return o[a]=n(c),o},{})}dispatch(e){this.store.dispatch(e)}constructor(e,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=r,e.subscribe(this.handleRefCountChange)}}function fe(t,e){return{x:t.x+e.x,y:t.y+e.y}}function G(t,e){return{x:t.x-e.x,y:t.y-e.y}}function le(t){const{clientOffset:e,initialClientOffset:r,initialSourceClientOffset:n}=t;return!e||!r||!n?null:G(fe(e,n),r)}function de(t){const{clientOffset:e,initialClientOffset:r}=t;return!e||!r?null:G(e,r)}const g=[],m=[];g.__IS_NONE__=!0;m.__IS_ALL__=!0;function ge(t,e){return t===g?!1:t===m||typeof e>"u"?!0:L(e,t).length>0}class pe{subscribeToStateChange(e,r={}){const{handlerIds:n}=r;s.invariant(typeof e=="function","listener must be a function."),s.invariant(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),c=a.stateId;try{c===i||c===i+1&&!ge(a.dirtyHandlerIds,n)||e()}finally{i=c}};return this.store.subscribe(o)}subscribeToOffsetChange(e){s.invariant(typeof e=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,e())};return this.store.subscribe(n)}canDragSource(e){if(!e)return!1;const r=this.registry.getSource(e);return s.invariant(r,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:r.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const r=this.registry.getTarget(e);if(s.invariant(r,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(e),i=this.getItemType();return v(n,i)&&r.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;const r=this.registry.getSource(e,!0);if(s.invariant(r,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(e),i=this.getItemType();return n!==i?!1:r.isDragging(this,e)}isOverTarget(e,r={shallow:!1}){if(!e)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(e),o=this.getItemType();if(o&&!v(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const c=a.indexOf(e);return n?c===a.length-1:c>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return le(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return de(this.store.getState().dragOffset)}constructor(e,r){this.store=e,this.registry=r}}const C="dnd-core/ADD_SOURCE",R="dnd-core/ADD_TARGET",x="dnd-core/REMOVE_SOURCE",O="dnd-core/REMOVE_TARGET";function he(t){return{type:C,payload:{sourceId:t}}}function ye(t){return{type:R,payload:{targetId:t}}}function Se(t){return{type:x,payload:{sourceId:t}}}function Oe(t){return{type:O,payload:{targetId:t}}}function De(t){s.invariant(typeof t.canDrag=="function","Expected canDrag to be a function."),s.invariant(typeof t.beginDrag=="function","Expected beginDrag to be a function."),s.invariant(typeof t.endDrag=="function","Expected endDrag to be a function.")}function be(t){s.invariant(typeof t.canDrop=="function","Expected canDrop to be a function."),s.invariant(typeof t.hover=="function","Expected hover to be a function."),s.invariant(typeof t.drop=="function","Expected beginDrag to be a function.")}function T(t,e){if(e&&Array.isArray(t)){t.forEach(r=>T(r,!1));return}s.invariant(typeof t=="string"||typeof t=="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var u;(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(u||(u={}));let ve=0;function Te(){return ve++}function Ee(t){const e=Te().toString();switch(t){case u.SOURCE:return`S${e}`;case u.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}function w(t){switch(t[0]){case"S":return u.SOURCE;case"T":return u.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function P(t,e){const r=t.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===e)return!0;n=!!i}while(!n);return!1}class Ie{addSource(e,r){T(e),De(r);const n=this.addHandler(u.SOURCE,e,r);return this.store.dispatch(he(n)),n}addTarget(e,r){T(e,!0),be(r);const n=this.addHandler(u.TARGET,e,r);return this.store.dispatch(ye(n)),n}containsHandler(e){return P(this.dragSources,e)||P(this.dropTargets,e)}getSource(e,r=!1){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),r&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return w(e)===u.SOURCE}isTargetId(e){return w(e)===u.TARGET}removeSource(e){s.invariant(this.getSource(e),"Expected an existing source."),this.store.dispatch(Se(e)),s.asap(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){s.invariant(this.getTarget(e),"Expected an existing target."),this.store.dispatch(Oe(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const r=this.getSource(e);s.invariant(r,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=r}unpinSource(){s.invariant(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,r,n){const i=Ee(e);return this.types.set(i,r),e===u.SOURCE?this.dragSources.set(i,n):e===u.TARGET&&this.dropTargets.set(i,n),i}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const me=(t,e)=>t===e;function Ce(t,e){return!t&&!e?!0:!t||!e?!1:t.x===e.x&&t.y===e.y}function Re(t,e,r=me){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!r(t[n],e[n]))return!1;return!0}function xe(t=g,e){switch(e.type){case h:break;case C:case R:case O:case x:return g;case p:case I:case S:case y:default:return m}const{targetIds:r=[],prevTargetIds:n=[]}=e.payload,i=N(r,n);if(!(i.length>0||!Re(r,n)))return g;const a=n[n.length-1],c=r[r.length-1];return a!==c&&(a&&i.push(a),c&&i.push(c)),i}function _e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function we(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){_e(t,i,r[i])})}return t}const A={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Pe(t=A,e){const{payload:r}=e;switch(e.type){case E:case p:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case h:return Ce(t.clientOffset,r.clientOffset)?t:we({},t,{clientOffset:r.clientOffset});case S:case y:return A;default:return t}}function Ae(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){Ae(t,i,r[i])})}return t}const Ue={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ge(t=Ue,e){const{payload:r}=e;switch(e.type){case p:return d({},t,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case I:return d({},t,{isSourcePublic:!0});case h:return d({},t,{targetIds:r.targetIds});case O:return t.targetIds.indexOf(r.targetId)===-1?t:d({},t,{targetIds:H(t.targetIds,r.targetId)});case y:return d({},t,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case S:return d({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}}function $e(t=0,e){switch(e.type){case C:case R:return t+1;case x:case O:return t-1;default:return t}}function Me(t=0){return t+1}function je(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function He(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){je(t,i,r[i])})}return t}function Ne(t={},e){return{dirtyHandlerIds:xe(t.dirtyHandlerIds,{type:e.type,payload:He({},e.payload,{prevTargetIds:j(t,"dragOperation.targetIds",[])})}),dragOffset:Pe(t.dragOffset,e),refCount:$e(t.refCount,e),dragOperation:Ge(t.dragOperation,e),stateId:Me(t.stateId)}}function Le(t,e=void 0,r={},n=!1){const i=Ve(n),o=new pe(i,new Ie(i)),a=new ue(i,o),c=t(a,e,r);return a.receiveBackend(c),a}function Ve(t){const e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return M.createStore(Ne,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}exports.createDragDropManager=Le;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as j } from "./vendor-
|
|
2
|
-
import { i as s, b as M } from "./react-dnd-vendor-
|
|
1
|
+
import { c as j } from "./vendor-VALJ9W3p.js";
|
|
2
|
+
import { i as s, b as M } from "./react-dnd-vendor-D4nn9Mqx.js";
|
|
3
3
|
function H(t, e, r) {
|
|
4
4
|
return e.split(".").reduce(
|
|
5
5
|
(n, i) => n && n[i] ? n[i] : r || null,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("./hoist-non-react-statics-vendor-C5vG1oEE.cjs");const f=require("react"),l=require("./emotion-vendor-D6PQH2K8.cjs");function E(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const s=E(f);var d=s.createContext(typeof HTMLElement<"u"?l.createCache({key:"css"}):null);d.Provider;var S=function(t){return f.forwardRef(function(r,n){var a=f.useContext(d);return t(r,a,n)})},h=s.createContext({}),g={}.hasOwnProperty,m="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",O=function(t,r){var n={};for(var a in r)g.call(r,a)&&(n[a]=r[a]);return n[m]=t,n},P=function(t){var r=t.cache,n=t.serialized,a=t.isStringTag;return l.registerStyles(r,n,a),l.useInsertionEffectAlwaysWithSyncFallback(function(){return l.insertStyles(r,n,a)}),null},w=S(function(e,t,r){var n=e.css;typeof n=="string"&&t.registered[n]!==void 0&&(n=t.registered[n]);var a=e[m],c=[n],i="";typeof e.className=="string"?i=l.getRegisteredStyles(t.registered,c,e.className):e.className!=null&&(i=e.className+" ");var v=l.serializeStyles(c,void 0,s.useContext(h));i+=t.key+"-"+v.name;var u={};for(var o in e)g.call(e,o)&&o!=="css"&&o!==m&&(u[o]=e[o]);return u.className=i,r&&(u.ref=r),s.createElement(s.Fragment,null,s.createElement(P,{cache:t,serialized:v,isStringTag:typeof a=="string"}),s.createElement(a,u))}),C=w;exports.jsx=function(t,r){var n=arguments;if(r==null||!g.call(r,"css"))return s.createElement.apply(void 0,n);var a=n.length,c=new Array(a);c[0]=C,c[1]=O(t,r);for(var i=2;i<a;i++)c[i]=n[i];return s.createElement.apply(null,c)};(function(e){var t;t||(t=e.JSX||(e.JSX={}))})(exports.jsx||(exports.jsx={}));function y(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.serializeStyles(t)}function N(){var e=y.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}exports.css=y;exports.keyframes=N;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import "./hoist-non-react-statics-vendor-DJU3S3cV.js";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { forwardRef as d, useContext as y } from "react";
|
|
4
|
+
import { c as S, g as h, s as g, r as C, u as w, i as P } from "./emotion-vendor-DNnoMT20.js";
|
|
5
|
+
var E = /* @__PURE__ */ i.createContext(
|
|
6
|
+
// we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
7
|
+
// because this module is primarily intended for the browser and node
|
|
8
|
+
// but it's also required in react native and similar environments sometimes
|
|
9
|
+
// and we could have a special build just for that
|
|
10
|
+
// but this is much easier and the native packages
|
|
11
|
+
// might use a different theme context in the future anyway
|
|
12
|
+
typeof HTMLElement < "u" ? /* @__PURE__ */ S({
|
|
13
|
+
key: "css"
|
|
14
|
+
}) : null
|
|
15
|
+
);
|
|
16
|
+
E.Provider;
|
|
17
|
+
var N = function(e) {
|
|
18
|
+
return /* @__PURE__ */ d(function(t, n) {
|
|
19
|
+
var a = y(E);
|
|
20
|
+
return e(t, a, n);
|
|
21
|
+
});
|
|
22
|
+
}, x = /* @__PURE__ */ i.createContext({}), u = {}.hasOwnProperty, m = "__EMOTION_TYPE_PLEASE_DO_NOT_USE__", O = function(e, t) {
|
|
23
|
+
var n = {};
|
|
24
|
+
for (var a in t)
|
|
25
|
+
u.call(t, a) && (n[a] = t[a]);
|
|
26
|
+
return n[m] = e, n;
|
|
27
|
+
}, T = function(e) {
|
|
28
|
+
var t = e.cache, n = e.serialized, a = e.isStringTag;
|
|
29
|
+
return C(t, n, a), w(function() {
|
|
30
|
+
return P(t, n, a);
|
|
31
|
+
}), null;
|
|
32
|
+
}, A = /* @__PURE__ */ N(function(r, e, t) {
|
|
33
|
+
var n = r.css;
|
|
34
|
+
typeof n == "string" && e.registered[n] !== void 0 && (n = e.registered[n]);
|
|
35
|
+
var a = r[m], o = [n], s = "";
|
|
36
|
+
typeof r.className == "string" ? s = h(e.registered, o, r.className) : r.className != null && (s = r.className + " ");
|
|
37
|
+
var f = g(o, void 0, i.useContext(x));
|
|
38
|
+
s += e.key + "-" + f.name;
|
|
39
|
+
var c = {};
|
|
40
|
+
for (var l in r)
|
|
41
|
+
u.call(r, l) && l !== "css" && l !== m && (c[l] = r[l]);
|
|
42
|
+
return c.className = s, t && (c.ref = t), /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(T, {
|
|
43
|
+
cache: e,
|
|
44
|
+
serialized: f,
|
|
45
|
+
isStringTag: typeof a == "string"
|
|
46
|
+
}), /* @__PURE__ */ i.createElement(a, c));
|
|
47
|
+
}), z = A, v = function(e, t) {
|
|
48
|
+
var n = arguments;
|
|
49
|
+
if (t == null || !u.call(t, "css"))
|
|
50
|
+
return i.createElement.apply(void 0, n);
|
|
51
|
+
var a = n.length, o = new Array(a);
|
|
52
|
+
o[0] = z, o[1] = O(e, t);
|
|
53
|
+
for (var s = 2; s < a; s++)
|
|
54
|
+
o[s] = n[s];
|
|
55
|
+
return i.createElement.apply(null, o);
|
|
56
|
+
};
|
|
57
|
+
(function(r) {
|
|
58
|
+
var e;
|
|
59
|
+
e || (e = r.JSX || (r.JSX = {}));
|
|
60
|
+
})(v || (v = {}));
|
|
61
|
+
function I() {
|
|
62
|
+
for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++)
|
|
63
|
+
e[t] = arguments[t];
|
|
64
|
+
return g(e);
|
|
65
|
+
}
|
|
66
|
+
function L() {
|
|
67
|
+
var r = I.apply(void 0, arguments), e = "animation-" + r.name;
|
|
68
|
+
return {
|
|
69
|
+
name: e,
|
|
70
|
+
styles: "@keyframes " + e + "{" + r.styles + "}",
|
|
71
|
+
anim: 1,
|
|
72
|
+
toString: function() {
|
|
73
|
+
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
I as c,
|
|
79
|
+
v as j,
|
|
80
|
+
L as k
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("./stylis-vendor-DzcTLVj9.cjs"),M=require("react");function R(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const S=R(M);function O(e){if(e.sheet)return e.sheet;for(var r=0;r<document.styleSheets.length;r++)if(document.styleSheets[r].ownerNode===e)return document.styleSheets[r]}function v(e){var r=document.createElement("style");return r.setAttribute("data-emotion",e.key),e.nonce!==void 0&&r.setAttribute("nonce",e.nonce),r.appendChild(document.createTextNode("")),r.setAttribute("data-s",""),r}var _=(function(){function e(n){var a=this;this._insertTag=function(s){var i;a.tags.length===0?a.insertionPoint?i=a.insertionPoint.nextSibling:a.prepend?i=a.container.firstChild:i=a.before:i=a.tags[a.tags.length-1].nextSibling,a.container.insertBefore(s,i),a.tags.push(s)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var r=e.prototype;return r.hydrate=function(a){a.forEach(this._insertTag)},r.insert=function(a){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(v(this));var s=this.tags[this.tags.length-1];if(this.isSpeedy){var i=O(s);try{i.insertRule(a,i.cssRules.length)}catch{}}else s.appendChild(document.createTextNode(a));this.ctr++},r.flush=function(){this.tags.forEach(function(a){var s;return(s=a.parentNode)==null?void 0:s.removeChild(a)}),this.tags=[],this.ctr=0},e})();function P(e){var r=Object.create(null);return function(n){return r[n]===void 0&&(r[n]=e(n)),r[n]}}var N=function(r,n,a){for(var s=0,i=0;s=i,i=t.peek(),s===38&&i===12&&(n[a]=1),!t.token(i);)t.next();return t.slice(r,t.position)},F=function(r,n){var a=-1,s=44;do switch(t.token(s)){case 0:s===38&&t.peek()===12&&(n[a]=1),r[a]+=N(t.position-1,n,a);break;case 2:r[a]+=t.delimit(s);break;case 4:if(s===44){r[++a]=t.peek()===58?"&\f":"",n[a]=r[a].length;break}default:r[a]+=t.from(s)}while(s=t.next());return r},G=function(r,n){return t.dealloc(F(t.alloc(r),n))},E=new WeakMap,L=function(r){if(!(r.type!=="rule"||!r.parent||r.length<1)){for(var n=r.value,a=r.parent,s=r.column===a.column&&r.line===a.line;a.type!=="rule";)if(a=a.parent,!a)return;if(!(r.props.length===1&&n.charCodeAt(0)!==58&&!E.get(a))&&!s){E.set(r,!0);for(var i=[],c=G(n,i),f=a.props,o=0,u=0;o<c.length;o++)for(var d=0;d<f.length;d++,u++)r.props[u]=i[o]?c[o].replace(/&\f/g,f[d]):f[d]+" "+c[o]}}},D=function(r){if(r.type==="decl"){var n=r.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(r.return="",r.value="")}};function W(e,r){switch(t.hash(e,r)){case 5103:return t.WEBKIT+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return t.WEBKIT+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return t.WEBKIT+e+t.MOZ+e+t.MS+e+e;case 6828:case 4268:return t.WEBKIT+e+t.MS+e+e;case 6165:return t.WEBKIT+e+t.MS+"flex-"+e+e;case 5187:return t.WEBKIT+e+t.replace(e,/(\w+).+(:[^]+)/,t.WEBKIT+"box-$1$2"+t.MS+"flex-$1$2")+e;case 5443:return t.WEBKIT+e+t.MS+"flex-item-"+t.replace(e,/flex-|-self/,"")+e;case 4675:return t.WEBKIT+e+t.MS+"flex-line-pack"+t.replace(e,/align-content|flex-|-self/,"")+e;case 5548:return t.WEBKIT+e+t.MS+t.replace(e,"shrink","negative")+e;case 5292:return t.WEBKIT+e+t.MS+t.replace(e,"basis","preferred-size")+e;case 6060:return t.WEBKIT+"box-"+t.replace(e,"-grow","")+t.WEBKIT+e+t.MS+t.replace(e,"grow","positive")+e;case 4554:return t.WEBKIT+t.replace(e,/([^-])(transform)/g,"$1"+t.WEBKIT+"$2")+e;case 6187:return t.replace(t.replace(t.replace(e,/(zoom-|grab)/,t.WEBKIT+"$1"),/(image-set)/,t.WEBKIT+"$1"),e,"")+e;case 5495:case 3959:return t.replace(e,/(image-set\([^]*)/,t.WEBKIT+"$1$`$1");case 4968:return t.replace(t.replace(e,/(.+:)(flex-)?(.*)/,t.WEBKIT+"box-pack:$3"+t.MS+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+t.WEBKIT+e+e;case 4095:case 3583:case 4068:case 2532:return t.replace(e,/(.+)-inline(.+)/,t.WEBKIT+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(t.strlen(e)-1-r>6)switch(t.charat(e,r+1)){case 109:if(t.charat(e,r+4)!==45)break;case 102:return t.replace(e,/(.+:)(.+)-([^]+)/,"$1"+t.WEBKIT+"$2-$3$1"+t.MOZ+(t.charat(e,r+3)==108?"$3":"$2-$3"))+e;case 115:return~t.indexof(e,"stretch")?W(t.replace(e,"stretch","fill-available"),r)+e:e}break;case 4949:if(t.charat(e,r+1)!==115)break;case 6444:switch(t.charat(e,t.strlen(e)-3-(~t.indexof(e,"!important")&&10))){case 107:return t.replace(e,":",":"+t.WEBKIT)+e;case 101:return t.replace(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+t.WEBKIT+(t.charat(e,14)===45?"inline-":"")+"box$3$1"+t.WEBKIT+"$2$3$1"+t.MS+"$2box$3")+e}break;case 5936:switch(t.charat(e,r+11)){case 114:return t.WEBKIT+e+t.MS+t.replace(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return t.WEBKIT+e+t.MS+t.replace(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return t.WEBKIT+e+t.MS+t.replace(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return t.WEBKIT+e+t.MS+e+e}return e}var V=function(r,n,a,s){if(r.length>-1&&!r.return)switch(r.type){case t.DECLARATION:r.return=W(r.value,r.length);break;case t.KEYFRAMES:return t.serialize([t.copy(r,{value:t.replace(r.value,"@","@"+t.WEBKIT)})],s);case t.RULESET:if(r.length)return t.combine(r.props,function(i){switch(t.match(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return t.serialize([t.copy(r,{props:[t.replace(i,/:(read-\w+)/,":"+t.MOZ+"$1")]})],s);case"::placeholder":return t.serialize([t.copy(r,{props:[t.replace(i,/:(plac\w+)/,":"+t.WEBKIT+"input-$1")]}),t.copy(r,{props:[t.replace(i,/:(plac\w+)/,":"+t.MOZ+"$1")]}),t.copy(r,{props:[t.replace(i,/:(plac\w+)/,t.MS+"input-$1")]})],s)}return""})}},Z=[V],q=function(r){var n=r.key;if(n==="css"){var a=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(a,function(l){var p=l.getAttribute("data-emotion");p.indexOf(" ")!==-1&&(document.head.appendChild(l),l.setAttribute("data-s",""))})}var s=r.stylisPlugins||Z,i={},c,f=[];c=r.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(l){for(var p=l.getAttribute("data-emotion").split(" "),y=1;y<p.length;y++)i[p[y]]=!0;f.push(l)});var o,u=[L,D];{var d,x=[t.stringify,t.rulesheet(function(l){d.insert(l)})],C=t.middleware(u.concat(s,x)),K=function(p){return t.serialize(t.compile(p),C)};o=function(p,y,A,k){d=A,K(p?p+"{"+y.styles+"}":y.styles),k&&(g.inserted[y.name]=!0)}}var g={key:n,sheet:new _({key:n,container:c,nonce:r.nonce,speedy:r.speedy,prepend:r.prepend,insertionPoint:r.insertionPoint}),nonce:r.nonce,inserted:i,registered:{},insert:o};return g.sheet.hydrate(f),g},z=!0;function j(e,r,n){var a="";return n.split(" ").forEach(function(s){e[s]!==void 0?r.push(e[s]+";"):s&&(a+=s+" ")}),a}var $=function(r,n,a){var s=r.key+"-"+n.name;(a===!1||z===!1)&&r.registered[s]===void 0&&(r.registered[s]=n.styles)},H=function(r,n,a){$(r,n,a);var s=r.key+"-"+n.name;if(r.inserted[n.name]===void 0){var i=n;do r.insert(n===i?"."+s:"",i,r.sheet,!0),i=i.next;while(i!==void 0)}};function U(e){for(var r=0,n,a=0,s=e.length;s>=4;++a,s-=4)n=e.charCodeAt(a)&255|(e.charCodeAt(++a)&255)<<8|(e.charCodeAt(++a)&255)<<16|(e.charCodeAt(++a)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,r=(n&65535)*1540483477+((n>>>16)*59797<<16)^(r&65535)*1540483477+((r>>>16)*59797<<16);switch(s){case 3:r^=(e.charCodeAt(a+2)&255)<<16;case 2:r^=(e.charCodeAt(a+1)&255)<<8;case 1:r^=e.charCodeAt(a)&255,r=(r&65535)*1540483477+((r>>>16)*59797<<16)}return r^=r>>>13,r=(r&65535)*1540483477+((r>>>16)*59797<<16),((r^r>>>15)>>>0).toString(36)}var Y={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},J=/[A-Z]|^ms/g,Q=/_EMO_([^_]+?)_([^]*?)_EMO_/g,B=function(r){return r.charCodeAt(1)===45},w=function(r){return r!=null&&typeof r!="boolean"},m=P(function(e){return B(e)?e:e.replace(J,"-$&").toLowerCase()}),I=function(r,n){switch(r){case"animation":case"animationName":if(typeof n=="string")return n.replace(Q,function(a,s,i){return h={name:s,styles:i,next:h},s})}return Y[r]!==1&&!B(r)&&typeof n=="number"&&n!==0?n+"px":n};function b(e,r,n){if(n==null)return"";var a=n;if(a.__emotion_styles!==void 0)return a;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return h={name:s.name,styles:s.styles,next:h},s.name;var i=n;if(i.styles!==void 0){var c=i.next;if(c!==void 0)for(;c!==void 0;)h={name:c.name,styles:c.styles,next:h},c=c.next;var f=i.styles+";";return f}return X(e,r,n)}case"function":{if(e!==void 0){var o=h,u=n(e);return h=o,b(e,r,u)}break}}var d=n;return d}function X(e,r,n){var a="";if(Array.isArray(n))for(var s=0;s<n.length;s++)a+=b(e,r,n[s])+";";else for(var i in n){var c=n[i];if(typeof c!="object"){var f=c;w(f)&&(a+=m(i)+":"+I(i,f)+";")}else if(Array.isArray(c)&&typeof c[0]=="string"&&r==null)for(var o=0;o<c.length;o++)w(c[o])&&(a+=m(i)+":"+I(i,c[o])+";");else{var u=b(e,r,c);switch(i){case"animation":case"animationName":{a+=m(i)+":"+u+";";break}default:a+=i+"{"+u+"}"}}}return a}var T=/label:\s*([^\s;{]+)\s*(;|$)/g,h;function ee(e,r,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var a=!0,s="";h=void 0;var i=e[0];if(i==null||i.raw===void 0)a=!1,s+=b(n,r,i);else{var c=i;s+=c[0]}for(var f=1;f<e.length;f++)if(s+=b(n,r,e[f]),a){var o=i;s+=o[f]}T.lastIndex=0;for(var u="",d;(d=T.exec(s))!==null;)u+="-"+d[1];var x=U(s)+u;return{name:x,styles:s,next:h}}var re=function(r){return r()},te=S.useInsertionEffect?S.useInsertionEffect:!1,ne=te||re;exports.createCache=q;exports.getRegisteredStyles=j;exports.insertStyles=H;exports.registerStyles=$;exports.serializeStyles=ee;exports.useInsertionEffectAlwaysWithSyncFallback=ne;
|