@esrf/daiquiri-lib 5.7.1 → 5.7.2
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/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1077 -1076
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
${n.hardwareStatus}`:n.hardwareStatus:n.description,[n.description,n.hardwareStatus]);return e.jsx("div",{style:t,children:e.jsx(i.Badge,{bg:n.variant,title:o,children:n.state})})}function vt(n){const{states:t,variants:o={},descriptions:s={},minWidth:r,hardwareStatus:a}=n,c=t[0]??"";if(t.length===0)return e.jsx(D,{state:"NO_STATE",hardwareStatus:a,variant:"fatal",description:"The device no not expose any state",minWidth:r});if(t.length===1)return e.jsx(D,{state:c,hardwareStatus:a,variant:o[c]??"fatal",description:s[c],minWidth:r});const l={display:"inline-block",minWidth:r?`${r}em`:""};function u(f){return e.jsxs(i.Tooltip,{id:"device-state",...f,children:[a??e.jsx(i.Row,{className:"gx-0",children:e.jsx(i.Col,{sm:"12",children:a})}),t.map((d,p)=>{const m=s[d],h=d.startsWith("_")?d.slice(1):d;return e.jsxs(i.Row,{className:"gx-0",children:[e.jsx(i.Col,{sm:"3",className:"text-end",children:e.jsx(i.Badge,{className:"text-right",bg:o[d]??"fatal",children:h})}),e.jsx(i.Col,{sm:"9",className:"text-start lh-1 my-auto ps-1",children:m})]})})]})}return e.jsx("div",{style:l,children:e.jsx(i.OverlayTrigger,{placement:"top",delay:{show:250,hide:400},overlay:u,children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx(i.Badge,{className:"rounded-end-0",bg:o[c]??"fatal",children:c}),e.jsxs(i.Badge,{className:"rounded-start-0",bg:"secondary",children:["+",t.length-1]})]})})})}function Fe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={ON:"success",OFF:"danger",MOVING_ON:"transient",MOVING_OFF:"transient",UNKNOWN:"fatal",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function Gs(n){const{hardware:t}=n;return e.jsx(Fe,{hardware:t})}function Ls(n){var l;const{hardware:t,options:o,disabled:s}=n,r=((l=t.properties)==null?void 0:l.state)??"OFFLINE",a=r==="ON",c=r==="OFF";return e.jsx("div",{style:{display:"grid",gridTemplateRows:"min-content min-content",gridTemplateColumns:"min-content auto",gridGap:"1px"},children:e.jsxs(i.ButtonGroup,{className:"mx-auto",style:{width:"12em"},children:[e.jsx(i.Button,{onClick:()=>{t.actions.call("on")},disabled:a||s,style:{width:"5em"},children:e.jsx("span",{className:"text-nowrap",children:"On"})}),e.jsx(i.Button,{onClick:()=>{t.actions.call("off")},disabled:c||s,style:{width:"5em"},children:e.jsx("span",{className:"text-nowrap",children:"Off"})})]})})}function Nt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Air bearing",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(Fe,{hardware:t});function a(){return e.jsx(Ls,{...n})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function et(n){return e.jsx(i.Button,{variant:n.isActive?"primary":n.wasActivated?"warning":"secondary",onClick:n.onClick,disabled:n.disabled||n.wasActivated,title:n.title,children:e.jsxs(i.Row,{className:"gx-0",children:[e.jsx("i",{className:`col-sm-4 justify-content-center align-self-center ${n.icon}`}),e.jsx(i.Col,{sm:"8",children:n.children})]})})}function Hs(n){var d;const{hardware:t,options:o={},disabled:s}=n;function r(){t.actions.call("on")}function a(){t.actions.call("off")}const c=((d=t.properties)==null?void 0:d.state)??"UNKNOWN",l=c==="MOVING_ON"||c==="MOVING_OFF",u=c==="MOVING_ON",f=c==="MOVING_OFF";return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:s||l}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(et,{icon:"fa fa-arrow-up",wasActivated:u,onClick:()=>{r()},disabled:s||l,title:"Turn on the air bearing",children:["Turn",e.jsx("br",{}),"on"]}),e.jsxs(et,{icon:"fa fa-arrow-down",wasActivated:f,onClick:()=>{a()},disabled:s||l,title:"Turn off the air bearing",children:["Turn",e.jsx("br",{}),"off"]})]})})})]})})]})}function Us(n){const{hardware:t,options:o,disabled:s}=n,{state:r}=t.properties??"OFFLINE",c={ON:"success",OFF:"danger",MOVING_ON:"transient",MOVING_OFF:"transient",UNKNOWN:"fatal",OFFLINE:"warning"}[r]??"fatal";return e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:c,className:"text-center",style:{minWidth:"10em"},value:r}),e.jsx(Hs,{...n})]})}function bt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Air bearing",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(Fe,{hardware:t});function a(){return e.jsx(Us,{...n})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const Vs=["on","off","sync_hard"],qs="airbearing",Ws="airbearing",zs=!0,Ys={state:"ON"},Ks="bliss",Qs=!1,Xs="airbearing",Zs={callables:Vs,id:qs,name:Ws,online:zs,properties:Ys,protocol:Ks,require_staff:Qs,type:Xs},_t={default:Zs};async function L(n){await new Promise(t=>{setTimeout(t,n)})}function V(n){const{name:t,alias:o=null,type:s,setProperty:r,call:a,properties:c,useHardwareContext:l=()=>null}=n,u=l(),f=g.useMemo(()=>{var h,w;const m={setProperty:r,call:a};return(w=u==null?void 0:(h=u.actions).updateHardwareChangeActions)==null||w.call(h,t,m),m},[]),d={id:t,name:t,alias:o,online:!0,properties:c,type:s,actions:f,user_tags:[],locked:null},p=g.useRef(null);return g.useEffect(()=>{(p.current===null||!P.isEqual(p.current,d))&&(p.current=d,u==null||u.actions.updateHardware(t,d))},[t,d]),e.jsx(e.Fragment,{})}function St(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("ON");async function c(f,d){if(f==="on"){a("MOVING_ON"),await L(2e3),a("ON");return}if(f==="off"){a("MOVING_OFF"),await L(2e3),a("OFF");return}console.log("AirBearingSimulator: Unsupported call",f,d)}async function l(f,d){console.log("AirBearingSimulator: Unsupported setProperty",f,d)}const u={state:r};return e.jsx(V,{name:t,alias:o,type:"tomoflatmotion",call:c,setProperty:l,properties:u,useHardwareContext:s})}const Js={default:Nt,protected:bt,state:Gs},Ct={variants:Js,mocks:_t,simulator:St};function er(n){const{hardware:t}=n,{properties:o}=t,s=o.mdt_mode;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"MDT mode"}),e.jsx(i.Form.Control,{value:`${s}`,readOnly:!0})]})}function tr(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(e.Fragment,{}),a=e.jsx(e.Fragment,{children:e.jsx(er,{hardware:t})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const nr=[],or="BEAMLINE",sr="pir121",rr=!0,ir={mdt_mode:!0},ar="bliss",cr=!1,lr="beamline",dr={callables:nr,id:or,name:sr,online:rr,properties:ir,protocol:ar,require_staff:cr,type:lr},ur={default:dr};function fr(n){const{hardware:t,options:o={}}=n,{online:s=!1,properties:r={}}=t,{mdt_mode:a}=r,c=o.name??t.alias??t.name??t.id;function l(){return a?["danger","MDT MODE","The interlocked shutters are skipped to allow to test the scans and scripts. This will not allow to acquire real data."]:["secondary","Production","In prodiction mode"]}const[u,f,d]=l();return e.jsxs(X,{children:[e.jsx("h1",{children:c}),e.jsx(i.Badge,{bg:u,title:d,children:f})]})}const pr={default:tr,monitor:fr},$t={variants:pr,mocks:ur};function mr(n){const[t,o]=g.useState(),[s,r]=g.useState(),{hardware:a,options:c={}}=n;function l(){const f=a.actions.call("read");return f!==void 0&&(console.log("pending"),f.then(d=>{o(d),r(void 0)}).catch(d=>{r(`${d}`)})),f}function u(f){return a.actions.setProperty("diode_range",f)}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[a.name," Details"]}),e.jsx(i.Popover.Body,{children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{children:[e.jsx(i.Col,{sm:6,className:"text-nowrap",children:"Diode Range:"}),e.jsx(i.Col,{children:e.jsx(i.Form.Control,{size:"sm",as:"select",disabled:n.disabled,onChange:f=>{u(f.target.value)},defaultValue:a.properties.diode_range,children:P.map(a.properties.diode_ranges,f=>e.jsx("option",{value:f,children:f},f))})})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{sm:6,children:"Current:"}),e.jsxs(i.Col,{children:[s&&e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-1",title:s}),!s&&e.jsx(e.Fragment,{children:t}),e.jsx(i.Button,{size:"sm",disabled:n.disabled,onClick:()=>{l()},children:"Read"})]})]})]})})]}),children:e.jsx(i.Button,{title:"Beamviewer Details",className:"float-end",size:"sm",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ot(n){const{hardware:t,options:o={}}=n,s=[{name:"Screen",prop:"screen",success:"OUT",toggle:t.properties.screen==="IN",button:t.properties.screen==="IN"?"Out":"In"},{name:"Led",prop:"led",success:"OFF",toggle:t.properties.led==="ON",button:t.properties.led==="ON"?"Off":"On"},{name:"Foil",prop:"foil",success:"OUT",toggle:t.properties.foil==="IN",button:t.properties.foil==="IN"?"Out":"In",test:t.properties.foil!=="NONE"}];function r(a,c){t.actions.call(a,c)}return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Beamviewer",icon:"fam-hardware-beamviewer",online:t.online}),e.jsx("div",{className:"name me-auto",children:t.name}),e.jsx(mr,{...n})]}),e.jsx("div",{className:"hw-content",children:e.jsx(i.Container,{style:{minWidth:"150px"},children:P.map(s,a=>e.jsx(g.Fragment,{children:(a.test===!0||a.test===void 0)&&e.jsxs(i.Row,{className:"align-items-center mb-1",children:[e.jsx(i.Col,{sm:4,children:a.name}),e.jsx(i.Col,{sm:4,children:e.jsx(i.Badge,{className:"ms-1",bg:t.properties[a.prop]===a.success?"success":"danger",children:t.properties[a.prop]})}),e.jsx(i.Col,{sm:4,children:e.jsx(i.Button,{size:"sm",className:"ms-1",disabled:n.disabled,onClick:c=>r(a.prop,!a.toggle),children:a.button})})]})},a.name))})})]})}const hr=["foil","current","screen","led"],gr="bv1",xr="bv1",wr=!0,jr={diode_range:"1uA",diode_ranges:["1mA","100uA","10uA","1uA","100nA","10nA"],foil:"NONE",led:"OFF",screen:"OUT",state:"ON"},yr="bliss",vr=!0,Nr="beamviewer",br={callables:hr,id:gr,name:xr,online:wr,properties:jr,protocol:yr,require_staff:vr,type:Nr},It={default:br},_r=["1mA","100uA","10uA","1uA","100nA","10nA"];function Mt(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("OFF"),[c,l]=g.useState("OUT"),[u,f]=g.useState("NONE"),[d,p]=g.useState("1uA");async function m(x,j){if(x==="read"){const y=Math.random();if(y<.1)throw new Error("Dummy error");return y}return x==="led"?(a(j?"ON":"OFF"),null):x==="screen"?(l(j?"IN":"OUT"),null):x==="foil"?(f(j?"IN":"OUT"),null):(console.log("BeamviewerSimulator: Unsupported call",x,j),null)}async function h(x,j){if(x==="diode_range"){p(j);return}console.log("BeamviewerSimulator: Unsupported setProperty",x,j)}const w={state:"ON",led:r,screen:c,foil:u,diode_range:d,diode_ranges:_r};return console.log(w),e.jsx(V,{name:t,alias:o,type:"optic",call:m,setProperty:h,properties:w,useHardwareContext:s})}const Sr={default:Ot},Dt={variants:Sr,mocks:It,simulator:Mt};function Ue(n){const{hardware:t}=n,{energy:o=null}=t.properties??{},s=o!==null||Number.isFinite(o)?"VALID":"INVALID",r=t.online?s:"OFFLINE",a={VALID:"success",INVALID:"danger",OFFLINE:"warning"},c=a[r]||a.UNKNOWN;return e.jsx(D,{state:r,minWidth:7,variant:c})}function Cr(n){const{hardware:t,disabled:o=!1}=n,{properties:s}=t,{source:r=null,available_source_names:a=[]}=s,c=r==null?void 0:r.slice(9);function l(f){t.actions.setProperty("source",`hardware:${f}`)}function u(f){const p=c===f?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:o,onClick:()=>{l(f)},title:`Select the source ${f}`,children:[e.jsx("i",{className:p})," ",f]},f)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:o,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:a.map(f=>u(f))})]})}function Tt(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,{energy:a,unit:c,source:l}=r,u=e.jsx(N,{name:"Energymanager",icon:"fam-hardware-multiposition",online:t.online}),f=e.jsx(Ue,{hardware:t});function d(w){return w===void 0?"Unknown":w===null?"∅":Number.isFinite(w)?w.toFixed(2):"∅"}const p=g.useMemo(()=>{if(l===void 0)return"Unknown";const w=l.slice(9);return w===""?"No source":w},[l]);function m(){return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{children:p}),e.jsx(B,{value:d(a)}),!s&&e.jsx(Cr,{...n}),c&&e.jsx(i.InputGroup.Text,{children:c})]})}const h=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:u,widgetState:f,widgetContent:m(),headerMode:h})}function Ft(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{source:r,energy:a,unit:c}=s;function l(p,m){return p===void 0||m===void 0?"Unknown":p===null?"∅":Number.isFinite(p)?`${p.toFixed(2)} ${m}`:"∅"}const u=g.useMemo(()=>{if(r===void 0)return"Unknown";const p=r.slice(9);return p===""?"No source":p},[r]),f=l(a,c),d=f!=="∅"?"success":"danger";return e.jsxs(X,{children:[e.jsx("h1",{children:o.name??u}),e.jsx(i.Badge,{bg:d,children:f})]})}const $r=[],Or="energymanager",Ir="energymanager",Mr=!0,Dr={energy:15.2,unit:"keV",available_source_names:["hardware:pink_beam","hardware:dcm"],source:"hardware:pink_beam"},Tr="bliss",Fr=!1,Rr="energymanager",Ar={callables:$r,id:Or,name:Ir,online:Mr,properties:Dr,protocol:Tr,require_staff:Fr,type:Rr},Rt={default:Ar},tt={pink_beam:1.2,dcm:15.6,dcm_off:null};function At(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("pink_beam");async function c(d,p){console.log("MultipositionSimulator: Unsupported call",d,p)}async function l(d,p){if(d==="source"){const m=p.slice(9);a(m);return}console.log("EnergyManagerSimulator: Unsupported setProperty",d,p)}const u=g.useMemo(()=>Object.keys(tt).map(d=>d),[]),f={energy:tt[r]??null,unit:"keV",source:`hardware:${r}`,available_source_names:u};return e.jsx(V,{name:t,alias:o,type:"energymanager",call:c,setProperty:l,properties:f,useHardwareContext:s})}const Er={default:Tt,state:Ue,monitor:Ft},Et={variants:Er,mocks:Rt,simulator:At,monitor:Ft},Ee={OFFLINE:{description:"Filterset is offline",variant:"secondary",priority:0},MOVING:{description:"Filterset is moving",variant:"transient",priority:10},FAULT:{description:"Filterset is in fault",variant:"danger",priority:20},LOCKED:{description:"Filterset is locked",variant:"warning",priority:25},DISABLED:{description:"Filterset is disabled",variant:"warning",priority:40},READY:{description:"Ready to handle request",variant:"success",priority:60},UNKNOWN:{description:"Unknown state is exposed",variant:"fatal",priority:100}};function kt(n){const{hardware:t}=n,{online:o=!1,properties:s={},locked:r=null}=t,{state:a,status:c=null}=s,[l,u,f]=g.useMemo(()=>{if(!o){const d=Ee.OFFLINE;return["OFFLINE",d.variant,d.description]}if(r)return["LOCKED",`Locked by ${(r==null?void 0:r.reason)??"an object"}`];if(a in Ee){const d=Ee[a];return[a,d.variant,d.description]}return["UNKNOWN","fatal",`State '${a}' is not handled`]},[a,o,r]);return e.jsx(D,{state:l,description:f,hardwareStatus:c??void 0,minWidth:6,variant:u})}function Pt(n){const{hardware:t}=n;return e.jsx(kt,{hardware:t})}function kr(n){const{className:t,filter:o}=n,{name:s}=o,[r,a]=g.useMemo(()=>{switch(o.state){case"IN":return["success",`Filter ${s} is IN`];case"OUT":return["secondary",`Filter ${s} is OUT`];case"MOVING":return["transient",`Filter ${s} is MOVING`];case"IN_OUT":return["warning",`Filter ${s} is simultaneously IN and OUT`];default:return["danger",`Filter ${s} is in an unknown state`]}},[o]);return e.jsx(i.Badge,{className:t,bg:r,title:a,children:o.state})}const nt={minWidth:"2em"};function Pr(n){const{filter:t,disabled:o,actions:s,row:r}=n,a=t.name,{state:c}=t,l=c==="IN"||c==="IN_OUT",u=c==="OUT"||c==="IN_OUT",f=c==="MOVING",d=l?"animate-box-left":u?"animate-box-right":"animate-box-center";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"me-2",style:{gridColumn:1,gridRow:r+1},children:t.name}),e.jsx("div",{className:"me-2",style:{gridColumn:2,gridRow:r+1},children:t.description}),e.jsx("div",{className:"me-2 p-0 position-relative",style:{gridColumn:3,gridRow:r+1},children:e.jsx(kr,{filter:t,className:`${d}`})}),e.jsx("div",{style:{gridColumn:4,gridRow:r+1},children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{size:"sm",onClick:()=>{s.call("move_in",a)},disabled:o||f||l&&!u,title:"Move the filter IN",children:e.jsx("div",{style:nt,children:"In"})}),e.jsx(i.Button,{size:"sm",onClick:()=>{s.call("move_out",a)},disabled:o||f||u&&!l,title:"Move the filter OUT",children:e.jsx("div",{style:nt,children:"Out"})})]})})]})}function Bt(n){const{hardware:t,options:o={}}=n,{properties:s={},actions:r}=t,{state:a}=s,c=a==="DISABLED",l=n.disabled||!t.online||c,u=e.jsx(N,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),f=e.jsx(kt,{hardware:t});function d(){return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"min-content auto 7em min-content",gridRowGap:"1px"},children:s.filters.map((m,h)=>e.jsx(Pr,{disabled:l,filter:m,actions:r,row:h}))})}const p=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:u,widgetState:f,widgetContent:d(),headerMode:p})}const Br=["move_in","move_out"],Gr="filter",Lr="filter",Hr=!0,Ur={state:"READY",status:"Ready",filters:[{name:"filter1",description:"500 µm Si",state:"IN"},{name:"filter2",description:"500 µm Si",state:"OUT"},{name:"filter3",description:"500 µm Si",state:"IN_OUT"},{name:"filter4",description:"2 mm Si",state:"MOVING"},{name:"filter5",description:"420 µm Ge",state:"UNKNOWN"},{name:"filter6",description:"1mm Si",state:"OUT"},{name:"filter7",description:"590 µm Ge",state:"OUT"},{name:"filter8",description:"590 µm Ge",state:"OUT"}]},Vr="bliss",qr=!1,Wr="filterset",zr={callables:Br,id:Gr,name:Lr,online:Hr,properties:Ur,protocol:Vr,require_staff:qr,type:Wr},Yr=["move_in","move_out"],Kr="filter",Qr="filter",Xr=!0,Zr={state:"READY",status:"Ready",filters:[{name:"filter1",description:"500 µm Si",state:"IN"},{name:"filter2",description:"590 µm Ge",state:"OUT"}]},Jr="bliss",ei=!1,ti="filterset",ni={callables:Yr,id:Kr,name:Qr,online:Xr,properties:Zr,protocol:Jr,require_staff:ei,type:ti},Gt={default:zr,small:ni},oi=[{name:"filter1",description:"500 µm Si",state:"IN"},{name:"filter2",description:"500 µm Si",state:"OUT"},{name:"filter3",description:"500 µm Si",state:"IN_OUT"},{name:"filter4",description:"2 mm Si",state:"MOVING"},{name:"filter5",description:"420 µm Ge",state:"UNKNOWN"},{name:"filter6",description:"1mm Si",state:"OUT"},{name:"filter7",description:"590 µm Ge",state:"OUT"},{name:"filter8",description:"590 µm Ge",state:"OUT"}];function _e(n,t,o){return n.map(s=>s.name===t?{...s,state:o}:s)}function Lt(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState(oi),[c,l]=g.useState("READY");async function u(p,m){if(p==="move_in"){const h=m;l("MOVING"),a(w=>_e(w,h,"MOVING")),await L(500),a(w=>_e(w,h,"IN")),l("READY");return}if(p==="move_out"){const h=m;l("READY"),a(w=>_e(w,h,"MOVING")),await L(500),a(w=>_e(w,h,"OUT")),l("READY");return}console.log("FiltersetSimulator: Unsupported call",p,m)}async function f(p,m){console.log("FiltersetSimulator: Unsupported setProperty",p,m)}const d={state:c,filters:r};return e.jsx(V,{name:t,alias:o,type:"multiposition",call:u,setProperty:f,properties:d,useHardwareContext:s})}const si={state:Pt,default:Bt},ri={variants:si,mocks:Gt,simulator:Lt};function ii(n){const t={24:"Y",21:"Z",18:"E",15:"P",12:"T",9:"G",6:"M",3:"k","-3":"m","-6":"µ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},o=Math.log(n)/Math.log(1e3),s=!Number.isInteger(o),r=3*Math.ceil(o-(s?1:0)),a=r===0?"":t[r];return{scalar:n*10**-r,prefix:a,multiplier:10**-r}}function ai(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Ht(n){if(n<60)return`${Math.round(n)} sec`;const t=Math.round(n/60),o=t%60,s=Math.floor(t/60);return s?`${s} hr ${o} min`:`${o} min`}function ci(n){return n>0?(662607004e-42*299792458/(n*1e-10)/160218e-24*.001).toFixed(4):0}function li(n,t){return Number.parseFloat(n.toFixed(t))}const di=Object.freeze(Object.defineProperty({__proto__:null,formatEng:ii,round:li,toEnergy:ci,toHoursMins:Ht,ucfirst:ai},Symbol.toStringTag,{value:"Module"}));function ui(n){const{hardware:t}=n;function o(){t.actions.call("reset")}const s={"Front End":"feitlk",Experimental:"expitlk",PSS:"pssitlk"},r={Current:`${t.properties.current.toFixed(1)} mA`,Mode:t.properties.mode,Refill:Ht(t.properties.refill),Message:e.jsx("pre",{children:t.properties.message})};function a(c){if(!(c in t.properties))return"UNKNOWN";const l=t.properties[c];return!l||typeof l!="string"?"UNKNOWN":l}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("h6",{children:"Interlocks"}),e.jsx(i.Container,{children:P.map(s,(c,l)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[l,":"]}),e.jsx(i.Col,{children:e.jsx(i.Badge,{bg:a(c)==="ON"?"success":"danger",children:a(c)})})]},l))}),e.jsx("h6",{children:"Ring Status"}),e.jsx(i.Container,{children:P.map(r,(c,l)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[l,":"]}),e.jsx(i.Col,{children:c})]},l))}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Shutter Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ut(n){const{hardware:t,options:o={}}=n;function s(){t.actions.call(t.properties.frontend==="FE open"?"close":"open")}return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Frontend",icon:"fam-hardware-frontend",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.ButtonGroup,{className:"d-flex",children:[e.jsx(i.Button,{variant:t.properties.frontend==="FE open"?"danger":"success",onClick:s,disabled:n.disabled,children:t.properties.frontend==="FE open"?"Close":"Open"}),e.jsx(ui,{...n})]})})]})}function fi(n){switch(n){case"OPEN":case"RUNNING":return"success"}return"danger"}function Vt(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r="OFFLINE",status:a}=s,c=o.name??t.alias??t.name,l=fi(r),u=e.jsxs(X,{children:[e.jsx("h1",{children:c}),e.jsx(i.Badge,{bg:l,children:`${r}`})]});if(a){const f=`${a}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:f.includes(`
|
|
1
|
+
"use strict";var _s=Object.defineProperty;var Ss=(n,t,o)=>t in n?_s(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var ne=(n,t,o)=>(Ss(n,typeof t!="symbol"?t+"":t,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react-bootstrap"),g=require("react"),P=require("lodash"),Cs=require("classnames"),$s=require("lodash/debounce"),Os=require("semver");require("react-bootstrap-typeahead/css/Typeahead.css");require("react-bootstrap-typeahead/css/Typeahead.bs5.css");const Q=require("react-bootstrap-typeahead"),Is=require("@react-hookz/web"),E=require("@vallsv/rc-knob"),H=require("@h5web/lib");require("@h5web/lib/styles.css");const Ms=require("js-quantities"),Ds=require("debug"),pe=require("react-svgmt"),ue=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},Ts=ue(g),q=ue(Cs),Fs=ue($s),Rs=ue(Os),pt=ue(Ms),He=ue(Ds);function Te(n){var l;const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":(l=t.properties)==null?void 0:l.state)||"UNKNOWN":"OFFLINE",c={READY:"success",OFFLINE:"secondary",MOVING:"transient",DISABLED:"secondary",UNKNOWN:"danger",ERROR:"danger",FAILED:"danger",LOCKED:"warning"}[r]||"success";return e.jsx(i.Badge,{bg:c,children:r})}function mt(n){const{hardware:t}=n;return e.jsx(Te,{hardware:t})}function ht(n){const{hardware:t,options:o}=n;function s(){return t.name?t.name:t.id}function r(){return o.overrideName!==void 0?o.overrideName:t.alias?t.alias:t.name?t.name:t.id}function a(){if(o.overrideName!==void 0)return`Real name: ${s()}`;if(t.alias)return`Real name: ${t.name}`}const c=r(),l=a();return e.jsx("span",{title:l,children:c})}function gt(n){const{hardware:t,options:o={}}=n;function s(){const r=o.property;if(r===void 0)return"property is not set";if(r===null)return"property is null";let a=t;for(const c of r.split("/"))if(a=a[c],a===void 0)return`property '${r}' not found`;return`${a}`}return e.jsx(e.Fragment,{children:s()})}function As(n){const{activeMessage:t="Online",inactiveMessage:o="Offline",message:s="This device is"}=n;return e.jsx("div",{className:`dot-indicator small bg-${n.online?"success":"danger"}`,title:`${s} ${n.online?t:o}`})}function N(n){const{name:t,icon:o}=n;return e.jsxs("div",{className:"icon",title:t,children:[e.jsx("i",{className:`fa ${o}`}),e.jsx(As,{...n})]})}function _(n){const{headerMode:t,hardware:o}=n;function s(){return o.alias?o.alias:o.name?o.name:o.id}const r=s();switch(t){case"front":return e.jsx("div",{className:"hw-component",children:e.jsxs("div",{className:"hw-single",children:[n.widgetIcon,e.jsx("div",{className:"name",children:r}),e.jsx("div",{className:"d-inline-block",children:n.widgetContent})]})});case"none":return e.jsx("div",{className:"hw-component",children:e.jsx("div",{className:"hw-single",children:n.widgetContent})});case"state":return n.widgetState;default:return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[n.widgetIcon,e.jsx("div",{className:"name",children:e.jsx(i.Form.Label,{htmlFor:o.id,children:r})}),n.widgetState,n.hardware.errors&&n.hardware.errors.length>0&&e.jsx(i.OverlayTrigger,{trigger:"click",placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:n.hardware.id,style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Device Errors"}),e.jsxs(i.Popover.Body,{children:["There were errors with properties on this device:",e.jsx("ul",{children:n.hardware.errors.map(a=>e.jsxs("li",{children:[a.property,":",e.jsxs("span",{className:"stack-trace",children:[a.traceback,e.jsx("br",{}),a.exception]})]}))})]})]}),children:e.jsx(i.Button,{variant:"danger",size:"sm",children:e.jsx("i",{className:"fa fa-exclamation-triangle"})})})]}),e.jsx("div",{className:"hw-content",children:n.widgetContent})]})}}function B(n){const{value:t,variant:o,style:s,className:r,title:a}=n,c=o?`badge-${o} bg-${o} text-bg-${o} border-${o}`:"border-light";return e.jsx(i.Form.Control,{className:`${c} ${r} bg-secondary`,style:s,value:t,title:a,readOnly:!0})}function Es(n){const t=n.online?"READY":"OFFLINE";return e.jsx(i.Badge,{bg:t==="READY"?"success":"warning",children:t})}function xt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fa-cog",online:t.online}),r=e.jsx(Es,{...t});function a(){const d=o.property;if(d===void 0)return"property is not set";if(d===null)return"property is null";let p=t;for(const m of d.split("/"))if(p=p[m],p===void 0)return`property '${d}' not found`;return`${p}`}function c(){const d=o.unit;if(!d)return null;if(!d.includes("properties"))return d;let p=n;for(const m of d.split("/"))if(p=p[m],p===void 0)return null;return`${p}`}const l=c(),u=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:a()}),l&&e.jsx(i.InputGroup.Text,{children:l})]}),f=n.options.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:u,headerMode:f})}const X=g.forwardRef(({className:n="",style:t,children:o,...s},r)=>e.jsx(i.Col,{ref:r,...s,className:`monitor-panel-item ${n}`,style:t,children:o}));function wt(n){const{hardware:t,options:o={}}=n,s=o.name??t.alias??t.name??t.id;return e.jsxs(X,{children:[e.jsx("h1",{children:s}),e.jsx(Te,{hardware:t})]})}const ks={callables:[],id:"test_object",name:"test_object",online:!0,properties:{number:345,option:"one",state:"1",string:"asbkjdsah"},protocol:"bliss",require_staff:!1,type:"test"},Ps={$ref:"#/definitions/HWTestSchema",$schema:"http://json-schema.org/draft-07/schema#",asyncValidate:!1,cache:!0,definitions:{HWTestSchema:{additionalProperties:!1,properties:{callables:{$ref:"#/definitions/HardwareSchema",type:"object"},id:{title:"id",type:"string"},name:{title:"name",type:"string"},online:{title:"online",type:"boolean"},properties:{$ref:"#/definitions/TestPropertiesSchema",type:"object"},protocol:{title:"protocol",type:"string"},require_staff:{title:"require_staff",type:"boolean"},type:{title:"type",type:"string"}},type:"object"},HardwareSchema:{additionalProperties:!1,cache:!0,properties:{},type:"object"},TestPropertiesSchema:{additionalProperties:!1,cache:!0,properties:{number:{format:"integer",title:"number",type:"number"},option:{enum:["one","two","three"],enumNames:[],title:"option",type:"string"},state:{enum:["ON","OFF","UNKNOWN","ERROR"],enumNames:[],readOnly:!0,title:"state",type:"string"},string:{title:"string",type:"string"}},type:"object"}},save_presets:!1},Bs={response:ks,schema:Ps},jt={default:Bs},Gs={state:mt,name:ht,info:gt,property:xt,monitor:wt},yt={variants:Gs,mocks:jt,monitor:wt};function D(n){const t={display:"inline-block",minWidth:""};n.minWidth&&(t.minWidth=`${n.minWidth}em`);const o=g.useMemo(()=>n.hardwareStatus?n.description?`${n.description}
|
|
2
|
+
${n.hardwareStatus}`:n.hardwareStatus:n.description,[n.description,n.hardwareStatus]);return e.jsx("div",{style:t,children:e.jsx(i.Badge,{bg:n.variant,title:o,children:n.state})})}function vt(n){const{states:t,variants:o={},descriptions:s={},minWidth:r,hardwareStatus:a}=n,c=t[0]??"";if(t.length===0)return e.jsx(D,{state:"NO_STATE",hardwareStatus:a,variant:"fatal",description:"The device no not expose any state",minWidth:r});if(t.length===1)return e.jsx(D,{state:c,hardwareStatus:a,variant:o[c]??"fatal",description:s[c],minWidth:r});const l={display:"inline-block",minWidth:r?`${r}em`:""};function u(f){return e.jsxs(i.Tooltip,{id:"device-state",...f,children:[a??e.jsx(i.Row,{className:"gx-0",children:e.jsx(i.Col,{sm:"12",children:a})}),t.map((d,p)=>{const m=s[d],h=d.startsWith("_")?d.slice(1):d;return e.jsxs(i.Row,{className:"gx-0",children:[e.jsx(i.Col,{sm:"3",className:"text-end",children:e.jsx(i.Badge,{className:"text-right",bg:o[d]??"fatal",children:h})}),e.jsx(i.Col,{sm:"9",className:"text-start lh-1 my-auto ps-1",children:m})]})})]})}return e.jsx("div",{style:l,children:e.jsx(i.OverlayTrigger,{placement:"top",delay:{show:250,hide:400},overlay:u,children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx(i.Badge,{className:"rounded-end-0",bg:o[c]??"fatal",children:c}),e.jsxs(i.Badge,{className:"rounded-start-0",bg:"secondary",children:["+",t.length-1]})]})})})}function Fe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={ON:"success",OFF:"danger",MOVING_ON:"transient",MOVING_OFF:"transient",UNKNOWN:"fatal",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function Ls(n){const{hardware:t}=n;return e.jsx(Fe,{hardware:t})}function Hs(n){var l;const{hardware:t,options:o,disabled:s}=n,r=((l=t.properties)==null?void 0:l.state)??"OFFLINE",a=r==="ON",c=r==="OFF";return e.jsx("div",{style:{display:"grid",gridTemplateRows:"min-content min-content",gridTemplateColumns:"min-content auto",gridGap:"1px"},children:e.jsxs(i.ButtonGroup,{className:"mx-auto",style:{width:"12em"},children:[e.jsx(i.Button,{onClick:()=>{t.actions.call("on")},disabled:a||s,style:{width:"5em"},children:e.jsx("span",{className:"text-nowrap",children:"On"})}),e.jsx(i.Button,{onClick:()=>{t.actions.call("off")},disabled:c||s,style:{width:"5em"},children:e.jsx("span",{className:"text-nowrap",children:"Off"})})]})})}function Nt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Air bearing",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(Fe,{hardware:t});function a(){return e.jsx(Hs,{...n})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function et(n){return e.jsx(i.Button,{variant:n.isActive?"primary":n.wasActivated?"warning":"secondary",onClick:n.onClick,disabled:n.disabled||n.wasActivated,title:n.title,children:e.jsxs(i.Row,{className:"gx-0",children:[e.jsx("i",{className:`col-sm-4 justify-content-center align-self-center ${n.icon}`}),e.jsx(i.Col,{sm:"8",children:n.children})]})})}function Us(n){var d;const{hardware:t,options:o={},disabled:s}=n;function r(){t.actions.call("on")}function a(){t.actions.call("off")}const c=((d=t.properties)==null?void 0:d.state)??"UNKNOWN",l=c==="MOVING_ON"||c==="MOVING_OFF",u=c==="MOVING_ON",f=c==="MOVING_OFF";return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:s||l}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(et,{icon:"fa fa-arrow-up",wasActivated:u,onClick:()=>{r()},disabled:s||l,title:"Turn on the air bearing",children:["Turn",e.jsx("br",{}),"on"]}),e.jsxs(et,{icon:"fa fa-arrow-down",wasActivated:f,onClick:()=>{a()},disabled:s||l,title:"Turn off the air bearing",children:["Turn",e.jsx("br",{}),"off"]})]})})})]})})]})}function Vs(n){const{hardware:t,options:o,disabled:s}=n,{state:r}=t.properties??"OFFLINE",c={ON:"success",OFF:"danger",MOVING_ON:"transient",MOVING_OFF:"transient",UNKNOWN:"fatal",OFFLINE:"warning"}[r]??"fatal";return e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:c,className:"text-center",style:{minWidth:"10em"},value:r}),e.jsx(Us,{...n})]})}function bt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Air bearing",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(Fe,{hardware:t});function a(){return e.jsx(Vs,{...n})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const qs=["on","off","sync_hard"],Ws="airbearing",zs="airbearing",Ys=!0,Ks={state:"ON"},Qs="bliss",Xs=!1,Zs="airbearing",Js={callables:qs,id:Ws,name:zs,online:Ys,properties:Ks,protocol:Qs,require_staff:Xs,type:Zs},_t={default:Js};async function L(n){await new Promise(t=>{setTimeout(t,n)})}function V(n){const{name:t,alias:o=null,type:s,setProperty:r,call:a,properties:c,useHardwareContext:l=()=>null}=n,u=l(),f=g.useMemo(()=>{var h,w;const m={setProperty:r,call:a};return(w=u==null?void 0:(h=u.actions).updateHardwareChangeActions)==null||w.call(h,t,m),m},[]),d={id:t,name:t,alias:o,online:!0,properties:c,type:s,actions:f,user_tags:[],locked:null},p=g.useRef(null);return g.useEffect(()=>{(p.current===null||!P.isEqual(p.current,d))&&(p.current=d,u==null||u.actions.updateHardware(t,d))},[t,d]),e.jsx(e.Fragment,{})}function St(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("ON");async function c(f,d){if(f==="on"){a("MOVING_ON"),await L(2e3),a("ON");return}if(f==="off"){a("MOVING_OFF"),await L(2e3),a("OFF");return}console.log("AirBearingSimulator: Unsupported call",f,d)}async function l(f,d){console.log("AirBearingSimulator: Unsupported setProperty",f,d)}const u={state:r};return e.jsx(V,{name:t,alias:o,type:"tomoflatmotion",call:c,setProperty:l,properties:u,useHardwareContext:s})}const er={default:Nt,protected:bt,state:Ls},Ct={variants:er,mocks:_t,simulator:St};function tr(n){const{hardware:t}=n,{properties:o}=t,s=o.mdt_mode;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"MDT mode"}),e.jsx(i.Form.Control,{value:`${s}`,readOnly:!0})]})}function nr(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(e.Fragment,{}),a=e.jsx(e.Fragment,{children:e.jsx(tr,{hardware:t})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const or=[],sr="BEAMLINE",rr="pir121",ir=!0,ar={mdt_mode:!0},cr="bliss",lr=!1,dr="beamline",ur={callables:or,id:sr,name:rr,online:ir,properties:ar,protocol:cr,require_staff:lr,type:dr},fr={default:ur};function pr(n){const{hardware:t,options:o={}}=n,{online:s=!1,properties:r={}}=t,{mdt_mode:a}=r,c=o.name??t.alias??t.name??t.id;function l(){return a?["danger","MDT MODE","The interlocked shutters are skipped to allow to test the scans and scripts. This will not allow to acquire real data."]:["secondary","Production","In prodiction mode"]}const[u,f,d]=l();return e.jsxs(X,{children:[e.jsx("h1",{children:c}),e.jsx(i.Badge,{bg:u,title:d,children:f})]})}const mr={default:nr,monitor:pr},$t={variants:mr,mocks:fr};function hr(n){const[t,o]=g.useState(),[s,r]=g.useState(),{hardware:a,options:c={}}=n;function l(){const f=a.actions.call("read");return f!==void 0&&(console.log("pending"),f.then(d=>{o(d),r(void 0)}).catch(d=>{r(`${d}`)})),f}function u(f){return a.actions.setProperty("diode_range",f)}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[a.name," Details"]}),e.jsx(i.Popover.Body,{children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{children:[e.jsx(i.Col,{sm:6,className:"text-nowrap",children:"Diode Range:"}),e.jsx(i.Col,{children:e.jsx(i.Form.Control,{size:"sm",as:"select",disabled:n.disabled,onChange:f=>{u(f.target.value)},defaultValue:a.properties.diode_range,children:P.map(a.properties.diode_ranges,f=>e.jsx("option",{value:f,children:f},f))})})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{sm:6,children:"Current:"}),e.jsxs(i.Col,{children:[s&&e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-1",title:s}),!s&&e.jsx(e.Fragment,{children:t}),e.jsx(i.Button,{size:"sm",disabled:n.disabled,onClick:()=>{l()},children:"Read"})]})]})]})})]}),children:e.jsx(i.Button,{title:"Beamviewer Details",className:"float-end",size:"sm",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ot(n){const{hardware:t,options:o={}}=n,s=[{name:"Screen",prop:"screen",success:"OUT",toggle:t.properties.screen==="IN",button:t.properties.screen==="IN"?"Out":"In"},{name:"Led",prop:"led",success:"OFF",toggle:t.properties.led==="ON",button:t.properties.led==="ON"?"Off":"On"},{name:"Foil",prop:"foil",success:"OUT",toggle:t.properties.foil==="IN",button:t.properties.foil==="IN"?"Out":"In",test:t.properties.foil!=="NONE"}];function r(a,c){t.actions.call(a,c)}return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Beamviewer",icon:"fam-hardware-beamviewer",online:t.online}),e.jsx("div",{className:"name me-auto",children:t.name}),e.jsx(hr,{...n})]}),e.jsx("div",{className:"hw-content",children:e.jsx(i.Container,{style:{minWidth:"150px"},children:P.map(s,a=>e.jsx(g.Fragment,{children:(a.test===!0||a.test===void 0)&&e.jsxs(i.Row,{className:"align-items-center mb-1",children:[e.jsx(i.Col,{sm:4,children:a.name}),e.jsx(i.Col,{sm:4,children:e.jsx(i.Badge,{className:"ms-1",bg:t.properties[a.prop]===a.success?"success":"danger",children:t.properties[a.prop]})}),e.jsx(i.Col,{sm:4,children:e.jsx(i.Button,{size:"sm",className:"ms-1",disabled:n.disabled,onClick:c=>r(a.prop,!a.toggle),children:a.button})})]})},a.name))})})]})}const gr=["foil","current","screen","led"],xr="bv1",wr="bv1",jr=!0,yr={diode_range:"1uA",diode_ranges:["1mA","100uA","10uA","1uA","100nA","10nA"],foil:"NONE",led:"OFF",screen:"OUT",state:"ON"},vr="bliss",Nr=!0,br="beamviewer",_r={callables:gr,id:xr,name:wr,online:jr,properties:yr,protocol:vr,require_staff:Nr,type:br},It={default:_r},Sr=["1mA","100uA","10uA","1uA","100nA","10nA"];function Mt(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("OFF"),[c,l]=g.useState("OUT"),[u,f]=g.useState("NONE"),[d,p]=g.useState("1uA");async function m(x,j){if(x==="read"){const y=Math.random();if(y<.1)throw new Error("Dummy error");return y}return x==="led"?(a(j?"ON":"OFF"),null):x==="screen"?(l(j?"IN":"OUT"),null):x==="foil"?(f(j?"IN":"OUT"),null):(console.log("BeamviewerSimulator: Unsupported call",x,j),null)}async function h(x,j){if(x==="diode_range"){p(j);return}console.log("BeamviewerSimulator: Unsupported setProperty",x,j)}const w={state:"ON",led:r,screen:c,foil:u,diode_range:d,diode_ranges:Sr};return console.log(w),e.jsx(V,{name:t,alias:o,type:"optic",call:m,setProperty:h,properties:w,useHardwareContext:s})}const Cr={default:Ot},Dt={variants:Cr,mocks:It,simulator:Mt};function Ue(n){const{hardware:t}=n,{energy:o=null}=t.properties??{},s=o!==null||Number.isFinite(o)?"VALID":"INVALID",r=t.online?s:"OFFLINE",a={VALID:"success",INVALID:"danger",OFFLINE:"warning"},c=a[r]||a.UNKNOWN;return e.jsx(D,{state:r,minWidth:7,variant:c})}function $r(n){const{hardware:t,disabled:o=!1}=n,{properties:s}=t,{source:r=null,available_source_names:a=[]}=s,c=r==null?void 0:r.slice(9);function l(f){t.actions.setProperty("source",`hardware:${f}`)}function u(f){const p=c===f?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:o,onClick:()=>{l(f)},title:`Select the source ${f}`,children:[e.jsx("i",{className:p})," ",f]},f)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:o,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:a.map(f=>u(f))})]})}function Tt(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,{energy:a,unit:c,source:l}=r,u=e.jsx(N,{name:"Energymanager",icon:"fam-hardware-multiposition",online:t.online}),f=e.jsx(Ue,{hardware:t});function d(w){return w===void 0?"Unknown":w===null?"∅":Number.isFinite(w)?w.toFixed(2):"∅"}const p=g.useMemo(()=>{if(l===void 0)return"Unknown";const w=l.slice(9);return w===""?"No source":w},[l]);function m(){return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{children:p}),e.jsx(B,{value:d(a)}),!s&&e.jsx($r,{...n}),c&&e.jsx(i.InputGroup.Text,{children:c})]})}const h=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:u,widgetState:f,widgetContent:m(),headerMode:h})}function Ft(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{source:r,energy:a,unit:c}=s;function l(p,m){return p===void 0||m===void 0?"Unknown":p===null?"∅":Number.isFinite(p)?`${p.toFixed(2)} ${m}`:"∅"}const u=g.useMemo(()=>{if(r===void 0)return"Unknown";const p=r.slice(9);return p===""?"No source":p},[r]),f=l(a,c),d=f!=="∅"?"success":"danger";return e.jsxs(X,{children:[e.jsx("h1",{children:o.name??u}),e.jsx(i.Badge,{bg:d,children:f})]})}const Or=[],Ir="energymanager",Mr="energymanager",Dr=!0,Tr={energy:15.2,unit:"keV",available_source_names:["hardware:pink_beam","hardware:dcm"],source:"hardware:pink_beam"},Fr="bliss",Rr=!1,Ar="energymanager",Er={callables:Or,id:Ir,name:Mr,online:Dr,properties:Tr,protocol:Fr,require_staff:Rr,type:Ar},Rt={default:Er},tt={pink_beam:1.2,dcm:15.6,dcm_off:null};function At(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("pink_beam");async function c(d,p){console.log("MultipositionSimulator: Unsupported call",d,p)}async function l(d,p){if(d==="source"){const m=p.slice(9);a(m);return}console.log("EnergyManagerSimulator: Unsupported setProperty",d,p)}const u=g.useMemo(()=>Object.keys(tt).map(d=>d),[]),f={energy:tt[r]??null,unit:"keV",source:`hardware:${r}`,available_source_names:u};return e.jsx(V,{name:t,alias:o,type:"energymanager",call:c,setProperty:l,properties:f,useHardwareContext:s})}const kr={default:Tt,state:Ue,monitor:Ft},Et={variants:kr,mocks:Rt,simulator:At,monitor:Ft},Ee={OFFLINE:{description:"Filterset is offline",variant:"secondary",priority:0},MOVING:{description:"Filterset is moving",variant:"transient",priority:10},FAULT:{description:"Filterset is in fault",variant:"danger",priority:20},LOCKED:{description:"Filterset is locked",variant:"warning",priority:25},DISABLED:{description:"Filterset is disabled",variant:"warning",priority:40},READY:{description:"Ready to handle request",variant:"success",priority:60},UNKNOWN:{description:"Unknown state is exposed",variant:"fatal",priority:100}};function kt(n){const{hardware:t}=n,{online:o=!1,properties:s={},locked:r=null}=t,{state:a,status:c=null}=s,[l,u,f]=g.useMemo(()=>{if(!o){const d=Ee.OFFLINE;return["OFFLINE",d.variant,d.description]}if(r)return["LOCKED",`Locked by ${(r==null?void 0:r.reason)??"an object"}`];if(a in Ee){const d=Ee[a];return[a,d.variant,d.description]}return["UNKNOWN","fatal",`State '${a}' is not handled`]},[a,o,r]);return e.jsx(D,{state:l,description:f,hardwareStatus:c??void 0,minWidth:6,variant:u})}function Pt(n){const{hardware:t}=n;return e.jsx(kt,{hardware:t})}function Pr(n){const{className:t,filter:o}=n,{name:s}=o,[r,a]=g.useMemo(()=>{switch(o.state){case"IN":return["success",`Filter ${s} is IN`];case"OUT":return["secondary",`Filter ${s} is OUT`];case"MOVING":return["transient",`Filter ${s} is MOVING`];case"IN_OUT":return["warning",`Filter ${s} is simultaneously IN and OUT`];default:return["danger",`Filter ${s} is in an unknown state`]}},[o]);return e.jsx(i.Badge,{className:t,bg:r,title:a,children:o.state})}const nt={minWidth:"2em"};function Br(n){const{filter:t,disabled:o,actions:s,row:r}=n,a=t.name,{state:c}=t,l=c==="IN"||c==="IN_OUT",u=c==="OUT"||c==="IN_OUT",f=c==="MOVING",d=l?"animate-box-left":u?"animate-box-right":"animate-box-center";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"me-2",style:{gridColumn:1,gridRow:r+1},children:t.name}),e.jsx("div",{className:"me-2",style:{gridColumn:2,gridRow:r+1},children:t.description}),e.jsx("div",{className:"me-2 p-0 position-relative",style:{gridColumn:3,gridRow:r+1},children:e.jsx(Pr,{filter:t,className:`${d}`})}),e.jsx("div",{style:{gridColumn:4,gridRow:r+1},children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{size:"sm",onClick:()=>{s.call("move_in",a)},disabled:o||f||l&&!u,title:"Move the filter IN",children:e.jsx("div",{style:nt,children:"In"})}),e.jsx(i.Button,{size:"sm",onClick:()=>{s.call("move_out",a)},disabled:o||f||u&&!l,title:"Move the filter OUT",children:e.jsx("div",{style:nt,children:"Out"})})]})})]})}function Bt(n){const{hardware:t,options:o={}}=n,{properties:s={},actions:r}=t,{state:a}=s,c=a==="DISABLED",l=n.disabled||!t.online||c,u=e.jsx(N,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),f=e.jsx(kt,{hardware:t});function d(){return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"min-content auto 7em min-content",gridRowGap:"1px"},children:s.filters.map((m,h)=>e.jsx(Br,{disabled:l,filter:m,actions:r,row:h}))})}const p=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:u,widgetState:f,widgetContent:d(),headerMode:p})}const Gr=["move_in","move_out"],Lr="filter",Hr="filter",Ur=!0,Vr={state:"READY",status:"Ready",filters:[{name:"filter1",description:"500 µm Si",state:"IN"},{name:"filter2",description:"500 µm Si",state:"OUT"},{name:"filter3",description:"500 µm Si",state:"IN_OUT"},{name:"filter4",description:"2 mm Si",state:"MOVING"},{name:"filter5",description:"420 µm Ge",state:"UNKNOWN"},{name:"filter6",description:"1mm Si",state:"OUT"},{name:"filter7",description:"590 µm Ge",state:"OUT"},{name:"filter8",description:"590 µm Ge",state:"OUT"}]},qr="bliss",Wr=!1,zr="filterset",Yr={callables:Gr,id:Lr,name:Hr,online:Ur,properties:Vr,protocol:qr,require_staff:Wr,type:zr},Kr=["move_in","move_out"],Qr="filter",Xr="filter",Zr=!0,Jr={state:"READY",status:"Ready",filters:[{name:"filter1",description:"500 µm Si",state:"IN"},{name:"filter2",description:"590 µm Ge",state:"OUT"}]},ei="bliss",ti=!1,ni="filterset",oi={callables:Kr,id:Qr,name:Xr,online:Zr,properties:Jr,protocol:ei,require_staff:ti,type:ni},Gt={default:Yr,small:oi},si=[{name:"filter1",description:"500 µm Si",state:"IN"},{name:"filter2",description:"500 µm Si",state:"OUT"},{name:"filter3",description:"500 µm Si",state:"IN_OUT"},{name:"filter4",description:"2 mm Si",state:"MOVING"},{name:"filter5",description:"420 µm Ge",state:"UNKNOWN"},{name:"filter6",description:"1mm Si",state:"OUT"},{name:"filter7",description:"590 µm Ge",state:"OUT"},{name:"filter8",description:"590 µm Ge",state:"OUT"}];function _e(n,t,o){return n.map(s=>s.name===t?{...s,state:o}:s)}function Lt(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState(si),[c,l]=g.useState("READY");async function u(p,m){if(p==="move_in"){const h=m;l("MOVING"),a(w=>_e(w,h,"MOVING")),await L(500),a(w=>_e(w,h,"IN")),l("READY");return}if(p==="move_out"){const h=m;l("READY"),a(w=>_e(w,h,"MOVING")),await L(500),a(w=>_e(w,h,"OUT")),l("READY");return}console.log("FiltersetSimulator: Unsupported call",p,m)}async function f(p,m){console.log("FiltersetSimulator: Unsupported setProperty",p,m)}const d={state:c,filters:r};return e.jsx(V,{name:t,alias:o,type:"multiposition",call:u,setProperty:f,properties:d,useHardwareContext:s})}const ri={state:Pt,default:Bt},Ht={variants:ri,mocks:Gt,simulator:Lt};function ii(n){const t={24:"Y",21:"Z",18:"E",15:"P",12:"T",9:"G",6:"M",3:"k","-3":"m","-6":"µ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},o=Math.log(n)/Math.log(1e3),s=!Number.isInteger(o),r=3*Math.ceil(o-(s?1:0)),a=r===0?"":t[r];return{scalar:n*10**-r,prefix:a,multiplier:10**-r}}function ai(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Ut(n){if(n<60)return`${Math.round(n)} sec`;const t=Math.round(n/60),o=t%60,s=Math.floor(t/60);return s?`${s} hr ${o} min`:`${o} min`}function ci(n){return n>0?(662607004e-42*299792458/(n*1e-10)/160218e-24*.001).toFixed(4):0}function li(n,t){return Number.parseFloat(n.toFixed(t))}const di=Object.freeze(Object.defineProperty({__proto__:null,formatEng:ii,round:li,toEnergy:ci,toHoursMins:Ut,ucfirst:ai},Symbol.toStringTag,{value:"Module"}));function ui(n){const{hardware:t}=n;function o(){t.actions.call("reset")}const s={"Front End":"feitlk",Experimental:"expitlk",PSS:"pssitlk"},r={Current:`${t.properties.current.toFixed(1)} mA`,Mode:t.properties.mode,Refill:Ut(t.properties.refill),Message:e.jsx("pre",{children:t.properties.message})};function a(c){if(!(c in t.properties))return"UNKNOWN";const l=t.properties[c];return!l||typeof l!="string"?"UNKNOWN":l}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("h6",{children:"Interlocks"}),e.jsx(i.Container,{children:P.map(s,(c,l)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[l,":"]}),e.jsx(i.Col,{children:e.jsx(i.Badge,{bg:a(c)==="ON"?"success":"danger",children:a(c)})})]},l))}),e.jsx("h6",{children:"Ring Status"}),e.jsx(i.Container,{children:P.map(r,(c,l)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[l,":"]}),e.jsx(i.Col,{children:c})]},l))}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Shutter Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Vt(n){const{hardware:t,options:o={}}=n;function s(){t.actions.call(t.properties.frontend==="FE open"?"close":"open")}return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Frontend",icon:"fam-hardware-frontend",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.ButtonGroup,{className:"d-flex",children:[e.jsx(i.Button,{variant:t.properties.frontend==="FE open"?"danger":"success",onClick:s,disabled:n.disabled,children:t.properties.frontend==="FE open"?"Close":"Open"}),e.jsx(ui,{...n})]})})]})}function fi(n){switch(n){case"OPEN":case"RUNNING":return"success"}return"danger"}function qt(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r="OFFLINE",status:a}=s,c=o.name??t.alias??t.name,l=fi(r),u=e.jsxs(X,{children:[e.jsx("h1",{children:c}),e.jsx(i.Badge,{bg:l,children:`${r}`})]});if(a){const f=`${a}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:f.includes(`
|
|
3
3
|
`)?e.jsx("pre",{children:f}):f}),children:u})}return u}const pi=["open","close","reset"],mi="fe",hi="fe",gi=!0,xi={current:196.58051532652968,expitlk:"ON",feitlk:"ON",frontend:"FE open",pssitlk:"ON",refill:2287,state:"RUNNING",mode:"USM",message:"USM until 18:00",status:`State : The Front End is open with automatic opening mode on
|
|
4
4
|
Mode : Beam Delivery
|
|
5
5
|
Automatic : Automatic opening active
|
|
@@ -9,7 +9,7 @@ Module 1 Gate Valve 1: Open
|
|
|
9
9
|
Module 1 Gate Valve 2: Open
|
|
10
10
|
Module 2 Gate Valve 1: Open
|
|
11
11
|
|
|
12
|
-
`},wi="tango",ji=!0,yi="frontend",vi={callables:pi,id:mi,name:hi,online:gi,properties:xi,protocol:wi,require_staff:ji,type:yi},
|
|
12
|
+
`},wi="tango",ji=!0,yi="frontend",vi={callables:pi,id:mi,name:hi,online:gi,properties:xi,protocol:wi,require_staff:ji,type:yi},Wt={default:vi},Ni={default:Vt,monitor:qt},zt={variants:Ni,mocks:Wt,monitor:qt};function bi(n){const{hardware:t}=n,o=()=>{t.actions.call(t.properties.state==="ON"?"off":"on")};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:t.properties.state==="ON"?"Off":"On"})})]})]}),children:e.jsx(i.Button,{title:"Gauge Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Yt(n){const{hardware:t,options:o={}}=n;return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Gauge",icon:"fam-hardware-gauge",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="ON"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{value:t.properties.pressure.toExponential(o.precision||3),disabled:!0}),(t.properties.unit||o.unit)&&e.jsx(i.InputGroup.Text,{children:t.properties.unit||o.unit}),e.jsx(bi,{...n})]})})]})}const _i=["off","on"],Si="pir121",Ci="pir121",$i=!0,Oi={pressure:.0007999999797903001,state:"ON",status:`
|
|
13
13
|
Gauge is underrange - Channel B2 (4)
|
|
14
14
|
Rel. | Lower | Upper | SA | State
|
|
15
15
|
1 | 1.0e-6| 3.0e-6| 1 | ON
|
|
@@ -27,15 +27,15 @@ Rel. | Lower | Upper | SA | State
|
|
|
27
27
|
4 | 4.0e-3| 6.0e-3| 4 | ON
|
|
28
28
|
A | 4.0e-3| 1.0e-5| 6 | ON
|
|
29
29
|
B | 4.0e-3| 1.0e-5| 8 | ON
|
|
30
|
-
`},Pi="tango",Bi=!0,Gi="gauge",Li={callables:Fi,id:Ri,name:Ai,online:Ei,properties:ki,protocol:Pi,require_staff:Bi,type:Gi},Yt={default:Ti,default2:Li},Hi={default:zt},Kt={variants:Hi,mocks:Yt},Ui=g.forwardRef((n,t)=>{const o=g.useRef(null),s=g.useRef(),[r,a]=g.useState(n.step),[c,l]=g.useState(!1),u=O=>{const Y=t;if(o.current===null)return;let te=Number.parseFloat(Y.current.value);if(o.current.value.startsWith("*")){const K=Number.parseFloat(o.current.value.replace("*",""));te=O?te*K:te/K}else{const K=Number.parseFloat(o.current.value);te+=O?K:-K}Y.current.value=`${te}`,n.onStep&&n.onStep({target:Y.current})},{onStep:f,step:d,overlay:p,incIcon:m,decIcon:h,swapIncDec:w,onKeyDown:x,onBlur:j,horizontalArrows:y,largeArrows:S,disabled:$,stepOnly:b,...v}=n,C=O=>{O.key==="ArrowUp"?(O.preventDefault(),l(!0),u(!0)):O.key==="ArrowDown"?(O.preventDefault(),l(!0),u(!1)):x&&x(O)};c&&(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{var O;(O=t==null?void 0:t.current)==null||O.focus()},100)),g.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const I=()=>{s.current&&clearTimeout(s.current),l(!1),j&&j()};if(!n.step)return e.jsx(i.Form.Control,{ref:t,type:"number",step:"any",onKeyDown:C,onBlur:I,disabled:$,onClick:O=>{O.stopPropagation()},...v});const M=P.map(n.steps||[n.step],O=>e.jsx("option",{value:O,children:O},O)),k=m||h;return e.jsx("div",{className:q.default("numeric-step",{"numeric-step-large":S,"numeric-step-horizontal":y}),children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{onKeyDown:C,onBlur:I,ref:t,type:"number",step:"any",disabled:$||b,...v}),e.jsxs(e.Fragment,{children:[p,!p&&e.jsxs(i.InputGroup.Text,{className:`d-flex flex-column ${k?"inc-dec":""}`,children:[e.jsx(i.Form.Control,{ref:o,as:"select",className:"step-size",defaultValue:r,disabled:$,onChange:O=>a(Number.parseFloat(O.target.value)),children:M}),n.unit&&e.jsx("div",{children:n.unit}),!m&&!h&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{className:"step step-up",disabled:n.disabled,onClick:O=>u(!0)}),e.jsx(i.Button,{className:"step step-down",disabled:n.disabled,onClick:O=>u(!1)})]})]}),h&&w&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>u(!1),children:e.jsx("i",{className:`fa fa-fw fa-${h}`})}),m&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>u(!0),children:e.jsx("i",{className:`fa fa-fw fa-${m}`})}),h&&!w&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>u(!1),children:e.jsx("i",{className:`fa fa-fw fa-${h}`})})]})]})})}),Qt=Ui;function ge(n){const t=g.useRef(null),[o,s]=g.useState(!1),[r,a]=g.useState(!1);g.useEffect(()=>{t.current&&(n.hardwareValue===null?t.current.value="":n.precision!==void 0?t.current.value=n.hardwareValue.toFixed(n.precision):t.current.value=n.hardwareValue.toString(),s(!1))},[n.hardwareValue]);function c(p){let m=p;n.precision!==void 0&&(m=Number.parseFloat(m).toFixed(n.precision)),t!=null&&t.current&&(t.current.value=m)}function l(){o&&setTimeout(()=>{c(n.hardwareValue),s(!1)},3e3)}function u(p){n.hardwareValue!==null&&s(p.target.value!==n.hardwareValue.toString())}function f(p){s(!1);const m=n.onMoveRequested(p.target.value);m&&m.catch(()=>{a(!0),setTimeout(()=>{c(n.hardwareValue),a(!1)},2e3)})}function d(p){switch(p.key){case"Enter":{s(!1);const m=Number.parseFloat(p.target.value),h=n.onMoveRequested(m);h&&h.catch(()=>{a(!0),setTimeout(()=>{c(n.hardwareValue),a(!1)},2e3)})}p.preventDefault(),p.stopPropagation();break;case"Esc":case"Escape":o&&(a(!1),s(!1),c(n.hardwareValue)),p.target.blur(),p.preventDefault(),p.stopPropagation();break}}return e.jsx(Qt,{id:n.id,className:q.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:n.readOnly?"text":"number",ref:t,precision:n.precision,onChange:u,onBlur:l,onStep:f,onKeyDown:d,disabled:n.hardwareIsDisabled||n.readOnly||!n.hardwareIsReady,stepOnly:n.stepOnly,step:n.step,steps:n.steps,incIcon:n.incIcon,decIcon:n.decIcon,swapIncDec:n.swapIncDec,horizontalArrows:n.horizontalArrows,largeArrows:n.largeArrows,overlay:n.hardwareIsMoving&&!n.hardwareIsDisabled?e.jsx(i.Button,{variant:"danger",onClick:n.onAbortRequested,children:e.jsx("i",{className:"fa fa-times"})}):null})}function Xt(n){const{hardware:t,options:o={},disabled:s}=n;function r(f){return t.actions.setProperty("power",f)}function a(f){return t.actions.call(f?"on":"off")}const c=t.properties.state,l=e.jsx(N,{name:"Laser",icon:"fam-hardware-laser",online:t.online}),u=e.jsx(D,{state:c,minWidth:6,variant:c==="ON"?"success":"warning"});return e.jsx(_,{hardware:t,widgetIcon:l,widgetState:u,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(ge,{id:t.id,hardwareValue:t.properties.power,hardwareIsDisabled:!1,hardwareIsReady:!0,hardwareIsMoving:c==="MOVING",onMoveRequested:r,onAbortRequested:()=>null,precision:1,readOnly:!1,step:o.step,steps:o.steps,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),e.jsx(i.Button,{size:"sm",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>{a(t.properties.state!=="ON")},children:e.jsx("i",{className:t.properties.state==="ON"?"fa fa-toggle-on":"fa fa-toggle-off"})})]})})}const Vi=[],qi="yag1",Wi="yag1",zi=!0,Yi={power:5,state:"ON"},Ki="bliss",Qi=!1,Xi="laser",Zi={callables:Vi,id:qi,name:Wi,online:zi,properties:Yi,protocol:Ki,require_staff:Qi,type:Xi},Zt={default:Zi},Ji={default:Xt},Jt={variants:Ji,mocks:Zt};function ea(n){var o;const{hardware:t}=n;return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"laserheating_overlay",children:[e.jsxs(i.Popover.Header,{children:[t.name," details"]}),e.jsx(i.Popover.Body,{children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Background Mode"}),e.jsx(i.Col,{children:t.properties.background_mode})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Calibration"}),e.jsx(i.Col,{children:t.properties.current_calibration})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Fit Wavelength"}),e.jsxs(i.Col,{children:[(o=t.properties.fit_wavelength)==null?void 0:o.join(" - ")," ",e.jsx("span",{children:"nm"})]})]})]})})]}),children:e.jsx(i.Button,{children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function en(n){const{hardware:t,options:o={},disabled:s}=n,[r,a]=g.useState(!1);function c(p){return p<=0?Promise.reject(new Error("exposure_time must be > 0")):t.actions.setProperty("exposure_time",p)}function l(){a(!0);const p=t.actions.call("measure");return p!==void 0&&(console.log("pending"),p.then(()=>{a(!1)}).catch(m=>{a(!1)})),p}const u=t.properties.state,f=e.jsx(N,{name:"Laser Heating",icon:"fa-fire",online:t.online}),d=e.jsx(D,{state:u,minWidth:6,variant:u==="READY"?"success":"warning"});return e.jsx(_,{hardware:t,widgetIcon:f,widgetState:d,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(ge,{id:t.id,hardwareValue:t.properties.exposure_time,hardwareIsReady:!0,hardwareIsDisabled:n.disabled,hardwareIsMoving:!1,onMoveRequested:c,onAbortRequested:()=>null,precision:1,readOnly:!1,step:o.exposureStep,steps:o.exposureSteps,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),e.jsx(i.InputGroup.Text,{children:"s"}),e.jsx(i.Button,{size:"sm",disabled:n.disabled||r,onClick:()=>{l()},children:r?e.jsx("i",{className:"fa fa-spinner fa-spin"}):e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"fa fa-play me-1"}),"Measure"]})}),e.jsx(ea,{hardware:t,disabled:n.disabled})]})})}const ta=[],na="laserheating",oa="laserheating",sa=!0,ra={exposure_time:.5,state:"ON",background_mode:"READY",fit_wavelength:[500,650],current_calibration:"/path/to/file"},ia="bliss",aa=!1,ca="laserheating",la={callables:ta,id:na,name:oa,online:sa,properties:ra,protocol:ia,require_staff:aa,type:ca},tn={default:la},da={default:en},nn={variants:da,mocks:tn};function on(n){const t=g.useRef(null),{hardware:o,options:s={}}=n;function r(c){o.actions.setProperty("intensity",c)}const a=g.useCallback(Ts.default(r,100),[]);return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Light",icon:"fa-lightbulb-o",online:o.online}),e.jsx("div",{className:"name",children:o.name}),e.jsx(i.Badge,{bg:o.properties.state==="ON"?"success":"danger",children:o.properties.state})]}),e.jsxs("div",{className:"hw-content",children:[e.jsx(i.Form.Control,{ref:t,disabled:n.disabled,type:"range",min:"0",max:"100",onChange:c=>a(Number.parseFloat(c.target.value)),defaultValue:o.properties.intensity}),e.jsxs("div",{children:[e.jsx(i.Button,{disabled:o.properties.intensity===0,size:"sm",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>a(0),children:e.jsx("i",{className:"fa fa-power-off"})}),e.jsxs("span",{className:"float-end",children:[o.properties.intensity," %"]})]})]})]})}const ua=[],fa="light_vlm",pa="light_vlm",ma=!0,ha={intensity:0,state:"ON",temperature:23.2},ga="bliss",xa=!1,wa="light",ja={callables:ua,id:fa,name:pa,online:ma,properties:ha,protocol:ga,require_staff:xa,type:wa},sn={default:ja},ya={default:on},rn={variants:ya,mocks:sn};function Z(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=t.properties.state??"UNKNOWN",a=o?(r==="ACQUIRING"?r:s!==null?"LOCKED":r)||"UNKNOWN":"OFFLINE",c={UNKNOWN:"critical",ACQUIRING:"transient",READY:"success",OFFLINE:"secondary",LOCKED:"warning"},l=c[a]??c.UNKNOWN;return e.jsx(D,{state:a,minWidth:6,variant:l})}function va(n){const{hardware:t}=n;return e.jsx(Z,{hardware:t})}function ot(n){const{hardware:t,options:o={}}=n;return e.jsx(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:e.jsx("div",{children:t.name})})}function an(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=o.header||"top";return a==="none"?e.jsx(ot,{...n}):e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(ot,{...n}),headerMode:a})}function st(n){const{hardware:t,options:o={}}=n,[s,r]=t.properties.size??["?","?"];return e.jsxs(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:[e.jsxs("div",{children:[s," × ",r]}),e.jsx("div",{className:"ms-auto",children:e.jsx("small",{children:e.jsx("small",{children:"px"})})})]})}function cn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=o.header??"top";return a==="none"?e.jsx(st,{...n}):e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(st,{...n}),headerMode:a})}function J(n){const[t,o]=g.useState(!1);return e.jsxs(i.Button,{variant:n.isActive?"primary":t?"warning":"secondary",onClick:()=>{o(!0),n.onAction().finally(()=>{o(!1)})},disabled:n.disabled||t,title:n.title,className:"text-nowrap",children:[n.icon&&e.jsx("i",{className:`col-sm-4 justify-content-center align-self-center ${n.icon}`}),n.children]})}function Na(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r,properties:a}=t,{rotation:c,flip:[l,u]}=a;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:s}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Rotation"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsx(J,{isActive:c===0,onAction:()=>r.setProperty("rotation",0),disabled:s,title:"Disable rotation transformation",children:"None"}),e.jsxs(J,{isActive:c===90,onAction:()=>r.setProperty("rotation",90),disabled:s,title:"Disable rotation transformation",children:["90 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),e.jsxs(J,{isActive:c===180,onAction:()=>r.setProperty("rotation",180),disabled:s,title:"Disable rotation transformation",children:["180 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),e.jsxs(J,{isActive:c===270,onAction:()=>r.setProperty("rotation",270),disabled:s,title:"Disable rotation transformation",children:["270 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]})]})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Flip"})}),e.jsxs(i.Row,{className:"gx-0",children:[e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(J,{isActive:l,onAction:()=>r.setProperty("flip",[!0,u]),disabled:s,title:"Enable horizontal flip transformation",children:["Horiz ",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),e.jsx(J,{isActive:!l,onAction:()=>r.setProperty("flip",[!1,u]),disabled:s,title:"Disable horizontal flip transformation",children:"No"})]})}),e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(J,{isActive:u,onAction:()=>r.setProperty("flip",[l,!0]),disabled:s,title:"Enable vertical flip transformation",children:["Vert ",e.jsx("i",{className:"fa fa-fw fa-up-down"})]}),e.jsx(J,{isActive:!u,onAction:()=>r.setProperty("flip",[l,!1]),disabled:s,title:"Disable vertical flip transformation",children:"No"})]})})]})]})})]})}function ba(n){const{hardware:t,options:o={}}=n,{properties:s}=t,[r,a]=s.flip,c=s.rotation??0,l=!r&&!a&&c===0;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsxs(i.InputGroup.Text,{children:[r&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Flip",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),a&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Flip",e.jsx("i",{className:"fa fa-fw fa-up-down"})]}),c!==0&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Rot ",c.toFixed(0),e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),l&&e.jsx(i.Badge,{bg:"secondary",style:{fontSize:"130%"},title:"No transformation",children:"None"})]}),!o.readonly&&e.jsx(Na,{...n})]})}function ln(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(ba,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const dn="4.2em";function _a(n){const{hardware:t}=n,{properties:o}=t,s=o.state==="READY",r=n.disabled||!t.online||!s,a=o.binning_mode??"SUM";function c(l){const{binningMode:u,selectedMode:f,title:d}=l,m=u===f?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:r,onClick:()=>{t.actions.setProperty("binning_mode",u)},title:d,children:[e.jsx("i",{className:m})," "," ",e.jsx(i.Badge,{style:{minWidth:dn},children:u})]},u)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:r,variant:"secondary"}),e.jsxs(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:[e.jsx(c,{binningMode:"SUM",selectedMode:a,title:"Merge binned pixel with SUM operation"}),e.jsx(c,{binningMode:"MEAN",selectedMode:a,title:"Merge binned pixel with MEAN operation"})]})]})}function Sa(n){const{hardware:t,options:o,disabled:s}=n,{properties:r={}}=t,{binning:a,binning_mode:c="SUM"}=r;function l(h){t.actions.setProperty("binning",[h,h])}const u=Nc(t),f=o.readonly??!1;if(a===void 0)return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx("i",{className:"fa fa-fw fam-binning-2d fa-2x"})}),e.jsx(B,{value:"? × ?"})]});const[d,p]=a??[0,0],m=d===p?d:0;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx("i",{className:"fa fa-fw fam-binning-2d fa-2x"})}),e.jsx(B,{value:`${a[0]} × ${a[1]}`}),!f&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{variant:m===1?"primary":"secondary",onClick:()=>{l(1)},disabled:s,children:"1"}),e.jsx(i.Button,{variant:m===2?"primary":"secondary",onClick:()=>{l(2)},disabled:s,children:"2"}),e.jsx(i.Button,{variant:m===3?"primary":"secondary",onClick:()=>{l(3)},disabled:s,children:"3"}),e.jsx(i.Button,{variant:m===4?"primary":"secondary",onClick:()=>{l(4)},disabled:s,children:"4"})]}),e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx(i.Badge,{style:{fontSize:"130%",minWidth:dn},title:`Detector setup with binning ${c}`,children:c})}),!f&&u&&e.jsx(_a,{...n})]})}function un(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Sa,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Ca(n){const{hardware:t}=n,{properties:o}=t;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Rotation applied to the detector",children:e.jsx("i",{className:"fa fa-fw fa-crop-simple fa-2x"})}),e.jsx(i.Form.Control,{value:`${o.roi[0]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[1]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[2]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[3]}`,readOnly:!0}),e.jsx(i.InputGroup.Text,{children:"px"})]})}function fn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Ca,{hardware:t})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function $a(n){const{hardware:t}=n,{properties:o}=t,s=o.static,[r,a]=(s==null?void 0:s.image_max_dim)??["?","?"];return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Max size of the detector",children:"Max size"}),e.jsx(i.Form.Control,{value:`${r} × ${a}`,readOnly:!0}),e.jsx(i.InputGroup.Text,{children:"px"})]})}function Oa(n){const{hardware:t}=n,{properties:o}=t,s=o.static;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Version of the Lima server (lima-core)",children:"Lima version"}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.lima_version}`,readOnly:!0})]})}function Ia(n){const{hardware:t}=n,{properties:o}=t,s=o.static;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Model of the detector",children:"Type/model"}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.camera_type}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.camera_model}`,readOnly:!0})]})}function pn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Ia,{hardware:t}),e.jsx($a,{hardware:t}),e.jsx(Oa,{hardware:t})]}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Ma(n){var v;const{hardware:t,disabled:o}=n,{properties:s}=t,r=((v=s.static)==null?void 0:v.image_max_dim)??[0,0],a=s.roi,c=s.binning??[1,1],l=r[0]/c[0],u=r[1]/c[1];function f(){return u>l?1/u:1/l}const d=f(),[p,m]=[100*l*d,100*u*d];function h(){const[C,I,M,k]=a;return[100*C/l,100*I/u,100*M/l,100*k/u]}function w(){const[C,I,M,k]=a;return[100*(C+M*.5)/l,100*(I+k*.5)/u]}const[x,j,y,S]=h(),[$,b]=w();return e.jsx("div",{style:{backgroundColor:"#AAAAAA",width:"10em",height:"10em"},children:e.jsxs("div",{className:"position-relative",title:`Detector ${t.id}`,style:{backgroundColor:"#FFFFFF",border:"2px solid black",width:`${p}%`,height:`${m}%`},children:[e.jsx("div",{title:"ROI location",className:"position-absolute",style:{backgroundColor:"#FFFFFF",border:"2px dotted black",left:`${x}%`,top:`${j}%`,width:`${y}%`,height:`${S}%`}}),e.jsxs("span",{className:"position-absolute",style:{left:`${$}%`,top:`${b}%`,transform:"translate(-50%, -50%)"},children:[a[2],"×",a[3]]})]})})}function mn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Ma,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const F={};function Da(n){n.useHardware&&(F.useHardware&&console.warn("useHardware hook was already registered"),F.useHardware=n.useHardware),n.useHardwareChangeActions&&(F.useHardwareChangeActions&&console.warn("useHardwareChangeActions hook was already registered"),F.useHardwareChangeActions=n.useHardwareChangeActions),n.useHardwareSchema&&(F.useHardwareSchema&&console.warn("useHardwareSchema hook was already registered"),F.useHardwareSchema=n.useHardwareSchema),n.useOperator&&(F.useOperator&&console.warn("useOperator hook was already registered"),F.useOperator=n.useOperator),n.useScanRunning&&(F.useScanRunning&&console.warn("useScanRunning hook was already registered"),F.useScanRunning=n.useScanRunning)}function G(n){if(!F.useHardware)throw new Error("No `useHardware` hook registered");return F.useHardware(n)}function oe(n){if(!F.useHardwareChangeActions)throw new Error("No `useHardwareChangeActions` hook registered");return F.useHardwareChangeActions(n)}function Ta(n){if(!F.useHardwareSchema)throw new Error("No `useHardwareSchema` hook registered");return F.useHardwareSchema(n)}function Fa(){if(!F.useOperator)throw new Error("No `useOperator` hook registered");return F.useOperator()}function Ra(){if(!F.useScanRunning)throw new Error("No `useScanRunning` hook registered");return F.useScanRunning()}const Aa="lima_cam",Ea="lima_cam",ka="bliss",Pa="lima",Ba=!0,Ga=!1,La={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:0,size:[128,128],state:"READY"},Ha={id:Aa,name:Ea,protocol:ka,type:Pa,online:Ba,require_staff:Ga,properties:La},Ua="lima_cam",Va="lima_cam",qa="bliss",Wa="lima",za=!0,Ya=!1,Ka={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!0,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:0,size:[128,128],state:"READY"},Qa={id:Ua,name:Va,protocol:qa,type:Wa,online:za,require_staff:Ya,properties:Ka},Xa="lima_cam",Za="lima_cam",Ja="bliss",ec="lima",tc=!0,nc=!1,oc={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:180,size:[128,128],state:"READY"},sc={id:Xa,name:Za,protocol:Ja,type:ec,online:tc,require_staff:nc,properties:oc},rc="lima_cam",ic="lima_cam",ac="bliss",cc="lima",lc=!0,dc=!1,uc={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,710,1920,500],roi:[0,710,1920,500],rotation:0,size:[1920,1920],state:"READY"},fc={id:rc,name:ic,protocol:ac,type:cc,online:lc,require_staff:dc,properties:uc},pc="lima_cam",mc="lima_cam",hc="bliss",gc="lima",xc=!0,wc=!1,jc={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[5e3,2e3]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,5e3,2e3],roi:[0,0,5e3,2e3],rotation:0,size:[5e3,2e3],state:"READY"},yc={id:pc,name:mc,protocol:hc,type:gc,online:xc,require_staff:wc,properties:jc},hn={default:Ha,flip:Qa,rot:sc,roicenter:fc,squaredetector:yc};function gn(n){const{name:t,alias:o,useHardwareContext:s}=n,r=[1920,1920],a=[16e-6,16e-6],[c,l]=g.useState({static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:a,image_max_dim:r},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:a,raw_roi:[0,0,...r],roi:[0,0,...r],rotation:0,size:r,state:"READY"});async function u(x,j){console.log("LimaSimulator: Unsupported call",x,j)}function f(x,j){const y=[Math.round(a[0]*j[0]),Math.round(a[1]*j[1])],S=[Math.round(r[0]/j[0]),Math.round(r[1]/j[1])];return{...x,binning:j,pixel_size:y,roi:[0,0,...S],size:S}}function d(x,j){return{...x,binning_mode:j}}function p(x,j){return{...x,rotation:j}}function m(x,j){return{...x,flip:[j,x.flip[1]]}}function h(x,j){return{...x,flip:[x.flip[0],j]}}async function w(x,j){if(x==="binning"){l(y=>f(y,j));return}if(x==="binning_mode"){l(y=>d(y,j));return}if(x==="rotation"){l(y=>p(y,j));return}if(x==="flip_x"){l(y=>m(y,j));return}if(x==="flip_y"){l(y=>h(y,j));return}console.log("LimaSimulator: Unsupported setProperty",x,j)}return e.jsx(V,{name:t,alias:o,type:"lima",call:u,setProperty:w,properties:c,useHardwareContext:s})}function xe(n){return n.type==="lima"}function xn(n){const t=G(n);return t===null||!xe(t)?null:t}function wn(n,t){const o=Math.ceil(n/t),s=n/o;return[o,s]}const vc={default:an,size:cn,transformation:ln,binning:un,imageroi:fn,description:pn,shape:mn,state:va},jn={variants:vc,mocks:hn,simulator:gn};function Nc(n){var t;return n.properties.binning_mode!==void 0&&Fs.default.gte(((t=n.properties.static)==null?void 0:t.lima_version)??"0.0.0","1.10.4")}function bc(n,t){const{inputRef:o,referenceElementRef:s,onAddSelection:r,onRemoveSelection:a,...c}=n,l=g.useRef(),u=()=>{setTimeout(()=>{const p=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;p&&p.call(l.current,""),l.current&&l.current.dispatchEvent(new Event("input",{bubbles:!0}))},500)},f=()=>{r&&r(t.results).then(()=>{u()})},d=()=>{const p=t.text?[...t.selected].filter(m=>m.toLowerCase().indexOf(t.text.toLowerCase())!==-1):[...t.selected];a&&a(p).then(()=>{u()})};return e.jsxs(i.InputGroup,{children:[e.jsx(Q.Hint,{children:e.jsx(i.Form.Control,{style:{width:"100%"},...c,ref:p=>{l.current=p,o(p),s(p)},placeholder:`${t.selected.length} enabled`})}),e.jsx(i.Button,{disabled:n.disabled||t.results.length===0,onClick:f,children:e.jsx("i",{className:"fa fa-plus"})}),e.jsx(i.Button,{disabled:n.disabled,onClick:d,children:e.jsx("i",{className:"fa fa-minus"})})]})}function _c(n){return function(t){function o(s,r,a){return t(s,r,a,n)}return o.displayName=`WithExtraProps(${t.displayName||t.name||"Component"})`,o}}function Sc(n,t,o,s){const a=[...o.selected].filter(u=>u.toLowerCase().indexOf(o.text.toLowerCase())!==-1).sort().map(u=>e.jsx("a",{href:"#",className:"dropdown-item",onClick:()=>o.onRemove(u),children:e.jsx(Q.Highlighter,{search:o.text,children:u})},u)),l=[...o.results].sort().map((u,f)=>e.jsx(Q.MenuItem,{option:u,position:f,children:e.jsx(Q.Highlighter,{search:o.text,children:u})},u));return e.jsxs(Q.Menu,{...t,style:{...t.style,width:350},children:[s.pending&&e.jsx(Q.Menu.Header,{children:"Loading..."}),!s.pending&&e.jsxs(e.Fragment,{children:[e.jsx(Q.Menu.Header,{children:"Enabled"}),a,a.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items enabled"}),e.jsx(Q.Menu.Header,{children:"Available"}),l,l.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items available"})]})]})}function Cc(n){const{hardware:t,disabled:o=!1}=n,{online:s}=t;if(!s)return e.jsx(i.Alert,{children:"Offline"});const r=t.properties.available.filter(u=>!t.properties.disabled.includes(u));function a(u){const f=u.filter(p=>!r.includes(p)),d=r.filter(p=>!u.includes(p));f.length>0&&f.forEach(p=>{t.actions.call("enable",p)}),d.length>0&&d.forEach(p=>{t.actions.call("disable",p)})}function c(u){const f=[];return u.forEach(d=>{const p=t.actions.call("enable",d);f.push(p)}),Promise.all(f)}function l(u){const f=[];return u.forEach(d=>{const p=t.actions.call("disable",d);f.push(p)}),Promise.all(f)}return e.jsx(Q.Typeahead,{disabled:o,id:`typeahead_mg_${t.name}`,multiple:!0,flip:!0,positionFixed:!0,renderInput:bc,renderMenu:_c({name:t.id})(Sc),onChange:a,inputProps:{onAddSelection:c,onRemoveSelection:l},selected:r,options:t.properties.available,selectHint:(u,f)=>f.key==="Enter"||u})}function yn(n){const{hardware:t,options:o={},disabled:s=!1}=n;function r(){return t.actions.call("set_active")}const a=o.header??"top",c=e.jsx(N,{name:"Measurement Group",icon:"fa-list-ol",online:!0}),l=e.jsx(e.Fragment,{children:e.jsx(i.OverlayTrigger,{placement:"top",overlay:e.jsx(i.Tooltip,{id:"active",children:"Activate this measurement group"}),children:e.jsx(i.Button,{size:"sm",disabled:s,onClick:()=>void r(),className:"float-right ml-1",children:e.jsx("i",{className:"fa fa-power-off"})})})}),u=e.jsx(Cc,{...n});return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:u,headerMode:a})}const $c=[],Oc="mg",Ic="mg",Mc=!0,Dc={available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]},Tc="bliss",Fc=!1,Rc="measurementgroup",Ac={callables:$c,id:Oc,name:Ic,online:Mc,properties:Dc,protocol:Tc,require_staff:Fc,type:Rc},vn={default:Ac};function Nn(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState({available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]});async function c(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.filter(h=>h!==d)}})}async function l(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.includes(d)?m:[...m,d]}})}async function u(d,p){if(d==="enable"){await c(p);return}if(d==="disable"){await l(p);return}d!=="set_active"&&console.log("MeasurementGroupSimulator: Unsupported call",d,p)}async function f(d,p){console.log("MeasurementGroupSimulator: Unsupported setProperty",d,p)}return e.jsx(V,{name:t,alias:o,type:"measurementgroup",call:u,setProperty:f,properties:r,useHardwareContext:s})}const Ec={default:yn},bn={variants:Ec,mocks:vn,simulator:Nn},Pe={description:"Unknown state is exposed",variant:"fatal",priority:100},Se={OFFLINE:{description:"Axis is offline",variant:"secondary",priority:0},MOVING:{description:"Axis is moving",variant:"transient",priority:10},FAULT:{description:"Axis is in fault",variant:"danger",priority:20},LOCKED:{description:"Axis is locked",variant:"warning",priority:25},OFF:{description:"Power is off",variant:"secondary",priority:30},DISABLED:{description:"Axis is disabled",variant:"warning",priority:40},LOWLIMIT:{description:"Low limit is reached",variant:"warning",priority:50},HIGHLIMIT:{description:"High limit is reached",variant:"warning",priority:51},HOME:{description:"Home signal active",variant:"info",priority:52},READY:{description:"Ready to handle request",variant:"success",priority:60},NOT_READY:{description:"Not ready",variant:"warning",priority:100},UNKNOWN:Pe};function we(n){const{hardware:t}=n,{locked:o=null}=t,{state:s=["UNKNOWN"]}=t.properties,[r,a]=g.useMemo(()=>{if(!t.online)return[["OFFLINE"],void 0];function c(p,m){const h=Se[p]??Pe,w=Se[m]??Pe;return h.priority-w.priority}const l=[...s,...o!==null?["LOCKED"]:[],...s.length===0?["NOT_READY"]:[]];l.sort(c);function u(p){const m=p.split(":",2);return m.length===1?[p,void 0]:m}const f={};return[l.map(p=>{if(p.startsWith("_")){const m=u(p);return m[1]!==void 0&&(f[m[0]]=m[1]),m[0]}return p==="LOCKED"?f[p]=`Locked by ${(o==null?void 0:o.reason)??" an object"}`:f[p]=Se[p].description??"",p}),f]},[s,t.online,o]);return e.jsx(vt,{states:r,descriptions:a,minWidth:6,variants:Object.fromEntries(Object.entries(Se).map(([c,l])=>[c,l.variant]))})}function kc(n){const{hardware:t}=n;return e.jsx(we,{hardware:t})}function me(n){const t=g.useRef(null),[o,s]=g.useState(!1),[r,a]=g.useState(!1);function c(d){return n.precision!==void 0?Number.parseFloat(d).toFixed(n.precision):d}g.useEffect(()=>{var d;t.current&&(t.current.value=c((d=n.hardwareValue)==null?void 0:d.toString()),s(!1))},[n.hardwareValue,n.precision]);function l(d){const p=c(d);t!=null&&t.current&&(t.current.value=p)}function u(d){switch(d.key){case"Enter":{s(!1);const p=Number.parseFloat(d.target.value),m=n.onMoveRequested(p);m&&m.catch(()=>{a(!0),setTimeout(()=>{l(n.hardwareValue),a(!1)},2e3)}),d.preventDefault(),d.stopPropagation();break}case"Esc":case"Escape":o&&(a(!1),s(!1),l(n.hardwareValue)),d.target.blur(),d.preventDefault(),d.stopPropagation();break}}function f(d){s(d.target.value!==n.hardwareValue.toString())}return e.jsx(i.Form.Control,{className:q.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:"number",ref:t,onChange:f,onKeyDown:u,disabled:n.readOnly||n.hardwareIsMoving||n.hardwareIsDisabled,step:n.step,onClick:d=>{d.stopPropagation()}})}function Pc(n){const{states:t,hardware:o}=n,{properties:s}=o;function r(c){return o.actions.setProperty("velocity",c)}function a(c){return o.actions.setProperty("acceleration",c)}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[o.name," details"]}),e.jsxs(i.Popover.Body,{children:[e.jsxs(i.Form.Group,{children:[e.jsx(i.Form.Label,{children:"Velocity"}),e.jsx(me,{hardwareValue:(s==null?void 0:s.velocity)??0,onMoveRequested:r,hardwareIsDisabled:n.disabled,hardwareIsReady:t.READY,hardwareIsMoving:t.MOVING,readOnly:n.readOnly})]}),e.jsxs(i.Form.Group,{children:[e.jsx(i.Form.Label,{children:"Acceleration"}),e.jsx(me,{hardwareValue:(s==null?void 0:s.acceleration)??0,onMoveRequested:a,hardwareIsDisabled:n.disabled,hardwareIsReady:t.READY,hardwareIsMoving:t.MOVING,readOnly:n.readOnly})]})]})]}),children:e.jsx(i.Button,{children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function ce(n){const{hardware:t,options:o={}}=n,{properties:s,user_tags:r}=t;function a(){t.actions.call("stop")}function c(p){return t.actions.call("move",p)}const l=je(s.state,r),u=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),f=e.jsx(we,{hardware:t}),d=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:u,widgetState:f,widgetContent:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(ge,{id:t.id,hardwareValue:(s==null?void 0:s.position)??null,hardwareIsDisabled:n.disabled,hardwareIsReady:l.READY??!1,hardwareIsMoving:l.MOVING??!1,onMoveRequested:c,onAbortRequested:a,precision:o.precision??s.display_digits??void 0,readOnly:o.readOnly,stepOnly:o.stepOnly,step:o.step,steps:o.steps,incIcon:o.incicon,decIcon:o.decicon,swapIncDec:o.swapincdec,horizontalArrows:o.horizontalarrows,largeArrows:o.largearrows}),s.unit&&e.jsx(i.InputGroup.Text,{children:s.unit}),!l.MOVING&&o.extended&&e.jsx(Pc,{hardware:t,disabled:n.disabled,readOnly:o.readOnly,states:l}),l.MOVING&&!n.disabled&&!o.step&&e.jsx(i.Button,{variant:"danger",onClick:a,children:e.jsx("i",{className:"fa fa-times"})})]}),headerMode:d})}function rt(n){const{hardware:t,options:o={}}=n,s=je(t.properties.state,t.user_tags);function r(a){if(a===null)return"∅";const c=o.precision??t.properties.display_digits??void 0;return c!==void 0?a.toFixed(c):`${a}`}return e.jsxs(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:[e.jsx("div",{className:q.default({"hw-moving":s.MOVING}),children:r(t.properties.position)}),t.properties.unit&&e.jsx("div",{className:"ms-auto",children:e.jsx("small",{children:e.jsx("small",{children:t.properties.unit})})})]})}function _n(n){const{hardware:t}=n,o=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),s=e.jsx(we,{hardware:t}),r=n.options?n.options.header:"top";return r==="none"?e.jsx(rt,{...n}):e.jsx(_,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:e.jsx(rt,{...n}),headerMode:r})}const A={background:"hsl(0 0% 98%)",backgroundD10:"hsl(0 0% 88%)",disabled0:"hsl(0, 0%, 93%)",disabledD10:"hsl(0, 0%, 83%)",danger:"rgb(220, 53, 69)",edited:"hsl(45, 100%, 71.4%)",transient:"#4285eb",text:"black",textD10:"black"},Bc={up:0,right:-90,down:180,left:90};function Sn(n){const{size:t,value:o=null,target:s=null,min:r=null,max:a=null,disabled:c=!1,readOnly:l=!1,origin:u="up",direction:f="clockwise",onChange:d=z=>{},onInteractiveChange:p=null,className:m}=n,[h,w]=g.useState(null);function x(){w(null)}function j(z){w(z),p&&p(z)}const y=8,S=5,$=12,b=t*.5,v=b-S-y,C=4,I=v-$-C/2,M=!c&&!l,k=5,O=h!==null?h:s;function Y(z){return z.mouseRadius<v/3?{readOnly:!0}:z.ctrlKey?{steps:8}:b-y-S<=z.mouseRadius&&z.mouseRadius<=b+S?{steps:8}:{}}function te(){if(o===null||r===null||a===null)return null;const z=a-r;return z>=360?null:[(a-360)/360,(a-360+360-z)/360]}const K=te(),vs=f==="clockwise"?360:-360,Ns=Bc[u]+(f==="clockwise"?0:360);return e.jsxs(E.Knob,{size:t,value:o,angleOffset:Ns,angleRange:vs,min:0,max:360,multiRotation:!0,onChange:d,onInteractiveChange:j,interactiveHook:Y,onEnd:x,readOnly:!M,tracking:!1,useMouseWheel:!1,className:m,children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"knob-shadow",cx:t/2,cy:t/2,fx:t*.75,fy:t*.75,r:v+k,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:v/(v+k),stopColor:A.backgroundD10,stopOpacity:"0.1"}),e.jsx("stop",{offset:1,stopColor:A.backgroundD10,stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"knob-enabled",x1:0,y1:t/2-v,x2:0,y2:t/2+v,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0%",stopColor:A.backgroundD10}),e.jsx("stop",{offset:"30%",stopColor:A.background}),e.jsx("stop",{offset:"70%",stopColor:A.background}),e.jsx("stop",{offset:"100%",stopColor:A.backgroundD10})]}),e.jsxs("linearGradient",{id:"knob-disabled",x1:0,y1:t/2-v,x2:0,y2:t/2+v,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0%",stopColor:A.disabledD10}),e.jsx("stop",{offset:"30%",stopColor:A.disabled0}),e.jsx("stop",{offset:"70%",stopColor:A.disabled0}),e.jsx("stop",{offset:"100%",stopColor:A.disabledD10})]})]}),e.jsx("circle",{r:v+k,cx:t/2,cy:t/2,fill:"url(#knob-shadow)"}),e.jsx("circle",{r:v,cx:t/2,cy:t/2,fill:M?"url(#knob-enabled)":"url(#knob-disabled)"}),K&&e.jsx(E.Range,{percentageFrom:K[0],percentageTo:K[1],radius:b,color:A.danger,arcWidth:y}),e.jsx(E.Scale,{steps:8,tickWidth:2,tickHeight:y,radius:b,color:A.textD10}),e.jsx(E.Scale,{steps:32,tickWidth:1,tickHeight:y/2,radius:b,color:A.textD10}),e.jsx(E.Label,{percentage:.1,radius:b+6,label:"+",style:{fontSize:"80%",fontWeight:"bold"}}),e.jsx(E.Label,{percentage:-.1,radius:b+6,label:"-",style:{fontSize:"80%",fontWeight:"bold"}}),O!==null&&o!==null&&e.jsx(E.Range,{percentageFrom:o/360,percentageTo:O/360,radius:I+C*1.5,color:h!==null?A.edited:A.transient,arcWidth:C}),O!==null&&e.jsx(E.Pointer,{percentage:O/360,width:C,height:C,radius:I,type:"circle",color:h!==null?A.edited:A.transient}),e.jsx(E.Pointer,{percentage:0,width:2.5,height:y,radius:b-y*1.5,type:"circle",color:A.text}),o!==null&&e.jsx(E.Pointer,{percentage:o/360,width:C,height:C,radius:I,type:"circle",color:A.text}),e.jsx(E.Value,{value:h!==null?h:o,decimalPlace:1,marginBottom:t/2,className:"knob-text"})]})}function Cn(n){const{hardware:t,options:o={}}=n,s=Os.useDebouncedCallback(m=>{t.actions.call("move",m)},[t.actions],100),r=je(t.properties.state,t.user_tags),a=r.MOVING?t.properties.target:void 0,c=Dn(t,o),l=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor-r",online:t.online}),u=Tn(t),f=e.jsx(we,{hardware:t}),d=e.jsx(Sn,{className:"mx-auto my-auto",size:100,value:t.properties.position,min:u[0],max:u[1],target:a,onChange:s,disabled:n.disabled,readOnly:o.readOnly||!r.READY,origin:"down",direction:c?"clockwise":"anticlockwise"}),p=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:l,widgetState:f,widgetContent:d,headerMode:p})}function Gc(n,t){return n?t.FAULT?"danger":t.MOVING?"transient":"secondary":"secondary"}function $n(n){const{hardware:t,options:o={}}=n,{online:s=!1,properties:r={}}=t,{state:a,position:c,unit:l=null,display_digits:u}=r,f=je(a,[]),d=o.name??t.alias??t.name??t.id,p=Gc(s,f);function m(){let w="";return c!==void 0&&(c===null?w="null":Number.isFinite(c)?w+=c.toFixed(u??2):w=`${c}`),l!==null&&l!==""&&(w=`${w} ${l}`),w}const h=m();return e.jsxs(X,{children:[e.jsx("h1",{children:d}),e.jsx(i.Badge,{bg:p,children:h})]})}const Lc=["move","stop","wait","rmove"],Hc="omega",Uc="omega 123",Vc=!0,qc={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Wc="bliss",zc=!1,Yc="motor",Kc=[],Qc={callables:Lc,id:Hc,name:Uc,online:Vc,properties:qc,protocol:Wc,require_staff:zc,type:Yc,user_tags:Kc},Xc=["move","stop","wait","rmove"],Zc="omega",Jc="omega 123",el=!0,tl={offset:0,sign:1,acceleration:300,limits:[-10,190],position:100,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3},nl="bliss",ol=!1,sl="motor",rl=[],il={callables:Xc,id:Zc,name:Jc,online:el,properties:tl,protocol:nl,require_staff:ol,type:sl,user_tags:rl},al=["move","wait","stop","rmove"],cl="omega",ll="omega 123",dl=!0,ul={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["UNKNOWN"],target:null,tolerance:1e-4,unit:"deg",velocity:null},fl="bliss",pl=!1,ml="motor",hl=[],gl={callables:al,id:cl,name:ll,online:dl,properties:ul,protocol:fl,require_staff:pl,type:ml,user_tags:hl},xl=["move","wait","stop","rmove"],wl="omega",jl="omega 123",yl=!0,vl={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:[],target:null,tolerance:1e-4,unit:"deg",velocity:null},Nl="bliss",bl=!1,_l="motor",Sl=[],Cl={callables:xl,id:wl,name:jl,online:yl,properties:vl,protocol:Nl,require_staff:bl,type:_l,user_tags:Sl},$l=["move","wait","stop","rmove"],Ol="omega",Il="omega 123",Ml=!1,Dl={},Tl="bliss",Fl=!1,Rl="motor",Al=[],El={callables:$l,id:Ol,name:Il,online:Ml,properties:Dl,protocol:Tl,require_staff:Fl,type:Rl,user_tags:Al},kl=["move","wait","stop","rmove"],Pl="omega",Bl="omega 123",Gl=!0,Ll={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["OFF"],target:null,tolerance:1e-4,unit:"deg",velocity:null},Hl="bliss",Ul=!1,Vl="motor",ql=[],Wl={callables:kl,id:Pl,name:Bl,online:Gl,properties:Ll,protocol:Hl,require_staff:Ul,type:Vl,user_tags:ql},On={default:Qc,halfMotor:il,unknownMotor:gl,notReadyMotor:Cl,disconnectedMotor:El,powerOffMotor:Wl};function In(n){const{name:t="omega",minLimit:o=-999999999,maxLimit:s=999999999,initialPosition:r=0,initialVelocity:a=1e3,useHardwareContext:c=()=>null}=n,[l,u]=g.useState(r),[f,d]=g.useState(["READY"]),[p,m]=g.useState(null),h=g.useRef(Date.now()),w=c(),x=()=>{const v=Date.now(),C=(v-h.current)/1e3;let I;if(h.current=v,p!==null&&p!==l){let M,k;const O=C*a;if(O>Math.abs(l-p))I=p,M=["READY"],k=null;else{const Y=p>l?1:-1;I=l+Y*O,M=["MOVING"],k=p}u(I),d(M),m(k)}},j=g.useCallback((v,C)=>{if(v==="stop")return m(null),d(["READY"]),Promise.resolve();if(v==="move"){const I=Number.parseFloat(C);return m(Number.isNaN(I)?null:I),Promise.resolve()}return console.log("MotorSimulator: Unsupported call",v,C),Promise.resolve()},[]),y=g.useCallback((v,C)=>(console.log("MotorSimulator: Unsupported setProperty",v,C),Promise.resolve()),[]);g.useEffect(()=>{const v=setInterval(()=>{x()},500);return()=>clearInterval(v)});const S=g.useMemo(()=>{var C,I;const v={setProperty:y,call:j};return(I=w==null?void 0:(C=w.actions).updateHardwareChangeActions)==null||I.call(C,t,v),v},[]),$={id:t,name:t,alias:null,online:!0,properties:{acceleration:300,limits:[o,s],position:l,offset:0,sign:1,state:f,tolerance:1e-4,unit:"mm",velocity:a,target:p,display_digits:3},type:"motor",actions:S,user_tags:[],locked:null},b=g.useRef(null);return g.useEffect(()=>{b.current!==null&&P.isEqual(b.current,$)||(b.current=$,w==null||w.actions.updateHardware(t,$))},[t,$]),e.jsx(e.Fragment,{})}function je(n,t=[]){return g.useMemo(()=>{const o=t.includes("auto_ready"),s=t.includes("auto_on");if(n===void 0)return{UNKNOWN:!0};if((n==null?void 0:n.length)===0)return o?{READY:!0}:{NOT_READY:!0};const r=n.reduce((a,c)=>(a[c]=!0,a),{});return r.READY===void 0&&s&&r.OFF&&(r.READY=!0),r},[n,t])}function Mn(n){return n.type==="motor"}function U(n){const t=G(n);return t===null||!Mn(t)?null:t}const zl={default:ce,text:_n,rotation:Cn,state:kc,monitor:$n};function Dn(n,t){if((t==null?void 0:t.clockwise)!==void 0)return t.clockwise;const o=n.properties.sign<0,s=n.user_tags.includes("dial.anticlockwise"),r=n.user_tags.includes("dial.clockwise");return r&&s&&console.error("Both tags 'dial.clockwise' and 'dial.anticlockwise' are defined"),(r||!s)!==o}function Tn(n){var r;const t=(r=n.properties)==null?void 0:r.limits;if(t==null)return[void 0,void 0];const[o,s]=t;return[Number.isFinite(o)?o:void 0,Number.isFinite(s)?s:void 0]}const Fn={variants:zl,mocks:On,simulator:In,monitor:$n};function Yl(n,t){return{id:n,name:n,type:"motor",properties:{position:t,unit:"mm",limits:[-100,100]},online:!0}}function Ve(n){var l;const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":(l=t.properties)==null?void 0:l.state)||"UNKNOWN":"OFFLINE",c={OFFLINE:"secondary",READY:"success",MOVING:"transient",ERROR:"danger",UNKNOWN:"fatal",LOCKED:"warning"}[r]||"success";return e.jsx(i.Badge,{bg:c,children:r})}function Rn(n){const{hardware:t,options:o={}}=n,s=g.useRef(null);g.useEffect(()=>{if(!s.current){console.error("selectionRef ref is unset");return}s.current.value=t.properties.position??""},[t.properties.position]);function r(l){if(console.debug("change",l),!s||!s.current){console.error("selection ref is unset");return}t.actions.call("move",s.current.value)}function a(l){t.actions.call("stop")}const c=P.map(t.properties.positions,l=>e.jsx("option",{title:l.description,children:l.position},l.position));return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(Ve,{hardware:t})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsxs(i.Form.Control,{className:"custom-select",as:"select",ref:s,disabled:n.disabled,defaultValue:t.properties.position??"",children:[e.jsx("option",{disabled:!0,children:"unknown"}),c]}),t.properties.state!=="MOVING"&&e.jsx(i.Button,{onClick:r,disabled:n.disabled,children:"Move"}),t.properties.state==="MOVING"&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:a,children:e.jsx("i",{className:"fa fa-times"})})]})})]})}const An=g.forwardRef(({title:n,children:t,bsPrefix:o,rootCloseEvent:s,variant:r,size:a,menuRole:c,renderMenuOnMount:l,disabled:u,href:f,id:d,menuVariant:p,flip:m,style:h,className:w,popperConfig:x,...j},y)=>e.jsxs(i.Dropdown,{ref:y,...j,children:[e.jsx(i.DropdownToggle,{id:d,href:f,size:a,variant:r,disabled:u,childBsPrefix:o,style:h,className:w,children:n}),e.jsx(i.DropdownMenu,{popperConfig:x,role:c,renderOnMount:l,rootCloseEvent:s,variant:p,flip:m,children:t})]}));An.displayName="DropdownButton2";const Kl=An;function Ql(n){const{currentPositionId:t,position:o,disabled:s,onSelect:r,filter:a}=n,c=o.position,l=c===t,u=l?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return g.useMemo(()=>{var p,m;if(a==="")return!0;const d=a.toLowerCase();return((p=o.position)==null?void 0:p.toLowerCase().includes(d))||((m=o.description)==null?void 0:m.toLowerCase().includes(d))},[a,o])?e.jsxs(i.Dropdown.Item,{disabled:s,onClick:()=>{r(c)},title:o.description,children:[e.jsxs(i.Row,{className:"gx-0 nowrap",children:[e.jsx(i.Col,{sm:"2",children:e.jsx("i",{className:u})}),e.jsx(i.Col,{sm:"10",children:e.jsx(i.Badge,{className:"small",bg:l?"primary":"secondary",children:e.jsx("span",{className:"secondary",children:e.jsx("span",{className:"text-truncate w-50",children:c})})})})]}),e.jsxs(i.Row,{className:"gx-0 nowrap",children:[e.jsx(i.Col,{sm:"2"}),e.jsx(i.Col,{sm:"10",children:e.jsx(i.Row,{className:"gx-0",children:e.jsx(i.Col,{sm:"12",className:"text-truncate text-start",children:o.description})})})]})]},o.position):e.jsx(e.Fragment,{})}function Xl(n,t){if(n===null)return null;for(const o of t)if(n===o.position)return o;return null}function Zl(n){const{positionId:t,targetPositionId:o,hardware:s}=n,{properties:r={}}=s,{positions:a=[]}=r;function c(){return o?e.jsx(i.Badge,{bg:"transient",children:o}):t?e.jsx(i.Badge,{children:t}):e.jsx(i.Badge,{bg:"warning",children:"unknown"})}const l=c(),u=g.useMemo(()=>{if(o)return"Moving...";const f=Xl(t,a);return f===null?"Position not described":f.description??""},[o,t,a]);return e.jsxs(e.Fragment,{children:[l,e.jsx("div",{className:"text-truncate text-start ms-2 flex-grow-1 flex-shrink-1",title:u,style:{flex:"1 1 0",minWidth:0},children:u})]})}function En(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,r=s.state==="READY",a=(s==null?void 0:s.state)==="MOVING",c=n.disabled||!t.online||!r;function l(S){t.actions.call("move",S)}function u(S){t.actions.call("stop")}const f=e.jsx(N,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),d=e.jsx(Ve,{hardware:t}),p=a?"moving":null;function m(){var $;const S=(($=t.properties)==null?void 0:$.position)??null;return S==="unknown"?null:S}const h=m(),[w,x]=g.useState("");function j(){return e.jsxs(i.InputGroup,{className:"flex-nowrap",style:{alignItems:"stretch"},children:[e.jsxs(Kl,{variant:"secondary",title:e.jsx(Zl,{positionId:h,targetPositionId:p,hardware:t}),disabled:c,popperConfig:{strategy:"fixed"},className:"flex-grow-1 d-flex flex-nowrap align-items-center",style:{flex:"1 1 0",minWidth:0},children:[o.search&&e.jsxs(i.Container,{className:"d-flex justify-content-center align-items-center",children:[e.jsx("i",{className:"fa fa-search fa-fw flex-shrink"}),e.jsx(i.Form.Control,{autoFocus:!0,className:"mx-1 my-2 w-50",style:{marginLeft:"auto",marginRight:"auto"},placeholder:"Type to filter...",onChange:S=>x(S.target.value),value:w}),e.jsx(i.CloseButton,{disabled:w==="",onClick:()=>{x("")}})]}),s.positions.map(S=>e.jsx(Ql,{currentPositionId:h,position:S,onSelect:$=>{l($)},disabled:c,filter:w})),o.search&&w!==""&&e.jsxs(e.Fragment,{children:[e.jsx(i.Dropdown.Divider,{}),e.jsx(i.Dropdown.Item,{onClick:S=>{x(""),S.stopPropagation()},children:"Display all the positions..."})]})]}),a&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:u,children:e.jsx("i",{className:"fa fa-fw fa-times"})})]})}const y=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:f,widgetState:d,widgetContent:j(),headerMode:y})}const Jl=["move","stop"],ed="beamstop",td="beamstop",nd=!0,od={position:"OUT",positions:[{description:"Beamstop position IN the beam",position:"IN",target:[{destination:2.5,tolerance:.01},{destination:1,tolerance:.2}]},{description:"Beamstop position OUT of the beam",position:"OUT",target:[{destination:3.5,tolerance:.01},{destination:2,tolerance:.2}]}],state:"READY"},sd="bliss",rd=!1,id="multiposition",ad={callables:Jl,id:ed,name:td,online:nd,properties:od,protocol:sd,require_staff:rd,type:id},kn={default:ad};function Pn(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("empty"),[c,l]=g.useState("READY");async function u(p,m){if(p==="move"){l("MOVING"),a("unknown"),await L(2e3),l("READY"),a(m);return}if(p==="stop"){a("unknown"),await L(2e3);return}console.log("MultipositionSimulator: Unsupported call",p,m)}async function f(p,m){console.log("MultipositionSimulator: Unsupported setProperty",p,m)}const d={position:r,state:c,positions:[{position:"empty",description:"No filter",target:[]},{position:"gold2",description:"Gold filter 2mm",target:[]},{position:"silver3",description:"Silver filter 3mm",target:[]}]};return e.jsx(V,{name:t,alias:o,type:"multiposition",call:u,setProperty:f,properties:d,useHardwareContext:s})}const cd={state:Ve,default:Rn,default2:En},Bn={variants:cd,mocks:kn,simulator:Pn};function qe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOVING:"transient",INVALID:"danger",UNKNOWN:"danger",DISABLED:"secondary",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function ld(n){const{hardware:t}=n;return e.jsx(qe,{hardware:t})}function dd(n){const{hardware:t,options:o={}}=n,{properties:s}=t,{state:r}=s,a=r==="MOVING",c=r==="READY",l=a?s.target_magnification||0:s.magnification||0,f=[...s.available_magnifications??[]];f.sort((w,x)=>w>x?1:x>w?-1:0);const d=n.disabled||!t.online||!c,p=o.digits||2;function m(w){t.actions?t.actions.call("move",w):console.error("Change request was triggered with:",w)}function h(w,x){const y=l===x?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:d,onClick:()=>{m(x)},children:[e.jsx("i",{className:y})," × ",x]},`id${w}`)}return e.jsxs(e.Fragment,{children:[e.jsx(B,{value:l.toFixed(p),className:q.default({"hw-moving":a})}),e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:!c,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:f.map((w,x)=>h(x,w))})]})]})}function ud(n){const{hardware:t,options:o={}}=n,s=t.properties.magnification||0,r=o.digits||2,a=!!o.allowtuning;return e.jsxs(e.Fragment,{children:[e.jsx(B,{value:s.toFixed(r)}),a&&e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"×"}),e.jsx(Gn,{...n})]})})]})]})}function Gn(n){const{hardware:t,options:o={}}=n,s=t.properties.magnification||0,{state:r}=t.properties,a=r==="READY",c=n.disabled||!t.online||!a,[l,u]=t.properties.magnification_range||[null,null],f=g.useRef(null),d=g.useRef(null),[p,m]=g.useState(!1),h=o.digits||2;function w(b){t.actions?n.mode==="move"?t.actions.call("move",b):t.actions.setProperty("magnification",b):console.error("Change request was triggered with:",b)}function x(b){if(!f||!f.current){console.log("formRef not yet defined");return}if(b.key==="Enter"){m(!1);const{value:v}=f.current,C=Number.parseFloat(v);if(l!==null&&C<l||u!==null&&C>u)return;w(C)}else b.key==="Escape"?(f.current.value=s.toFixed(h),d.current&&(d.current.value=s.toString()),m(!1)):console.log(b.key)}function j(b){b!==s&&!p&&m(!0),b===s&&p&&m(!1)}function y(b){if(!f||!f.current){console.error("formRef is not set");return}const v=Number.parseFloat(f.current.value);j(v),d.current&&(d.current.value=v.toString())}function S(b){if(!f||!f.current){console.error("formRef is not set");return}if(!d||!d.current){console.error("rangeRef is not set");return}const v=Number.parseFloat(d.current.value);j(v),f.current.value=v.toFixed(h)}function $(){if(!d||!d.current){console.error("rangeRef is not set");return}const b=Number.parseFloat(d.current.value);w(b)}return g.useEffect(()=>{if(!f||!f.current){console.error("formRef is not set");return}p||(f.current.value=s.toFixed(h)),d.current&&(d.current.value=s.toString())},[h,p,s]),e.jsxs(e.Fragment,{children:[e.jsx(i.Form.Control,{className:p?"form-control-edited":"",type:"number",ref:f,defaultValue:s.toFixed(h),onChange:y,disabled:c,step:10**-h,onKeyDown:x}),l!==null&&u!==null&&e.jsx(i.Form.Control,{ref:d,disabled:c,type:"range",min:l,max:u,step:10**-h,onChange:S,onMouseUp:$,defaultValue:s})]})}function fd(n){const{hardware:t,options:o={}}=n,{properties:s}=t,r=s.state==="MOVING",a=s.state==="READY",c=r?s.target_magnification||0:s.magnification||0,l=n.options.digits||2;return e.jsxs(e.Fragment,{children:[e.jsx(B,{value:c.toFixed(l),className:q.default({"hw-moving":r})}),e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:!a,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"×"}),e.jsx(Gn,{...n,mode:"move"})]})})]})]})}function pd(n){return e.jsx(i.Form.Control,{className:"border-light",type:"text",disabled:!0,defaultValue:"Missing"})}function Ln(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fam-hardware-optic",online:t.online}),r=e.jsx(qe,{hardware:t});function a(){function l(){return t.online?t.properties.available_magnifications?dd:t.properties.magnification_range?fd:ud:pd}const u=l();return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{className:"border-light",children:"×"}),e.jsx(u,{...n})]})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const md=["magnification","reset","open"],hd="optic",gd="optic",xd=!0,wd={state:"READY",magnification:10,target_magnification:null,available_magnifications:[5,7.5,10],magnification_range:null},jd="bliss",yd=!1,vd="optic",Ce={callables:md,id:hd,name:gd,online:xd,properties:wd,protocol:jd,require_staff:yd,type:vd},Hn={default:Ce,fixed:Ce,off:Ce,range:Ce};function Un(n){const{name:t,alias:o,kind:s,useHardwareContext:r}=n;function a(){return s==="fixed"?{available_magnifications:null,magnification_range:null}:s==="range"?{available_magnifications:null,magnification_range:[5,10]}:s==="multi"?{available_magnifications:[5,7.5,10],magnification_range:null}:{available_magnifications:null,magnification_range:null}}const[c,l]=g.useState({state:"READY",magnification:10,target_magnification:null,...a()});async function u(p){let m=c.magnification;l(x=>({...x,state:"MOVING",target_magnification:p})),await L(100);const h=.2*(m<p?1:-1);function w(x){l(j=>({...j,magnification:x}))}for(;Math.abs(p-m)>=Math.abs(h)*1.01;)m+=h,w(m),await L(100);l(x=>({...x,state:"READY",magnification:p,target_magnification:null}))}async function f(p,m){if(p==="move"){await u(m);return}console.log("OpticSimulator: Unsupported call",p,m)}async function d(p,m){if(p==="magnification"){l(h=>({...h,magnifications:m}));return}console.log("OpticSimulator: Unsupported setProperty",p,m)}return e.jsx(V,{name:t,alias:o,type:"optic",call:f,setProperty:d,properties:c,useHardwareContext:r})}function Nd(n){return n.type==="optic"}const bd={default:Ln,state:ld},Vn={variants:bd,mocks:Hn,simulator:Un};function ye(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={STANDBY:"success",DISABLED:"secondary",OFFLINE:"secondary",RUNNING:"transient",ABORTING:"warning",AWAITING_USER_INPUT:"warning",UNKNOWN:"fatal"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function _d(n){const{hardware:t}=n;return e.jsx(ye,{hardware:t})}function qn(n){const{hardware:t,options:o}=n,s=n.disabled||!t.online,r=t.properties.state==="AWAITING_USER_INPUT",a=t.properties.state==="ABORTING",c=t.properties.state==="RUNNING"||r||a;function l(f){o.foreground?t.actions.call("run_foreground"):t.actions.call("start")}function u(f){t.actions.call("abort")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"w-100",children:[e.jsx(i.Button,{onClick:l,disabled:s||c,variant:"primary",children:"Start"}),e.jsx(i.Button,{onClick:u,disabled:s||!c,variant:"primary",children:"Abort"})]})}function Be(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ye,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(qn,{hardware:t,disabled:!n.operator,options:o})}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Sd(n){const{hardware:t}=n,o=t.properties.state==="AWAITING_USER_INPUT",s=t.properties.state==="ABORTING",r=t.properties.state==="RUNNING";return s?e.jsxs(i.Badge,{bg:"warning",children:[e.jsx("i",{className:"fa-solid fa-heart-crack fa-beat"})," ABORTING"]}):r?e.jsxs(i.Badge,{bg:"info",children:[e.jsx("i",{className:"fa-solid fa-heart fa-beat"})," RUNNING"]}):o?e.jsxs(i.Badge,{bg:"warning",title:"A user input is expected",children:[e.jsx("i",{className:"fa-solid fa-user fa-beat"})," AWAITING INPUT"]}):e.jsx(Wn,{hardware:t})}function Wn(n){const{hardware:t}=n,{previous_run_state:o,previous_run_exception:s}=t.properties,r={NONE:["secondary",null],ABORTED:["warning","fa-heart-crack"],FAILED:["danger",null],SUCCESSED:["success",null],UNKNOWN:["danger",null]},a=r[o]||r.UNKNOWN,[c,l]=a;return e.jsxs(i.Badge,{bg:c,title:s??void 0,children:[l&&e.jsxs(e.Fragment,{children:[e.jsx("i",{className:`fa-solid ${l}`})," "]}),o]})}function zn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ye,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx("div",{children:e.jsx("h3",{children:e.jsx(Sd,{hardware:t})})})}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Cd(n){const{hardware:t}=n,o=n.disabled||!t.online,s=t.properties.state==="AWAITING_USER_INPUT";function r(a){t.actions.call("validate")}return e.jsx(i.ButtonGroup,{size:"lg",className:"w-100",children:e.jsx(i.Button,{onClick:r,disabled:o||!s,variant:"primary",children:"Validate"})})}function Yn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ye,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(Cd,{hardware:t,disabled:!n.operator})}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const $d=["start","abort","clear","validate"],Od="procedure",Id="procedure",Md="procedure",Dd="bliss",Td=!1,Fd=!0,Rd={state:"STANDBY",previous_run_state:"NONE",previous_run_exception:null,parameters:{my_number:10,my_string:"foo",my_null:null,my_boolean:!0,my_dict:{a:10,b:"10",c:!0},my_list:[10,"10",!0],"my_scan_1.11":{__type__:"scan",node:"demo_session:tmp:scans:inhouse:id002405:sample:sample_0002:_1_flat images 1",mmh3:3852826388},"my_scan_2.0":{__type__:"scan",key:"esrf:scan:01J1QDB370S2V8WF7FX2Y9H29V",mmh3:3852826389},my_quantity:{__type__:"quantity",scalar:20,unit:"mm"},my_nan:{__type__:"nan"},my_posinf:{__type__:"posinf"},my_neginf:{__type__:"neginf"},my_obj:{__type__:"hardware",name:"roby"}}},Ad={callables:$d,type:Od,id:Id,name:Md,protocol:Dd,require_staff:Td,online:Fd,properties:Rd},Kn={standby:Ad},Ed={default:Be,manage:Be,execution:zn,validate:Yn,state:_d},Qn={variants:Ed,mocks:Kn};function Xn(n){return n.type==="procedure"}function kd(n){const t=G(n);return t===null||!Xn(t)?null:t}function Zn(n){return n==="OFF"?"danger":n==="READY"?"success":n==="MOVING"?"transient":"warning"}function it({tooltip:n,children:t}){return e.jsx(i.OverlayTrigger,{placement:"top",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:n}),children:t})}function Jn(n){var p,m;const{hardware:t,options:o={}}=n,{showOutput:s=!0,step:r,steps:a}=o;function c(h){return t.actions.call(h)}function l(h){return t.actions.setProperty("setpoint",h)}const u=t.properties.state,f=e.jsx(N,{name:"RegulationLoop",icon:"fa-repeat",online:t.online}),d=e.jsxs(e.Fragment,{children:[e.jsx(D,{state:u,minWidth:6,variant:Zn(u)}),!t.properties.is_softloop&&e.jsx(it,{tooltip:"Start/Stop Monitor",children:e.jsx(i.Button,{size:"sm",variant:t.properties.is_monitoring?"success":"warning",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>{c(t.properties.is_monitoring?"stop_monitor":"start_monitor")},children:e.jsx("i",{className:t.properties.is_monitoring?"fa fa-toggle-on":"fa fa-toggle-off"})})}),e.jsx(it,{tooltip:"Stop Ramping",children:e.jsx(i.Button,{disabled:t.properties.state==="OFF",size:"sm",variant:"danger",className:"ms-1",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>{c("stop_ramping")},children:e.jsx("i",{className:"fa fa-circle-exclamation"})})})]});return e.jsx(_,{hardware:t,widgetIcon:f,widgetState:d,widgetContent:e.jsxs(e.Fragment,{children:[e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(ge,{id:t.id,hardwareValue:t.properties.setpoint??null,hardwareIsDisabled:!1,hardwareIsMoving:!1,hardwareIsReady:!0,onMoveRequested:l,onAbortRequested:()=>null,precision:1,readOnly:!1,step:r,steps:a,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),t.properties.input_unit&&e.jsx(i.InputGroup.Text,{children:t.properties.input_unit})]}),e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"I"}),e.jsx(i.Form.Control,{type:"number",disabled:!0,value:(p=t.properties.input_value)==null?void 0:p.toFixed(2)}),t.properties.input_unit&&e.jsx(i.InputGroup.Text,{children:n.hardware.properties.input_unit}),s&&e.jsxs(e.Fragment,{children:[e.jsx(i.InputGroup.Text,{children:"O"}),e.jsx(i.Form.Control,{type:"number",disabled:!0,value:(m=t.properties.output_value)==null?void 0:m.toFixed(2)}),t.properties.output_unit&&e.jsx(i.InputGroup.Text,{children:n.hardware.properties.output_unit})]})]})]})})}function eo(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r}=s,a=o.name??t.alias??t.name,c=Zn(r);let l=t.properties.input_value;return Number.isFinite(l)&&(l=l.toFixed(2)),e.jsxs(X,{children:[e.jsx("h1",{children:a}),e.jsxs(i.Badge,{bg:c,children:[l," ",t.properties.input_unit]})]})}function Pd({curves:n}){const t=n[0].x??[],o=H.useValueToIndexScale(t,!0),{abscissaConfig:s}=H.useVisCanvasContext();return e.jsx(H.TooltipMesh,{guides:"both",renderTooltip:r=>{const a=o(r);return e.jsxs("div",{className:"h5web-tooltip",children:[s.label||"x","=",t[a],n.map(c=>e.jsxs("div",{children:[e.jsx("span",{style:{content:"",display:"inline-block",width:"0.75em",height:"0.375rem",marginRight:"0.375rem",paddingBottom:"0.125rem",backgroundColor:c.color,transform:"translateY(-1px)"},"data-keep-colors":!0}),e.jsxs("strong",{children:[c.name,":"]})," ",c.y[a].toFixed(2)]},c.name))]})}})}const at=["#1f77b4","#ff7f0e","#d62728","#2ca02c"],ct=[.1,1],lt=6;function dt(n){const{data:t,xAxisTitle:o,yAxisTitle:s,title:r}=n,a=t.flatMap((u,f)=>{const d=u.x;let p=u.y;return d.length<p.length&&(p=p.slice(0,d.length)),[{color:u.color??at[f%at.length],name:u.name,x:[...H.getAxisValues(d,p.length)],y:p}]}),c=H.useCombinedDomain(H.useDomains(a.map(u=>u.x)))||ct,l=H.useCombinedDomain(H.useDomains(a.map(u=>u.y)))||ct;return e.jsxs(H.VisCanvas,{title:r,abscissaConfig:{visDomain:c,showGrid:!0,label:o},ordinateConfig:{visDomain:l,showGrid:!0,label:s},raycasterThreshold:lt,children:[a.map(u=>e.jsx(H.DataCurve,{abscissas:u.x,ordinates:u.y,color:u.color,glyphSize:lt,glyphType:H.GlyphType.Circle},u.name)),e.jsx(H.Zoom,{}),e.jsx(H.Pan,{}),e.jsx(Pd,{curves:a})]})}const $e=100;function Oe(n,t){const[o,s]=g.useState(new Array(n).fill(null)),r=g.useRef(0);function a(l){s(u=>{const f=[...u];return r.current===n-1?(f.shift(),f.push(l)):(f[r.current]=l,r.current=(r.current+1)%n),f})}function c(){return o.filter(l=>l!==null)}return{read:c,write:a,name:t}}function We(n){const{hardware:t,options:o}=n,{showOutput:s=!0,plotHeight:r,plotWidth:a}=o,c=Oe($e,"Time"),l=Oe($e,"Input"),u=Oe($e,"Output"),f=Oe($e,"Setpoint");g.useEffect(()=>{c.write(Date.now()),l.write(t.properties.input_value),u.write(t.properties.output_value),f.write(t.properties.setpoint)},[t.properties]);const d=Date.now(),p=c.read().map(j=>-(d-j)/1e3),m=[l,f].map(j=>({name:j.name,x:p,y:j.read()})),h=[u].map(j=>({name:j.name,x:p,y:j.read()})),w={x:p,y:p.map(()=>t.properties.setpoint+(t.properties.deadband??0)),name:"Deadband+",color:"green"},x={x:p,y:p.map(()=>t.properties.setpoint-(t.properties.deadband??0)),name:"Deadband-",color:"green"};return e.jsx(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"vertical",children:e.jsxs("div",{className:"h5web-plot",style:{display:"flex",height:r??"20rem",width:a},children:[e.jsx(dt,{data:[...m,w,x],title:"Input",xAxisTitle:"Time (s)",yAxisTitle:t.properties.input_unit}),s&&e.jsx(dt,{data:h,title:"Output",xAxisTitle:"Time (s)",yAxisTitle:t.properties.output_unit})]})})}function Bd(n){const{hardware:t,options:o}=n,{showOutput:s=!0,popupPlacement:r="right",plotWidth:a}=o,c=e.jsxs(i.Popover,{id:`regulation-plot-${t.name}`,style:{maxWidth:a??s?300*2:276},children:[e.jsxs(i.Popover.Header,{as:"h3",children:["Regulation Plot for `",n.hardware.name,"`"]}),e.jsx(i.Popover.Body,{children:e.jsx(We,{...n})})]});return e.jsx(i.OverlayTrigger,{trigger:"click",placement:r,overlay:c,children:e.jsx(i.Button,{children:o.buttonTitle??"Plot"})})}const Gd=null,Ld=[],Hd=null,Ud="regulation",Vd=!0,qd={deadband:.05,input_unit:"degC",input_value:10.029739616019928,is_monitoring:!1,output_unit:"Volt",output_value:8.556047391201504,setpoint:10,state:"READY"},Wd="regulation",zd=[],Yd={alias:Gd,errors:Ld,locked:Hd,name:Ud,online:Vd,properties:qd,type:Wd,user_tags:zd},to={default:Yd};function no(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("READY"),[c,l]=g.useState(0),[u,f]=g.useState(0),[d,p]=g.useState(10),m=g.useRef(Date.now()),h=()=>{const y=Date.now(),S=(y-m.current)/1e3;let $,b;if(m.current=y,d!==null&&d!==c){let v;const C=S*2,I=Math.random()*.1-.05;if(C>Math.abs(c-d)+.05)$=d+I,v="READY",b=-I*5;else{const M=d>c?1:-1;$=c+M*C,b=10*M,v="MOVING"}l($),f(b),a(v)}};async function w(y,S){console.log("RegulationSimulator: Unsupported call",y,S)}async function x(y,S){y==="setpoint"&&p(S),console.log("RegulationSimulator: Unsupported setProperty",y,S)}g.useEffect(()=>{const y=setInterval(()=>{h()},500);return()=>clearInterval(y)});const j={state:r,deadband:.05,input_unit:"degC",input_value:c,is_monitoring:!0,output_unit:"Volt",output_value:u,setpoint:d};return e.jsx(V,{name:t,alias:o,type:"regulation",call:w,setProperty:x,properties:j,useHardwareContext:s})}const Kd={default:Jn,plot:We,popupplot:Bd,monitor:eo},oo={variants:Kd,mocks:to,simulator:no,monitor:eo};function ve(n){const{hardware:t}=n;function o(){if(!t.online)return"OFFLINE";const a=t.properties.state;return n.useReadyState&&(a==="OPEN"||a==="CLOSED")?"READY":a}const s=o();function r(){switch(s){case"READY":return"success";case"OPEN":return"success";case"CLOSED":return"danger";case"OFFLINE":case"DISABLED":return"secondary";case"MOVING":return"transient";case"STANDBY":return"warning";case"FAULT":return"fatal";default:return"fatal"}}return e.jsx(D,{state:s,minWidth:6,variant:r()})}function Qd(n){const{hardware:t}=n;return e.jsx(ve,{hardware:t,useReadyState:!0})}function Xd(n){const{hardware:t}=n;function o(){t.actions.call("reset")}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{onClick:o,disabled:n.disabled,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Shutter Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function so(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(ve,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(x){return x==="OPEN"?["Close","close"]:x==="CLOSED"?["Open","open"]:x==="DISABLED"||x==="STANDBY"||x==="FAULT"?["Closed",""]:x==="MOVING"?["...",""]:["Unknown",""]}const l=a(),[u,f]=c(l),p={OPEN:"danger",CLOSED:"success",MOVING:"transient",DISABLED:"secondary",STANDBY:"danger",FAULT:"fatal",UNKNOWN:"warning"}[l]||"danger";function m(){t.actions.call(f)}const h=e.jsxs(i.ButtonGroup,{className:"d-flex flex-nowrap",children:[e.jsx(i.Button,{variant:p,onClick:m,disabled:n.disabled||f==="",children:u}),o.extended&&e.jsx(Xd,{...n})]}),w=n.options.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:h,headerMode:w})}function Zd(n){var u;const{hardware:t,options:o={}}=n;function s(){t.actions.call("open")}function r(){t.actions.call("close")}const a=((u=t.properties)==null?void 0:u.state)??"UNKNOWN",c=a==="MOVING",l=a==="DISABLED"||c;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:n.disabled||l}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:c?"warning":"secondary",onClick:()=>{s()},disabled:n.disabled||l,title:"Open the shutter",children:"Open"}),e.jsx(i.Button,{variant:c?"warning":"secondary",onClick:()=>{r()},disabled:n.disabled||l,title:"Close the shutter",children:"Close"})]})})})]})})]})}function ro(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(ve,{hardware:t,useReadyState:!0});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(x){return x==="OPEN"||x==="CLOSED"?x:x==="DISABLED"||x==="STANDBY"||x==="FAULT"?"CLOSED":x==="MOVING"?"...":"UNKNOWN"}function l(x){return x.charAt(0).toUpperCase()+x.slice(1).toLowerCase()}const u=a(),f=c(u),p={OPEN:"success",CLOSED:"danger",MOVING:"transient",DISABLED:"secondary",STANDBY:"success",FAULT:"fatal",UNKNOWN:"fatal"}[u],m=l(f),h=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:p,className:"text-center",style:{minWidth:"10em"},value:m}),e.jsx(Zd,{...n})]}),w=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:h,headerMode:w})}function io(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r="OFFLINE",status:a}=s,c=o.name??t.alias??t.name,l=e.jsxs(X,{children:[e.jsx("h1",{children:c}),e.jsx(ve,{hardware:t})]});if(a){const u=`${a}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:u.includes(`
|
|
30
|
+
`},Pi="tango",Bi=!0,Gi="gauge",Li={callables:Fi,id:Ri,name:Ai,online:Ei,properties:ki,protocol:Pi,require_staff:Bi,type:Gi},Kt={default:Ti,default2:Li},Hi={default:Yt},Qt={variants:Hi,mocks:Kt},Ui=g.forwardRef((n,t)=>{const o=g.useRef(null),s=g.useRef(),[r,a]=g.useState(n.step),[c,l]=g.useState(!1),u=O=>{const Y=t;if(o.current===null)return;let te=Number.parseFloat(Y.current.value);if(o.current.value.startsWith("*")){const K=Number.parseFloat(o.current.value.replace("*",""));te=O?te*K:te/K}else{const K=Number.parseFloat(o.current.value);te+=O?K:-K}Y.current.value=`${te}`,n.onStep&&n.onStep({target:Y.current})},{onStep:f,step:d,overlay:p,incIcon:m,decIcon:h,swapIncDec:w,onKeyDown:x,onBlur:j,horizontalArrows:y,largeArrows:S,disabled:$,stepOnly:b,...v}=n,C=O=>{O.key==="ArrowUp"?(O.preventDefault(),l(!0),u(!0)):O.key==="ArrowDown"?(O.preventDefault(),l(!0),u(!1)):x&&x(O)};c&&(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{var O;(O=t==null?void 0:t.current)==null||O.focus()},100)),g.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const I=()=>{s.current&&clearTimeout(s.current),l(!1),j&&j()};if(!n.step)return e.jsx(i.Form.Control,{ref:t,type:"number",step:"any",onKeyDown:C,onBlur:I,disabled:$,onClick:O=>{O.stopPropagation()},...v});const M=P.map(n.steps||[n.step],O=>e.jsx("option",{value:O,children:O},O)),k=m||h;return e.jsx("div",{className:q.default("numeric-step",{"numeric-step-large":S,"numeric-step-horizontal":y}),children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{onKeyDown:C,onBlur:I,ref:t,type:"number",step:"any",disabled:$||b,...v}),e.jsxs(e.Fragment,{children:[p,!p&&e.jsxs(i.InputGroup.Text,{className:`d-flex flex-column ${k?"inc-dec":""}`,children:[e.jsx(i.Form.Control,{ref:o,as:"select",className:"step-size",defaultValue:r,disabled:$,onChange:O=>a(Number.parseFloat(O.target.value)),children:M}),n.unit&&e.jsx("div",{children:n.unit}),!m&&!h&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{className:"step step-up",disabled:n.disabled,onClick:O=>u(!0)}),e.jsx(i.Button,{className:"step step-down",disabled:n.disabled,onClick:O=>u(!1)})]})]}),h&&w&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>u(!1),children:e.jsx("i",{className:`fa fa-fw fa-${h}`})}),m&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>u(!0),children:e.jsx("i",{className:`fa fa-fw fa-${m}`})}),h&&!w&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>u(!1),children:e.jsx("i",{className:`fa fa-fw fa-${h}`})})]})]})})}),Xt=Ui;function ge(n){const t=g.useRef(null),[o,s]=g.useState(!1),[r,a]=g.useState(!1);g.useEffect(()=>{t.current&&(n.hardwareValue===null?t.current.value="":n.precision!==void 0?t.current.value=n.hardwareValue.toFixed(n.precision):t.current.value=n.hardwareValue.toString(),s(!1))},[n.hardwareValue]);function c(p){let m=p;n.precision!==void 0&&(m=Number.parseFloat(m).toFixed(n.precision)),t!=null&&t.current&&(t.current.value=m)}function l(){o&&setTimeout(()=>{c(n.hardwareValue),s(!1)},3e3)}function u(p){n.hardwareValue!==null&&s(p.target.value!==n.hardwareValue.toString())}function f(p){s(!1);const m=n.onMoveRequested(p.target.value);m&&m.catch(()=>{a(!0),setTimeout(()=>{c(n.hardwareValue),a(!1)},2e3)})}function d(p){switch(p.key){case"Enter":{s(!1);const m=Number.parseFloat(p.target.value),h=n.onMoveRequested(m);h&&h.catch(()=>{a(!0),setTimeout(()=>{c(n.hardwareValue),a(!1)},2e3)})}p.preventDefault(),p.stopPropagation();break;case"Esc":case"Escape":o&&(a(!1),s(!1),c(n.hardwareValue)),p.target.blur(),p.preventDefault(),p.stopPropagation();break}}return e.jsx(Xt,{id:n.id,className:q.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:n.readOnly?"text":"number",ref:t,precision:n.precision,onChange:u,onBlur:l,onStep:f,onKeyDown:d,disabled:n.hardwareIsDisabled||n.readOnly||!n.hardwareIsReady,stepOnly:n.stepOnly,step:n.step,steps:n.steps,incIcon:n.incIcon,decIcon:n.decIcon,swapIncDec:n.swapIncDec,horizontalArrows:n.horizontalArrows,largeArrows:n.largeArrows,overlay:n.hardwareIsMoving&&!n.hardwareIsDisabled?e.jsx(i.Button,{variant:"danger",onClick:n.onAbortRequested,children:e.jsx("i",{className:"fa fa-times"})}):null})}function Zt(n){const{hardware:t,options:o={},disabled:s}=n;function r(f){return t.actions.setProperty("power",f)}function a(f){return t.actions.call(f?"on":"off")}const c=t.properties.state,l=e.jsx(N,{name:"Laser",icon:"fam-hardware-laser",online:t.online}),u=e.jsx(D,{state:c,minWidth:6,variant:c==="ON"?"success":"warning"});return e.jsx(_,{hardware:t,widgetIcon:l,widgetState:u,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(ge,{id:t.id,hardwareValue:t.properties.power,hardwareIsDisabled:!1,hardwareIsReady:!0,hardwareIsMoving:c==="MOVING",onMoveRequested:r,onAbortRequested:()=>null,precision:1,readOnly:!1,step:o.step,steps:o.steps,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),e.jsx(i.Button,{size:"sm",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>{a(t.properties.state!=="ON")},children:e.jsx("i",{className:t.properties.state==="ON"?"fa fa-toggle-on":"fa fa-toggle-off"})})]})})}const Vi=[],qi="yag1",Wi="yag1",zi=!0,Yi={power:5,state:"ON"},Ki="bliss",Qi=!1,Xi="laser",Zi={callables:Vi,id:qi,name:Wi,online:zi,properties:Yi,protocol:Ki,require_staff:Qi,type:Xi},Jt={default:Zi},Ji={default:Zt},en={variants:Ji,mocks:Jt};function ea(n){var o;const{hardware:t}=n;return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"laserheating_overlay",children:[e.jsxs(i.Popover.Header,{children:[t.name," details"]}),e.jsx(i.Popover.Body,{children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Background Mode"}),e.jsx(i.Col,{children:t.properties.background_mode})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Calibration"}),e.jsx(i.Col,{children:t.properties.current_calibration})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Fit Wavelength"}),e.jsxs(i.Col,{children:[(o=t.properties.fit_wavelength)==null?void 0:o.join(" - ")," ",e.jsx("span",{children:"nm"})]})]})]})})]}),children:e.jsx(i.Button,{children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function tn(n){const{hardware:t,options:o={},disabled:s}=n,[r,a]=g.useState(!1);function c(p){return p<=0?Promise.reject(new Error("exposure_time must be > 0")):t.actions.setProperty("exposure_time",p)}function l(){a(!0);const p=t.actions.call("measure");return p!==void 0&&(console.log("pending"),p.then(()=>{a(!1)}).catch(m=>{a(!1)})),p}const u=t.properties.state,f=e.jsx(N,{name:"Laser Heating",icon:"fa-fire",online:t.online}),d=e.jsx(D,{state:u,minWidth:6,variant:u==="READY"?"success":"warning"});return e.jsx(_,{hardware:t,widgetIcon:f,widgetState:d,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(ge,{id:t.id,hardwareValue:t.properties.exposure_time,hardwareIsReady:!0,hardwareIsDisabled:n.disabled,hardwareIsMoving:!1,onMoveRequested:c,onAbortRequested:()=>null,precision:1,readOnly:!1,step:o.exposureStep,steps:o.exposureSteps,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),e.jsx(i.InputGroup.Text,{children:"s"}),e.jsx(i.Button,{size:"sm",disabled:n.disabled||r,onClick:()=>{l()},children:r?e.jsx("i",{className:"fa fa-spinner fa-spin"}):e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"fa fa-play me-1"}),"Measure"]})}),e.jsx(ea,{hardware:t,disabled:n.disabled})]})})}const ta=[],na="laserheating",oa="laserheating",sa=!0,ra={exposure_time:.5,state:"ON",background_mode:"READY",fit_wavelength:[500,650],current_calibration:"/path/to/file"},ia="bliss",aa=!1,ca="laserheating",la={callables:ta,id:na,name:oa,online:sa,properties:ra,protocol:ia,require_staff:aa,type:ca},nn={default:la},da={default:tn},on={variants:da,mocks:nn};function sn(n){const t=g.useRef(null),{hardware:o,options:s={}}=n;function r(c){o.actions.setProperty("intensity",c)}const a=g.useCallback(Fs.default(r,100),[]);return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Light",icon:"fa-lightbulb-o",online:o.online}),e.jsx("div",{className:"name",children:o.name}),e.jsx(i.Badge,{bg:o.properties.state==="ON"?"success":"danger",children:o.properties.state})]}),e.jsxs("div",{className:"hw-content",children:[e.jsx(i.Form.Control,{ref:t,disabled:n.disabled,type:"range",min:"0",max:"100",onChange:c=>a(Number.parseFloat(c.target.value)),defaultValue:o.properties.intensity}),e.jsxs("div",{children:[e.jsx(i.Button,{disabled:o.properties.intensity===0,size:"sm",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>a(0),children:e.jsx("i",{className:"fa fa-power-off"})}),e.jsxs("span",{className:"float-end",children:[o.properties.intensity," %"]})]})]})]})}const ua=[],fa="light_vlm",pa="light_vlm",ma=!0,ha={intensity:0,state:"ON",temperature:23.2},ga="bliss",xa=!1,wa="light",ja={callables:ua,id:fa,name:pa,online:ma,properties:ha,protocol:ga,require_staff:xa,type:wa},rn={default:ja},ya={default:sn},an={variants:ya,mocks:rn};function Z(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=t.properties.state??"UNKNOWN",a=o?(r==="ACQUIRING"?r:s!==null?"LOCKED":r)||"UNKNOWN":"OFFLINE",c={UNKNOWN:"critical",ACQUIRING:"transient",READY:"success",OFFLINE:"secondary",LOCKED:"warning"},l=c[a]??c.UNKNOWN;return e.jsx(D,{state:a,minWidth:6,variant:l})}function va(n){const{hardware:t}=n;return e.jsx(Z,{hardware:t})}function ot(n){const{hardware:t,options:o={}}=n;return e.jsx(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:e.jsx("div",{children:t.name})})}function cn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=o.header||"top";return a==="none"?e.jsx(ot,{...n}):e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(ot,{...n}),headerMode:a})}function st(n){const{hardware:t,options:o={}}=n,[s,r]=t.properties.size??["?","?"];return e.jsxs(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:[e.jsxs("div",{children:[s," × ",r]}),e.jsx("div",{className:"ms-auto",children:e.jsx("small",{children:e.jsx("small",{children:"px"})})})]})}function ln(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=o.header??"top";return a==="none"?e.jsx(st,{...n}):e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(st,{...n}),headerMode:a})}function J(n){const[t,o]=g.useState(!1);return e.jsxs(i.Button,{variant:n.isActive?"primary":t?"warning":"secondary",onClick:()=>{o(!0),n.onAction().finally(()=>{o(!1)})},disabled:n.disabled||t,title:n.title,className:"text-nowrap",children:[n.icon&&e.jsx("i",{className:`col-sm-4 justify-content-center align-self-center ${n.icon}`}),n.children]})}function Na(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r,properties:a}=t,{rotation:c,flip:[l,u]}=a;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:s}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Rotation"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsx(J,{isActive:c===0,onAction:()=>r.setProperty("rotation",0),disabled:s,title:"Disable rotation transformation",children:"None"}),e.jsxs(J,{isActive:c===90,onAction:()=>r.setProperty("rotation",90),disabled:s,title:"Disable rotation transformation",children:["90 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),e.jsxs(J,{isActive:c===180,onAction:()=>r.setProperty("rotation",180),disabled:s,title:"Disable rotation transformation",children:["180 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),e.jsxs(J,{isActive:c===270,onAction:()=>r.setProperty("rotation",270),disabled:s,title:"Disable rotation transformation",children:["270 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]})]})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Flip"})}),e.jsxs(i.Row,{className:"gx-0",children:[e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(J,{isActive:l,onAction:()=>r.setProperty("flip",[!0,u]),disabled:s,title:"Enable horizontal flip transformation",children:["Horiz ",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),e.jsx(J,{isActive:!l,onAction:()=>r.setProperty("flip",[!1,u]),disabled:s,title:"Disable horizontal flip transformation",children:"No"})]})}),e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(J,{isActive:u,onAction:()=>r.setProperty("flip",[l,!0]),disabled:s,title:"Enable vertical flip transformation",children:["Vert ",e.jsx("i",{className:"fa fa-fw fa-up-down"})]}),e.jsx(J,{isActive:!u,onAction:()=>r.setProperty("flip",[l,!1]),disabled:s,title:"Disable vertical flip transformation",children:"No"})]})})]})]})})]})}function ba(n){const{hardware:t,options:o={}}=n,{properties:s}=t,[r,a]=s.flip,c=s.rotation??0,l=!r&&!a&&c===0;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsxs(i.InputGroup.Text,{children:[r&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Flip",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),a&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Flip",e.jsx("i",{className:"fa fa-fw fa-up-down"})]}),c!==0&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Rot ",c.toFixed(0),e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),l&&e.jsx(i.Badge,{bg:"secondary",style:{fontSize:"130%"},title:"No transformation",children:"None"})]}),!o.readonly&&e.jsx(Na,{...n})]})}function dn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(ba,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const un="4.2em";function _a(n){const{hardware:t}=n,{properties:o}=t,s=o.state==="READY",r=n.disabled||!t.online||!s,a=o.binning_mode??"SUM";function c(l){const{binningMode:u,selectedMode:f,title:d}=l,m=u===f?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:r,onClick:()=>{t.actions.setProperty("binning_mode",u)},title:d,children:[e.jsx("i",{className:m})," "," ",e.jsx(i.Badge,{style:{minWidth:un},children:u})]},u)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:r,variant:"secondary"}),e.jsxs(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:[e.jsx(c,{binningMode:"SUM",selectedMode:a,title:"Merge binned pixel with SUM operation"}),e.jsx(c,{binningMode:"MEAN",selectedMode:a,title:"Merge binned pixel with MEAN operation"})]})]})}function Sa(n){const{hardware:t,options:o,disabled:s}=n,{properties:r={}}=t,{binning:a,binning_mode:c="SUM"}=r;function l(h){t.actions.setProperty("binning",[h,h])}const u=Nc(t),f=o.readonly??!1;if(a===void 0)return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx("i",{className:"fa fa-fw fam-binning-2d fa-2x"})}),e.jsx(B,{value:"? × ?"})]});const[d,p]=a??[0,0],m=d===p?d:0;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx("i",{className:"fa fa-fw fam-binning-2d fa-2x"})}),e.jsx(B,{value:`${a[0]} × ${a[1]}`}),!f&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{variant:m===1?"primary":"secondary",onClick:()=>{l(1)},disabled:s,children:"1"}),e.jsx(i.Button,{variant:m===2?"primary":"secondary",onClick:()=>{l(2)},disabled:s,children:"2"}),e.jsx(i.Button,{variant:m===3?"primary":"secondary",onClick:()=>{l(3)},disabled:s,children:"3"}),e.jsx(i.Button,{variant:m===4?"primary":"secondary",onClick:()=>{l(4)},disabled:s,children:"4"})]}),e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx(i.Badge,{style:{fontSize:"130%",minWidth:un},title:`Detector setup with binning ${c}`,children:c})}),!f&&u&&e.jsx(_a,{...n})]})}function fn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Sa,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Ca(n){const{hardware:t}=n,{properties:o}=t;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Rotation applied to the detector",children:e.jsx("i",{className:"fa fa-fw fa-crop-simple fa-2x"})}),e.jsx(i.Form.Control,{value:`${o.roi[0]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[1]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[2]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[3]}`,readOnly:!0}),e.jsx(i.InputGroup.Text,{children:"px"})]})}function pn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Ca,{hardware:t})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function $a(n){const{hardware:t}=n,{properties:o}=t,s=o.static,[r,a]=(s==null?void 0:s.image_max_dim)??["?","?"];return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Max size of the detector",children:"Max size"}),e.jsx(i.Form.Control,{value:`${r} × ${a}`,readOnly:!0}),e.jsx(i.InputGroup.Text,{children:"px"})]})}function Oa(n){const{hardware:t}=n,{properties:o}=t,s=o.static;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Version of the Lima server (lima-core)",children:"Lima version"}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.lima_version}`,readOnly:!0})]})}function Ia(n){const{hardware:t}=n,{properties:o}=t,s=o.static;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Model of the detector",children:"Type/model"}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.camera_type}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.camera_model}`,readOnly:!0})]})}function mn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Ia,{hardware:t}),e.jsx($a,{hardware:t}),e.jsx(Oa,{hardware:t})]}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Ma(n){var v;const{hardware:t,disabled:o}=n,{properties:s}=t,r=((v=s.static)==null?void 0:v.image_max_dim)??[0,0],a=s.roi,c=s.binning??[1,1],l=r[0]/c[0],u=r[1]/c[1];function f(){return u>l?1/u:1/l}const d=f(),[p,m]=[100*l*d,100*u*d];function h(){const[C,I,M,k]=a;return[100*C/l,100*I/u,100*M/l,100*k/u]}function w(){const[C,I,M,k]=a;return[100*(C+M*.5)/l,100*(I+k*.5)/u]}const[x,j,y,S]=h(),[$,b]=w();return e.jsx("div",{style:{backgroundColor:"#AAAAAA",width:"10em",height:"10em"},children:e.jsxs("div",{className:"position-relative",title:`Detector ${t.id}`,style:{backgroundColor:"#FFFFFF",border:"2px solid black",width:`${p}%`,height:`${m}%`},children:[e.jsx("div",{title:"ROI location",className:"position-absolute",style:{backgroundColor:"#FFFFFF",border:"2px dotted black",left:`${x}%`,top:`${j}%`,width:`${y}%`,height:`${S}%`}}),e.jsxs("span",{className:"position-absolute",style:{left:`${$}%`,top:`${b}%`,transform:"translate(-50%, -50%)"},children:[a[2],"×",a[3]]})]})})}function hn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Z,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Ma,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const F={};function Da(n){n.useHardware&&(F.useHardware&&console.warn("useHardware hook was already registered"),F.useHardware=n.useHardware),n.useHardwareChangeActions&&(F.useHardwareChangeActions&&console.warn("useHardwareChangeActions hook was already registered"),F.useHardwareChangeActions=n.useHardwareChangeActions),n.useHardwareSchema&&(F.useHardwareSchema&&console.warn("useHardwareSchema hook was already registered"),F.useHardwareSchema=n.useHardwareSchema),n.useOperator&&(F.useOperator&&console.warn("useOperator hook was already registered"),F.useOperator=n.useOperator),n.useScanRunning&&(F.useScanRunning&&console.warn("useScanRunning hook was already registered"),F.useScanRunning=n.useScanRunning)}function G(n){if(!F.useHardware)throw new Error("No `useHardware` hook registered");return F.useHardware(n)}function oe(n){if(!F.useHardwareChangeActions)throw new Error("No `useHardwareChangeActions` hook registered");return F.useHardwareChangeActions(n)}function Ta(n){if(!F.useHardwareSchema)throw new Error("No `useHardwareSchema` hook registered");return F.useHardwareSchema(n)}function Fa(){if(!F.useOperator)throw new Error("No `useOperator` hook registered");return F.useOperator()}function Ra(){if(!F.useScanRunning)throw new Error("No `useScanRunning` hook registered");return F.useScanRunning()}const Aa="lima_cam",Ea="lima_cam",ka="bliss",Pa="lima",Ba=!0,Ga=!1,La={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:0,size:[128,128],state:"READY"},Ha={id:Aa,name:Ea,protocol:ka,type:Pa,online:Ba,require_staff:Ga,properties:La},Ua="lima_cam",Va="lima_cam",qa="bliss",Wa="lima",za=!0,Ya=!1,Ka={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!0,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:0,size:[128,128],state:"READY"},Qa={id:Ua,name:Va,protocol:qa,type:Wa,online:za,require_staff:Ya,properties:Ka},Xa="lima_cam",Za="lima_cam",Ja="bliss",ec="lima",tc=!0,nc=!1,oc={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:180,size:[128,128],state:"READY"},sc={id:Xa,name:Za,protocol:Ja,type:ec,online:tc,require_staff:nc,properties:oc},rc="lima_cam",ic="lima_cam",ac="bliss",cc="lima",lc=!0,dc=!1,uc={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,710,1920,500],roi:[0,710,1920,500],rotation:0,size:[1920,1920],state:"READY"},fc={id:rc,name:ic,protocol:ac,type:cc,online:lc,require_staff:dc,properties:uc},pc="lima_cam",mc="lima_cam",hc="bliss",gc="lima",xc=!0,wc=!1,jc={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[5e3,2e3]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,5e3,2e3],roi:[0,0,5e3,2e3],rotation:0,size:[5e3,2e3],state:"READY"},yc={id:pc,name:mc,protocol:hc,type:gc,online:xc,require_staff:wc,properties:jc},gn={default:Ha,flip:Qa,rot:sc,roicenter:fc,squaredetector:yc};function xn(n){const{name:t,alias:o,useHardwareContext:s}=n,r=[1920,1920],a=[16e-6,16e-6],[c,l]=g.useState({static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:a,image_max_dim:r},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:a,raw_roi:[0,0,...r],roi:[0,0,...r],rotation:0,size:r,state:"READY"});async function u(x,j){console.log("LimaSimulator: Unsupported call",x,j)}function f(x,j){const y=[Math.round(a[0]*j[0]),Math.round(a[1]*j[1])],S=[Math.round(r[0]/j[0]),Math.round(r[1]/j[1])];return{...x,binning:j,pixel_size:y,roi:[0,0,...S],size:S}}function d(x,j){return{...x,binning_mode:j}}function p(x,j){return{...x,rotation:j}}function m(x,j){return{...x,flip:[j,x.flip[1]]}}function h(x,j){return{...x,flip:[x.flip[0],j]}}async function w(x,j){if(x==="binning"){l(y=>f(y,j));return}if(x==="binning_mode"){l(y=>d(y,j));return}if(x==="rotation"){l(y=>p(y,j));return}if(x==="flip_x"){l(y=>m(y,j));return}if(x==="flip_y"){l(y=>h(y,j));return}console.log("LimaSimulator: Unsupported setProperty",x,j)}return e.jsx(V,{name:t,alias:o,type:"lima",call:u,setProperty:w,properties:c,useHardwareContext:s})}function xe(n){return n.type==="lima"}function wn(n){const t=G(n);return t===null||!xe(t)?null:t}function jn(n,t){const o=Math.ceil(n/t),s=n/o;return[o,s]}const vc={default:cn,size:ln,transformation:dn,binning:fn,imageroi:pn,description:mn,shape:hn,state:va},yn={variants:vc,mocks:gn,simulator:xn};function Nc(n){var t;return n.properties.binning_mode!==void 0&&Rs.default.gte(((t=n.properties.static)==null?void 0:t.lima_version)??"0.0.0","1.10.4")}function bc(n,t){const{inputRef:o,referenceElementRef:s,onAddSelection:r,onRemoveSelection:a,...c}=n,l=g.useRef(),u=()=>{setTimeout(()=>{const p=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;p&&p.call(l.current,""),l.current&&l.current.dispatchEvent(new Event("input",{bubbles:!0}))},500)},f=()=>{r&&r(t.results).then(()=>{u()})},d=()=>{const p=t.text?[...t.selected].filter(m=>m.toLowerCase().indexOf(t.text.toLowerCase())!==-1):[...t.selected];a&&a(p).then(()=>{u()})};return e.jsxs(i.InputGroup,{children:[e.jsx(Q.Hint,{children:e.jsx(i.Form.Control,{style:{width:"100%"},...c,ref:p=>{l.current=p,o(p),s(p)},placeholder:`${t.selected.length} enabled`})}),e.jsx(i.Button,{disabled:n.disabled||t.results.length===0,onClick:f,children:e.jsx("i",{className:"fa fa-plus"})}),e.jsx(i.Button,{disabled:n.disabled,onClick:d,children:e.jsx("i",{className:"fa fa-minus"})})]})}function _c(n){return function(t){function o(s,r,a){return t(s,r,a,n)}return o.displayName=`WithExtraProps(${t.displayName||t.name||"Component"})`,o}}function Sc(n,t,o,s){const a=[...o.selected].filter(u=>u.toLowerCase().indexOf(o.text.toLowerCase())!==-1).sort().map(u=>e.jsx("a",{href:"#",className:"dropdown-item",onClick:()=>o.onRemove(u),children:e.jsx(Q.Highlighter,{search:o.text,children:u})},u)),l=[...o.results].sort().map((u,f)=>e.jsx(Q.MenuItem,{option:u,position:f,children:e.jsx(Q.Highlighter,{search:o.text,children:u})},u));return e.jsxs(Q.Menu,{...t,style:{...t.style,width:350},children:[s.pending&&e.jsx(Q.Menu.Header,{children:"Loading..."}),!s.pending&&e.jsxs(e.Fragment,{children:[e.jsx(Q.Menu.Header,{children:"Enabled"}),a,a.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items enabled"}),e.jsx(Q.Menu.Header,{children:"Available"}),l,l.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items available"})]})]})}function Cc(n){const{hardware:t,disabled:o=!1}=n,{online:s}=t;if(!s)return e.jsx(i.Alert,{children:"Offline"});const r=t.properties.available.filter(u=>!t.properties.disabled.includes(u));function a(u){const f=u.filter(p=>!r.includes(p)),d=r.filter(p=>!u.includes(p));f.length>0&&f.forEach(p=>{t.actions.call("enable",p)}),d.length>0&&d.forEach(p=>{t.actions.call("disable",p)})}function c(u){const f=[];return u.forEach(d=>{const p=t.actions.call("enable",d);f.push(p)}),Promise.all(f)}function l(u){const f=[];return u.forEach(d=>{const p=t.actions.call("disable",d);f.push(p)}),Promise.all(f)}return e.jsx(Q.Typeahead,{disabled:o,id:`typeahead_mg_${t.name}`,multiple:!0,flip:!0,positionFixed:!0,renderInput:bc,renderMenu:_c({name:t.id})(Sc),onChange:a,inputProps:{onAddSelection:c,onRemoveSelection:l},selected:r,options:t.properties.available,selectHint:(u,f)=>f.key==="Enter"||u})}function vn(n){const{hardware:t,options:o={},disabled:s=!1}=n;function r(){return t.actions.call("set_active")}const a=o.header??"top",c=e.jsx(N,{name:"Measurement Group",icon:"fa-list-ol",online:!0}),l=e.jsx(e.Fragment,{children:e.jsx(i.OverlayTrigger,{placement:"top",overlay:e.jsx(i.Tooltip,{id:"active",children:"Activate this measurement group"}),children:e.jsx(i.Button,{size:"sm",disabled:s,onClick:()=>void r(),className:"float-right ml-1",children:e.jsx("i",{className:"fa fa-power-off"})})})}),u=e.jsx(Cc,{...n});return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:u,headerMode:a})}const $c=[],Oc="mg",Ic="mg",Mc=!0,Dc={available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]},Tc="bliss",Fc=!1,Rc="measurementgroup",Ac={callables:$c,id:Oc,name:Ic,online:Mc,properties:Dc,protocol:Tc,require_staff:Fc,type:Rc},Nn={default:Ac};function bn(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState({available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]});async function c(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.filter(h=>h!==d)}})}async function l(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.includes(d)?m:[...m,d]}})}async function u(d,p){if(d==="enable"){await c(p);return}if(d==="disable"){await l(p);return}d!=="set_active"&&console.log("MeasurementGroupSimulator: Unsupported call",d,p)}async function f(d,p){console.log("MeasurementGroupSimulator: Unsupported setProperty",d,p)}return e.jsx(V,{name:t,alias:o,type:"measurementgroup",call:u,setProperty:f,properties:r,useHardwareContext:s})}const Ec={default:vn},_n={variants:Ec,mocks:Nn,simulator:bn},Pe={description:"Unknown state is exposed",variant:"fatal",priority:100},Se={OFFLINE:{description:"Axis is offline",variant:"secondary",priority:0},MOVING:{description:"Axis is moving",variant:"transient",priority:10},FAULT:{description:"Axis is in fault",variant:"danger",priority:20},LOCKED:{description:"Axis is locked",variant:"warning",priority:25},OFF:{description:"Power is off",variant:"secondary",priority:30},DISABLED:{description:"Axis is disabled",variant:"warning",priority:40},LOWLIMIT:{description:"Low limit is reached",variant:"warning",priority:50},HIGHLIMIT:{description:"High limit is reached",variant:"warning",priority:51},HOME:{description:"Home signal active",variant:"info",priority:52},READY:{description:"Ready to handle request",variant:"success",priority:60},NOT_READY:{description:"Not ready",variant:"warning",priority:100},UNKNOWN:Pe};function we(n){const{hardware:t}=n,{locked:o=null}=t,{state:s=["UNKNOWN"]}=t.properties,[r,a]=g.useMemo(()=>{if(!t.online)return[["OFFLINE"],void 0];function c(p,m){const h=Se[p]??Pe,w=Se[m]??Pe;return h.priority-w.priority}const l=[...s,...o!==null?["LOCKED"]:[],...s.length===0?["NOT_READY"]:[]];l.sort(c);function u(p){const m=p.split(":",2);return m.length===1?[p,void 0]:m}const f={};return[l.map(p=>{if(p.startsWith("_")){const m=u(p);return m[1]!==void 0&&(f[m[0]]=m[1]),m[0]}return p==="LOCKED"?f[p]=`Locked by ${(o==null?void 0:o.reason)??" an object"}`:f[p]=Se[p].description??"",p}),f]},[s,t.online,o]);return e.jsx(vt,{states:r,descriptions:a,minWidth:6,variants:Object.fromEntries(Object.entries(Se).map(([c,l])=>[c,l.variant]))})}function kc(n){const{hardware:t}=n;return e.jsx(we,{hardware:t})}function me(n){const t=g.useRef(null),[o,s]=g.useState(!1),[r,a]=g.useState(!1);function c(d){return n.precision!==void 0?Number.parseFloat(d).toFixed(n.precision):d}g.useEffect(()=>{var d;t.current&&(t.current.value=c((d=n.hardwareValue)==null?void 0:d.toString()),s(!1))},[n.hardwareValue,n.precision]);function l(d){const p=c(d);t!=null&&t.current&&(t.current.value=p)}function u(d){switch(d.key){case"Enter":{s(!1);const p=Number.parseFloat(d.target.value),m=n.onMoveRequested(p);m&&m.catch(()=>{a(!0),setTimeout(()=>{l(n.hardwareValue),a(!1)},2e3)}),d.preventDefault(),d.stopPropagation();break}case"Esc":case"Escape":o&&(a(!1),s(!1),l(n.hardwareValue)),d.target.blur(),d.preventDefault(),d.stopPropagation();break}}function f(d){s(d.target.value!==n.hardwareValue.toString())}return e.jsx(i.Form.Control,{className:q.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:"number",ref:t,onChange:f,onKeyDown:u,disabled:n.readOnly||n.hardwareIsMoving||n.hardwareIsDisabled,step:n.step,onClick:d=>{d.stopPropagation()}})}function Pc(n){const{states:t,hardware:o}=n,{properties:s}=o;function r(c){return o.actions.setProperty("velocity",c)}function a(c){return o.actions.setProperty("acceleration",c)}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[o.name," details"]}),e.jsxs(i.Popover.Body,{children:[e.jsxs(i.Form.Group,{children:[e.jsx(i.Form.Label,{children:"Velocity"}),e.jsx(me,{hardwareValue:(s==null?void 0:s.velocity)??0,onMoveRequested:r,hardwareIsDisabled:n.disabled,hardwareIsReady:t.READY,hardwareIsMoving:t.MOVING,readOnly:n.readOnly})]}),e.jsxs(i.Form.Group,{children:[e.jsx(i.Form.Label,{children:"Acceleration"}),e.jsx(me,{hardwareValue:(s==null?void 0:s.acceleration)??0,onMoveRequested:a,hardwareIsDisabled:n.disabled,hardwareIsReady:t.READY,hardwareIsMoving:t.MOVING,readOnly:n.readOnly})]})]})]}),children:e.jsx(i.Button,{children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function ce(n){const{hardware:t,options:o={}}=n,{properties:s,user_tags:r}=t;function a(){t.actions.call("stop")}function c(p){return t.actions.call("move",p)}const l=je(s.state,r),u=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),f=e.jsx(we,{hardware:t}),d=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:u,widgetState:f,widgetContent:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(ge,{id:t.id,hardwareValue:(s==null?void 0:s.position)??null,hardwareIsDisabled:n.disabled,hardwareIsReady:l.READY??!1,hardwareIsMoving:l.MOVING??!1,onMoveRequested:c,onAbortRequested:a,precision:o.precision??s.display_digits??void 0,readOnly:o.readOnly,stepOnly:o.stepOnly,step:o.step,steps:o.steps,incIcon:o.incicon,decIcon:o.decicon,swapIncDec:o.swapincdec,horizontalArrows:o.horizontalarrows,largeArrows:o.largearrows}),s.unit&&e.jsx(i.InputGroup.Text,{children:s.unit}),!l.MOVING&&o.extended&&e.jsx(Pc,{hardware:t,disabled:n.disabled,readOnly:o.readOnly,states:l}),l.MOVING&&!n.disabled&&!o.step&&e.jsx(i.Button,{variant:"danger",onClick:a,children:e.jsx("i",{className:"fa fa-times"})})]}),headerMode:d})}function rt(n){const{hardware:t,options:o={}}=n,s=je(t.properties.state,t.user_tags);function r(a){if(a===null)return"∅";const c=o.precision??t.properties.display_digits??void 0;return c!==void 0?a.toFixed(c):`${a}`}return e.jsxs(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:[e.jsx("div",{className:q.default({"hw-moving":s.MOVING}),children:r(t.properties.position)}),t.properties.unit&&e.jsx("div",{className:"ms-auto",children:e.jsx("small",{children:e.jsx("small",{children:t.properties.unit})})})]})}function Sn(n){const{hardware:t}=n,o=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),s=e.jsx(we,{hardware:t}),r=n.options?n.options.header:"top";return r==="none"?e.jsx(rt,{...n}):e.jsx(_,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:e.jsx(rt,{...n}),headerMode:r})}const A={background:"hsl(0 0% 98%)",backgroundD10:"hsl(0 0% 88%)",disabled0:"hsl(0, 0%, 93%)",disabledD10:"hsl(0, 0%, 83%)",danger:"rgb(220, 53, 69)",edited:"hsl(45, 100%, 71.4%)",transient:"#4285eb",text:"black",textD10:"black"},Bc={up:0,right:-90,down:180,left:90};function Cn(n){const{size:t,value:o=null,target:s=null,min:r=null,max:a=null,disabled:c=!1,readOnly:l=!1,origin:u="up",direction:f="clockwise",onChange:d=z=>{},onInteractiveChange:p=null,className:m}=n,[h,w]=g.useState(null);function x(){w(null)}function j(z){w(z),p&&p(z)}const y=8,S=5,$=12,b=t*.5,v=b-S-y,C=4,I=v-$-C/2,M=!c&&!l,k=5,O=h!==null?h:s;function Y(z){return z.mouseRadius<v/3?{readOnly:!0}:z.ctrlKey?{steps:8}:b-y-S<=z.mouseRadius&&z.mouseRadius<=b+S?{steps:8}:{}}function te(){if(o===null||r===null||a===null)return null;const z=a-r;return z>=360?null:[(a-360)/360,(a-360+360-z)/360]}const K=te(),Ns=f==="clockwise"?360:-360,bs=Bc[u]+(f==="clockwise"?0:360);return e.jsxs(E.Knob,{size:t,value:o,angleOffset:bs,angleRange:Ns,min:0,max:360,multiRotation:!0,onChange:d,onInteractiveChange:j,interactiveHook:Y,onEnd:x,readOnly:!M,tracking:!1,useMouseWheel:!1,className:m,children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"knob-shadow",cx:t/2,cy:t/2,fx:t*.75,fy:t*.75,r:v+k,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:v/(v+k),stopColor:A.backgroundD10,stopOpacity:"0.1"}),e.jsx("stop",{offset:1,stopColor:A.backgroundD10,stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"knob-enabled",x1:0,y1:t/2-v,x2:0,y2:t/2+v,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0%",stopColor:A.backgroundD10}),e.jsx("stop",{offset:"30%",stopColor:A.background}),e.jsx("stop",{offset:"70%",stopColor:A.background}),e.jsx("stop",{offset:"100%",stopColor:A.backgroundD10})]}),e.jsxs("linearGradient",{id:"knob-disabled",x1:0,y1:t/2-v,x2:0,y2:t/2+v,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0%",stopColor:A.disabledD10}),e.jsx("stop",{offset:"30%",stopColor:A.disabled0}),e.jsx("stop",{offset:"70%",stopColor:A.disabled0}),e.jsx("stop",{offset:"100%",stopColor:A.disabledD10})]})]}),e.jsx("circle",{r:v+k,cx:t/2,cy:t/2,fill:"url(#knob-shadow)"}),e.jsx("circle",{r:v,cx:t/2,cy:t/2,fill:M?"url(#knob-enabled)":"url(#knob-disabled)"}),K&&e.jsx(E.Range,{percentageFrom:K[0],percentageTo:K[1],radius:b,color:A.danger,arcWidth:y}),e.jsx(E.Scale,{steps:8,tickWidth:2,tickHeight:y,radius:b,color:A.textD10}),e.jsx(E.Scale,{steps:32,tickWidth:1,tickHeight:y/2,radius:b,color:A.textD10}),e.jsx(E.Label,{percentage:.1,radius:b+6,label:"+",style:{fontSize:"80%",fontWeight:"bold"}}),e.jsx(E.Label,{percentage:-.1,radius:b+6,label:"-",style:{fontSize:"80%",fontWeight:"bold"}}),O!==null&&o!==null&&e.jsx(E.Range,{percentageFrom:o/360,percentageTo:O/360,radius:I+C*1.5,color:h!==null?A.edited:A.transient,arcWidth:C}),O!==null&&e.jsx(E.Pointer,{percentage:O/360,width:C,height:C,radius:I,type:"circle",color:h!==null?A.edited:A.transient}),e.jsx(E.Pointer,{percentage:0,width:2.5,height:y,radius:b-y*1.5,type:"circle",color:A.text}),o!==null&&e.jsx(E.Pointer,{percentage:o/360,width:C,height:C,radius:I,type:"circle",color:A.text}),e.jsx(E.Value,{value:h!==null?h:o,decimalPlace:1,marginBottom:t/2,className:"knob-text"})]})}function $n(n){const{hardware:t,options:o={}}=n,s=Is.useDebouncedCallback(m=>{t.actions.call("move",m)},[t.actions],100),r=je(t.properties.state,t.user_tags),a=r.MOVING?t.properties.target:void 0,c=Tn(t,o),l=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor-r",online:t.online}),u=Fn(t),f=e.jsx(we,{hardware:t}),d=e.jsx(Cn,{className:"mx-auto my-auto",size:100,value:t.properties.position,min:u[0],max:u[1],target:a,onChange:s,disabled:n.disabled,readOnly:o.readOnly||!r.READY,origin:"down",direction:c?"clockwise":"anticlockwise"}),p=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:l,widgetState:f,widgetContent:d,headerMode:p})}function Gc(n,t){return n?t.FAULT?"danger":t.MOVING?"transient":"secondary":"secondary"}function On(n){const{hardware:t,options:o={}}=n,{online:s=!1,properties:r={}}=t,{state:a,position:c,unit:l=null,display_digits:u}=r,f=je(a,[]),d=o.name??t.alias??t.name??t.id,p=Gc(s,f);function m(){let w="";return c!==void 0&&(c===null?w="null":Number.isFinite(c)?w+=c.toFixed(u??2):w=`${c}`),l!==null&&l!==""&&(w=`${w} ${l}`),w}const h=m();return e.jsxs(X,{children:[e.jsx("h1",{children:d}),e.jsx(i.Badge,{bg:p,children:h})]})}const Lc=["move","stop","wait","rmove"],Hc="omega",Uc="omega 123",Vc=!0,qc={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Wc="bliss",zc=!1,Yc="motor",Kc=[],Qc={callables:Lc,id:Hc,name:Uc,online:Vc,properties:qc,protocol:Wc,require_staff:zc,type:Yc,user_tags:Kc},Xc=["move","stop","wait","rmove"],Zc="omega",Jc="omega 123",el=!0,tl={offset:0,sign:1,acceleration:300,limits:[-10,190],position:100,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3},nl="bliss",ol=!1,sl="motor",rl=[],il={callables:Xc,id:Zc,name:Jc,online:el,properties:tl,protocol:nl,require_staff:ol,type:sl,user_tags:rl},al=["move","wait","stop","rmove"],cl="omega",ll="omega 123",dl=!0,ul={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["UNKNOWN"],target:null,tolerance:1e-4,unit:"deg",velocity:null},fl="bliss",pl=!1,ml="motor",hl=[],gl={callables:al,id:cl,name:ll,online:dl,properties:ul,protocol:fl,require_staff:pl,type:ml,user_tags:hl},xl=["move","wait","stop","rmove"],wl="omega",jl="omega 123",yl=!0,vl={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:[],target:null,tolerance:1e-4,unit:"deg",velocity:null},Nl="bliss",bl=!1,_l="motor",Sl=[],Cl={callables:xl,id:wl,name:jl,online:yl,properties:vl,protocol:Nl,require_staff:bl,type:_l,user_tags:Sl},$l=["move","wait","stop","rmove"],Ol="omega",Il="omega 123",Ml=!1,Dl={},Tl="bliss",Fl=!1,Rl="motor",Al=[],El={callables:$l,id:Ol,name:Il,online:Ml,properties:Dl,protocol:Tl,require_staff:Fl,type:Rl,user_tags:Al},kl=["move","wait","stop","rmove"],Pl="omega",Bl="omega 123",Gl=!0,Ll={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["OFF"],target:null,tolerance:1e-4,unit:"deg",velocity:null},Hl="bliss",Ul=!1,Vl="motor",ql=[],Wl={callables:kl,id:Pl,name:Bl,online:Gl,properties:Ll,protocol:Hl,require_staff:Ul,type:Vl,user_tags:ql},In={default:Qc,halfMotor:il,unknownMotor:gl,notReadyMotor:Cl,disconnectedMotor:El,powerOffMotor:Wl};function Mn(n){const{name:t="omega",minLimit:o=-999999999,maxLimit:s=999999999,initialPosition:r=0,initialVelocity:a=1e3,useHardwareContext:c=()=>null}=n,[l,u]=g.useState(r),[f,d]=g.useState(["READY"]),[p,m]=g.useState(null),h=g.useRef(Date.now()),w=c(),x=()=>{const v=Date.now(),C=(v-h.current)/1e3;let I;if(h.current=v,p!==null&&p!==l){let M,k;const O=C*a;if(O>Math.abs(l-p))I=p,M=["READY"],k=null;else{const Y=p>l?1:-1;I=l+Y*O,M=["MOVING"],k=p}u(I),d(M),m(k)}},j=g.useCallback((v,C)=>{if(v==="stop")return m(null),d(["READY"]),Promise.resolve();if(v==="move"){const I=Number.parseFloat(C);return m(Number.isNaN(I)?null:I),Promise.resolve()}return console.log("MotorSimulator: Unsupported call",v,C),Promise.resolve()},[]),y=g.useCallback((v,C)=>(console.log("MotorSimulator: Unsupported setProperty",v,C),Promise.resolve()),[]);g.useEffect(()=>{const v=setInterval(()=>{x()},500);return()=>clearInterval(v)});const S=g.useMemo(()=>{var C,I;const v={setProperty:y,call:j};return(I=w==null?void 0:(C=w.actions).updateHardwareChangeActions)==null||I.call(C,t,v),v},[]),$={id:t,name:t,alias:null,online:!0,properties:{acceleration:300,limits:[o,s],position:l,offset:0,sign:1,state:f,tolerance:1e-4,unit:"mm",velocity:a,target:p,display_digits:3},type:"motor",actions:S,user_tags:[],locked:null},b=g.useRef(null);return g.useEffect(()=>{b.current!==null&&P.isEqual(b.current,$)||(b.current=$,w==null||w.actions.updateHardware(t,$))},[t,$]),e.jsx(e.Fragment,{})}function je(n,t=[]){return g.useMemo(()=>{const o=t.includes("auto_ready"),s=t.includes("auto_on");if(n===void 0)return{UNKNOWN:!0};if((n==null?void 0:n.length)===0)return o?{READY:!0}:{NOT_READY:!0};const r=n.reduce((a,c)=>(a[c]=!0,a),{});return r.READY===void 0&&s&&r.OFF&&(r.READY=!0),r},[n,t])}function Dn(n){return n.type==="motor"}function U(n){const t=G(n);return t===null||!Dn(t)?null:t}const zl={default:ce,text:Sn,rotation:$n,state:kc,monitor:On};function Tn(n,t){if((t==null?void 0:t.clockwise)!==void 0)return t.clockwise;const o=n.properties.sign<0,s=n.user_tags.includes("dial.anticlockwise"),r=n.user_tags.includes("dial.clockwise");return r&&s&&console.error("Both tags 'dial.clockwise' and 'dial.anticlockwise' are defined"),(r||!s)!==o}function Fn(n){var r;const t=(r=n.properties)==null?void 0:r.limits;if(t==null)return[void 0,void 0];const[o,s]=t;return[Number.isFinite(o)?o:void 0,Number.isFinite(s)?s:void 0]}const Rn={variants:zl,mocks:In,simulator:Mn,monitor:On};function Yl(n,t){return{id:n,name:n,type:"motor",properties:{position:t,unit:"mm",limits:[-100,100]},online:!0}}function Ve(n){var l;const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":(l=t.properties)==null?void 0:l.state)||"UNKNOWN":"OFFLINE",c={OFFLINE:"secondary",READY:"success",MOVING:"transient",ERROR:"danger",UNKNOWN:"fatal",LOCKED:"warning"}[r]||"success";return e.jsx(i.Badge,{bg:c,children:r})}function An(n){const{hardware:t,options:o={}}=n,s=g.useRef(null);g.useEffect(()=>{if(!s.current){console.error("selectionRef ref is unset");return}s.current.value=t.properties.position??""},[t.properties.position]);function r(l){if(console.debug("change",l),!s||!s.current){console.error("selection ref is unset");return}t.actions.call("move",s.current.value)}function a(l){t.actions.call("stop")}const c=P.map(t.properties.positions,l=>e.jsx("option",{title:l.description,children:l.position},l.position));return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(Ve,{hardware:t})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsxs(i.Form.Control,{className:"custom-select",as:"select",ref:s,disabled:n.disabled,defaultValue:t.properties.position??"",children:[e.jsx("option",{disabled:!0,children:"unknown"}),c]}),t.properties.state!=="MOVING"&&e.jsx(i.Button,{onClick:r,disabled:n.disabled,children:"Move"}),t.properties.state==="MOVING"&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:a,children:e.jsx("i",{className:"fa fa-times"})})]})})]})}const En=g.forwardRef(({title:n,children:t,bsPrefix:o,rootCloseEvent:s,variant:r,size:a,menuRole:c,renderMenuOnMount:l,disabled:u,href:f,id:d,menuVariant:p,flip:m,style:h,className:w,popperConfig:x,...j},y)=>e.jsxs(i.Dropdown,{ref:y,...j,children:[e.jsx(i.DropdownToggle,{id:d,href:f,size:a,variant:r,disabled:u,childBsPrefix:o,style:h,className:w,children:n}),e.jsx(i.DropdownMenu,{popperConfig:x,role:c,renderOnMount:l,rootCloseEvent:s,variant:p,flip:m,children:t})]}));En.displayName="DropdownButton2";const Kl=En;function Ql(n){const{currentPositionId:t,position:o,disabled:s,onSelect:r,filter:a}=n,c=o.position,l=c===t,u=l?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return g.useMemo(()=>{var p,m;if(a==="")return!0;const d=a.toLowerCase();return((p=o.position)==null?void 0:p.toLowerCase().includes(d))||((m=o.description)==null?void 0:m.toLowerCase().includes(d))},[a,o])?e.jsxs(i.Dropdown.Item,{disabled:s,onClick:()=>{r(c)},title:o.description,children:[e.jsxs(i.Row,{className:"gx-0 nowrap",children:[e.jsx(i.Col,{sm:"2",children:e.jsx("i",{className:u})}),e.jsx(i.Col,{sm:"10",children:e.jsx(i.Badge,{className:"small",bg:l?"primary":"secondary",children:e.jsx("span",{className:"secondary",children:e.jsx("span",{className:"text-truncate w-50",children:c})})})})]}),e.jsxs(i.Row,{className:"gx-0 nowrap",children:[e.jsx(i.Col,{sm:"2"}),e.jsx(i.Col,{sm:"10",children:e.jsx(i.Row,{className:"gx-0",children:e.jsx(i.Col,{sm:"12",className:"text-truncate text-start",children:o.description})})})]})]},o.position):e.jsx(e.Fragment,{})}function Xl(n,t){if(n===null)return null;for(const o of t)if(n===o.position)return o;return null}function Zl(n){const{positionId:t,targetPositionId:o,hardware:s}=n,{properties:r={}}=s,{positions:a=[]}=r;function c(){return o?e.jsx(i.Badge,{bg:"transient",children:o}):t?e.jsx(i.Badge,{children:t}):e.jsx(i.Badge,{bg:"warning",children:"unknown"})}const l=c(),u=g.useMemo(()=>{if(o)return"Moving...";const f=Xl(t,a);return f===null?"Position not described":f.description??""},[o,t,a]);return e.jsxs(e.Fragment,{children:[l,e.jsx("div",{className:"text-truncate text-start ms-2 flex-grow-1 flex-shrink-1",title:u,style:{flex:"1 1 0",minWidth:0},children:u})]})}function kn(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,r=s.state==="READY",a=(s==null?void 0:s.state)==="MOVING",c=n.disabled||!t.online||!r;function l(S){t.actions.call("move",S)}function u(S){t.actions.call("stop")}const f=e.jsx(N,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),d=e.jsx(Ve,{hardware:t}),p=a?"moving":null;function m(){var $;const S=(($=t.properties)==null?void 0:$.position)??null;return S==="unknown"?null:S}const h=m(),[w,x]=g.useState("");function j(){return e.jsxs(i.InputGroup,{className:"flex-nowrap",style:{alignItems:"stretch"},children:[e.jsxs(Kl,{variant:"secondary",title:e.jsx(Zl,{positionId:h,targetPositionId:p,hardware:t}),disabled:c,popperConfig:{strategy:"fixed"},className:"flex-grow-1 d-flex flex-nowrap align-items-center",style:{flex:"1 1 0",minWidth:0},children:[o.search&&e.jsxs(i.Container,{className:"d-flex justify-content-center align-items-center",children:[e.jsx("i",{className:"fa fa-search fa-fw flex-shrink"}),e.jsx(i.Form.Control,{autoFocus:!0,className:"mx-1 my-2 w-50",style:{marginLeft:"auto",marginRight:"auto"},placeholder:"Type to filter...",onChange:S=>x(S.target.value),value:w}),e.jsx(i.CloseButton,{disabled:w==="",onClick:()=>{x("")}})]}),s.positions.map(S=>e.jsx(Ql,{currentPositionId:h,position:S,onSelect:$=>{l($)},disabled:c,filter:w})),o.search&&w!==""&&e.jsxs(e.Fragment,{children:[e.jsx(i.Dropdown.Divider,{}),e.jsx(i.Dropdown.Item,{onClick:S=>{x(""),S.stopPropagation()},children:"Display all the positions..."})]})]}),a&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:u,children:e.jsx("i",{className:"fa fa-fw fa-times"})})]})}const y=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:f,widgetState:d,widgetContent:j(),headerMode:y})}const Jl=["move","stop"],ed="beamstop",td="beamstop",nd=!0,od={position:"OUT",positions:[{description:"Beamstop position IN the beam",position:"IN",target:[{destination:2.5,tolerance:.01},{destination:1,tolerance:.2}]},{description:"Beamstop position OUT of the beam",position:"OUT",target:[{destination:3.5,tolerance:.01},{destination:2,tolerance:.2}]}],state:"READY"},sd="bliss",rd=!1,id="multiposition",ad={callables:Jl,id:ed,name:td,online:nd,properties:od,protocol:sd,require_staff:rd,type:id},Pn={default:ad};function Bn(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("empty"),[c,l]=g.useState("READY");async function u(p,m){if(p==="move"){l("MOVING"),a("unknown"),await L(2e3),l("READY"),a(m);return}if(p==="stop"){a("unknown"),await L(2e3);return}console.log("MultipositionSimulator: Unsupported call",p,m)}async function f(p,m){console.log("MultipositionSimulator: Unsupported setProperty",p,m)}const d={position:r,state:c,positions:[{position:"empty",description:"No filter",target:[]},{position:"gold2",description:"Gold filter 2mm",target:[]},{position:"silver3",description:"Silver filter 3mm",target:[]}]};return e.jsx(V,{name:t,alias:o,type:"multiposition",call:u,setProperty:f,properties:d,useHardwareContext:s})}const cd={state:Ve,default:An,default2:kn},Gn={variants:cd,mocks:Pn,simulator:Bn};function qe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOVING:"transient",INVALID:"danger",UNKNOWN:"danger",DISABLED:"secondary",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function ld(n){const{hardware:t}=n;return e.jsx(qe,{hardware:t})}function dd(n){const{hardware:t,options:o={}}=n,{properties:s}=t,{state:r}=s,a=r==="MOVING",c=r==="READY",l=a?s.target_magnification||0:s.magnification||0,f=[...s.available_magnifications??[]];f.sort((w,x)=>w>x?1:x>w?-1:0);const d=n.disabled||!t.online||!c,p=o.digits||2;function m(w){t.actions?t.actions.call("move",w):console.error("Change request was triggered with:",w)}function h(w,x){const y=l===x?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:d,onClick:()=>{m(x)},children:[e.jsx("i",{className:y})," × ",x]},`id${w}`)}return e.jsxs(e.Fragment,{children:[e.jsx(B,{value:l.toFixed(p),className:q.default({"hw-moving":a})}),e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:!c,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:f.map((w,x)=>h(x,w))})]})]})}function ud(n){const{hardware:t,options:o={}}=n,s=t.properties.magnification||0,r=o.digits||2,a=!!o.allowtuning;return e.jsxs(e.Fragment,{children:[e.jsx(B,{value:s.toFixed(r)}),a&&e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"×"}),e.jsx(Ln,{...n})]})})]})]})}function Ln(n){const{hardware:t,options:o={}}=n,s=t.properties.magnification||0,{state:r}=t.properties,a=r==="READY",c=n.disabled||!t.online||!a,[l,u]=t.properties.magnification_range||[null,null],f=g.useRef(null),d=g.useRef(null),[p,m]=g.useState(!1),h=o.digits||2;function w(b){t.actions?n.mode==="move"?t.actions.call("move",b):t.actions.setProperty("magnification",b):console.error("Change request was triggered with:",b)}function x(b){if(!f||!f.current){console.log("formRef not yet defined");return}if(b.key==="Enter"){m(!1);const{value:v}=f.current,C=Number.parseFloat(v);if(l!==null&&C<l||u!==null&&C>u)return;w(C)}else b.key==="Escape"?(f.current.value=s.toFixed(h),d.current&&(d.current.value=s.toString()),m(!1)):console.log(b.key)}function j(b){b!==s&&!p&&m(!0),b===s&&p&&m(!1)}function y(b){if(!f||!f.current){console.error("formRef is not set");return}const v=Number.parseFloat(f.current.value);j(v),d.current&&(d.current.value=v.toString())}function S(b){if(!f||!f.current){console.error("formRef is not set");return}if(!d||!d.current){console.error("rangeRef is not set");return}const v=Number.parseFloat(d.current.value);j(v),f.current.value=v.toFixed(h)}function $(){if(!d||!d.current){console.error("rangeRef is not set");return}const b=Number.parseFloat(d.current.value);w(b)}return g.useEffect(()=>{if(!f||!f.current){console.error("formRef is not set");return}p||(f.current.value=s.toFixed(h)),d.current&&(d.current.value=s.toString())},[h,p,s]),e.jsxs(e.Fragment,{children:[e.jsx(i.Form.Control,{className:p?"form-control-edited":"",type:"number",ref:f,defaultValue:s.toFixed(h),onChange:y,disabled:c,step:10**-h,onKeyDown:x}),l!==null&&u!==null&&e.jsx(i.Form.Control,{ref:d,disabled:c,type:"range",min:l,max:u,step:10**-h,onChange:S,onMouseUp:$,defaultValue:s})]})}function fd(n){const{hardware:t,options:o={}}=n,{properties:s}=t,r=s.state==="MOVING",a=s.state==="READY",c=r?s.target_magnification||0:s.magnification||0,l=n.options.digits||2;return e.jsxs(e.Fragment,{children:[e.jsx(B,{value:c.toFixed(l),className:q.default({"hw-moving":r})}),e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:!a,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"×"}),e.jsx(Ln,{...n,mode:"move"})]})})]})]})}function pd(n){return e.jsx(i.Form.Control,{className:"border-light",type:"text",disabled:!0,defaultValue:"Missing"})}function Hn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fam-hardware-optic",online:t.online}),r=e.jsx(qe,{hardware:t});function a(){function l(){return t.online?t.properties.available_magnifications?dd:t.properties.magnification_range?fd:ud:pd}const u=l();return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{className:"border-light",children:"×"}),e.jsx(u,{...n})]})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const md=["magnification","reset","open"],hd="optic",gd="optic",xd=!0,wd={state:"READY",magnification:10,target_magnification:null,available_magnifications:[5,7.5,10],magnification_range:null},jd="bliss",yd=!1,vd="optic",Ce={callables:md,id:hd,name:gd,online:xd,properties:wd,protocol:jd,require_staff:yd,type:vd},Un={default:Ce,fixed:Ce,off:Ce,range:Ce};function Vn(n){const{name:t,alias:o,kind:s,useHardwareContext:r}=n;function a(){return s==="fixed"?{available_magnifications:null,magnification_range:null}:s==="range"?{available_magnifications:null,magnification_range:[5,10]}:s==="multi"?{available_magnifications:[5,7.5,10],magnification_range:null}:{available_magnifications:null,magnification_range:null}}const[c,l]=g.useState({state:"READY",magnification:10,target_magnification:null,...a()});async function u(p){let m=c.magnification;l(x=>({...x,state:"MOVING",target_magnification:p})),await L(100);const h=.2*(m<p?1:-1);function w(x){l(j=>({...j,magnification:x}))}for(;Math.abs(p-m)>=Math.abs(h)*1.01;)m+=h,w(m),await L(100);l(x=>({...x,state:"READY",magnification:p,target_magnification:null}))}async function f(p,m){if(p==="move"){await u(m);return}console.log("OpticSimulator: Unsupported call",p,m)}async function d(p,m){if(p==="magnification"){l(h=>({...h,magnifications:m}));return}console.log("OpticSimulator: Unsupported setProperty",p,m)}return e.jsx(V,{name:t,alias:o,type:"optic",call:f,setProperty:d,properties:c,useHardwareContext:r})}function Nd(n){return n.type==="optic"}const bd={default:Hn,state:ld},qn={variants:bd,mocks:Un,simulator:Vn};function ye(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={STANDBY:"success",DISABLED:"secondary",OFFLINE:"secondary",RUNNING:"transient",ABORTING:"warning",AWAITING_USER_INPUT:"warning",UNKNOWN:"fatal"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function _d(n){const{hardware:t}=n;return e.jsx(ye,{hardware:t})}function Wn(n){const{hardware:t,options:o}=n,s=n.disabled||!t.online,r=t.properties.state==="AWAITING_USER_INPUT",a=t.properties.state==="ABORTING",c=t.properties.state==="RUNNING"||r||a;function l(f){o.foreground?t.actions.call("run_foreground"):t.actions.call("start")}function u(f){t.actions.call("abort")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"w-100",children:[e.jsx(i.Button,{onClick:l,disabled:s||c,variant:"primary",children:"Start"}),e.jsx(i.Button,{onClick:u,disabled:s||!c,variant:"primary",children:"Abort"})]})}function Be(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ye,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(Wn,{hardware:t,disabled:!n.operator,options:o})}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Sd(n){const{hardware:t}=n,o=t.properties.state==="AWAITING_USER_INPUT",s=t.properties.state==="ABORTING",r=t.properties.state==="RUNNING";return s?e.jsxs(i.Badge,{bg:"warning",children:[e.jsx("i",{className:"fa-solid fa-heart-crack fa-beat"})," ABORTING"]}):r?e.jsxs(i.Badge,{bg:"info",children:[e.jsx("i",{className:"fa-solid fa-heart fa-beat"})," RUNNING"]}):o?e.jsxs(i.Badge,{bg:"warning",title:"A user input is expected",children:[e.jsx("i",{className:"fa-solid fa-user fa-beat"})," AWAITING INPUT"]}):e.jsx(zn,{hardware:t})}function zn(n){const{hardware:t}=n,{previous_run_state:o,previous_run_exception:s}=t.properties,r={NONE:["secondary",null],ABORTED:["warning","fa-heart-crack"],FAILED:["danger",null],SUCCESSED:["success",null],UNKNOWN:["danger",null]},a=r[o]||r.UNKNOWN,[c,l]=a;return e.jsxs(i.Badge,{bg:c,title:s??void 0,children:[l&&e.jsxs(e.Fragment,{children:[e.jsx("i",{className:`fa-solid ${l}`})," "]}),o]})}function Yn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ye,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx("div",{children:e.jsx("h3",{children:e.jsx(Sd,{hardware:t})})})}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Cd(n){const{hardware:t}=n,o=n.disabled||!t.online,s=t.properties.state==="AWAITING_USER_INPUT";function r(a){t.actions.call("validate")}return e.jsx(i.ButtonGroup,{size:"lg",className:"w-100",children:e.jsx(i.Button,{onClick:r,disabled:o||!s,variant:"primary",children:"Validate"})})}function Kn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ye,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(Cd,{hardware:t,disabled:!n.operator})}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const $d=["start","abort","clear","validate"],Od="procedure",Id="procedure",Md="procedure",Dd="bliss",Td=!1,Fd=!0,Rd={state:"STANDBY",previous_run_state:"NONE",previous_run_exception:null,parameters:{my_number:10,my_string:"foo",my_null:null,my_boolean:!0,my_dict:{a:10,b:"10",c:!0},my_list:[10,"10",!0],"my_scan_1.11":{__type__:"scan",node:"demo_session:tmp:scans:inhouse:id002405:sample:sample_0002:_1_flat images 1",mmh3:3852826388},"my_scan_2.0":{__type__:"scan",key:"esrf:scan:01J1QDB370S2V8WF7FX2Y9H29V",mmh3:3852826389},my_quantity:{__type__:"quantity",scalar:20,unit:"mm"},my_nan:{__type__:"nan"},my_posinf:{__type__:"posinf"},my_neginf:{__type__:"neginf"},my_obj:{__type__:"hardware",name:"roby"}}},Ad={callables:$d,type:Od,id:Id,name:Md,protocol:Dd,require_staff:Td,online:Fd,properties:Rd},Qn={standby:Ad},Ed={default:Be,manage:Be,execution:Yn,validate:Kn,state:_d},Xn={variants:Ed,mocks:Qn};function Zn(n){return n.type==="procedure"}function kd(n){const t=G(n);return t===null||!Zn(t)?null:t}function Jn(n){return n==="OFF"?"danger":n==="READY"?"success":n==="MOVING"?"transient":"warning"}function it({tooltip:n,children:t}){return e.jsx(i.OverlayTrigger,{placement:"top",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:n}),children:t})}function eo(n){var p,m;const{hardware:t,options:o={}}=n,{showOutput:s=!0,step:r,steps:a}=o;function c(h){return t.actions.call(h)}function l(h){return t.actions.setProperty("setpoint",h)}const u=t.properties.state,f=e.jsx(N,{name:"RegulationLoop",icon:"fa-repeat",online:t.online}),d=e.jsxs(e.Fragment,{children:[e.jsx(D,{state:u,minWidth:6,variant:Jn(u)}),!t.properties.is_softloop&&e.jsx(it,{tooltip:"Start/Stop Monitor",children:e.jsx(i.Button,{size:"sm",variant:t.properties.is_monitoring?"success":"warning",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>{c(t.properties.is_monitoring?"stop_monitor":"start_monitor")},children:e.jsx("i",{className:t.properties.is_monitoring?"fa fa-toggle-on":"fa fa-toggle-off"})})}),e.jsx(it,{tooltip:"Stop Ramping",children:e.jsx(i.Button,{disabled:t.properties.state==="OFF",size:"sm",variant:"danger",className:"ms-1",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>{c("stop_ramping")},children:e.jsx("i",{className:"fa fa-circle-exclamation"})})})]});return e.jsx(_,{hardware:t,widgetIcon:f,widgetState:d,widgetContent:e.jsxs(e.Fragment,{children:[e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(ge,{id:t.id,hardwareValue:t.properties.setpoint??null,hardwareIsDisabled:!1,hardwareIsMoving:!1,hardwareIsReady:!0,onMoveRequested:l,onAbortRequested:()=>null,precision:1,readOnly:!1,step:r,steps:a,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),t.properties.input_unit&&e.jsx(i.InputGroup.Text,{children:t.properties.input_unit})]}),e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"I"}),e.jsx(i.Form.Control,{type:"number",disabled:!0,value:(p=t.properties.input_value)==null?void 0:p.toFixed(2)}),t.properties.input_unit&&e.jsx(i.InputGroup.Text,{children:n.hardware.properties.input_unit}),s&&e.jsxs(e.Fragment,{children:[e.jsx(i.InputGroup.Text,{children:"O"}),e.jsx(i.Form.Control,{type:"number",disabled:!0,value:(m=t.properties.output_value)==null?void 0:m.toFixed(2)}),t.properties.output_unit&&e.jsx(i.InputGroup.Text,{children:n.hardware.properties.output_unit})]})]})]})})}function to(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r}=s,a=o.name??t.alias??t.name,c=Jn(r);let l=t.properties.input_value;return Number.isFinite(l)&&(l=l.toFixed(2)),e.jsxs(X,{children:[e.jsx("h1",{children:a}),e.jsxs(i.Badge,{bg:c,children:[l," ",t.properties.input_unit]})]})}function Pd({curves:n}){const t=n[0].x??[],o=H.useValueToIndexScale(t,!0),{abscissaConfig:s}=H.useVisCanvasContext();return e.jsx(H.TooltipMesh,{guides:"both",renderTooltip:r=>{const a=o(r);return e.jsxs("div",{className:"h5web-tooltip",children:[s.label||"x","=",t[a],n.map(c=>e.jsxs("div",{children:[e.jsx("span",{style:{content:"",display:"inline-block",width:"0.75em",height:"0.375rem",marginRight:"0.375rem",paddingBottom:"0.125rem",backgroundColor:c.color,transform:"translateY(-1px)"},"data-keep-colors":!0}),e.jsxs("strong",{children:[c.name,":"]})," ",c.y[a].toFixed(2)]},c.name))]})}})}const at=["#1f77b4","#ff7f0e","#d62728","#2ca02c"],ct=[.1,1],lt=6;function dt(n){const{data:t,xAxisTitle:o,yAxisTitle:s,title:r}=n,a=t.flatMap((u,f)=>{const d=u.x;let p=u.y;return d.length<p.length&&(p=p.slice(0,d.length)),[{color:u.color??at[f%at.length],name:u.name,x:[...H.getAxisValues(d,p.length)],y:p}]}),c=H.useCombinedDomain(H.useDomains(a.map(u=>u.x)))||ct,l=H.useCombinedDomain(H.useDomains(a.map(u=>u.y)))||ct;return e.jsxs(H.VisCanvas,{title:r,abscissaConfig:{visDomain:c,showGrid:!0,label:o},ordinateConfig:{visDomain:l,showGrid:!0,label:s},raycasterThreshold:lt,children:[a.map(u=>e.jsx(H.DataCurve,{abscissas:u.x,ordinates:u.y,color:u.color,glyphSize:lt,glyphType:H.GlyphType.Circle},u.name)),e.jsx(H.Zoom,{}),e.jsx(H.Pan,{}),e.jsx(Pd,{curves:a})]})}const $e=100;function Oe(n,t){const[o,s]=g.useState(new Array(n).fill(null)),r=g.useRef(0);function a(l){s(u=>{const f=[...u];return r.current===n-1?(f.shift(),f.push(l)):(f[r.current]=l,r.current=(r.current+1)%n),f})}function c(){return o.filter(l=>l!==null)}return{read:c,write:a,name:t}}function We(n){const{hardware:t,options:o}=n,{showOutput:s=!0,plotHeight:r,plotWidth:a}=o,c=Oe($e,"Time"),l=Oe($e,"Input"),u=Oe($e,"Output"),f=Oe($e,"Setpoint");g.useEffect(()=>{c.write(Date.now()),l.write(t.properties.input_value),u.write(t.properties.output_value),f.write(t.properties.setpoint)},[t.properties]);const d=Date.now(),p=c.read().map(j=>-(d-j)/1e3),m=[l,f].map(j=>({name:j.name,x:p,y:j.read()})),h=[u].map(j=>({name:j.name,x:p,y:j.read()})),w={x:p,y:p.map(()=>t.properties.setpoint+(t.properties.deadband??0)),name:"Deadband+",color:"green"},x={x:p,y:p.map(()=>t.properties.setpoint-(t.properties.deadband??0)),name:"Deadband-",color:"green"};return e.jsx(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"vertical",children:e.jsxs("div",{className:"h5web-plot",style:{display:"flex",height:r??"20rem",width:a},children:[e.jsx(dt,{data:[...m,w,x],title:"Input",xAxisTitle:"Time (s)",yAxisTitle:t.properties.input_unit}),s&&e.jsx(dt,{data:h,title:"Output",xAxisTitle:"Time (s)",yAxisTitle:t.properties.output_unit})]})})}function Bd(n){const{hardware:t,options:o}=n,{showOutput:s=!0,popupPlacement:r="right",plotWidth:a}=o,c=e.jsxs(i.Popover,{id:`regulation-plot-${t.name}`,style:{maxWidth:a??s?300*2:276},children:[e.jsxs(i.Popover.Header,{as:"h3",children:["Regulation Plot for `",n.hardware.name,"`"]}),e.jsx(i.Popover.Body,{children:e.jsx(We,{...n})})]});return e.jsx(i.OverlayTrigger,{trigger:"click",placement:r,overlay:c,children:e.jsx(i.Button,{children:o.buttonTitle??"Plot"})})}const Gd=null,Ld=[],Hd=null,Ud="regulation",Vd=!0,qd={deadband:.05,input_unit:"degC",input_value:10.029739616019928,is_monitoring:!1,output_unit:"Volt",output_value:8.556047391201504,setpoint:10,state:"READY"},Wd="regulation",zd=[],Yd={alias:Gd,errors:Ld,locked:Hd,name:Ud,online:Vd,properties:qd,type:Wd,user_tags:zd},no={default:Yd};function oo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("READY"),[c,l]=g.useState(0),[u,f]=g.useState(0),[d,p]=g.useState(10),m=g.useRef(Date.now()),h=()=>{const y=Date.now(),S=(y-m.current)/1e3;let $,b;if(m.current=y,d!==null&&d!==c){let v;const C=S*2,I=Math.random()*.1-.05;if(C>Math.abs(c-d)+.05)$=d+I,v="READY",b=-I*5;else{const M=d>c?1:-1;$=c+M*C,b=10*M,v="MOVING"}l($),f(b),a(v)}};async function w(y,S){console.log("RegulationSimulator: Unsupported call",y,S)}async function x(y,S){y==="setpoint"&&p(S),console.log("RegulationSimulator: Unsupported setProperty",y,S)}g.useEffect(()=>{const y=setInterval(()=>{h()},500);return()=>clearInterval(y)});const j={state:r,deadband:.05,input_unit:"degC",input_value:c,is_monitoring:!0,output_unit:"Volt",output_value:u,setpoint:d};return e.jsx(V,{name:t,alias:o,type:"regulation",call:w,setProperty:x,properties:j,useHardwareContext:s})}const Kd={default:eo,plot:We,popupplot:Bd,monitor:to},so={variants:Kd,mocks:no,simulator:oo,monitor:to};function ve(n){const{hardware:t}=n;function o(){if(!t.online)return"OFFLINE";const a=t.properties.state;return n.useReadyState&&(a==="OPEN"||a==="CLOSED")?"READY":a}const s=o();function r(){switch(s){case"READY":return"success";case"OPEN":return"success";case"CLOSED":return"danger";case"OFFLINE":case"DISABLED":return"secondary";case"MOVING":return"transient";case"STANDBY":return"warning";case"FAULT":return"fatal";default:return"fatal"}}return e.jsx(D,{state:s,minWidth:6,variant:r()})}function Qd(n){const{hardware:t}=n;return e.jsx(ve,{hardware:t,useReadyState:!0})}function Xd(n){const{hardware:t}=n;function o(){t.actions.call("reset")}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{onClick:o,disabled:n.disabled,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Shutter Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function ro(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(ve,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(x){return x==="OPEN"?["Close","close"]:x==="CLOSED"?["Open","open"]:x==="DISABLED"||x==="STANDBY"||x==="FAULT"?["Closed",""]:x==="MOVING"?["...",""]:["Unknown",""]}const l=a(),[u,f]=c(l),p={OPEN:"danger",CLOSED:"success",MOVING:"transient",DISABLED:"secondary",STANDBY:"danger",FAULT:"fatal",UNKNOWN:"warning"}[l]||"danger";function m(){t.actions.call(f)}const h=e.jsxs(i.ButtonGroup,{className:"d-flex flex-nowrap",children:[e.jsx(i.Button,{variant:p,onClick:m,disabled:n.disabled||f==="",children:u}),o.extended&&e.jsx(Xd,{...n})]}),w=n.options.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:h,headerMode:w})}function Zd(n){var u;const{hardware:t,options:o={}}=n;function s(){t.actions.call("open")}function r(){t.actions.call("close")}const a=((u=t.properties)==null?void 0:u.state)??"UNKNOWN",c=a==="MOVING",l=a==="DISABLED"||c;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:n.disabled||l}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:c?"warning":"secondary",onClick:()=>{s()},disabled:n.disabled||l,title:"Open the shutter",children:"Open"}),e.jsx(i.Button,{variant:c?"warning":"secondary",onClick:()=>{r()},disabled:n.disabled||l,title:"Close the shutter",children:"Close"})]})})})]})})]})}function io(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(ve,{hardware:t,useReadyState:!0});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(x){return x==="OPEN"||x==="CLOSED"?x:x==="DISABLED"||x==="STANDBY"||x==="FAULT"?"CLOSED":x==="MOVING"?"...":"UNKNOWN"}function l(x){return x.charAt(0).toUpperCase()+x.slice(1).toLowerCase()}const u=a(),f=c(u),p={OPEN:"success",CLOSED:"danger",MOVING:"transient",DISABLED:"secondary",STANDBY:"success",FAULT:"fatal",UNKNOWN:"fatal"}[u],m=l(f),h=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:p,className:"text-center",style:{minWidth:"10em"},value:m}),e.jsx(Zd,{...n})]}),w=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:h,headerMode:w})}function ao(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r="OFFLINE",status:a}=s,c=o.name??t.alias??t.name,l=e.jsxs(X,{children:[e.jsx("h1",{children:c}),e.jsx(ve,{hardware:t})]});if(a){const u=`${a}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:u.includes(`
|
|
31
31
|
`)?e.jsx("pre",{children:u}):u}),children:l})}return l}const Jd=["reset","open","close","toggle"],eu="abs1",tu="abs1",nu=!0,ou={closed_text:"",open_text:"",state:"OPEN",status:`Pneumatic Beam Shutter is open
|
|
32
32
|
`,valid:!0},su="tango",ru=!0,iu="shutter",au={callables:Jd,id:eu,name:tu,online:nu,properties:ou,protocol:su,require_staff:ru,type:iu},cu=["reset","open","close","toggle"],lu="abs1",du="abs1",uu=!0,fu={closed_text:"",open_text:"",state:"CLOSED",status:`Pneumatic Beam Shutter is closed
|
|
33
|
-
`,valid:!0},pu="tango",mu=!0,hu="shutter",gu={callables:cu,id:lu,name:du,online:uu,properties:fu,protocol:pu,require_staff:mu,type:hu},
|
|
33
|
+
`,valid:!0},pu="tango",mu=!0,hu="shutter",gu={callables:cu,id:lu,name:du,online:uu,properties:fu,protocol:pu,require_staff:mu,type:hu},co={default:au,closed:gu};function lo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("OPEN");async function c(f,d){if(f==="open"){a("MOVING"),await L(2e3),a("OPEN");return}if(f==="close"){a("MOVING"),await L(2e3),a("CLOSED");return}console.log("ShutterSimulator: Unsupported call",f,d)}async function l(f,d){console.log("ShutterSimulator: Unsupported setProperty",f,d)}const u={state:r,closed_text:"",open_text:"",status:`Shutter is ${r}`,valid:!0};return e.jsx(V,{name:t,alias:o,type:"shutter",call:c,setProperty:l,properties:u,useHardwareContext:s})}const xu={default:ro,protected:io,state:Qd,monitor:ao},uo={variants:xu,mocks:co,simulator:lo,monitor:ao};function wu(n){var d,p,m,h;const{properties:t}=n,o=(d=t.vgap)==null?void 0:d.slice(9),s=U(o),r=(p=t.hgap)==null?void 0:p.slice(9),a=U(r),c=(m=t.voffset)==null?void 0:m.slice(9),l=U(c),u=(h=t.hoffset)==null?void 0:h.slice(9),f=U(u);return g.useMemo(()=>{var w,x,j,y;return{vgap:((w=s==null?void 0:s.properties)==null?void 0:w.state)??null,hgap:((x=a==null?void 0:a.properties)==null?void 0:x.state)??null,voffset:((j=l==null?void 0:l.properties)==null?void 0:j.state)??null,hoffset:((y=f==null?void 0:f.properties)==null?void 0:y.state)??null}},[s,a,l,f])}function ze(n){const{hardware:t}=n,o=wu(t),[s,r,a]=g.useMemo(()=>{if(!t.online)return["OFFLINE","secondary","No motor online"];if(o.vgap===null&&o.hgap===null&&o.voffset===null&&o.hoffset===null)return["OFFLINE","secondary","No motor online"];const c=new Set([...o.vgap??[],...o.hgap??[],...o.voffset??[],...o.hoffset??[]]);return c.has("MOVING")?["MOVING","transient","A motor is moving"]:c.has("OFF")?["OFF","secondary","A motor is off"]:["READY","success","The slit is ready"]},[t.online,o]);return e.jsx(D,{state:s,description:a,variant:r,minWidth:6})}function ju(n){const{hardware:t}=n;return e.jsx(ze,{hardware:t})}function yu(n){var x,j,y,S;const{properties:t}=n,o=(x=t.vgap)==null?void 0:x.slice(9),s=U(o),r=oe(o),a=(j=t.hgap)==null?void 0:j.slice(9),c=U(a),l=oe(a),u=(y=t.voffset)==null?void 0:y.slice(9),f=U(u),d=oe(u),p=(S=t.hoffset)==null?void 0:S.slice(9),m=U(p),h=oe(p);function w($,b){return $===null?null:{...$,actions:b}}return{vgap:w(s,r),hgap:w(c,l),voffset:w(f,d),hoffset:w(m,h)}}function vu(n){const{hardware:t,operator:o,disabled:s,resolved:r}=n;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary"}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{className:"flex-nowrap",children:[e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("i",{className:"fa fa-fw fa-square",title:"Gap",style:{alignSelf:"center"}})}),e.jsx(i.Col,{sm:5,children:r.hgap&&e.jsx(ce,{hardware:r.hgap,options:{header:"none"},disabled:s,operator:o})}),e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("span",{style:{alignSelf:"center"},children:"×"})}),e.jsx(i.Col,{sm:5,children:r.vgap&&e.jsx(ce,{hardware:r.vgap,options:{header:"none"},disabled:s,operator:o})})]}),e.jsxs(i.Row,{className:"flex-nowrap",children:[e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("i",{className:"fa fa-fw fa-arrows-up-down-left-right ",title:"Offset",style:{alignSelf:"center"}})}),e.jsx(i.Col,{sm:5,children:r.hoffset&&e.jsx(ce,{hardware:r.hoffset,options:{header:"none"},disabled:s,operator:o})}),e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("span",{style:{alignSelf:"center"},children:";"})}),e.jsx(i.Col,{sm:5,children:r.voffset&&e.jsx(ce,{hardware:r.voffset,options:{header:"none"},disabled:s,operator:o})})]})]})})]})}function Nu(n){const{hardware:t,options:o={}}=n,s=yu(t),{readonly:r=!1}=o;function a(m){var x,j;const h=((x=m==null?void 0:m.properties)==null?void 0:x.position)??null;if(h===null)return"∅";const w=o.precision??((j=m==null?void 0:m.properties)==null?void 0:j.display_digits)??void 0;return w!==void 0?h.toFixed(w):`${h}`}const[c,l,u,f,d,p]=g.useMemo(()=>{var b,v,C,I,M,k,O,Y;const m=`${a(s.hgap)} × ${a(s.vgap)}`,h=((b=s.hgap)==null?void 0:b.properties.unit)??((v=s.vgap)==null?void 0:v.properties.unit)??"?",x=new Set([...((C=s.hgap)==null?void 0:C.properties.state)??[],...((I=s.vgap)==null?void 0:I.properties.state)??[]]).has("MOVING"),j=`${a(s.hoffset)} ; ${a(s.voffset)}`,y=((M=s.hoffset)==null?void 0:M.properties.unit)??((k=s.voffset)==null?void 0:k.properties.unit)??"?",$=new Set([...((O=s.hoffset)==null?void 0:O.properties.state)??[],...((Y=s.voffset)==null?void 0:Y.properties.state)??[]]).has("MOVING");return[m,h,x,j,y,$]},[s.hgap,s.hoffset,s.vgap,s.voffset]);return e.jsxs(i.InputGroup,{className:"w-100 flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Gap (horizontal and vertical)",children:e.jsx("i",{className:"fa fa-fw fa-square fa-2x"})}),e.jsx(B,{value:c,title:"Gap",className:q.default({"hw-moving":u})}),e.jsx(i.InputGroup.Text,{children:l}),e.jsx(i.InputGroup.Text,{title:"Offset (horizontal and vertical)",children:e.jsx("i",{className:"fa fa-fw fa-arrows-up-down-left-right fa-2x"})}),e.jsx(B,{value:f,title:"Offset",className:q.default({"hw-moving":p})}),e.jsx(i.InputGroup.Text,{children:d}),!r&&e.jsx(vu,{...n,resolved:s})]})}function fo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Slit",icon:"fam-hardware-motor",online:t.online}),r=e.jsx(ze,{hardware:t}),a=e.jsx(Nu,{...n}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const bu="s1",_u="s1",Su=!0,Cu={vgap:"hardware:s1vg",voffset:"hardware:s1vo",hgap:"hardware:s1hg",hoffset:"hardware:s1ho"},$u="slit",Ou={id:bu,name:_u,online:Su,properties:Cu,type:$u},Iu="s1",Mu="s1",Du=!0,Tu={vgap:"hardware:",voffset:"hardware:",hgap:"hardware:s1hg",hoffset:"hardware:s1ho"},Fu="slit",Ru={id:Iu,name:Mu,online:Du,properties:Tu,type:Fu},Au="s1",Eu="s1",ku=!0,Pu={vgap:"hardware:s1vg",voffset:"hardware:s1vo",hgap:"hardware:",hoffset:"hardware:"},Bu="slit",Gu={id:Au,name:Eu,online:ku,properties:Pu,type:Bu},po={default:Ou,horizontal:Ru,vertical:Gu},Lu={default:fo,state:ju},mo={variants:Lu,mocks:po};function Hu(n){const{hardware:t}=n,o=()=>{t.actions.call(t.properties.state==="ON"?"off":"on")},s={Voltage:`${t.properties.voltage.toFixed(0)} V`,Current:`${(t.properties.current*1e3).toFixed(2)} mA`};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("h6",{children:"Properties"}),e.jsx(i.Container,{children:P.map(s,(r,a)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[a,":"]}),e.jsx(i.Col,{children:r})]},a))}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,variant:t.properties.state==="ON"?"danger":"success",children:t.properties.state==="ON"?"Off":"On"})})]})]}),children:e.jsx(i.Button,{title:"Pump Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function ho(n){const{hardware:t,options:o={}}=n;return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Pump",icon:"fam-hardware-pump",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="ON"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{value:t.properties.pressure.toExponential(o.precision||3),disabled:!0}),(t.properties.unit||o.unit)&&e.jsx(i.InputGroup.Text,{children:t.properties.unit||o.unit}),e.jsx(Hu,{...n})]})})]})}const Uu=["off","on"],Vu="ip121",qu="ip121",Wu=!0,zu={current:.0003000000142492354,pressure:26000000730164174e-23,state:"ON",status:`Pump is ON
|
|
34
34
|
Modes: Step/Protect
|
|
35
35
|
ID21/v-var-ctrl/121 - Serial line OK
|
|
36
36
|
Pump size: 75-55-40 SC/T
|
|
37
|
-
`,voltage:6998},Yu="tango",Ku=!0,Qu="pump",Xu={callables:Uu,id:Vu,name:qu,online:Wu,properties:zu,protocol:Yu,require_staff:Ku,type:Qu},ho={default:Xu},Zu={default:mo},go={variants:Zu,mocks:ho};function Ye(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={RETRACTED:"success",IN_TOUCH:"warning",LOST:"warning",MOVING_IN:"transient",MOVING_OUT:"transient",UNKNOWN:"danger",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function Ju(n){const{hardware:t}=n;return e.jsx(Ye,{hardware:t})}function Ie(n){const{text:t,icon:o,leftIcon:s=o,rightIcon:r=o,iconLocation:a="left",onAction:c,onActionChange:l,disabled:u=!1,variant:f,style:d={},className:p=""}=n,[m,h]=g.useState(!1),w=r&&a==="right",x=s&&a==="left";return e.jsx(i.Button,{variant:f,style:d,className:p,onClick:()=>{l==null||l(!0),h(!0),c().finally(()=>{h(!1),l==null||l(!1)})},disabled:u,children:e.jsxs("span",{className:"text-nowrap",children:[x&&e.jsxs(e.Fragment,{children:[e.jsx("i",{className:m?"fa-solid fa-fw fa-cog fa-spin":s})," "]}),t,w&&e.jsxs(e.Fragment,{children:[" ",e.jsx("i",{className:m?"fa-solid fa-fw fa-cog fa-spin":r})]})]})})}function ef(n){const{className:t,hardware:o,options:s={},style:r={},leftToRight:a}=n,{state:c}=o.properties??"OFFLINE",u=!(c==="IN_TOUCH")||n.disabled;function f(d){const{distance:p,style:m}=d;return e.jsx(Ie,{text:`${p}`,style:m,variant:"secondary",onAction:()=>o.actions.call("push",p),disabled:u,leftIcon:"fa fa-fw fa-arrow-left",rightIcon:"fa fa-fw fa-arrow-right",iconLocation:a?"right":"left"})}return e.jsxs("div",{className:t,style:{display:"grid",gridTemplateRows:"min-content min-content min-content",gridTemplateColumns:"min-content min-content min-content",gridGap:"1px",...r},children:[e.jsx(f,{distance:5,style:{gridColumn:a?3:1,gridRow:1}}),e.jsx(f,{distance:.5,style:{gridColumn:2,gridRow:1}}),e.jsx(f,{distance:.05,style:{gridColumn:a?1:3,gridRow:1}}),e.jsx(f,{distance:2,style:{gridColumn:a?3:1,gridRow:2}}),e.jsx(f,{distance:.2,style:{gridColumn:2,gridRow:2}}),e.jsx(f,{distance:.02,style:{gridColumn:a?1:3,gridRow:2}}),e.jsx(f,{distance:1,style:{gridColumn:a?3:1,gridRow:3}}),e.jsx(f,{distance:.1,style:{gridColumn:2,gridRow:3}}),e.jsx(f,{distance:.01,style:{gridColumn:a?1:3,gridRow:3}})]})}function tf(n){const{hardware:t,options:o,disabled:s,leftToRight:r}=n,{state:a}=t.properties??"OFFLINE",c=a==="RETRACTED",l=a==="IN_TOUCH",u=a==="LOST",[f,d]=g.useState(!1);function p(){return c?r?"ms-0":"ms-auto":l?r?"ms-auto":"ms-0":"mx-auto"}const m=p();return e.jsxs("div",{style:{display:"grid",gridTemplateRows:"min-content min-content",gridTemplateColumns:r?"auto min-content":"min-content auto",gridGap:"1px"},children:[e.jsx("i",{className:`${l||u?"fas fa-dizzy":"fa fa-smile"} fa-3x my-auto`,style:{gridColumn:r?2:1,gridRow:1}}),e.jsx(ef,{className:m,...n,style:{gridColumn:r?1:2,gridRow:1}}),e.jsxs(i.ButtonGroup,{className:"mx-auto",style:{width:"12em",gridColumn:r?1:2,gridRow:2},children:[!r&&e.jsx(Ie,{text:"In",onAction:()=>t.actions.call("move_in"),onActionChange:h=>{d(h)},disabled:l||s||f,style:{width:"5em"},iconLocation:"left",icon:"fa fa-fw fa-arrow-left"}),e.jsx(Ie,{text:"Out",onAction:()=>t.actions.call("move_out"),onActionChange:h=>{d(h)},iconLocation:r?"left":"right",disabled:c||s||f,style:{width:"5em"},leftIcon:"fa fa-fw fa-arrow-left",rightIcon:"fa fa-fw fa-arrow-right"}),r&&e.jsx(Ie,{text:"In",onAction:()=>t.actions.call("move_in"),onActionChange:h=>{d(h)},disabled:l||s||f,style:{width:"5em"},iconLocation:"right",icon:"fa fa-fw fa-arrow-right"})]})]})}function xo(n){const{hardware:t,options:o={}}=n,s=(o.orientation??"right-left")==="left-right",r=e.jsx(N,{name:"Pusher",icon:"fa-hand-point-right",online:t.online}),a=e.jsx(Ye,{hardware:t});function c(){return e.jsx(tf,{...n,leftToRight:s})}const l=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:c(),headerMode:l})}const nf=["move_in","move_out","push","sync_hard"],of="pusher",sf="pusher",rf=!0,af={state:"RETRACTED"},cf="bliss",lf=!1,df="pusher",uf={callables:nf,id:of,name:sf,online:rf,properties:af,protocol:cf,require_staff:lf,type:df},wo={default:uf};function jo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("RETRACTED");async function c(f,d){if(f==="move_in"){a("MOVING_IN"),await L(2e3),a("IN_TOUCH");return}if(f==="move_out"){a("MOVING_OUT"),await L(2e3),a("RETRACTED");return}if(f==="push"){await L(100);return}console.log("PusherSimulator: Unsupported call",f,d)}async function l(f,d){console.log("PusherSimulator: Unsupported setProperty",f,d)}const u={state:r};return e.jsx(V,{name:t,alias:o,type:"pusher",call:c,setProperty:l,properties:u,useHardwareContext:s})}const ff={default:xo,state:Ju},yo={variants:ff,mocks:wo,simulator:jo};function Re(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={STOPPED:"danger",STARTING:"transient",RUNNING:"success",BACKOFF:"warning",STOPPING:"transient",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"fatal",OFFLINE:"secondary"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function pf(n){const{hardware:t}=n;return e.jsx(Re,{hardware:t})}function vo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(Re,{hardware:t});function a(){t.actions.call("start")}function c(){t.actions.call("restart")}function l(){t.actions.call("stop")}function u(){return t.properties?t.properties.state:"UNKNOWN"}function f(b){return b.charAt(0).toUpperCase()+b.slice(1).toLowerCase()}const d=u(),p=f(d),h={STOPPED:"danger",STARTING:"transient",RUNNING:"success",BACKOFF:"warning",STOPPING:"transient",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"secondary",OFFLINE:"secondary"}[d]||"danger";function w(){const b=d==="RUNNING"||d==="STARTING";return{icon:b?"fa fa-refresh fa-wp":"fa fa-play fa-wp",variant:n.disabled?"":"success",callback:d==="RUNNING"?c:a,disabled:n.disabled,title:n.operator?b?"Restart the service":"Start the serStaticTextInputvice":"You dont have the control to the session"}}function x(){const b=d==="RUNNING"||d==="STARTING";return{icon:"fa fa-stop fa-wp",variant:n.disabled?"":b?"danger":"secondary",callback:l,disabled:n.disabled,title:n.operator?"Stop the service":"You dont have the control to the session"}}const j=w(),y=x(),S=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:h,className:"text-center",style:{minWidth:"8em"},value:p}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${j.variant}`,onClick:j.callback,disabled:j.disabled,title:j.title,children:e.jsx("i",{className:`${j.icon}`})}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${y.variant}`,onClick:y.callback,disabled:y.disabled,title:y.title,children:e.jsx("i",{className:`${y.icon}`})})]}),$=n.options.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:S,headerMode:$})}function mf(n){var u;const{hardware:t,options:o={}}=n;function s(){t.actions.call("start")}function r(){t.actions.call("restart")}function a(){t.actions.call("stop")}const c=((u=t.properties)==null?void 0:u.state)??"UNKNOWN",l=c==="STOPPING"||c==="STARTING";return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,placement:o.dropDirection==="up"?"top":"bottom",overlay:e.jsx(i.Popover,{id:"service-protected-overlay",children:e.jsxs(i.Popover.Body,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsxs(i.Col,{children:[c==="RUNNING"&&e.jsxs(i.Button,{className:"me-1 text-success border-secondary",variant:"light",onClick:()=>{r()},disabled:n.disabled,title:"Restart the service",children:[e.jsx("i",{className:"fa fa-refresh fa-wp me-1"}),"Restart"]}),c!=="RUNNING"&&e.jsxs(i.Button,{className:"me-1 text-success border-secondary",variant:"light",onClick:()=>{s()},disabled:n.disabled,title:"Start the service",children:[e.jsx("i",{className:"fa fa-play fa-wp me-1"}),"Start"]}),e.jsxs(i.Button,{className:`text-${c!=="STOPPED"?"danger":"primary"} border-secondary`,variant:"light",onClick:()=>{a()},disabled:n.disabled,title:"Stop the service",children:[e.jsx("i",{className:"fa fa-stop fa-wp me-1"}),"Stop"]})]})})]})}),children:e.jsx(i.Button,{disabled:n.disabled||l,children:e.jsx("i",{className:`fa fa-caret-${o.dropDirection==="up"?"up":"down"}`})})})}function No(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(Re,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(h){return h.charAt(0).toUpperCase()+h.slice(1).toLowerCase()}const l=a(),f={STOPPED:"danger",STARTING:"transient",RUNNING:"success",BACKOFF:"warning",STOPPING:"transient",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"fatal",OFFLINE:"secondary"}[l],d=c(l),p=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:f,style:{minWidth:"10em"},value:d,className:"text-center"}),e.jsx(mf,{...n})]}),m=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:p,headerMode:m})}const hf=["start","stop","restart"],gf="service1",xf="service1",wf=!0,jf={state:"RUNNING"},yf="multivisor",vf=!0,Nf="service",bf={callables:hf,id:gf,name:xf,online:wf,properties:jf,protocol:yf,require_staff:vf,type:Nf},bo={default:bf},_f={default:vo,protected:No,state:pf},_o={variants:_f,mocks:bo};function Ne(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:["success","Ready to be used"],IN:["success","The sample is in the beam"],OUT:["danger","The sample is out of the beam"],MOVING_IN:["transient","The sample moving in the beam"],MOVING_OUT:["transient","The sample moving out of the beam"],LOST:["warning","The motion was interrupted between IN and OUT positions"],UNKNOWN:["fatal","The device have an unknown state"]},[r,a]=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r,description:a})}function Sf(n){const{hardware:t}=n;return e.jsx(Ne,{hardware:t})}function Cf(n){const{motion:t}=n,s=t.axisRef.slice(9),r=U(s),a=(r==null?void 0:r.alias)??(r==null?void 0:r.name)??(r==null?void 0:r.id)??s;return e.jsx("div",{className:"my-auto",children:a})}function $f(n){const{motion:t,actions:o,disabled:s}=n,r=t.axisRef;function a(){o.call("update_axis",{axis_ref:r})}return e.jsx(i.Button,{variant:"danger",onClick:a,disabled:s,children:e.jsx("i",{className:"fa fa-trash"})})}function Of(n){const{motion:t,actions:o,axisRef:s,disabled:r}=n,a=g.useMemo(()=>{for(const d of t)if(d.axisRef===s)return!0;return!1},[t,s]),c=s.slice(9),l=U(c),u=(l==null?void 0:l.alias)??(l==null?void 0:l.name)??(l==null?void 0:l.id)??c;function f(){o.call("update_axis",{axis_ref:s,relative_position:0})}return e.jsx(i.Button,{className:"ms-1",variant:a?"primary":"secondary",onClick:()=>{a||f()},title:a?"This axis is already part of the motion":"Use this axis in the motion",disabled:r,children:u})}function If(n){var x;const{motion:t,actions:o}=n,s=t.axisRef,r=t.absolute_position??t.relative_position??0,a=s.slice(9),c=U(a),l=n.disabled||!(c!=null&&c.online),u=g.useRef(null),[f,d]=g.useState(!1),p=3,m=((x=c==null?void 0:c.properties)==null?void 0:x.unit)??"";function h(j){if(!u||!u.current)console.log("formRef not yet defined");else if(j.key==="Enter"){d(!1);const y=Number.parseFloat(u.current.value);o.call("update_axis",{axis_ref:s,absolute_position:t.absolute_position!==null?y:null,relative_position:t.relative_position!==null?y:null})}else j.key==="Escape"?(u.current.value=r.toFixed(p),d(!1)):console.log(j.key)}function w(j){const{value:y}=j.target;if(y===void 0)return;const S=Number.parseFloat(y);S!==r&&!f&&d(!0),S===r&&f&&d(!1)}return g.useEffect(()=>{!u||!u.current?console.log("formRef not yet defined"):f||(u.current.value=r.toFixed(p))},[f,r]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:f?"form-control-edited":"",type:"number",ref:u,defaultValue:r.toFixed(p),onChange:w,disabled:l,onKeyDown:h}),e.jsx(i.InputGroup.Text,{children:m})]})}function Mf(n){const{actions:t,motion:o,disabled:s}=n;function r(){t.call("update_axis",{axis_ref:o.axisRef,absolute_position:o.absolute_position??o.relative_position})}function a(){t.call("update_axis",{axis_ref:o.axisRef,relative_position:o.absolute_position??o.relative_position})}return e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{onClick:r,variant:o.absolute_position!==null?"primary":"secondary",disabled:s,children:"Abs"}),e.jsx(i.Button,{onClick:a,variant:o.relative_position!==null?"primary":"secondary",disabled:s,children:"Rel"})]})}function So(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,a=Do(t),c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(Ne,{hardware:t}),u=e.jsxs(i.Container,{children:[e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Move in parallel"}),e.jsx(i.Col,{xs:9,children:r.move_in_parallel?"true":"false"})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Switch power on/off"}),e.jsx(i.Col,{xs:9,children:r.power_onoff?"true":"false"})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Settle time"}),e.jsxs(i.Col,{xs:9,children:[r.settle_time.toFixed(2)," ",e.jsx("span",{title:"seconds",children:"s"})]})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Available axes"}),e.jsx(i.Col,{xs:9,children:r.available_axes.map(d=>e.jsx(Of,{axisRef:d,motion:r.motion,actions:t.actions,disabled:s||!a},d))})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Actual motion"}),e.jsx(i.Col,{xs:9,children:e.jsxs("div",{style:{display:"grid",gridGap:5,gridTemplateColumns:"min-content min-content auto min-content"},children:[e.jsx("div",{children:"Axis"}),e.jsx("div",{children:"Kind"}),e.jsx("div",{children:"Displacement"}),e.jsx("div",{}),r.motion.map((d,p)=>e.jsxs(g.Fragment,{children:[e.jsx(Cf,{motion:d}),e.jsx(Mf,{motion:d,actions:t.actions,disabled:s||!a}),e.jsx(If,{motion:d,actions:t.actions,disabled:s||!a}),e.jsx($f,{motion:d,actions:t.actions,disabled:s||!a})]},`motion${p}`))]})})]})]}),f=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:u,headerMode:f})}function Df(n){var b;const{motion:t,actions:o}=n,s=t.axisRef,r=t.absolute_position??t.relative_position??0,a=s.slice(9),c=U(a),l=n.disabled||!(c!=null&&c.online),u=g.useRef(null),[f,d]=g.useState(!1),p=3,m=((b=c==null?void 0:c.properties)==null?void 0:b.unit)??"",h=(c==null?void 0:c.alias)??(c==null?void 0:c.name)??(c==null?void 0:c.id)??"none";function w(v){if(!u||!u.current)console.log("formRef not yet defined");else if(v.key==="Enter"){d(!1);const C=Number.parseFloat(u.current.value);o.call("update_axis",{axis_ref:s,absolute_position:t.absolute_position!==null?C:null,relative_position:t.relative_position!==null?C:null})}else v.key==="Escape"?(u.current.value=r.toFixed(p),d(!1)):console.log(v.key)}function x(v){const{value:C}=v.target;if(C===void 0)return;const I=Number.parseFloat(C);I!==r&&!f&&d(!0),I===r&&f&&d(!1)}g.useEffect(()=>{!u||!u.current?console.log("formRef not yet defined"):f||(u.current.value=r.toFixed(p))},[f,r]);function j(){return t.absolute_position!==null?["ABS","warning","Absolute displacement"]:t.relative_position!==null?["REL","none","Relative displacement"]:["ERR","danger","Unknown motion kind"]}const[y,S,$]=j();return e.jsxs(i.InputGroup,{className:"w-100 flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Displacement to apply on this axis to take a flat",style:{width:"5em"},children:h}),e.jsx(i.InputGroup.Text,{className:`bg-${S}`,title:$,style:{width:"3em"},children:y}),e.jsx(i.Form.Control,{className:f?"form-control-edited":"",type:"number",ref:u,defaultValue:r.toFixed(p),onChange:x,disabled:l,onKeyDown:w}),e.jsx(i.InputGroup.Text,{children:m})]})}function Co(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,a=Do(t),c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(Ne,{hardware:t}),u=e.jsxs(e.Fragment,{children:[r.motion.length===0&&e.jsx(i.Alert,{variant:"danger",className:"mb-0",children:"No flat motion defined"}),r.motion.length>0&&e.jsx(i.Stack,{direction:"vertical",children:r.motion.map((d,p)=>e.jsx(Df,{actions:t.actions,motion:d,disabled:s||!a},d.axisRef))})]}),f=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:u,headerMode:f})}function Tf(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r}=t,{state:a="UNKNOWN"}=r,c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(Ne,{hardware:t}),u=a==="IN",f=a==="OUT";function d(){return u?"1 / 3":f?"3 / 5":"2 / 4"}const p=d(),m=u?"fa-face-grin-beam-sweat":"fa-smile",h=u?"The sample is in front of the beam":f?"The sample is out of the beam":"",w=e.jsx("div",{style:{display:"grid",gridGap:0,gridTemplateColumns:"1fr 1fr 1fr 1fr 1fr 1fr",gridTemplateRows:"1fr"},children:e.jsx("i",{className:`fa ${m} fa-3x my-auto mx-auto`,style:{gridColumn:p,gridRow:1},title:h})}),x=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:w,headerMode:x})}const Ff="tomoflatmotion",Rf="tomoflatmotion",Af=!0,Ef={state:"READY",settle_time:2,power_onoff:!1,move_in_parallel:!0,available_axes:["hardware:sy","hardware:sy2"],motion:[{axisRef:"hardware:sy",absolute_position:null,relative_position:1}]},kf="bliss",Pf=!1,Bf="tomoflatmotion",Gf={id:Ff,name:Rf,online:Af,properties:Ef,protocol:kf,require_staff:Pf,type:Bf},Lf=["move","stop","wait","rmove"],Hf="sy",Uf="sy",Vf=!0,qf={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Wf="bliss",zf=!1,Yf="motor",Kf=[],Qf={callables:Lf,id:Hf,name:Uf,online:Vf,properties:qf,protocol:Wf,require_staff:zf,type:Yf,user_tags:Kf},Xf=["move","stop","wait","rmove"],Zf="sy2",Jf="sy2",ep=!0,tp={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},np="bliss",op=!1,sp="motor",rp=[],ip={callables:Xf,id:Zf,name:Jf,online:ep,properties:tp,protocol:np,require_staff:op,type:sp,user_tags:rp},$o={default:Gf,sy:Qf,sy2:ip};function Oo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState({state:"READY",settle_time:2,power_onoff:!1,move_in_parallel:!0,available_axes:["hardware:sy","hardware:sy2"],motion:[{axisRef:"hardware:sy",absolute_position:null,relative_position:1}]});function c(f,d){const p=[];let m=!1;return f.motion.forEach(h=>{if(h.axisRef===d.axis_ref){if(m=!0,d.relative_position===void 0&&d.absolute_position===void 0)return;p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null});return}p.push(h)}),m||p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null}),{...f,motion:p}}async function l(f,d){if(f==="update_axis"){a(p=>c(p,d));return}console.log("TomoFlatMotionSimulator: Unsupported call",f,d)}async function u(f,d){console.log("TomoFlatMotionSimulator: Unsupported setProperty",f,d)}return e.jsx(V,{name:t,alias:o,type:"tomoflatmotion",call:l,setProperty:u,properties:r,useHardwareContext:s})}const ap={default:So,small:Co,state:Sf,sample_location:Tf},Io={variants:ap,mocks:$o,simulator:Oo};function Mo(n){return n.type==="tomoflatmotion"}function cp(n){const t=G(n);return t===null||!Mo(t)?null:t}function Do(n){const{properties:t={}}=n,{state:o="UNKNOWN"}=t;return["IN","READY"].includes(o)}function To(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r}=t,{label:a}=o,[c,l]=g.useState(void 0),[u,f]=g.useState(!1),d=e.jsx(N,{name:"TomoReferencePositionSchema",icon:"fam-hardware-motor",online:t.online});function p(x){l(void 0),f(!0),r.call("move_to_reference").catch(j=>{l(`${j}`)}).finally(()=>{f(!1)})}const m=e.jsx(e.Fragment,{}),h=e.jsxs(i.Button,{onClick:p,variant:c===void 0?"secondary":"danger",disabled:s||u,className:"w-100",children:[c&&e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-1",title:c}),!c&&u&&e.jsx("i",{className:"fa-solid fa-cog fa-spin me-1"}),a??"Back to reference position"]}),w=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:d,widgetState:m,widgetContent:h,headerMode:w})}function lp(n){return n.type==="tomoreferenceposition"}const dp={default:To},Fo={variants:dp};function be(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":t.properties.state)||"UNKNOWN":"OFFLINE",a={UNKNOWN:"danger",READY:"success",OFFLINE:"secondary",INVALID:"danger",MOUNTING:"transient",UNMOUNTING:"transient",LOCKED:"warning"},c=a[r]||a.UNKNOWN;return e.jsx(D,{state:r,minWidth:6,variant:c})}function up(n){const{hardware:t}=n;return e.jsx(be,{hardware:t})}function fp(n){const{hardware:t,options:o={}}=n;function s(a){return t.actions?t.actions.setProperty("sample_pixel_size_mode",a):console.error("Change request was triggered with:",a),null}const r=t.properties.sample_pixel_size_mode;return e.jsx(i.Dropdown,{style:n.style,children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:r==="USER"?"primary":"secondary",onClick:()=>{s("USER")},disabled:n.disabled,title:"Use a fixed pixel size defined by the user",children:"USER"}),e.jsx(i.Button,{variant:r==="AUTO"?"primary":"secondary",onClick:()=>{s("AUTO")},disabled:n.disabled,title:"Compute the pixel size automatically based on the beamline geometry",children:"AUTO"})]})})}function pp(n){const{hardware:t,options:o={}}=n,s=t.properties.user_sample_pixel_size||0,{state:r}=t.properties,a=r==="READY";function c(l){return t.actions?t.actions.setProperty("user_sample_pixel_size",l):console.error("Change request was triggered with:",l),null}return e.jsx(me,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.sample_pixel_size_mode!=="USER"})}function mp(n){const{hardware:t,options:o={}}=n;return t.properties.state,e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:n.disabled,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Mode"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsx(fp,{...n,style:{width:"100%"}})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center mt-1",children:"User pixel size"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.InputGroup,{children:[e.jsx(pp,{...n}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function hp(n,t,o){return g.useMemo(()=>{function s(c){return c==="um"?"μm":c}function r(c){return c.toFixed(3).replace(/\.?0+$/,"")}if(n==null)return["∅",""];if(t===o)return[r(n),s(o)];const a=pt.default(n,t);return[r(a.to(o).scalar),s(o)]},[n,t,o])}function Ro(n){const{hardware:t,options:o={}}=n,s=o.display_unit??"um",r=e.jsx(N,{name:"TomoDetector",icon:"fa-cog",online:t.online}),a=e.jsx(be,{hardware:t}),[c,l]=hp(t.properties.sample_pixel_size,"um",s),u=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{className:"justify-content-center",style:{minWidth:"4em"},children:t.properties.sample_pixel_size_mode}),e.jsx(B,{value:c,title:`${t.properties.sample_pixel_size} um`}),e.jsx(i.InputGroup.Text,{children:l}),e.jsx(mp,{...n})]}),f=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:u,headerMode:f})}function de(n,t,o,s){if(t===o)return n;if(t==="rad"&&o==="deg")return 180*n/Math.PI;if(t==="deg"&&o==="rad")return Math.PI*n/180;if(t==="px"){if(s!==void 0){const r=s.to("mm").scalar;return de(n*r,"mm",o,void 0)}return Number.NaN}if(o==="px"){if(s!==void 0){const r=de(n,t,"mm",void 0),a=s.to("mm").scalar;return r/a}return Number.NaN}try{return pt.default(n,t).to(o).scalar}catch{return console.error(`Convertion ${t}->${o} is not provided`),Number.NaN}}function Ao(n){return n.startsWith("u")?`μ${n.slice(1)}`:n}function le(n){return!n||!n.startsWith("hardware:")?null:n.slice(9)}function gp(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{sample_pixel_size:r,detector:a=null}=s,c=xn(le(a)),{properties:l={}}=c??{},{size:u}=l,f=o.display_unit??"mm",d=o.digits??3,p=e.jsx(N,{name:"TomoDetector",icon:"fa-eye",online:t.online}),m=e.jsx(be,{hardware:t}),h=g.useMemo(()=>{if(r==null||u===null||u===void 0)return"∅";const j=de(u[0]*r,"um",f),y=de(u[1]*r,"um",f);return`${j.toFixed(d)} × ${y.toFixed(d)}`},[r,u,f,d]),w=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:h}),e.jsx(i.InputGroup.Text,{children:Ao(f)})]}),x=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:p,widgetState:m,widgetContent:w,headerMode:x})}function xp(n){const{hardware:t,options:o={}}=n;function s(a){return t.actions?t.actions.setProperty("acq_mode",a):console.error("Change request was triggered with:",a),null}const r=t.properties.acq_mode;return e.jsx(i.Dropdown,{style:n.style,children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:r==="SINGLE"?"primary":"secondary",onClick:()=>{s("SINGLE")},disabled:n.disabled,title:"Do acquisition in a single shot",children:"SINGLE"}),e.jsx(i.Button,{variant:r==="ACCUMULATION"?"primary":"secondary",onClick:()=>{s("ACCUMULATION")},disabled:n.disabled,title:"Do acqisition in multiple sub frame with accumulation",children:"ACCU"})]})})}function wp(n){const{hardware:t,actions:o}=n,s=t.properties.acc_max_expo_time||0,{state:r}=t.properties,a=r==="READY";function c(l){return o.setProperty("acc_max_expo_time",l),null}return e.jsx(me,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.state!=="READY"})}function jp(n){const t=G(n);return t!==null&&xe(t)?t:null}function yp(n){var c;const{hardware:t}=n,{properties:o}=t,s=((c=o.detector)==null?void 0:c.slice(9))??"",r=jp(s),a=oe(s);return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:n.disabled,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Acquisition mode"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsx(xp,{...n,style:{width:"100%"}})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center mt-1",children:"Max sub frame exposition"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:r&&e.jsxs(i.InputGroup,{children:[e.jsx(wp,{hardware:r,actions:a}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function Eo(n){const{hardware:t}=n,o=e.jsx(N,{name:"TomoDetector",icon:"fa-cog",online:t.online}),s=e.jsx(be,{hardware:t}),r=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:t.properties.acq_mode}),e.jsx(yp,{...n})]}),a=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:r,headerMode:a})}const vp="tomodet1",Np="tomodet1",bp=!0,_p={state:"READY",sample_pixel_size_mode:"AUTO",user_sample_pixel_size:50,sample_pixel_size:48,detector:"hardware:det1",optic:"hardware:opt1",source_distance:10,acq_mode:"SINGLE"},Sp="bliss",Cp=!1,$p="tomodetector",Op={id:vp,name:Np,online:bp,properties:_p,protocol:Sp,require_staff:Cp,type:$p},ko={default:Op},Ip={samplepixelsize:Ro,acquisitionmode:Eo,fieldofview:gp,state:up},Po={variants:Ip,mocks:ko};function Ke(n){return n.type==="tomodetector"}function Mp(n){const t=G(n);return t===null||!Ke(t)?null:t}function Qe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOUNTING:"transient",UNMOUNTING:"transient",UNKNOWN:"fatal",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function Dp(n){const{hardware:t}=n;return e.jsx(Qe,{hardware:t})}function Tp(n){const{hardware:t}=n,{properties:o}=t,{detectors:s}=o,r=le(o.active_detector),a=le(o.target_detector),c=o.state==="READY",l=n.disabled||!t.online||!c;function u(d){t.actions?t.actions.call("mount",d):console.error("Change request was triggered with:",d)}function f(d){const p=le(d),h=p===(a||r)?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:l,onClick:()=>{u(p)},children:[e.jsx("i",{className:h})," ",p]},d)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:l,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:s.map(d=>f(d))})]})}function Bo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Qe,{hardware:t}),{properties:a}=t,c=a.state==="MOUNTING",l=le(a.active_detector),u=le(a.target_detector);function f(){return e.jsxs(i.InputGroup,{children:[e.jsx(B,{className:q.default({"hw-moving":c}),value:u||l||"No detector"}),e.jsx(Tp,{...n})]})}const d=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:f(),headerMode:d})}const Fp="tomodetectors",Rp="tomodetectors",Ap=!0,Ep={state:"READY",active_detector:"hardware:limadetector1",detectors:["hardware:limadetector1","hardware:limadetector2","hardware:limadetector3"]},kp="bliss",Pp=!1,Bp="optic",Gp={id:Fp,name:Rp,online:Ap,properties:Ep,protocol:kp,require_staff:Pp,type:Bp},Go={default:Gp},Lp={default:Bo,state:Dp},Lo={variants:Lp,mocks:Go};function Ho(n){return n.type==="tomodetectors"}function Hp(n){const t=G(n);return t===null||!Ho(t)?null:t}function ae(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",BLOCKED:"secondary",ACQUIRING:"transient",UNKNOWN:"fatal"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function Up(n){const{hardware:t}=n;return e.jsx(ae,{hardware:t})}function Vp(n){const{hardware:t}=n,o=t.properties.update_on_move,s=n.disabled||!t.online;function r(c){t.actions.setProperty("update_on_move",!1)}function a(c){t.actions.setProperty("update_on_move",!0)}return e.jsxs(i.ButtonGroup,{className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Update mode"}),e.jsx(i.Button,{onClick:a,disabled:s,variant:o?"primary":"secondary",children:"Auto"}),e.jsx(i.Button,{onClick:r,disabled:s,variant:o?"secondary":"primary",children:"Off"})]})}function qp(n){const{hardware:t}=n,o=t.properties.exposure_time??0,s=n.disabled||!t.online,r=g.useRef(null),[a,c]=g.useState(!1),l=2;function u(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("exposure_time",Number.parseFloat(r.current.value))):d.key==="Escape"&&(r.current.value=o.toFixed(l),c(!1))}function f(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return g.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Exposure time"}),e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:f,disabled:s,onKeyDown:u}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Wp(n){const{hardware:t}=n,o=n.disabled||!t.online;function s(c){t.actions.call("take_proj")}function r(c){t.actions.call("take_dark")}function a(c){t.actions.call("take_flat")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Take"}),e.jsx(i.Button,{onClick:s,disabled:o,variant:"primary",children:"Proj"}),e.jsx(i.Button,{onClick:a,disabled:o,variant:"primary",children:"Flat"}),e.jsx(i.Button,{onClick:r,disabled:o,variant:"primary",children:"Dark"})]})}function Uo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsxs(i.Container,{children:[e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Vp,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(qp,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Wp,{hardware:t,disabled:n.disabled})})})]}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function zp(n){const{style:t,className:o,value:s,decimals:r=2,allowNullAsEmpty:a=!1,disabled:c=!1}=n,[l,u]=g.useState(void 0),f=l!==void 0,d=g.useMemo(()=>n.preferedDisplayUnit!==void 0&&(n.pixelSize===void 0||n.unit==="px"||n.preferedDisplayUnit==="px")?n.preferedDisplayUnit:n.displayUnit??n.unit,[n.displayUnit,n.unit,n.preferedDisplayUnit,n.pixelSize]),p=g.useCallback(y=>y===null||d===void 0?null:de(y,d,n.unit,n.pixelSize),[n.unit,d,n.pixelSize]),m=g.useCallback(y=>y===null||d===void 0?null:de(y,n.unit,d,n.pixelSize),[n.unit,d,n.pixelSize]);function h(y){return(y??"")===""?null:Number.parseFloat(y)}function w(){var $;if(l===void 0||!a&&l==="")return;let y;try{y=h(l)}catch{return}const S=p(y);($=n.onAccepted)==null||$.call(n,S),u(void 0)}function x(){var y;l!==void 0&&((y=n.onAborted)==null||y.call(n),u(void 0))}const j=g.useMemo(()=>{const y=m(s);return y===null?"":y.toFixed(r)},[s]);return e.jsx(i.Form.Control,{value:l??j??void 0,className:o,step:n.step,type:"number",style:{...t,backgroundColor:f?"#FFFF80":void 0},disabled:c,onChange:y=>{u(y.target.value)},onBlur:()=>{x()},onKeyDown:y=>/^[ a-z]$/i.test(y.key)?(y.preventDefault(),!1):(y.stopPropagation(),y.key==="Enter"?w():y.key==="Escape"&&x(),!0)})}function Yp(n){const{onAccepted:t,...o}=n;return e.jsx(zp,{...o,allowNullAsEmpty:!1,onAccepted:t})}function Kp(n){const{hardware:t,options:o}=n,s=t.properties.exposure_time??0,r=n.disabled||!t.online,a=o.unit??"s",c=o.digits??3;return e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(Yp,{value:s,unit:"s",displayUnit:o.unit??"s",onAccepted:l=>{t.actions.setProperty("exposure_time",l)},decimals:c,disabled:r}),e.jsx(i.InputGroup.Text,{children:Ao(a)})]})}function Qp(n){const{exposureTime:t}=n,o=G("ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector"),s=G("ACTIVE_TOMOCONFIG.ref.detectors.active_detector");if(o===null||s===null)return e.jsx(e.Fragment,{});if(!xe(o)||!Ke(s))return e.jsx(e.Fragment,{});const r=o.properties.acc_max_expo_time,a=s.properties.acq_mode;if(!r||a!=="ACCUMULATION")return e.jsx(e.Fragment,{});const[c,l]=wn(t,r);return e.jsxs("div",{className:"text-center",title:"Decompisiton of the accumulation",children:[c," × ",l.toFixed(3)]})}function Vo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Kp,{hardware:t,disabled:n.disabled,options:o}),e.jsx(Qp,{exposureTime:t.properties.exposure_time})]}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Xp(n){const{hardware:t}=n,o=t.properties.settle_time||0,s=n.disabled||!t.online,r=g.useRef(null),[a,c]=g.useState(!1),l=3;function u(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("settle_time",Number.parseFloat(r.current.value))):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function f(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return g.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:f,disabled:s,onKeyDown:u}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function qo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsx(Xp,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function ke(n){const[t,o]=g.useState(!1),[s,r]=g.useState(void 0),{text:a,disabled:c,onAction:l,onStarted:u,onTerminated:f,title:d}=n;function p(m){u==null||u(),r(void 0),o(!0),l().catch(h=>{r(`${h}`)}).finally(()=>{o(!1),f==null||f()})}return e.jsxs(i.Button,{onClick:p,disabled:c||t,variant:s===void 0?"primary":"danger",className:q.default({"ps-4":!t,"pe-4":!t}),title:d,children:[s&&e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-1",title:s}),!s&&t&&e.jsx("i",{className:"fa-solid fa-cog fa-spin me-1"}),a]})}function Zp(){const n=G("ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector");return n===null||!xe(n)?null:n}function Jp(n){const{hardware:t,restoreSample:o}=n,[s,r]=g.useState(!1),a=n.disabled||!t.online||s,c=Zp(),l=(c==null?void 0:c.properties.state)==="OFFLINE";function u(){r(!0)}function f(){r(!1)}function d(){return t.actions.call("take_proj")}function p(){return t.actions.call("take_dark")}function m(){return t.actions.call(o?"take_flat":"take_flat_and_stay")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"w-100",title:l?`The detector '${c==null?void 0:c.name}' is offline`:void 0,children:[e.jsx(ke,{onAction:d,onStarted:u,onTerminated:f,disabled:a||l,text:"Proj",title:"Take a projection"}),e.jsx(ke,{onAction:m,onStarted:u,onTerminated:f,disabled:a||l,text:"Flat",title:"Take a flat"}),e.jsx(ke,{onAction:p,onStarted:u,onTerminated:f,disabled:a||l,text:"Dark",title:"Take a dark"})]})}function Wo(n){const{hardware:t,options:o={}}=n,{restore_sample:s=!0}=o,r=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),a=e.jsx(ae,{hardware:t}),c=e.jsx(Jp,{hardware:t,disabled:n.disabled,restoreSample:s}),l=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:c,headerMode:l})}function em(n){const{hardware:t}=n,o=t.properties.update_on_move,s=n.disabled||!t.online;function r(c){t.actions.setProperty("update_on_move",!1)}function a(c){t.actions.setProperty("update_on_move",!0)}return e.jsxs(i.ButtonGroup,{className:"w-100",children:[e.jsx(i.Button,{onClick:a,disabled:s,variant:o?"primary":"secondary",children:"Auto"}),e.jsx(i.Button,{onClick:r,disabled:s,variant:o?"secondary":"primary",children:"Off"})]})}function zo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsx(em,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const tm="tomoimaging",nm="tomoimaging",om=!0,sm={state:"READY",update_on_move:!1,exposure_time:1},rm="bliss",im=!1,am="optic",cm={id:tm,name:nm,online:om,properties:sm,protocol:rm,require_staff:im,type:am},Yo={default:cm};function Ko(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState({state:"READY",update_on_move:!0,exposure_time:1,settle_time:0});function c(f){a(d=>({...d,state:f}))}async function l(f,d){if(f==="take_dark"){c("ACQUIRING"),await L(2e3),c("READY");return}if(f==="take_flat"){c("ACQUIRING"),await L(2e3),c("READY");return}if(f==="take_proj"){c("ACQUIRING"),await L(2e3),c("READY");return}console.log("TomoImagingSimulator: Unsupported call",f,d)}async function u(f,d){a(p=>({...p,[f]:d}))}return e.jsx(V,{name:t,alias:o,type:"tomoimaging",call:l,setProperty:u,properties:r,useHardwareContext:s})}const lm={default:Uo,exposuretime:Vo,settletime:qo,actions:Wo,updatemode:zo,state:Up},Qo={variants:lm,mocks:Yo,simulator:Ko},dm={},Xo={variants:dm};function Zo(n){return n.type==="tomosamplestage"}function um(n){const t=G(n);return t===null||!Zo(t)?null:t}function fm(n){const{hardware:t}=n,o=t.properties.latency_time||0,s=n.disabled||!t.online,r=g.useRef(null),[a,c]=g.useState(!1),l=3;function u(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("latency_time",r.current.value)):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function f(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return g.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:f,disabled:s,onKeyDown:u}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Jo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(e.Fragment,{}),a=e.jsx(fm,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const pm={latencytime:Jo},es={variants:pm};function ts(n){return n.type==="tomoconfig"}function mm(n){const t=G(n);return t===null||!ts(t)?null:t}function ns(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOVING:"transient",STABILIZING:"transient",INVALID:"danger",INVALID_DETECTOR_BINNING_CHANGED:"danger",INVALID_DETECTOR_DISTANCE_CHANGED:"danger",INVALID_DETECTOR_CHANGED:"danger"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function hm(n){const{hardware:t}=n;return e.jsx(ns,{hardware:t})}const gm={state:hm},os={variants:gm};function ss(n){return n.type==="tomoholo"}function xm(n){const t=G(n);return t===null||!ss(t)?null:t}function wm(n){const{hardware:t}=n,o=()=>{t.actions.call("reset")};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popover",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Valve Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function rs(n){const{hardware:t,options:o={}}=n,s=()=>{t.actions.call(t.properties.state==="OPEN"?"close":"open")};return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Valve",icon:"fam-hardware-valve",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.ButtonGroup,{className:"d-flex",children:[e.jsx(i.Button,{variant:t.properties.state==="OPEN"?"danger":"success",onClick:s,disabled:n.disabled,children:t.properties.state==="OPEN"?"Close":"Open"}),e.jsx(wm,{...n})]})})]})}const jm=["close","reset","open"],ym="rv12",vm="rv12",Nm=!0,bm={state:"CLOSED",status:`Pneumatic is closed
|
|
38
|
-
`},_m="tango",Sm=!1,Cm="valve",$m={callables:jm,id:ym,name:vm,online:Nm,properties:bm,protocol:_m,require_staff:Sm,type:Cm},is={default:$m},Om={default:rs},as={variants:Om,mocks:is},Im=He.default("daiquiri.components.hardware.NoObject");function Mm(n){if(n.options.emptyifnone)return Im('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const t=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is missing`,children:"Missing"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Dm(n){const t=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is loading`,children:e.jsx("i",{className:"fa-solid fa-spinner fa-spin-pulse"})}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}const Tm=He.default("daiquiri.components.hardware.MissingObject");function Fm(n){if(n.options.emptyifnone)return Tm('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const t=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is missing`,children:"Missing"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Rm(n){const{properties:t={}}=n,{message:o="Unknown error"}=t,s=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=e.jsx(e.Fragment,{}),a=e.jsx(i.OverlayTrigger,{trigger:["focus","hover"],placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"error",style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Error"}),e.jsx(i.Popover.Body,{children:e.jsx("ul",{children:e.jsx("li",{children:o})})})]}),children:e.jsxs(i.Button,{variant:"danger",size:"sm",className:"w-100",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," Error"]})}),c=n.options?n.options.header:"top",l={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const Am=He.default("daiquiri.components.hardware.MissingComponentObject");function Em(n){const{options:t}=n,{variant:o="default"}=t;if(t.emptyifnone)return Am('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const s=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=e.jsx(e.Fragment,{}),a=e.jsx(i.OverlayTrigger,{trigger:["focus","hover"],placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"error",style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Error"}),e.jsx(i.Popover.Body,{children:e.jsx("ul",{children:e.jsxs("li",{children:["No component available for object id '",n.name,"' (type '",n.type,"' and/or variant '",o,"' are not registred)"]})})})]}),children:e.jsxs(i.Button,{variant:"danger",size:"sm",className:"w-100",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," Error"]})}),c=t?t.header:"top",l={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function km(n){if(n.options.emptyifnone)return e.jsx(e.Fragment,{});const t=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx(e.Fragment,{children:"No object"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function cs(n){const[t,o]=g.useState({}),s=g.useRef(null);return g.useEffect(()=>{if(s.current){const r=s.current;o({width:r.clientWidth,height:r.clientHeight})}},[]),e.jsx("div",{ref:s,style:{width:"100%",height:"100%"},className:n.className,children:t.width>0&&e.jsx("div",{className:"full-sizer",style:{width:`${t.width}px`,height:`${t.height}px`,overflow:"scroll"},children:n.children})})}function Pm(n){const{size:t,value:o,min:s,max:r,lowWarning:a,hiWarning:c,lowDanger:l,hiDanger:u}=n;function f(j){return j===null?null:(j-s)/(r-s)}const d=g.useMemo(()=>{const j=l===void 0?void 0:f(l),y=u===void 0?void 0:f(u),S=a===void 0?void 0:f(a),$=c===void 0?void 0:f(c);return{lowPercentDanger:j,hiPercentDanger:y,lowPercentWarning:S,hiPercentWarning:$}},[s,r,a,c,l,u]),p=g.useMemo(()=>o===null?"value":l!==void 0&&o<=l||u!==void 0&&o>=u?"value value-danger":a!==void 0&&o<=a||c!==void 0&&o>=c?"value value-warning":"value",[o,l,u,a,c]),m=t/2-15,h=t/10,w=t/10*3;function x(j){return h+(w-h)*j}return e.jsxs(E.Knob,{size:t,angleOffset:240,angleRange:240,min:s,max:r,value:o,readOnly:!0,className:"gauge",children:[d.lowPercentDanger&&e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range range-danger",percentageFrom:0,percentageTo:d.lowPercentDanger,widthFrom:x(0),widthTo:x(d.lowPercentDanger)}),d.lowPercentWarning&&e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range range-warning",percentageFrom:d.lowPercentDanger??0,percentageTo:d.lowPercentWarning,widthFrom:x(d.lowPercentDanger??0),widthTo:x(d.lowPercentWarning)}),e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range",percentageFrom:d.lowPercentWarning??d.lowPercentDanger??0,percentageTo:d.hiPercentWarning??d.hiPercentDanger??1,widthFrom:x(d.lowPercentWarning??d.lowPercentDanger??0),widthTo:x(d.hiPercentWarning??d.hiPercentDanger??1)}),d.hiPercentWarning&&e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range range-warning",percentageFrom:d.hiPercentWarning,percentageTo:d.hiPercentDanger??1,widthFrom:x(d.hiPercentWarning),widthTo:x(d.hiPercentDanger??1)}),d.hiPercentDanger&&e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range range-danger",percentageFrom:d.hiPercentDanger,percentageTo:1,widthFrom:x(d.hiPercentDanger),widthTo:x(1)}),e.jsx("circle",{r:t/20,cx:t/2,cy:t/2,fill:"black"}),e.jsx(E.Pointer,{percentage:f(o),width:10,height:t/2-15,radius:2,type:"triangle",color:"black"}),e.jsx(E.Value,{className:p,value:o})]})}function Bm(n){return e.jsx("div",{className:"panel-header",style:n.style,children:n.children})}function Gm(n){return e.jsx("div",{className:`panel-contents ${n.className}`,style:n.style,children:n.children})}function R(n){const t=n.scroll?cs:g.Fragment;return e.jsx("div",{className:`panel ${n.className??""}`,style:n.style,children:e.jsx(t,{children:n.children})})}R.Header=Bm;R.Contents=Gm;function ls(n){return e.jsx(e.Fragment,{})}function Lm(n){const{providers:t={},yamlNode:o,label:s,...r}=n;return fs(o,"label",s),fe(o,r),e.jsx("div",{children:s})}function Hm({yamlNode:n,panel:t}){const{type:o,style:s,children:r,...a}=n;return fe(n,a),e.jsx(i.Row,{className:"ymllayout-row gx-0",style:s,children:P.map(r,(c,l)=>W(c,l,t))})}function Um({yamlNode:n,panel:t}){const{type:o,style:s,xs:r,children:a,...c}=n;return fe(n,c),ps(n,"xs",r),e.jsx(i.Col,{className:q.default("yamymllayout-col",{col:!!r}),style:s,xs:r,children:P.map(n.children,(l,u)=>W(l,u,t))})}function Vm({yamlNode:n,panel:t}){const o=n.options||{},s=n.style;return e.jsx(i.Container,{className:"ymllayout-container",...o,style:s,children:P.map(n.children,(r,a)=>W(r,a,t))})}function qm(n){const{yamlNode:t}=n,o=t.options||{},s={};return t.centerContent&&(s.margin="auto"),e.jsxs(R,{className:"ymllayout-panel",...o,style:t.style,children:[t.title&&e.jsx(R.Header,{children:t.title}),e.jsx(R.Contents,{style:s,children:P.map(t.children,(r,a)=>W(r,a,!1))})]})}const Wm=()=>Math.random().toString(36).slice(2,15)+Math.random().toString(36).slice(2,15);function zm({yamlNode:n,panel:t}){const o=[];return P.each(n.children,(s,r)=>{o.push(e.jsx(i.Tab,{eventKey:Wm(),title:s.title,style:s.style,children:W(s,0,!1)},r))}),t?e.jsxs(R,{className:"ymllayout-tabs",style:n.style,children:[n.title&&e.jsx(R.Header,{children:n.title}),e.jsx(R.Contents,{children:e.jsx(i.Tabs,{mountOnEnter:!0,children:o})})]}):e.jsx(i.Tabs,{children:o})}function Ym(n){const{node:t,state:o,row:s}=n,{title:r}=t;function a(){if(t.id)return t.id}function c(){if(r!==void 0)return r;if(t.type==="hardware"){const u=a(),f={_parentNode:t._parentNode,_indexFromParent:t._indexFromParent,type:"hardware",id:u,variant:"name",emptyifnone:!0};return W(f,"a",!1)}return""}const l=c();return e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("h5",{style:{margin:"0px",whiteSpace:"nowrap"},children:l}),o&&e.jsx("div",{style:{position:"relative",top:-5},children:o})]})}function Km(n){const{node:t,row:o}=n,{titlealign:s,title:r,stateinheader:a=!1,variant:c,id:l,...u}=t;let f,d;if(u.type==="hardware")if(f={...u,id:l,variant:c},a){const p={...u,id:l,variant:"state",emptyifnone:!0};d=W(p,"k",!1)}else d=null;else f=u,d=null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{gridColumn:1,alignSelf:s??"center"},children:e.jsx(Ym,{node:t,state:d,row:o})}),e.jsx("div",{style:{gridColumn:2,alignSelf:"center",overflow:"auto"},children:W(f,"k",!1)})]})}function Qm(n){const{yamlNode:t,panel:o}=n,{type:s,children:r,options:a={},title:c,style:l,...u}=t;return sh(t,u),e.jsxs(R,{className:"ymllayout-form",...a,children:[t.title&&e.jsx(R.Header,{children:t.title}),e.jsx(R.Contents,{className:"full-sizer",style:{overflow:"auto"},children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"min-content auto",...l},children:P.map(r,(f,d)=>f.type==="formheader"?W(f,d,o):f.type==="none"?e.jsx(Ds.default.Fragment,{},d):e.jsx(Km,{node:f,row:d},d))})})]})}function Xm({yamlNode:n}){const{type:t,title:o,style:s={},...r}=n;return Xe(n,"title",o),fe(n,r),e.jsx("div",{className:"ymllayout-form-header",style:{gridColumn:"1 / 3",...s},children:e.jsx("h3",{children:o})})}function Zm(n){const{yamlNode:t,panel:o}=n,s=t.style||{};return e.jsx("div",{className:"ymllayout-grid",style:{gridTemplateColumns:t.columns,gridTemplateRows:t.rows,...s},children:P.map(t.children,(r,a)=>{const{columnSpan:c=1,rowSpan:l=1,...u}=r,f=c>1?`span ${c}`:void 0,d=l>1?`span ${l}`:void 0;return e.jsx("div",{className:"ymllayout-grid-cell",style:{gridColumn:f,gridRow:d},children:W(u,a,o)},a)})})}const re={row:Hm,col:Um,container:Vm,panel:qm,tabs:zm,form:Qm,formheader:Xm,grid:Zm};function Jm(n,t){ie[n]&&console.warn(`yaml registration: The type ${n} is already a component. The component will not be reachable anymore.`),re[n]&&console.warn(`yaml registration: The type ${n} is already a container. The previous container will be dropped.`),re[n]=t}const ie={todo:ms,none:ls,label:Lm};function ds(n,t){ie[n]&&console.warn(`yaml registration: The type ${n} is already a component. The previous component will be dropped.`),re[n]&&console.warn(`yaml registration: The type ${n} is already a container. This component will not be used.`),ie[n]=t}function eh(n){Object.entries(n).forEach(([t,o])=>ds(t,o))}function th(){return ie}function nh(){return re}function oh(n){const{yamlNode:t,panel:o}=n,{type:s,style:r,scroll:a,title:c,...l}=t;if(!(s in ie))return e.jsx(R,{children:e.jsx(R.Contents,{children:e.jsxs(i.Alert,{variant:"warning",children:['Unknown component "',s,'"']})})});const u=ie[t.type];return o?e.jsx(R,{style:r,scroll:a,children:e.jsxs(g.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:[c&&e.jsx(R.Header,{children:c}),e.jsx(R.Contents,{children:e.jsx(u,{...l,yamlNode:t})})]})}):e.jsx(g.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:e.jsx(u,{...l,yamlNode:t})})}function W(n,t,o=!0){if(!n)return e.jsx(e.Fragment,{});const{type:s}=n,r=s&&s in re?re[s]:oh;return e.jsx(r,{yamlNode:n,panel:o},t)}function sh(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new he(n,Object.keys(r))}class se extends Error{constructor(o,s){super(o);ne(this,"yamlNode");this.yamlNode=s}}class he extends se{constructor(o,s){super(`Unexpected keys: ${s.join(", ")}`,o);ne(this,"keys");this.keys=s}}class Me extends se{constructor(o,s){super(`Keys ${s.join(", ")} are missing`,o);ne(this,"keys");this.keys=s}}class T extends se{constructor(o,s,r){super(`Key ${s} error: ${r}`,o);ne(this,"key");ne(this,"keyMessage");this.key=s,this.keyMessage=r}}function rh(n){let t=n;for(;t._parentNode;)t=t._parentNode;return t}function ih(n){const t=[];let o=n;for(;o;)t.push({node:o,indexFromParent:o._indexFromParent}),o=o._parentNode;return t.reverse(),t}function us(n,t=null,o=null){if(n._parentNode)throw new Error("Attribute _parentNode was already defined by the yml layout.");const s={...n,_parentNode:t,_indexFromParent:o};if(n.children){const r=[...n.children];Object.freeze(r),s.children=r.map((a,c)=>us(a,s,c))}return Object.freeze(s),s}function ah(n,t,o){if(n&&o===void 0)throw new Me(n,[t])}function fs(n,t,o){if(typeof o!="string")throw new T(n,t,"A string is expected")}function ch(n,t,o){if(typeof o!="boolean")throw new T(n,t,"A boolean is expected")}function lh(n,t,o){if(typeof o!="number")throw new T(n,t,"A number is expected")}function dh(n,t,o){if(o!==void 0&&typeof o!="boolean")throw new T(n,t,"An optional boolean is expected")}function Xe(n,t,o){if(o!==void 0&&typeof o!="string")throw new T(n,t,"An optional string is expected")}function uh(n,t,o){if(!Array.isArray(o))throw new T(n,t,"A list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new T(n,t,"A list of string is expected")})}function fh(n,t,o){if(o!==void 0&&typeof o!="string"){if(!Array.isArray(o))throw new T(n,t,"An optional string or list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new T(n,t,"An optional string or list of string is expected")})}}function ph(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new T(n,t,"An optional list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new T(n,t,"A optional list of string is expected")})}}function ps(n,t,o){if(o!==void 0&&typeof o!="number")throw new T(n,t,"An optional number is expected")}function mh(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new T(n,t,"An optional list of numbers is expected");o.forEach(s=>{if(typeof s!="number")throw new T(n,t,"An optional list of numbers is expected")})}}function hh(n,t,o,s,r){if(o!==void 0){if(!Array.isArray(o))throw new T(n,t,`An optional list of ${r} is expected`);o.forEach(a=>{if(!s(a))throw new T(n,t,`An optional list of type ${r} is expected`)})}}function fe(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new he(n,Object.keys(r))}function gh(n,t,o){if(o!=="last"&&typeof o!="number")throw new T(n,t,'"last" or a number is expected')}function xh(n,t,o){if(o!==void 0&&o!=="h5web"&&o!=="plotly")throw new T(n,t,'"h5web" or "plotly" string is expected')}function wh(n,t,o){if(o!==void 0&&!Array.isArray(o))throw new T(n,t,"A list is expected")}function jh(n,t,o){if(o!==void 0&&(o===null||typeof o!="object"))throw new T(n,t,"A list is expected")}function yh(n,t,o,s){const{optional:r,schema:a}=s;if(r&&o===void 0)return;if(!o||typeof o!="object")throw new T(n,t,"A mapping is expected");const c=Object.keys(o).filter(u=>typeof u=="string"&&!(u in a));if(c.length>0)throw new he(n,Object.keys(c.map(u=>`${t}/${u}`)));const l=o;Object.entries(a).forEach(([u,f])=>{typeof u=="string"&&f(n,`${t}/${u}`,l[u])})}const vh=Object.freeze(Object.defineProperty({__proto__:null,assertBoolean:ch,assertDataCollectionId:gh,assertKeyExpected:ah,assertNoUnknownKeys:fe,assertNumber:lh,assertOptionalArgs:wh,assertOptionalBackend:xh,assertOptionalBoolean:dh,assertOptionalKwargs:jh,assertOptionalListOfType:hh,assertOptionalNumber:ps,assertOptionalNumberList:mh,assertOptionalString:Xe,assertOptionalStringList:ph,assertOptionalStringOrStringList:fh,assertString:fs,assertStringList:uh,assertStringMappingRecord:yh},Symbol.toStringTag,{value:"Module"}));function ms(n){const{providers:t={},yamlNode:o,message:s,...r}=n;return Xe(o,"message",s),fe(o,r),e.jsx(i.Alert,{variant:"warning",className:"mb-0",children:s??"TODO"})}const ee={},hs={},Nh={airbearing:Ct,base:yt,beamviewer:Dt,beamline:$t,energymanager:Et,frontend:Wt,gauge:Kt,laser:Jt,laserheating:nn,light:rn,lima:jn,measurementgroup:bn,motor:Fn,multiposition:Bn,optic:Vn,procedure:Qn,pump:go,pusher:yo,regulation:oo,service:_o,shutter:lo,slit:po,tomoconfig:es,tomodetector:Po,tomodetectors:Lo,tomoflatmotion:Io,tomoholo:os,tomoimaging:Qo,tomoreferenceposition:Fo,tomosamplestage:Xo,valve:as};Object.entries(Nh).forEach(([n,t])=>{ee[n]={...t.variants},hs[n]={...t}});function bh(n,t,o){n in ee||(ee[n]={}),t in ee[n]&&console.warn(`Hardware variant ${n}/${t} already existes. Overwrite.`),ee[n][t]=o}function Ze(n,t){if(n in ee){const s=ee[n];if(t in s)return s[t]}const o=ee.base;return t in o?o[t]:null}function _h(){return hs}function Sh(n){const{hardware:t,options:o={}}=n,{emptyifnone:s=!1}=o;if(t===null)return s?e.jsx(e.Fragment,{}):e.jsx(D,{state:"NONE",variant:"danger",description:"No hardware"});const{type:r}=t;switch(r){case"missing":return e.jsx(D,{state:"MISSING",variant:"danger",description:"Hardware not available"});case"error":return e.jsx(D,{state:"ERROR",variant:"danger",description:"Error to load the hardware"});case"loading":return e.jsx(D,{state:"LOADING",variant:"warning",description:"The hardware was requested"})}const a=Ze(r,"state");if(!a)return e.jsx(Te,{hardware:t});const c={setProperty:(l,u)=>Promise.resolve(),call:(l,...u)=>Promise.resolve()};return e.jsx(a,{hardware:{...t,actions:c},options:{name:t.name},operator:!1,disabled:!1})}function Ch(n){const{title:t,children:o,buttons:s,cancelText:r,footer:a=!0,showClose:c=!0,show:l=!1,actions:u={},otherButtons:f,bodyClassName:d,size:p="lg",fullscreen:m}=n,{onShow:h,onClose:w}=u;return e.jsxs(i.Modal,{fullscreen:m,size:p,"aria-labelledby":"modal-title",centered:!0,onShow:h,onHide:w,show:l,children:[e.jsx(i.Modal.Header,{closeButton:!0,children:e.jsx(i.Modal.Title,{id:"modal-title",children:t})}),e.jsx(i.Modal.Body,{className:d,children:o}),a&&e.jsxs(i.Modal.Footer,{children:[f&&e.jsx("div",{className:"form-other-buttons",children:f}),s,c&&e.jsx(i.Button,{onClick:w,children:r||"Close"})]})]})}function $h(n){return n.condition?n.wrap(n.children):n.children}const Oh=g.forwardRef((n,t)=>{const[o,s]=g.useState(!1),{showButton:r=!0}=n,a=g.useRef(null);function c(){s(!1),n.onClose&&n.onClose()}function l(){c()}g.useImperativeHandle(t,()=>({showModal:()=>s(!0),close:()=>l()}));const u=n.modalClass||Ch;return e.jsxs(e.Fragment,{children:[r&&e.jsx($h,{condition:n.tooltip,wrap:f=>e.jsx(i.OverlayTrigger,{placement:n.tooltipPlacement||"top",overlay:e.jsx(i.Tooltip,{id:"tooltip1",children:n.tooltip}),children:f}),children:e.jsx(i.Button,{onClick:()=>{s(!0)},...n.buttonProps,ref:a,children:n.button})}),e.jsx(u,{target:a,show:o,actions:{onClose:l},title:n.title,buttons:n.buttons,children:n.children})]})}),Ih=Oh;function Ae(n){return n===void 0||n===null||typeof n!="string"?null:n.startsWith("$")?n.slice(1):n}const Ge={">":(n,t)=>n>t,"<":(n,t)=>n<t,">=":(n,t)=>n>=t,"<=":(n,t)=>n<=t,"==":(n,t)=>n===t,"!=":(n,t)=>n!==t,in:(n,t)=>t.indexOf(n)>-1},Mh=Object.keys(Ge),De=(n,t,o)=>{if(n in Ge)return Ge[n](t,o)};function gs(n,t,o){const s=n.split(t);return o?[s.slice(0,-o).join(t)].concat(s.slice(-o)):s}function ut(n){const t=n!==void 0?gs(n,".",1):[null,""],o=G(Ae(t[0]));if(!o||!o.properties)return;const s=t[1];if(s===null)return;const r=o.properties[s];return Array.isArray(r)?r[0]:r}function Dh(n){const t=n!==void 0&&!n.includes("."),o=n!==void 0?gs(n,".",1):[null,""],s=G(Ae(o[0]));if(t)return n;if(s&&s.properties&&o[1]!==null)return`${s.properties[o[1]]}`}function xs(n){const{monitor:t}=n;let o=ut(t.value)??"-";const s=Dh(t.unit),r=ut(t.overlay),a=Number.parseFloat(`${o}`);Number.isNaN(a)||String(a).length>5&&(o=a.toPrecision(5));function c(){return t.comparator&&t.comparison?De(t.comparator,o,t.comparison)?"success":"danger":"secondary"}const l=c();Number.isNaN(a)||s!==void 0&&(o=`${o} ${s}`);const u=e.jsxs(X,{children:[e.jsx("h1",{children:t.name}),e.jsx(i.Badge,{bg:l,children:`${o}`})]});if(r){const f=`${r}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:f.includes(`
|
|
39
|
-
`)?e.jsx("pre",{children:f}):f}),children:u})}return u}function Th({value:n,unit:t,display_digits:o}){let s="";return n!==void 0&&(n===null?s="null":Number.isFinite(n)?s+=n.toFixed(o??2):s=`${n}`),t!==null&&t!==""&&(s=`${s} ${t}`),s}function Fh(n){const t=g.useRef({}),[o,s]=g.useState(void 0),{synoptic:r,fetchSVG:a,getHardwareGroupComponent:c,hardwareObjects:l}=n;g.useEffect(()=>{a(r.synoptic).then(p=>{s(p.data)})},[r]);const u=g.useCallback(p=>{var m,h;p in t.current&&((h=(m=t.current)==null?void 0:m[p].current)==null||h.showModal())},[t]),f=g.useMemo(()=>r.elements.map(p=>{var y,S,$,b;let m=!1,h;const w=p.ids&&((y=p.ids)==null?void 0:y.length)>0;if(w&&(m=!0,(S=p.ids)==null||S.forEach(v=>{v in l&&(l[v].properties.state_ok||(m=!1))})),p.state){const v=p.state.split("."),C=l[v[0]],I=C?C.properties[v[1]]:!1;Array.isArray(p.state_comparison)?(m=void 0,p.state_comparison.forEach(M=>{(De(M==null?void 0:M.comparator,M==null?void 0:M.comparison,I)??!1)&&(h=M.color)})):p.state_comparison?m=De(($=p.state_comparison)==null?void 0:$.comparator,(b=p.state_comparison)==null?void 0:b.comparison,I)??!1:m=!!I}let x=null;if(p.value){const v=p.value.split("."),C=l[v[0]];C&&(x=Th({value:C.properties[v[1]],unit:C.properties.unit,display_digits:p.value_display_digits}))}const j=p.name.toLowerCase();return[e.jsx(pe.SvgProxy,{selector:`.${j} .status`,class:`$ORIGINAL ${m!==void 0?m?"ok":"error":""}`,style:h?`fill: ${h};`:""},`${j}state`),e.jsx(pe.SvgProxy,{selector:`.${j} .value`,children:x},`${j}value`),e.jsx(pe.SvgProxy,{selector:`.${j} > rect`,onClick:()=>u(j)},`${j}handler`),e.jsx(pe.SvgProxy,{class:`$ORIGINAL ${w?"active":""}`,selector:`.${j}`},`${j}comp`)]}),[r,l]),d=g.useMemo(()=>r.elements.filter(p=>{var m;return p.ids&&((m=p.ids)==null?void 0:m.length)>0}).map(p=>{const m=p.name.toLowerCase(),h=g.createRef();return t.current[m]=h,e.jsx(Ih,{ref:h,title:p.name,showButton:!1,button:e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"fa fa-plus"}),"show"]}),children:c(p.ids??[])},`${m}pop`)}),[r]);return e.jsxs("div",{children:[e.jsx(pe.SvgLoader,{width:"100%",svgXML:o,className:`synoptic ${r.color_icons?"synoptic-color":""}`,children:f}),d]})}const Rh=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ah=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function
|
|
40
|
-
`)}const r=rh(t.yamlNode).name;if(t instanceof he){const a=t.keys.length===1?"key":"keys";return e.jsxs(i.Alert,{variant:"danger",children:["Unexpected ",a," ",t.keys.map((c,l)=>e.jsxs(e.Fragment,{children:[l!==0&&", ",e.jsx("b",{children:c})]}))," ","from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]})}if(t instanceof Me){const a=t.keys.length===1?"Key":"Keys";return e.jsxs(i.Alert,{variant:"danger",children:["Expected ",a," ",t.keys.map((c,l)=>e.jsxs(e.Fragment,{children:[l!==0&&", ",e.jsx("b",{children:c})]}))," ","from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]})}return t instanceof T?e.jsxs(i.Alert,{variant:"danger",children:["Error on key ",e.jsx("b",{children:t.key})," from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]}):e.jsx(ws,{...n})}const ft={hasError:!1,message:"",error:void 0};class js extends g.Component{constructor(o){super(o);ne(this,"reload",()=>{window.location.reload()});this.state=ft}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o){var s,r;if(o instanceof se||!this.props.unhandledComponentDidCatch){this.setState({hasError:!0,message:o.message,error:o});return}(r=(s=this.props).unhandledComponentDidCatch)==null||r.call(s,o,a=>{this.setState({hasError:!0,message:o.message,error:o,...a})})}componentDidUpdate(o,s){this.state.hasError&&s.error!==void 0&&o.resetKey!==this.props.resetKey&&this.setState(ft)}render(){if(this.state.hasError){const{UnhandledErrorComponent:o}=this.props,{hasError:s,...r}=this.state;return e.jsxs(i.Container,{className:"mt-2",children:[e.jsx("h4",{children:"Something went wrong"}),this.state.error instanceof se&&e.jsx(Eh,{message:this.state.message,error:this.state.error}),!(this.state.error instanceof se)&&e.jsx(e.Fragment,{children:o?e.jsx(o,{...r}):e.jsx(ws,{message:this.state.message,error:this.state.error})}),e.jsxs("p",{children:["This error has been logged. Please"," ",e.jsxs(i.Button,{size:"sm",onClick:this.reload,children:[e.jsx("i",{className:"fa fa-refresh"})," Reload"]})," ","the application"]})]})}return this.props.children}}function kh(n){var o;const t=g.useMemo(()=>us(n.layout),[n.layout]);return t.error?e.jsx("div",{className:`${n.className??""} ymllayout-main`,"data-testid":n.testid,children:e.jsxs(R,{children:[e.jsx(R.Header,{children:"Layout Error"}),e.jsxs(R.Contents,{children:[e.jsxs("p",{children:["File: ",t.name]}),e.jsx(i.Alert,{variant:"warning",children:e.jsx("pre",{className:"mb-0",children:t.error})})]})]})}):e.jsx("div",{className:`${n.className??""} ymllayout-main`,"data-testid":n.testid,children:e.jsx(js,{resetKey:t,unhandledComponentDidCatch:n.unhandledComponentDidCatch,UnhandledErrorComponent:n.UnhandledErrorComponent,children:(o=t.children)==null?void 0:o.map((s,r)=>W(s,r))})})}const Je={hardwareproperty:xs,hardware:ys};function Ph(n,t){Je[n]=t}function Bh(){return Je}function Le(n){return e.jsxs(i.Col,{className:"monitor-panel-item bg-fatal",title:`Error from yaml configuration: ${n.message}`,children:[e.jsx("h1",{children:n.monitor.name}),e.jsx("div",{children:"Parsing error"})]})}function Gh(n){const t=P.map(n.monitors,(o,s)=>{const r=o.type??"hardwareproperty",a=Je[r];return a===void 0?e.jsx(Le,{monitor:o,message:`Type ${r} unsupported`},`m${s}`):e.jsx(a,{monitor:o},`m${s}`)});return e.jsx("div",{className:q.default({"ms-auto":n.margin==="start"},"me-auto","monitor-panel",{"monitor-panel-light":n.bg==="light"}),children:e.jsx(i.Container,{fluid:!0,children:e.jsx(i.Row,{className:"flex-nowrap",children:t})})})}function ys(n){const{monitor:t}=n,{id:o}=t,s=Ae(o),r=G(s),a=oe(s);if(o===void 0)return e.jsx(Le,{monitor:t,message:"'id' is missing"});if(typeof o!="string")return e.jsx(Le,{monitor:t,message:"'id' is invalid"});if(r===null)return e.jsx(D,{state:"NONE",variant:"danger",description:`hardware '${o}' was not found`});const{type:c="none"}=r,l={...r,actions:a},u=Ze(c,"monitor");return u?e.jsx(u,{hardware:l,options:{name:t.name},operator:!1,disabled:!1}):e.jsx(Te,{hardware:l})}exports.AirBearing=Nt;exports.AirBearingHardwareDesc=Ct;exports.AirBearingMocks=_t;exports.AirBearingProtected=bt;exports.AirBearingSimulator=St;exports.AirBearingState=Fe;exports.BaseHardwareDesc=yt;exports.BaseInfo=gt;exports.BaseMocks=jt;exports.BaseName=ht;exports.BaseProperty=xt;exports.BaseState=mt;exports.BeamlineHardwareDesc=$t;exports.Beamviewer=Ot;exports.BeamviewerHardwareDesc=Dt;exports.BeamviewerMocks=It;exports.BeamviewerSimulator=Mt;exports.COMPARATORS=Mh;exports.EnergyManagerDefault=Tt;exports.EnergyManagerHardwareDesc=Et;exports.EnergyManagerMocks=Rt;exports.EnergyManagerSimulator=At;exports.EnergyManagerState=Ue;exports.ErrorObject=Rm;exports.FiltersetDefault=Bt;exports.FiltersetHardwareDesc=ri;exports.FiltersetMocks=Gt;exports.FiltersetSimulator=Lt;exports.FiltersetState=Pt;exports.Formatting=di;exports.Frontend=Ut;exports.FrontendHardwareDesc=Wt;exports.FrontendMocks=qt;exports.FullSizer=cs;exports.Gauge=zt;exports.GaugeHardwareDesc=Kt;exports.GaugeIndicator=Pm;exports.GaugeMocks=Yt;exports.HardwareInputNumber=me;exports.HardwareNumericStep=ge;exports.HardwareSchema=Ah;exports.HardwareState=Sh;exports.HardwareTemplate=_;exports.HardwareTypes=Rh;exports.InfiniteKnob360=Sn;exports.KeyError=T;exports.Laser=Xt;exports.LaserHardwareDesc=Jt;exports.LaserHeating=en;exports.LaserHeatingHardwareDesc=nn;exports.LaserHeatingMocks=tn;exports.LaserMocks=Zt;exports.Light=on;exports.LightHardwareDesc=rn;exports.LightMocks=sn;exports.LimaBinning=un;exports.LimaDefault=an;exports.LimaDescription=pn;exports.LimaHardwareDesc=jn;exports.LimaImageRoi=fn;exports.LimaMocks=hn;exports.LimaShape=mn;exports.LimaSimulator=gn;exports.LimaSize=cn;exports.LimaState=Z;exports.LimaTransformation=ln;exports.LoadingObject=Dm;exports.MeasurementGroupDefault=yn;exports.MeasurementGroupHardwareDesc=bn;exports.MeasurementGroupMocks=vn;exports.MeasurementGroupSimulator=Nn;exports.MissingComponentObject=Em;exports.MissingKeysError=Me;exports.MissingObject=Fm;exports.MonitorHardware=ys;exports.MonitorHardwareProperty=xs;exports.MonitorPanel=Gh;exports.MonitorPanelItem=X;exports.MotorDefault=ce;exports.MotorHardwareDesc=Fn;exports.MotorMocks=On;exports.MotorRotation=Cn;exports.MotorSimulator=In;exports.MotorState=we;exports.MotorText=_n;exports.MultiState=vt;exports.Multiposition=Rn;exports.MultipositionDefault2=En;exports.MultipositionHardwareDesc=Bn;exports.MultipositionMocks=kn;exports.MultipositionSimulator=Pn;exports.NoObject=Mm;exports.None=ls;exports.NullObject=km;exports.NumericStep=Qt;exports.OpticDefault=Ln;exports.OpticHardwareDesc=Vn;exports.OpticMocks=Hn;exports.OpticSimulator=Un;exports.OpticState=qe;exports.Panel=R;exports.ProcedureActions=qn;exports.ProcedureExecution=zn;exports.ProcedureFinishedState=Wn;exports.ProcedureHardwareDesc=Qn;exports.ProcedureManage=Be;exports.ProcedureMocks=Kn;exports.ProcedureState=ye;exports.ProcedureValidate=Yn;exports.PumpDefault=mo;exports.PumpHardwareDesc=go;exports.PumpMocks=ho;exports.PusherDefault=xo;exports.PusherHardwareDesc=yo;exports.PusherMocks=wo;exports.PusherSimulator=jo;exports.PusherState=Ye;exports.RegulationDefault=Jn;exports.RegulationHardwareDesc=oo;exports.RegulationMocks=to;exports.RegulationPlot=We;exports.RegulationSimulator=no;exports.ServiceDefault=vo;exports.ServiceHardwareDesc=_o;exports.ServiceMocks=bo;exports.ServiceProtected=No;exports.ServiceState=Re;exports.ShutterDefault=so;exports.ShutterHardwareDesc=lo;exports.ShutterMocks=ao;exports.ShutterProtected=ro;exports.ShutterSimulator=co;exports.ShutterState=ve;exports.SlitDefault=uo;exports.SlitHardwareDesc=po;exports.SlitMocks=fo;exports.SlitState=ze;exports.State=D;exports.Synoptic=Fh;exports.Todo=ms;exports.TomoConfigHardwareDesc=es;exports.TomoConfigLatencyTime=Jo;exports.TomoDetectorAcquisitionMode=Eo;exports.TomoDetectorHardwareDesc=Po;exports.TomoDetectorMocks=ko;exports.TomoDetectorSamplePixelSize=Ro;exports.TomoDetectorState=be;exports.TomoDetectorsDefault=Bo;exports.TomoDetectorsHardwareDesc=Lo;exports.TomoDetectorsMocks=Go;exports.TomoDetectorsState=Qe;exports.TomoFlatMotionDefault=So;exports.TomoFlatMotionHardwareDesc=Io;exports.TomoFlatMotionMocks=$o;exports.TomoFlatMotionSimulator=Oo;exports.TomoFlatMotionSmall=Co;exports.TomoFlatMotionState=Ne;exports.TomoHoloHardwareDesc=os;exports.TomoHoloState=ns;exports.TomoImagingActions=Wo;exports.TomoImagingDefault=Uo;exports.TomoImagingExposureTime=Vo;exports.TomoImagingHardwareDesc=Qo;exports.TomoImagingMocks=Yo;exports.TomoImagingSettleTime=qo;exports.TomoImagingSimulator=Ko;exports.TomoImagingState=ae;exports.TomoImagingUpdateMode=zo;exports.TomoReferencePositionDefault=To;exports.TomoReferencePositionHardwareDesc=Fo;exports.TomoSampleStageHardwareDesc=Xo;exports.TypeIcon=N;exports.ValveDefault=rs;exports.ValveHardwareDesc=as;exports.ValveMocks=is;exports.YAMLErrorBoundary=js;exports.YAMLLayout=kh;exports.YamlAsserts=vh;exports.createMotorMock=Yl;exports.dynamicOp=De;exports.getAllHardwareDesc=_h;exports.getAllMonitors=Bh;exports.getHardwareVariantComponent=Ze;exports.getYamlComponents=th;exports.getYamlContainers=nh;exports.isLimaHardware=xe;exports.isMotorClockWise=Dn;exports.isMotorHardware=Mn;exports.isOpticHardware=Nd;exports.isProcedureHardware=Xn;exports.isTomoConfigHardware=ts;exports.isTomoDetectorHardware=Ke;exports.isTomoDetectorsHardware=Ho;exports.isTomoFlatMotionHardware=Mo;exports.isTomoHoloHardware=ss;exports.isTomoReferencePositionHardware=lp;exports.isTomoSampleStageHardware=Zo;exports.limaGuessSubframes=wn;exports.motorLimits=Tn;exports.normalizeId=Ae;exports.registerHardwareVariant=bh;exports.registerMonitorComponent=Ph;exports.registerRuntimeHook=Da;exports.registerYamlComponent=ds;exports.registerYamlComponents=eh;exports.registerYamlContainer=Jm;exports.renderYamlNode=W;exports.useHardware=G;exports.useHardwareChangeActions=oe;exports.useHardwareSchema=Ta;exports.useLimaHardware=xn;exports.useMotorHardware=U;exports.useMotorStates=je;exports.useOperator=Fa;exports.useProcedureHardware=kd;exports.useScanRunning=Ra;exports.useTomoConfigHardware=mm;exports.useTomoDetectorHardware=Mp;exports.useTomoDetectorsHardware=Hp;exports.useTomoFlatMotionHardware=cp;exports.useTomoHoloHardware=xm;exports.useTomoSampleStageHardware=um;exports.yamlComponents=ie;exports.yamlContainers=re;
|
|
37
|
+
`,voltage:6998},Yu="tango",Ku=!0,Qu="pump",Xu={callables:Uu,id:Vu,name:qu,online:Wu,properties:zu,protocol:Yu,require_staff:Ku,type:Qu},go={default:Xu},Zu={default:ho},xo={variants:Zu,mocks:go};function Ye(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={RETRACTED:"success",IN_TOUCH:"warning",LOST:"warning",MOVING_IN:"transient",MOVING_OUT:"transient",UNKNOWN:"danger",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function Ju(n){const{hardware:t}=n;return e.jsx(Ye,{hardware:t})}function Ie(n){const{text:t,icon:o,leftIcon:s=o,rightIcon:r=o,iconLocation:a="left",onAction:c,onActionChange:l,disabled:u=!1,variant:f,style:d={},className:p=""}=n,[m,h]=g.useState(!1),w=r&&a==="right",x=s&&a==="left";return e.jsx(i.Button,{variant:f,style:d,className:p,onClick:()=>{l==null||l(!0),h(!0),c().finally(()=>{h(!1),l==null||l(!1)})},disabled:u,children:e.jsxs("span",{className:"text-nowrap",children:[x&&e.jsxs(e.Fragment,{children:[e.jsx("i",{className:m?"fa-solid fa-fw fa-cog fa-spin":s})," "]}),t,w&&e.jsxs(e.Fragment,{children:[" ",e.jsx("i",{className:m?"fa-solid fa-fw fa-cog fa-spin":r})]})]})})}function ef(n){const{className:t,hardware:o,options:s={},style:r={},leftToRight:a}=n,{state:c}=o.properties??"OFFLINE",u=!(c==="IN_TOUCH")||n.disabled;function f(d){const{distance:p,style:m}=d;return e.jsx(Ie,{text:`${p}`,style:m,variant:"secondary",onAction:()=>o.actions.call("push",p),disabled:u,leftIcon:"fa fa-fw fa-arrow-left",rightIcon:"fa fa-fw fa-arrow-right",iconLocation:a?"right":"left"})}return e.jsxs("div",{className:t,style:{display:"grid",gridTemplateRows:"min-content min-content min-content",gridTemplateColumns:"min-content min-content min-content",gridGap:"1px",...r},children:[e.jsx(f,{distance:5,style:{gridColumn:a?3:1,gridRow:1}}),e.jsx(f,{distance:.5,style:{gridColumn:2,gridRow:1}}),e.jsx(f,{distance:.05,style:{gridColumn:a?1:3,gridRow:1}}),e.jsx(f,{distance:2,style:{gridColumn:a?3:1,gridRow:2}}),e.jsx(f,{distance:.2,style:{gridColumn:2,gridRow:2}}),e.jsx(f,{distance:.02,style:{gridColumn:a?1:3,gridRow:2}}),e.jsx(f,{distance:1,style:{gridColumn:a?3:1,gridRow:3}}),e.jsx(f,{distance:.1,style:{gridColumn:2,gridRow:3}}),e.jsx(f,{distance:.01,style:{gridColumn:a?1:3,gridRow:3}})]})}function tf(n){const{hardware:t,options:o,disabled:s,leftToRight:r}=n,{state:a}=t.properties??"OFFLINE",c=a==="RETRACTED",l=a==="IN_TOUCH",u=a==="LOST",[f,d]=g.useState(!1);function p(){return c?r?"ms-0":"ms-auto":l?r?"ms-auto":"ms-0":"mx-auto"}const m=p();return e.jsxs("div",{style:{display:"grid",gridTemplateRows:"min-content min-content",gridTemplateColumns:r?"auto min-content":"min-content auto",gridGap:"1px"},children:[e.jsx("i",{className:`${l||u?"fas fa-dizzy":"fa fa-smile"} fa-3x my-auto`,style:{gridColumn:r?2:1,gridRow:1}}),e.jsx(ef,{className:m,...n,style:{gridColumn:r?1:2,gridRow:1}}),e.jsxs(i.ButtonGroup,{className:"mx-auto",style:{width:"12em",gridColumn:r?1:2,gridRow:2},children:[!r&&e.jsx(Ie,{text:"In",onAction:()=>t.actions.call("move_in"),onActionChange:h=>{d(h)},disabled:l||s||f,style:{width:"5em"},iconLocation:"left",icon:"fa fa-fw fa-arrow-left"}),e.jsx(Ie,{text:"Out",onAction:()=>t.actions.call("move_out"),onActionChange:h=>{d(h)},iconLocation:r?"left":"right",disabled:c||s||f,style:{width:"5em"},leftIcon:"fa fa-fw fa-arrow-left",rightIcon:"fa fa-fw fa-arrow-right"}),r&&e.jsx(Ie,{text:"In",onAction:()=>t.actions.call("move_in"),onActionChange:h=>{d(h)},disabled:l||s||f,style:{width:"5em"},iconLocation:"right",icon:"fa fa-fw fa-arrow-right"})]})]})}function wo(n){const{hardware:t,options:o={}}=n,s=(o.orientation??"right-left")==="left-right",r=e.jsx(N,{name:"Pusher",icon:"fa-hand-point-right",online:t.online}),a=e.jsx(Ye,{hardware:t});function c(){return e.jsx(tf,{...n,leftToRight:s})}const l=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:c(),headerMode:l})}const nf=["move_in","move_out","push","sync_hard"],of="pusher",sf="pusher",rf=!0,af={state:"RETRACTED"},cf="bliss",lf=!1,df="pusher",uf={callables:nf,id:of,name:sf,online:rf,properties:af,protocol:cf,require_staff:lf,type:df},jo={default:uf};function yo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState("RETRACTED");async function c(f,d){if(f==="move_in"){a("MOVING_IN"),await L(2e3),a("IN_TOUCH");return}if(f==="move_out"){a("MOVING_OUT"),await L(2e3),a("RETRACTED");return}if(f==="push"){await L(100);return}console.log("PusherSimulator: Unsupported call",f,d)}async function l(f,d){console.log("PusherSimulator: Unsupported setProperty",f,d)}const u={state:r};return e.jsx(V,{name:t,alias:o,type:"pusher",call:c,setProperty:l,properties:u,useHardwareContext:s})}const ff={default:wo,state:Ju},vo={variants:ff,mocks:jo,simulator:yo};function Re(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={STOPPED:"danger",STARTING:"transient",RUNNING:"success",BACKOFF:"warning",STOPPING:"transient",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"fatal",OFFLINE:"secondary"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function pf(n){const{hardware:t}=n;return e.jsx(Re,{hardware:t})}function No(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(Re,{hardware:t});function a(){t.actions.call("start")}function c(){t.actions.call("restart")}function l(){t.actions.call("stop")}function u(){return t.properties?t.properties.state:"UNKNOWN"}function f(b){return b.charAt(0).toUpperCase()+b.slice(1).toLowerCase()}const d=u(),p=f(d),h={STOPPED:"danger",STARTING:"transient",RUNNING:"success",BACKOFF:"warning",STOPPING:"transient",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"secondary",OFFLINE:"secondary"}[d]||"danger";function w(){const b=d==="RUNNING"||d==="STARTING";return{icon:b?"fa fa-refresh fa-wp":"fa fa-play fa-wp",variant:n.disabled?"":"success",callback:d==="RUNNING"?c:a,disabled:n.disabled,title:n.operator?b?"Restart the service":"Start the serStaticTextInputvice":"You dont have the control to the session"}}function x(){const b=d==="RUNNING"||d==="STARTING";return{icon:"fa fa-stop fa-wp",variant:n.disabled?"":b?"danger":"secondary",callback:l,disabled:n.disabled,title:n.operator?"Stop the service":"You dont have the control to the session"}}const j=w(),y=x(),S=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:h,className:"text-center",style:{minWidth:"8em"},value:p}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${j.variant}`,onClick:j.callback,disabled:j.disabled,title:j.title,children:e.jsx("i",{className:`${j.icon}`})}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${y.variant}`,onClick:y.callback,disabled:y.disabled,title:y.title,children:e.jsx("i",{className:`${y.icon}`})})]}),$=n.options.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:S,headerMode:$})}function mf(n){var u;const{hardware:t,options:o={}}=n;function s(){t.actions.call("start")}function r(){t.actions.call("restart")}function a(){t.actions.call("stop")}const c=((u=t.properties)==null?void 0:u.state)??"UNKNOWN",l=c==="STOPPING"||c==="STARTING";return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,placement:o.dropDirection==="up"?"top":"bottom",overlay:e.jsx(i.Popover,{id:"service-protected-overlay",children:e.jsxs(i.Popover.Body,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsxs(i.Col,{children:[c==="RUNNING"&&e.jsxs(i.Button,{className:"me-1 text-success border-secondary",variant:"light",onClick:()=>{r()},disabled:n.disabled,title:"Restart the service",children:[e.jsx("i",{className:"fa fa-refresh fa-wp me-1"}),"Restart"]}),c!=="RUNNING"&&e.jsxs(i.Button,{className:"me-1 text-success border-secondary",variant:"light",onClick:()=>{s()},disabled:n.disabled,title:"Start the service",children:[e.jsx("i",{className:"fa fa-play fa-wp me-1"}),"Start"]}),e.jsxs(i.Button,{className:`text-${c!=="STOPPED"?"danger":"primary"} border-secondary`,variant:"light",onClick:()=>{a()},disabled:n.disabled,title:"Stop the service",children:[e.jsx("i",{className:"fa fa-stop fa-wp me-1"}),"Stop"]})]})})]})}),children:e.jsx(i.Button,{disabled:n.disabled||l,children:e.jsx("i",{className:`fa fa-caret-${o.dropDirection==="up"?"up":"down"}`})})})}function bo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(Re,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(h){return h.charAt(0).toUpperCase()+h.slice(1).toLowerCase()}const l=a(),f={STOPPED:"danger",STARTING:"transient",RUNNING:"success",BACKOFF:"warning",STOPPING:"transient",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"fatal",OFFLINE:"secondary"}[l],d=c(l),p=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:f,style:{minWidth:"10em"},value:d,className:"text-center"}),e.jsx(mf,{...n})]}),m=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:p,headerMode:m})}const hf=["start","stop","restart"],gf="service1",xf="service1",wf=!0,jf={state:"RUNNING"},yf="multivisor",vf=!0,Nf="service",bf={callables:hf,id:gf,name:xf,online:wf,properties:jf,protocol:yf,require_staff:vf,type:Nf},_o={default:bf},_f={default:No,protected:bo,state:pf},So={variants:_f,mocks:_o};function Ne(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:["success","Ready to be used"],IN:["success","The sample is in the beam"],OUT:["danger","The sample is out of the beam"],MOVING_IN:["transient","The sample moving in the beam"],MOVING_OUT:["transient","The sample moving out of the beam"],LOST:["warning","The motion was interrupted between IN and OUT positions"],UNKNOWN:["fatal","The device have an unknown state"]},[r,a]=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r,description:a})}function Sf(n){const{hardware:t}=n;return e.jsx(Ne,{hardware:t})}function Cf(n){const{motion:t}=n,s=t.axisRef.slice(9),r=U(s),a=(r==null?void 0:r.alias)??(r==null?void 0:r.name)??(r==null?void 0:r.id)??s;return e.jsx("div",{className:"my-auto",children:a})}function $f(n){const{motion:t,actions:o,disabled:s}=n,r=t.axisRef;function a(){o.call("update_axis",{axis_ref:r})}return e.jsx(i.Button,{variant:"danger",onClick:a,disabled:s,children:e.jsx("i",{className:"fa fa-trash"})})}function Of(n){const{motion:t,actions:o,axisRef:s,disabled:r}=n,a=g.useMemo(()=>{for(const d of t)if(d.axisRef===s)return!0;return!1},[t,s]),c=s.slice(9),l=U(c),u=(l==null?void 0:l.alias)??(l==null?void 0:l.name)??(l==null?void 0:l.id)??c;function f(){o.call("update_axis",{axis_ref:s,relative_position:0})}return e.jsx(i.Button,{className:"ms-1",variant:a?"primary":"secondary",onClick:()=>{a||f()},title:a?"This axis is already part of the motion":"Use this axis in the motion",disabled:r,children:u})}function If(n){var x;const{motion:t,actions:o}=n,s=t.axisRef,r=t.absolute_position??t.relative_position??0,a=s.slice(9),c=U(a),l=n.disabled||!(c!=null&&c.online),u=g.useRef(null),[f,d]=g.useState(!1),p=3,m=((x=c==null?void 0:c.properties)==null?void 0:x.unit)??"";function h(j){if(!u||!u.current)console.log("formRef not yet defined");else if(j.key==="Enter"){d(!1);const y=Number.parseFloat(u.current.value);o.call("update_axis",{axis_ref:s,absolute_position:t.absolute_position!==null?y:null,relative_position:t.relative_position!==null?y:null})}else j.key==="Escape"?(u.current.value=r.toFixed(p),d(!1)):console.log(j.key)}function w(j){const{value:y}=j.target;if(y===void 0)return;const S=Number.parseFloat(y);S!==r&&!f&&d(!0),S===r&&f&&d(!1)}return g.useEffect(()=>{!u||!u.current?console.log("formRef not yet defined"):f||(u.current.value=r.toFixed(p))},[f,r]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:f?"form-control-edited":"",type:"number",ref:u,defaultValue:r.toFixed(p),onChange:w,disabled:l,onKeyDown:h}),e.jsx(i.InputGroup.Text,{children:m})]})}function Mf(n){const{actions:t,motion:o,disabled:s}=n;function r(){t.call("update_axis",{axis_ref:o.axisRef,absolute_position:o.absolute_position??o.relative_position})}function a(){t.call("update_axis",{axis_ref:o.axisRef,relative_position:o.absolute_position??o.relative_position})}return e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{onClick:r,variant:o.absolute_position!==null?"primary":"secondary",disabled:s,children:"Abs"}),e.jsx(i.Button,{onClick:a,variant:o.relative_position!==null?"primary":"secondary",disabled:s,children:"Rel"})]})}function Co(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,a=To(t),c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(Ne,{hardware:t}),u=e.jsxs(i.Container,{children:[e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Move in parallel"}),e.jsx(i.Col,{xs:9,children:r.move_in_parallel?"true":"false"})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Switch power on/off"}),e.jsx(i.Col,{xs:9,children:r.power_onoff?"true":"false"})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Settle time"}),e.jsxs(i.Col,{xs:9,children:[r.settle_time.toFixed(2)," ",e.jsx("span",{title:"seconds",children:"s"})]})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Available axes"}),e.jsx(i.Col,{xs:9,children:r.available_axes.map(d=>e.jsx(Of,{axisRef:d,motion:r.motion,actions:t.actions,disabled:s||!a},d))})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Actual motion"}),e.jsx(i.Col,{xs:9,children:e.jsxs("div",{style:{display:"grid",gridGap:5,gridTemplateColumns:"min-content min-content auto min-content"},children:[e.jsx("div",{children:"Axis"}),e.jsx("div",{children:"Kind"}),e.jsx("div",{children:"Displacement"}),e.jsx("div",{}),r.motion.map((d,p)=>e.jsxs(g.Fragment,{children:[e.jsx(Cf,{motion:d}),e.jsx(Mf,{motion:d,actions:t.actions,disabled:s||!a}),e.jsx(If,{motion:d,actions:t.actions,disabled:s||!a}),e.jsx($f,{motion:d,actions:t.actions,disabled:s||!a})]},`motion${p}`))]})})]})]}),f=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:u,headerMode:f})}function Df(n){var b;const{motion:t,actions:o}=n,s=t.axisRef,r=t.absolute_position??t.relative_position??0,a=s.slice(9),c=U(a),l=n.disabled||!(c!=null&&c.online),u=g.useRef(null),[f,d]=g.useState(!1),p=3,m=((b=c==null?void 0:c.properties)==null?void 0:b.unit)??"",h=(c==null?void 0:c.alias)??(c==null?void 0:c.name)??(c==null?void 0:c.id)??"none";function w(v){if(!u||!u.current)console.log("formRef not yet defined");else if(v.key==="Enter"){d(!1);const C=Number.parseFloat(u.current.value);o.call("update_axis",{axis_ref:s,absolute_position:t.absolute_position!==null?C:null,relative_position:t.relative_position!==null?C:null})}else v.key==="Escape"?(u.current.value=r.toFixed(p),d(!1)):console.log(v.key)}function x(v){const{value:C}=v.target;if(C===void 0)return;const I=Number.parseFloat(C);I!==r&&!f&&d(!0),I===r&&f&&d(!1)}g.useEffect(()=>{!u||!u.current?console.log("formRef not yet defined"):f||(u.current.value=r.toFixed(p))},[f,r]);function j(){return t.absolute_position!==null?["ABS","warning","Absolute displacement"]:t.relative_position!==null?["REL","none","Relative displacement"]:["ERR","danger","Unknown motion kind"]}const[y,S,$]=j();return e.jsxs(i.InputGroup,{className:"w-100 flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Displacement to apply on this axis to take a flat",style:{width:"5em"},children:h}),e.jsx(i.InputGroup.Text,{className:`bg-${S}`,title:$,style:{width:"3em"},children:y}),e.jsx(i.Form.Control,{className:f?"form-control-edited":"",type:"number",ref:u,defaultValue:r.toFixed(p),onChange:x,disabled:l,onKeyDown:w}),e.jsx(i.InputGroup.Text,{children:m})]})}function $o(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,a=To(t),c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(Ne,{hardware:t}),u=e.jsxs(e.Fragment,{children:[r.motion.length===0&&e.jsx(i.Alert,{variant:"danger",className:"mb-0",children:"No flat motion defined"}),r.motion.length>0&&e.jsx(i.Stack,{direction:"vertical",children:r.motion.map((d,p)=>e.jsx(Df,{actions:t.actions,motion:d,disabled:s||!a},d.axisRef))})]}),f=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:u,headerMode:f})}function Tf(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r}=t,{state:a="UNKNOWN"}=r,c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(Ne,{hardware:t}),u=a==="IN",f=a==="OUT";function d(){return u?"1 / 3":f?"3 / 5":"2 / 4"}const p=d(),m=u?"fa-face-grin-beam-sweat":"fa-smile",h=u?"The sample is in front of the beam":f?"The sample is out of the beam":"",w=e.jsx("div",{style:{display:"grid",gridGap:0,gridTemplateColumns:"1fr 1fr 1fr 1fr 1fr 1fr",gridTemplateRows:"1fr"},children:e.jsx("i",{className:`fa ${m} fa-3x my-auto mx-auto`,style:{gridColumn:p,gridRow:1},title:h})}),x=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:w,headerMode:x})}const Ff="tomoflatmotion",Rf="tomoflatmotion",Af=!0,Ef={state:"READY",settle_time:2,power_onoff:!1,move_in_parallel:!0,available_axes:["hardware:sy","hardware:sy2"],motion:[{axisRef:"hardware:sy",absolute_position:null,relative_position:1}]},kf="bliss",Pf=!1,Bf="tomoflatmotion",Gf={id:Ff,name:Rf,online:Af,properties:Ef,protocol:kf,require_staff:Pf,type:Bf},Lf=["move","stop","wait","rmove"],Hf="sy",Uf="sy",Vf=!0,qf={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Wf="bliss",zf=!1,Yf="motor",Kf=[],Qf={callables:Lf,id:Hf,name:Uf,online:Vf,properties:qf,protocol:Wf,require_staff:zf,type:Yf,user_tags:Kf},Xf=["move","stop","wait","rmove"],Zf="sy2",Jf="sy2",ep=!0,tp={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},np="bliss",op=!1,sp="motor",rp=[],ip={callables:Xf,id:Zf,name:Jf,online:ep,properties:tp,protocol:np,require_staff:op,type:sp,user_tags:rp},Oo={default:Gf,sy:Qf,sy2:ip};function Io(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState({state:"READY",settle_time:2,power_onoff:!1,move_in_parallel:!0,available_axes:["hardware:sy","hardware:sy2"],motion:[{axisRef:"hardware:sy",absolute_position:null,relative_position:1}]});function c(f,d){const p=[];let m=!1;return f.motion.forEach(h=>{if(h.axisRef===d.axis_ref){if(m=!0,d.relative_position===void 0&&d.absolute_position===void 0)return;p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null});return}p.push(h)}),m||p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null}),{...f,motion:p}}async function l(f,d){if(f==="update_axis"){a(p=>c(p,d));return}console.log("TomoFlatMotionSimulator: Unsupported call",f,d)}async function u(f,d){console.log("TomoFlatMotionSimulator: Unsupported setProperty",f,d)}return e.jsx(V,{name:t,alias:o,type:"tomoflatmotion",call:l,setProperty:u,properties:r,useHardwareContext:s})}const ap={default:Co,small:$o,state:Sf,sample_location:Tf},Mo={variants:ap,mocks:Oo,simulator:Io};function Do(n){return n.type==="tomoflatmotion"}function cp(n){const t=G(n);return t===null||!Do(t)?null:t}function To(n){const{properties:t={}}=n,{state:o="UNKNOWN"}=t;return["IN","READY"].includes(o)}function Fo(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r}=t,{label:a}=o,[c,l]=g.useState(void 0),[u,f]=g.useState(!1),d=e.jsx(N,{name:"TomoReferencePositionSchema",icon:"fam-hardware-motor",online:t.online});function p(x){l(void 0),f(!0),r.call("move_to_reference").catch(j=>{l(`${j}`)}).finally(()=>{f(!1)})}const m=e.jsx(e.Fragment,{}),h=e.jsxs(i.Button,{onClick:p,variant:c===void 0?"secondary":"danger",disabled:s||u,className:"w-100",children:[c&&e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-1",title:c}),!c&&u&&e.jsx("i",{className:"fa-solid fa-cog fa-spin me-1"}),a??"Back to reference position"]}),w=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:d,widgetState:m,widgetContent:h,headerMode:w})}function lp(n){return n.type==="tomoreferenceposition"}const dp={default:Fo},Ro={variants:dp};function be(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":t.properties.state)||"UNKNOWN":"OFFLINE",a={UNKNOWN:"danger",READY:"success",OFFLINE:"secondary",INVALID:"danger",MOUNTING:"transient",UNMOUNTING:"transient",LOCKED:"warning"},c=a[r]||a.UNKNOWN;return e.jsx(D,{state:r,minWidth:6,variant:c})}function up(n){const{hardware:t}=n;return e.jsx(be,{hardware:t})}function fp(n){const{hardware:t,options:o={}}=n;function s(a){return t.actions?t.actions.setProperty("sample_pixel_size_mode",a):console.error("Change request was triggered with:",a),null}const r=t.properties.sample_pixel_size_mode;return e.jsx(i.Dropdown,{style:n.style,children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:r==="USER"?"primary":"secondary",onClick:()=>{s("USER")},disabled:n.disabled,title:"Use a fixed pixel size defined by the user",children:"USER"}),e.jsx(i.Button,{variant:r==="AUTO"?"primary":"secondary",onClick:()=>{s("AUTO")},disabled:n.disabled,title:"Compute the pixel size automatically based on the beamline geometry",children:"AUTO"})]})})}function pp(n){const{hardware:t,options:o={}}=n,s=t.properties.user_sample_pixel_size||0,{state:r}=t.properties,a=r==="READY";function c(l){return t.actions?t.actions.setProperty("user_sample_pixel_size",l):console.error("Change request was triggered with:",l),null}return e.jsx(me,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.sample_pixel_size_mode!=="USER"})}function mp(n){const{hardware:t,options:o={}}=n;return t.properties.state,e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:n.disabled,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Mode"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsx(fp,{...n,style:{width:"100%"}})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center mt-1",children:"User pixel size"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.InputGroup,{children:[e.jsx(pp,{...n}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function hp(n,t,o){return g.useMemo(()=>{function s(c){return c==="um"?"μm":c}function r(c){return c.toFixed(3).replace(/\.?0+$/,"")}if(n==null)return["∅",""];if(t===o)return[r(n),s(o)];const a=pt.default(n,t);return[r(a.to(o).scalar),s(o)]},[n,t,o])}function Ao(n){const{hardware:t,options:o={}}=n,s=o.display_unit??"um",r=e.jsx(N,{name:"TomoDetector",icon:"fa-cog",online:t.online}),a=e.jsx(be,{hardware:t}),[c,l]=hp(t.properties.sample_pixel_size,"um",s),u=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{className:"justify-content-center",style:{minWidth:"4em"},children:t.properties.sample_pixel_size_mode}),e.jsx(B,{value:c,title:`${t.properties.sample_pixel_size} um`}),e.jsx(i.InputGroup.Text,{children:l}),e.jsx(mp,{...n})]}),f=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:u,headerMode:f})}function de(n,t,o,s){if(t===o)return n;if(t==="rad"&&o==="deg")return 180*n/Math.PI;if(t==="deg"&&o==="rad")return Math.PI*n/180;if(t==="px"){if(s!==void 0){const r=s.to("mm").scalar;return de(n*r,"mm",o,void 0)}return Number.NaN}if(o==="px"){if(s!==void 0){const r=de(n,t,"mm",void 0),a=s.to("mm").scalar;return r/a}return Number.NaN}try{return pt.default(n,t).to(o).scalar}catch{return console.error(`Convertion ${t}->${o} is not provided`),Number.NaN}}function Eo(n){return n.startsWith("u")?`μ${n.slice(1)}`:n}function le(n){return!n||!n.startsWith("hardware:")?null:n.slice(9)}function gp(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{sample_pixel_size:r,detector:a=null}=s,c=wn(le(a)),{properties:l={}}=c??{},{size:u}=l,f=o.display_unit??"mm",d=o.digits??3,p=e.jsx(N,{name:"TomoDetector",icon:"fa-eye",online:t.online}),m=e.jsx(be,{hardware:t}),h=g.useMemo(()=>{if(r==null||u===null||u===void 0)return"∅";const j=de(u[0]*r,"um",f),y=de(u[1]*r,"um",f);return`${j.toFixed(d)} × ${y.toFixed(d)}`},[r,u,f,d]),w=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:h}),e.jsx(i.InputGroup.Text,{children:Eo(f)})]}),x=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:p,widgetState:m,widgetContent:w,headerMode:x})}function xp(n){const{hardware:t,options:o={}}=n;function s(a){return t.actions?t.actions.setProperty("acq_mode",a):console.error("Change request was triggered with:",a),null}const r=t.properties.acq_mode;return e.jsx(i.Dropdown,{style:n.style,children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:r==="SINGLE"?"primary":"secondary",onClick:()=>{s("SINGLE")},disabled:n.disabled,title:"Do acquisition in a single shot",children:"SINGLE"}),e.jsx(i.Button,{variant:r==="ACCUMULATION"?"primary":"secondary",onClick:()=>{s("ACCUMULATION")},disabled:n.disabled,title:"Do acqisition in multiple sub frame with accumulation",children:"ACCU"})]})})}function wp(n){const{hardware:t,actions:o}=n,s=t.properties.acc_max_expo_time||0,{state:r}=t.properties,a=r==="READY";function c(l){return o.setProperty("acc_max_expo_time",l),null}return e.jsx(me,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.state!=="READY"})}function jp(n){const t=G(n);return t!==null&&xe(t)?t:null}function yp(n){var c;const{hardware:t}=n,{properties:o}=t,s=((c=o.detector)==null?void 0:c.slice(9))??"",r=jp(s),a=oe(s);return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:n.disabled,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Acquisition mode"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsx(xp,{...n,style:{width:"100%"}})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center mt-1",children:"Max sub frame exposition"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:r&&e.jsxs(i.InputGroup,{children:[e.jsx(wp,{hardware:r,actions:a}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function ko(n){const{hardware:t}=n,o=e.jsx(N,{name:"TomoDetector",icon:"fa-cog",online:t.online}),s=e.jsx(be,{hardware:t}),r=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:t.properties.acq_mode}),e.jsx(yp,{...n})]}),a=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:r,headerMode:a})}const vp="tomodet1",Np="tomodet1",bp=!0,_p={state:"READY",sample_pixel_size_mode:"AUTO",user_sample_pixel_size:50,sample_pixel_size:48,detector:"hardware:det1",optic:"hardware:opt1",source_distance:10,acq_mode:"SINGLE"},Sp="bliss",Cp=!1,$p="tomodetector",Op={id:vp,name:Np,online:bp,properties:_p,protocol:Sp,require_staff:Cp,type:$p},Po={default:Op},Ip={samplepixelsize:Ao,acquisitionmode:ko,fieldofview:gp,state:up},Bo={variants:Ip,mocks:Po};function Ke(n){return n.type==="tomodetector"}function Mp(n){const t=G(n);return t===null||!Ke(t)?null:t}function Qe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOUNTING:"transient",UNMOUNTING:"transient",UNKNOWN:"fatal",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function Dp(n){const{hardware:t}=n;return e.jsx(Qe,{hardware:t})}function Tp(n){const{hardware:t}=n,{properties:o}=t,{detectors:s}=o,r=le(o.active_detector),a=le(o.target_detector),c=o.state==="READY",l=n.disabled||!t.online||!c;function u(d){t.actions?t.actions.call("mount",d):console.error("Change request was triggered with:",d)}function f(d){const p=le(d),h=p===(a||r)?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:l,onClick:()=>{u(p)},children:[e.jsx("i",{className:h})," ",p]},d)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:l,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:s.map(d=>f(d))})]})}function Go(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Qe,{hardware:t}),{properties:a}=t,c=a.state==="MOUNTING",l=le(a.active_detector),u=le(a.target_detector);function f(){return e.jsxs(i.InputGroup,{children:[e.jsx(B,{className:q.default({"hw-moving":c}),value:u||l||"No detector"}),e.jsx(Tp,{...n})]})}const d=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:f(),headerMode:d})}const Fp="tomodetectors",Rp="tomodetectors",Ap=!0,Ep={state:"READY",active_detector:"hardware:limadetector1",detectors:["hardware:limadetector1","hardware:limadetector2","hardware:limadetector3"]},kp="bliss",Pp=!1,Bp="optic",Gp={id:Fp,name:Rp,online:Ap,properties:Ep,protocol:kp,require_staff:Pp,type:Bp},Lo={default:Gp},Lp={default:Go,state:Dp},Ho={variants:Lp,mocks:Lo};function Uo(n){return n.type==="tomodetectors"}function Hp(n){const t=G(n);return t===null||!Uo(t)?null:t}function ae(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",BLOCKED:"secondary",ACQUIRING:"transient",UNKNOWN:"fatal"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function Up(n){const{hardware:t}=n;return e.jsx(ae,{hardware:t})}function Vp(n){const{hardware:t}=n,o=t.properties.update_on_move,s=n.disabled||!t.online;function r(c){t.actions.setProperty("update_on_move",!1)}function a(c){t.actions.setProperty("update_on_move",!0)}return e.jsxs(i.ButtonGroup,{className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Update mode"}),e.jsx(i.Button,{onClick:a,disabled:s,variant:o?"primary":"secondary",children:"Auto"}),e.jsx(i.Button,{onClick:r,disabled:s,variant:o?"secondary":"primary",children:"Off"})]})}function qp(n){const{hardware:t}=n,o=t.properties.exposure_time??0,s=n.disabled||!t.online,r=g.useRef(null),[a,c]=g.useState(!1),l=2;function u(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("exposure_time",Number.parseFloat(r.current.value))):d.key==="Escape"&&(r.current.value=o.toFixed(l),c(!1))}function f(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return g.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Exposure time"}),e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:f,disabled:s,onKeyDown:u}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Wp(n){const{hardware:t}=n,o=n.disabled||!t.online;function s(c){t.actions.call("take_proj")}function r(c){t.actions.call("take_dark")}function a(c){t.actions.call("take_flat")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Take"}),e.jsx(i.Button,{onClick:s,disabled:o,variant:"primary",children:"Proj"}),e.jsx(i.Button,{onClick:a,disabled:o,variant:"primary",children:"Flat"}),e.jsx(i.Button,{onClick:r,disabled:o,variant:"primary",children:"Dark"})]})}function Vo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsxs(i.Container,{children:[e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Vp,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(qp,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Wp,{hardware:t,disabled:n.disabled})})})]}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function zp(n){const{style:t,className:o,value:s,decimals:r=2,allowNullAsEmpty:a=!1,disabled:c=!1}=n,[l,u]=g.useState(void 0),f=l!==void 0,d=g.useMemo(()=>n.preferedDisplayUnit!==void 0&&(n.pixelSize===void 0||n.unit==="px"||n.preferedDisplayUnit==="px")?n.preferedDisplayUnit:n.displayUnit??n.unit,[n.displayUnit,n.unit,n.preferedDisplayUnit,n.pixelSize]),p=g.useCallback(y=>y===null||d===void 0?null:de(y,d,n.unit,n.pixelSize),[n.unit,d,n.pixelSize]),m=g.useCallback(y=>y===null||d===void 0?null:de(y,n.unit,d,n.pixelSize),[n.unit,d,n.pixelSize]);function h(y){return(y??"")===""?null:Number.parseFloat(y)}function w(){var $;if(l===void 0||!a&&l==="")return;let y;try{y=h(l)}catch{return}const S=p(y);($=n.onAccepted)==null||$.call(n,S),u(void 0)}function x(){var y;l!==void 0&&((y=n.onAborted)==null||y.call(n),u(void 0))}const j=g.useMemo(()=>{const y=m(s);return y===null?"":y.toFixed(r)},[s]);return e.jsx(i.Form.Control,{value:l??j??void 0,className:o,step:n.step,type:"number",style:{...t,backgroundColor:f?"#FFFF80":void 0},disabled:c,onChange:y=>{u(y.target.value)},onBlur:()=>{x()},onKeyDown:y=>/^[ a-z]$/i.test(y.key)?(y.preventDefault(),!1):(y.stopPropagation(),y.key==="Enter"?w():y.key==="Escape"&&x(),!0)})}function Yp(n){const{onAccepted:t,...o}=n;return e.jsx(zp,{...o,allowNullAsEmpty:!1,onAccepted:t})}function Kp(n){const{hardware:t,options:o}=n,s=t.properties.exposure_time??0,r=n.disabled||!t.online,a=o.unit??"s",c=o.digits??3;return e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(Yp,{value:s,unit:"s",displayUnit:o.unit??"s",onAccepted:l=>{t.actions.setProperty("exposure_time",l)},decimals:c,disabled:r}),e.jsx(i.InputGroup.Text,{children:Eo(a)})]})}function Qp(n){const{exposureTime:t}=n,o=G("ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector"),s=G("ACTIVE_TOMOCONFIG.ref.detectors.active_detector");if(o===null||s===null)return e.jsx(e.Fragment,{});if(!xe(o)||!Ke(s))return e.jsx(e.Fragment,{});const r=o.properties.acc_max_expo_time,a=s.properties.acq_mode;if(!r||a!=="ACCUMULATION")return e.jsx(e.Fragment,{});const[c,l]=jn(t,r);return e.jsxs("div",{className:"text-center",title:"Decompisiton of the accumulation",children:[c," × ",l.toFixed(3)]})}function qo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Kp,{hardware:t,disabled:n.disabled,options:o}),e.jsx(Qp,{exposureTime:t.properties.exposure_time})]}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Xp(n){const{hardware:t}=n,o=t.properties.settle_time||0,s=n.disabled||!t.online,r=g.useRef(null),[a,c]=g.useState(!1),l=3;function u(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("settle_time",Number.parseFloat(r.current.value))):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function f(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return g.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:f,disabled:s,onKeyDown:u}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Wo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsx(Xp,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function ke(n){const[t,o]=g.useState(!1),[s,r]=g.useState(void 0),{text:a,disabled:c,onAction:l,onStarted:u,onTerminated:f,title:d}=n;function p(m){u==null||u(),r(void 0),o(!0),l().catch(h=>{r(`${h}`)}).finally(()=>{o(!1),f==null||f()})}return e.jsxs(i.Button,{onClick:p,disabled:c||t,variant:s===void 0?"primary":"danger",className:q.default({"ps-4":!t,"pe-4":!t}),title:d,children:[s&&e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-1",title:s}),!s&&t&&e.jsx("i",{className:"fa-solid fa-cog fa-spin me-1"}),a]})}function Zp(){const n=G("ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector");return n===null||!xe(n)?null:n}function Jp(n){const{hardware:t,restoreSample:o}=n,[s,r]=g.useState(!1),a=n.disabled||!t.online||s,c=Zp(),l=(c==null?void 0:c.properties.state)==="OFFLINE";function u(){r(!0)}function f(){r(!1)}function d(){return t.actions.call("take_proj")}function p(){return t.actions.call("take_dark")}function m(){return t.actions.call(o?"take_flat":"take_flat_and_stay")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"w-100",title:l?`The detector '${c==null?void 0:c.name}' is offline`:void 0,children:[e.jsx(ke,{onAction:d,onStarted:u,onTerminated:f,disabled:a||l,text:"Proj",title:"Take a projection"}),e.jsx(ke,{onAction:m,onStarted:u,onTerminated:f,disabled:a||l,text:"Flat",title:"Take a flat"}),e.jsx(ke,{onAction:p,onStarted:u,onTerminated:f,disabled:a||l,text:"Dark",title:"Take a dark"})]})}function zo(n){const{hardware:t,options:o={}}=n,{restore_sample:s=!0}=o,r=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),a=e.jsx(ae,{hardware:t}),c=e.jsx(Jp,{hardware:t,disabled:n.disabled,restoreSample:s}),l=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:c,headerMode:l})}function em(n){const{hardware:t}=n,o=t.properties.update_on_move,s=n.disabled||!t.online;function r(c){t.actions.setProperty("update_on_move",!1)}function a(c){t.actions.setProperty("update_on_move",!0)}return e.jsxs(i.ButtonGroup,{className:"w-100",children:[e.jsx(i.Button,{onClick:a,disabled:s,variant:o?"primary":"secondary",children:"Auto"}),e.jsx(i.Button,{onClick:r,disabled:s,variant:o?"secondary":"primary",children:"Off"})]})}function Yo(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsx(em,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const tm="tomoimaging",nm="tomoimaging",om=!0,sm={state:"READY",update_on_move:!1,exposure_time:1},rm="bliss",im=!1,am="optic",cm={id:tm,name:nm,online:om,properties:sm,protocol:rm,require_staff:im,type:am},Ko={default:cm};function Qo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=g.useState({state:"READY",update_on_move:!0,exposure_time:1,settle_time:0});function c(f){a(d=>({...d,state:f}))}async function l(f,d){if(f==="take_dark"){c("ACQUIRING"),await L(2e3),c("READY");return}if(f==="take_flat"){c("ACQUIRING"),await L(2e3),c("READY");return}if(f==="take_proj"){c("ACQUIRING"),await L(2e3),c("READY");return}console.log("TomoImagingSimulator: Unsupported call",f,d)}async function u(f,d){a(p=>({...p,[f]:d}))}return e.jsx(V,{name:t,alias:o,type:"tomoimaging",call:l,setProperty:u,properties:r,useHardwareContext:s})}const lm={default:Vo,exposuretime:qo,settletime:Wo,actions:zo,updatemode:Yo,state:Up},Xo={variants:lm,mocks:Ko,simulator:Qo},dm={},Zo={variants:dm};function Jo(n){return n.type==="tomosamplestage"}function um(n){const t=G(n);return t===null||!Jo(t)?null:t}function fm(n){const{hardware:t}=n,o=t.properties.latency_time||0,s=n.disabled||!t.online,r=g.useRef(null),[a,c]=g.useState(!1),l=3;function u(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("latency_time",r.current.value)):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function f(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return g.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:f,disabled:s,onKeyDown:u}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function es(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(e.Fragment,{}),a=e.jsx(fm,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const pm={latencytime:es},ts={variants:pm};function ns(n){return n.type==="tomoconfig"}function mm(n){const t=G(n);return t===null||!ns(t)?null:t}function os(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOVING:"transient",STABILIZING:"transient",INVALID:"danger",INVALID_DETECTOR_BINNING_CHANGED:"danger",INVALID_DETECTOR_DISTANCE_CHANGED:"danger",INVALID_DETECTOR_CHANGED:"danger"},r=s[o]||s.UNKNOWN;return e.jsx(D,{state:o,minWidth:6,variant:r})}function hm(n){const{hardware:t}=n;return e.jsx(os,{hardware:t})}const gm={state:hm},ss={variants:gm};function rs(n){return n.type==="tomoholo"}function xm(n){const t=G(n);return t===null||!rs(t)?null:t}function wm(n){const{hardware:t}=n,o=()=>{t.actions.call("reset")};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popover",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Valve Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function is(n){const{hardware:t,options:o={}}=n,s=()=>{t.actions.call(t.properties.state==="OPEN"?"close":"open")};return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(N,{name:"Valve",icon:"fam-hardware-valve",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.ButtonGroup,{className:"d-flex",children:[e.jsx(i.Button,{variant:t.properties.state==="OPEN"?"danger":"success",onClick:s,disabled:n.disabled,children:t.properties.state==="OPEN"?"Close":"Open"}),e.jsx(wm,{...n})]})})]})}const jm=["close","reset","open"],ym="rv12",vm="rv12",Nm=!0,bm={state:"CLOSED",status:`Pneumatic is closed
|
|
38
|
+
`},_m="tango",Sm=!1,Cm="valve",$m={callables:jm,id:ym,name:vm,online:Nm,properties:bm,protocol:_m,require_staff:Sm,type:Cm},as={default:$m},Om={default:is},cs={variants:Om,mocks:as},Im=He.default("daiquiri.components.hardware.NoObject");function Mm(n){if(n.options.emptyifnone)return Im('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const t=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is missing`,children:"Missing"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Dm(n){const t=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is loading`,children:e.jsx("i",{className:"fa-solid fa-spinner fa-spin-pulse"})}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}const Tm=He.default("daiquiri.components.hardware.MissingObject");function Fm(n){if(n.options.emptyifnone)return Tm('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const t=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is missing`,children:"Missing"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Rm(n){const{properties:t={}}=n,{message:o="Unknown error"}=t,s=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=e.jsx(e.Fragment,{}),a=e.jsx(i.OverlayTrigger,{trigger:["focus","hover"],placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"error",style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Error"}),e.jsx(i.Popover.Body,{children:e.jsx("ul",{children:e.jsx("li",{children:o})})})]}),children:e.jsxs(i.Button,{variant:"danger",size:"sm",className:"w-100",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," Error"]})}),c=n.options?n.options.header:"top",l={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const Am=He.default("daiquiri.components.hardware.MissingComponentObject");function Em(n){const{options:t}=n,{variant:o="default"}=t;if(t.emptyifnone)return Am('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const s=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=e.jsx(e.Fragment,{}),a=e.jsx(i.OverlayTrigger,{trigger:["focus","hover"],placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"error",style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Error"}),e.jsx(i.Popover.Body,{children:e.jsx("ul",{children:e.jsxs("li",{children:["No component available for object id '",n.name,"' (type '",n.type,"' and/or variant '",o,"' are not registred)"]})})})]}),children:e.jsxs(i.Button,{variant:"danger",size:"sm",className:"w-100",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," Error"]})}),c=t?t.header:"top",l={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function km(n){if(n.options.emptyifnone)return e.jsx(e.Fragment,{});const t=e.jsx(N,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx(e.Fragment,{children:"No object"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(_,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function ls(n){const[t,o]=g.useState({}),s=g.useRef(null);return g.useEffect(()=>{if(s.current){const r=s.current;o({width:r.clientWidth,height:r.clientHeight})}},[]),e.jsx("div",{ref:s,style:{width:"100%",height:"100%"},className:n.className,children:t.width>0&&e.jsx("div",{className:"full-sizer",style:{width:`${t.width}px`,height:`${t.height}px`,overflow:"scroll"},children:n.children})})}function Pm(n){const{size:t,value:o,min:s,max:r,lowWarning:a,hiWarning:c,lowDanger:l,hiDanger:u}=n;function f(j){return j===null?null:(j-s)/(r-s)}const d=g.useMemo(()=>{const j=l===void 0?void 0:f(l),y=u===void 0?void 0:f(u),S=a===void 0?void 0:f(a),$=c===void 0?void 0:f(c);return{lowPercentDanger:j,hiPercentDanger:y,lowPercentWarning:S,hiPercentWarning:$}},[s,r,a,c,l,u]),p=g.useMemo(()=>o===null?"value":l!==void 0&&o<=l||u!==void 0&&o>=u?"value value-danger":a!==void 0&&o<=a||c!==void 0&&o>=c?"value value-warning":"value",[o,l,u,a,c]),m=t/2-15,h=t/10,w=t/10*3;function x(j){return h+(w-h)*j}return e.jsxs(E.Knob,{size:t,angleOffset:240,angleRange:240,min:s,max:r,value:o,readOnly:!0,className:"gauge",children:[d.lowPercentDanger&&e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range range-danger",percentageFrom:0,percentageTo:d.lowPercentDanger,widthFrom:x(0),widthTo:x(d.lowPercentDanger)}),d.lowPercentWarning&&e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range range-warning",percentageFrom:d.lowPercentDanger??0,percentageTo:d.lowPercentWarning,widthFrom:x(d.lowPercentDanger??0),widthTo:x(d.lowPercentWarning)}),e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range",percentageFrom:d.lowPercentWarning??d.lowPercentDanger??0,percentageTo:d.hiPercentWarning??d.hiPercentDanger??1,widthFrom:x(d.lowPercentWarning??d.lowPercentDanger??0),widthTo:x(d.hiPercentWarning??d.hiPercentDanger??1)}),d.hiPercentWarning&&e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range range-warning",percentageFrom:d.hiPercentWarning,percentageTo:d.hiPercentDanger??1,widthFrom:x(d.hiPercentWarning),widthTo:x(d.hiPercentDanger??1)}),d.hiPercentDanger&&e.jsx(E.Power,{radiusFrom:m,radiusTo:m,className:"range range-danger",percentageFrom:d.hiPercentDanger,percentageTo:1,widthFrom:x(d.hiPercentDanger),widthTo:x(1)}),e.jsx("circle",{r:t/20,cx:t/2,cy:t/2,fill:"black"}),e.jsx(E.Pointer,{percentage:f(o),width:10,height:t/2-15,radius:2,type:"triangle",color:"black"}),e.jsx(E.Value,{className:p,value:o})]})}function Bm(n){return e.jsx("div",{className:"panel-header",style:n.style,children:n.children})}function Gm(n){return e.jsx("div",{className:`panel-contents ${n.className}`,style:n.style,children:n.children})}function R(n){const t=n.scroll?ls:g.Fragment;return e.jsx("div",{className:`panel ${n.className??""}`,style:n.style,children:e.jsx(t,{children:n.children})})}R.Header=Bm;R.Contents=Gm;function ds(n){return e.jsx(e.Fragment,{})}function Lm(n){const{providers:t={},yamlNode:o,label:s,...r}=n;return ps(o,"label",s),fe(o,r),e.jsx("div",{children:s})}function Hm({yamlNode:n,panel:t}){const{type:o,style:s,children:r,...a}=n;return fe(n,a),e.jsx(i.Row,{className:"ymllayout-row gx-0",style:s,children:P.map(r,(c,l)=>W(c,l,t))})}function Um({yamlNode:n,panel:t}){const{type:o,style:s,xs:r,children:a,...c}=n;return fe(n,c),ms(n,"xs",r),e.jsx(i.Col,{className:q.default("yamymllayout-col",{col:!!r}),style:s,xs:r,children:P.map(n.children,(l,u)=>W(l,u,t))})}function Vm({yamlNode:n,panel:t}){const o=n.options||{},s=n.style;return e.jsx(i.Container,{className:"ymllayout-container",...o,style:s,children:P.map(n.children,(r,a)=>W(r,a,t))})}function qm(n){const{yamlNode:t}=n,o=t.options||{},s={};return t.centerContent&&(s.margin="auto"),e.jsxs(R,{className:"ymllayout-panel",...o,style:t.style,children:[t.title&&e.jsx(R.Header,{children:t.title}),e.jsx(R.Contents,{style:s,children:P.map(t.children,(r,a)=>W(r,a,!1))})]})}const Wm=()=>Math.random().toString(36).slice(2,15)+Math.random().toString(36).slice(2,15);function zm({yamlNode:n,panel:t}){const o=[];return P.each(n.children,(s,r)=>{o.push(e.jsx(i.Tab,{eventKey:Wm(),title:s.title,style:s.style,children:W(s,0,!1)},r))}),t?e.jsxs(R,{className:"ymllayout-tabs",style:n.style,children:[n.title&&e.jsx(R.Header,{children:n.title}),e.jsx(R.Contents,{children:e.jsx(i.Tabs,{mountOnEnter:!0,children:o})})]}):e.jsx(i.Tabs,{children:o})}function Ym(n){const{node:t,state:o,row:s}=n,{title:r}=t;function a(){if(t.id)return t.id}function c(){if(r!==void 0)return r;if(t.type==="hardware"){const u=a(),f={_parentNode:t._parentNode,_indexFromParent:t._indexFromParent,type:"hardware",id:u,variant:"name",emptyifnone:!0};return W(f,"a",!1)}return""}const l=c();return e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("h5",{style:{margin:"0px",whiteSpace:"nowrap"},children:l}),o&&e.jsx("div",{style:{position:"relative",top:-5},children:o})]})}function Km(n){const{node:t,row:o}=n,{titlealign:s,title:r,stateinheader:a=!1,variant:c,id:l,...u}=t;let f,d;if(u.type==="hardware")if(f={...u,id:l,variant:c},a){const p={...u,id:l,variant:"state",emptyifnone:!0};d=W(p,"k",!1)}else d=null;else f=u,d=null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{gridColumn:1,alignSelf:s??"center"},children:e.jsx(Ym,{node:t,state:d,row:o})}),e.jsx("div",{style:{gridColumn:2,alignSelf:"center",overflow:"auto"},children:W(f,"k",!1)})]})}function Qm(n){const{yamlNode:t,panel:o}=n,{type:s,children:r,options:a={},title:c,style:l,...u}=t;return sh(t,u),e.jsxs(R,{className:"ymllayout-form",...a,children:[t.title&&e.jsx(R.Header,{children:t.title}),e.jsx(R.Contents,{className:"full-sizer",style:{overflow:"auto"},children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"min-content auto",...l},children:P.map(r,(f,d)=>f.type==="formheader"?W(f,d,o):f.type==="none"?e.jsx(Ts.default.Fragment,{},d):e.jsx(Km,{node:f,row:d},d))})})]})}function Xm({yamlNode:n}){const{type:t,title:o,style:s={},...r}=n;return Xe(n,"title",o),fe(n,r),e.jsx("div",{className:"ymllayout-form-header",style:{gridColumn:"1 / 3",...s},children:e.jsx("h3",{children:o})})}function Zm(n){const{yamlNode:t,panel:o}=n,s=t.style||{};return e.jsx("div",{className:"ymllayout-grid",style:{gridTemplateColumns:t.columns,gridTemplateRows:t.rows,...s},children:P.map(t.children,(r,a)=>{const{columnSpan:c=1,rowSpan:l=1,...u}=r,f=c>1?`span ${c}`:void 0,d=l>1?`span ${l}`:void 0;return e.jsx("div",{className:"ymllayout-grid-cell",style:{gridColumn:f,gridRow:d},children:W(u,a,o)},a)})})}const re={row:Hm,col:Um,container:Vm,panel:qm,tabs:zm,form:Qm,formheader:Xm,grid:Zm};function Jm(n,t){ie[n]&&console.warn(`yaml registration: The type ${n} is already a component. The component will not be reachable anymore.`),re[n]&&console.warn(`yaml registration: The type ${n} is already a container. The previous container will be dropped.`),re[n]=t}const ie={todo:hs,none:ds,label:Lm};function us(n,t){ie[n]&&console.warn(`yaml registration: The type ${n} is already a component. The previous component will be dropped.`),re[n]&&console.warn(`yaml registration: The type ${n} is already a container. This component will not be used.`),ie[n]=t}function eh(n){Object.entries(n).forEach(([t,o])=>us(t,o))}function th(){return ie}function nh(){return re}function oh(n){const{yamlNode:t,panel:o}=n,{type:s,style:r,scroll:a,title:c,...l}=t;if(!(s in ie))return e.jsx(R,{children:e.jsx(R.Contents,{children:e.jsxs(i.Alert,{variant:"warning",children:['Unknown component "',s,'"']})})});const u=ie[t.type];return o?e.jsx(R,{style:r,scroll:a,children:e.jsxs(g.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:[c&&e.jsx(R.Header,{children:c}),e.jsx(R.Contents,{children:e.jsx(u,{...l,yamlNode:t})})]})}):e.jsx(g.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:e.jsx(u,{...l,yamlNode:t})})}function W(n,t,o=!0){if(!n)return e.jsx(e.Fragment,{});const{type:s}=n,r=s&&s in re?re[s]:oh;return e.jsx(r,{yamlNode:n,panel:o},t)}function sh(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new he(n,Object.keys(r))}class se extends Error{constructor(o,s){super(o);ne(this,"yamlNode");this.yamlNode=s}}class he extends se{constructor(o,s){super(`Unexpected keys: ${s.join(", ")}`,o);ne(this,"keys");this.keys=s}}class Me extends se{constructor(o,s){super(`Keys ${s.join(", ")} are missing`,o);ne(this,"keys");this.keys=s}}class T extends se{constructor(o,s,r){super(`Key ${s} error: ${r}`,o);ne(this,"key");ne(this,"keyMessage");this.key=s,this.keyMessage=r}}function rh(n){let t=n;for(;t._parentNode;)t=t._parentNode;return t}function ih(n){const t=[];let o=n;for(;o;)t.push({node:o,indexFromParent:o._indexFromParent}),o=o._parentNode;return t.reverse(),t}function fs(n,t=null,o=null){if(n._parentNode)throw new Error("Attribute _parentNode was already defined by the yml layout.");const s={...n,_parentNode:t,_indexFromParent:o};if(n.children){const r=[...n.children];Object.freeze(r),s.children=r.map((a,c)=>fs(a,s,c))}return Object.freeze(s),s}function ah(n,t,o){if(n&&o===void 0)throw new Me(n,[t])}function ps(n,t,o){if(typeof o!="string")throw new T(n,t,"A string is expected")}function ch(n,t,o){if(typeof o!="boolean")throw new T(n,t,"A boolean is expected")}function lh(n,t,o){if(typeof o!="number")throw new T(n,t,"A number is expected")}function dh(n,t,o){if(o!==void 0&&typeof o!="boolean")throw new T(n,t,"An optional boolean is expected")}function Xe(n,t,o){if(o!==void 0&&typeof o!="string")throw new T(n,t,"An optional string is expected")}function uh(n,t,o){if(!Array.isArray(o))throw new T(n,t,"A list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new T(n,t,"A list of string is expected")})}function fh(n,t,o){if(o!==void 0&&typeof o!="string"){if(!Array.isArray(o))throw new T(n,t,"An optional string or list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new T(n,t,"An optional string or list of string is expected")})}}function ph(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new T(n,t,"An optional list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new T(n,t,"A optional list of string is expected")})}}function ms(n,t,o){if(o!==void 0&&typeof o!="number")throw new T(n,t,"An optional number is expected")}function mh(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new T(n,t,"An optional list of numbers is expected");o.forEach(s=>{if(typeof s!="number")throw new T(n,t,"An optional list of numbers is expected")})}}function hh(n,t,o,s,r){if(o!==void 0){if(!Array.isArray(o))throw new T(n,t,`An optional list of ${r} is expected`);o.forEach(a=>{if(!s(a))throw new T(n,t,`An optional list of type ${r} is expected`)})}}function fe(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new he(n,Object.keys(r))}function gh(n,t,o){if(o!=="last"&&typeof o!="number")throw new T(n,t,'"last" or a number is expected')}function xh(n,t,o){if(o!==void 0&&o!=="h5web"&&o!=="plotly")throw new T(n,t,'"h5web" or "plotly" string is expected')}function wh(n,t,o){if(o!==void 0&&!Array.isArray(o))throw new T(n,t,"A list is expected")}function jh(n,t,o){if(o!==void 0&&(o===null||typeof o!="object"))throw new T(n,t,"A list is expected")}function yh(n,t,o,s){const{optional:r,schema:a}=s;if(r&&o===void 0)return;if(!o||typeof o!="object")throw new T(n,t,"A mapping is expected");const c=Object.keys(o).filter(u=>typeof u=="string"&&!(u in a));if(c.length>0)throw new he(n,Object.keys(c.map(u=>`${t}/${u}`)));const l=o;Object.entries(a).forEach(([u,f])=>{typeof u=="string"&&f(n,`${t}/${u}`,l[u])})}const vh=Object.freeze(Object.defineProperty({__proto__:null,assertBoolean:ch,assertDataCollectionId:gh,assertKeyExpected:ah,assertNoUnknownKeys:fe,assertNumber:lh,assertOptionalArgs:wh,assertOptionalBackend:xh,assertOptionalBoolean:dh,assertOptionalKwargs:jh,assertOptionalListOfType:hh,assertOptionalNumber:ms,assertOptionalNumberList:mh,assertOptionalString:Xe,assertOptionalStringList:ph,assertOptionalStringOrStringList:fh,assertString:ps,assertStringList:uh,assertStringMappingRecord:yh},Symbol.toStringTag,{value:"Module"}));function hs(n){const{providers:t={},yamlNode:o,message:s,...r}=n;return Xe(o,"message",s),fe(o,r),e.jsx(i.Alert,{variant:"warning",className:"mb-0",children:s??"TODO"})}const ee={},gs={},Nh={airbearing:Ct,base:yt,beamviewer:Dt,beamline:$t,energymanager:Et,filterset:Ht,frontend:zt,gauge:Qt,laser:en,laserheating:on,light:an,lima:yn,measurementgroup:_n,motor:Rn,multiposition:Gn,optic:qn,procedure:Xn,pump:xo,pusher:vo,regulation:so,service:So,shutter:uo,slit:mo,tomoconfig:ts,tomodetector:Bo,tomodetectors:Ho,tomoflatmotion:Mo,tomoholo:ss,tomoimaging:Xo,tomoreferenceposition:Ro,tomosamplestage:Zo,valve:cs};Object.entries(Nh).forEach(([n,t])=>{ee[n]={...t.variants},gs[n]={...t}});function bh(n,t,o){n in ee||(ee[n]={}),t in ee[n]&&console.warn(`Hardware variant ${n}/${t} already existes. Overwrite.`),ee[n][t]=o}function Ze(n,t){if(n in ee){const s=ee[n];if(t in s)return s[t]}const o=ee.base;return t in o?o[t]:null}function _h(){return gs}function Sh(n){const{hardware:t,options:o={}}=n,{emptyifnone:s=!1}=o;if(t===null)return s?e.jsx(e.Fragment,{}):e.jsx(D,{state:"NONE",variant:"danger",description:"No hardware"});const{type:r}=t;switch(r){case"missing":return e.jsx(D,{state:"MISSING",variant:"danger",description:"Hardware not available"});case"error":return e.jsx(D,{state:"ERROR",variant:"danger",description:"Error to load the hardware"});case"loading":return e.jsx(D,{state:"LOADING",variant:"warning",description:"The hardware was requested"})}const a=Ze(r,"state");if(!a)return e.jsx(Te,{hardware:t});const c={setProperty:(l,u)=>Promise.resolve(),call:(l,...u)=>Promise.resolve()};return e.jsx(a,{hardware:{...t,actions:c},options:{name:t.name},operator:!1,disabled:!1})}function Ch(n){const{title:t,children:o,buttons:s,cancelText:r,footer:a=!0,showClose:c=!0,show:l=!1,actions:u={},otherButtons:f,bodyClassName:d,size:p="lg",fullscreen:m}=n,{onShow:h,onClose:w}=u;return e.jsxs(i.Modal,{fullscreen:m,size:p,"aria-labelledby":"modal-title",centered:!0,onShow:h,onHide:w,show:l,children:[e.jsx(i.Modal.Header,{closeButton:!0,children:e.jsx(i.Modal.Title,{id:"modal-title",children:t})}),e.jsx(i.Modal.Body,{className:d,children:o}),a&&e.jsxs(i.Modal.Footer,{children:[f&&e.jsx("div",{className:"form-other-buttons",children:f}),s,c&&e.jsx(i.Button,{onClick:w,children:r||"Close"})]})]})}function $h(n){return n.condition?n.wrap(n.children):n.children}const Oh=g.forwardRef((n,t)=>{const[o,s]=g.useState(!1),{showButton:r=!0}=n,a=g.useRef(null);function c(){s(!1),n.onClose&&n.onClose()}function l(){c()}g.useImperativeHandle(t,()=>({showModal:()=>s(!0),close:()=>l()}));const u=n.modalClass||Ch;return e.jsxs(e.Fragment,{children:[r&&e.jsx($h,{condition:n.tooltip,wrap:f=>e.jsx(i.OverlayTrigger,{placement:n.tooltipPlacement||"top",overlay:e.jsx(i.Tooltip,{id:"tooltip1",children:n.tooltip}),children:f}),children:e.jsx(i.Button,{onClick:()=>{s(!0)},...n.buttonProps,ref:a,children:n.button})}),e.jsx(u,{target:a,show:o,actions:{onClose:l},title:n.title,buttons:n.buttons,children:n.children})]})}),Ih=Oh;function Ae(n){return n===void 0||n===null||typeof n!="string"?null:n.startsWith("$")?n.slice(1):n}const Ge={">":(n,t)=>n>t,"<":(n,t)=>n<t,">=":(n,t)=>n>=t,"<=":(n,t)=>n<=t,"==":(n,t)=>n===t,"!=":(n,t)=>n!==t,in:(n,t)=>t.indexOf(n)>-1},Mh=Object.keys(Ge),De=(n,t,o)=>{if(n in Ge)return Ge[n](t,o)};function xs(n,t,o){const s=n.split(t);return o?[s.slice(0,-o).join(t)].concat(s.slice(-o)):s}function ut(n){const t=n!==void 0?xs(n,".",1):[null,""],o=G(Ae(t[0]));if(!o||!o.properties)return;const s=t[1];if(s===null)return;const r=o.properties[s];return Array.isArray(r)?r[0]:r}function Dh(n){const t=n!==void 0&&!n.includes("."),o=n!==void 0?xs(n,".",1):[null,""],s=G(Ae(o[0]));if(t)return n;if(s&&s.properties&&o[1]!==null)return`${s.properties[o[1]]}`}function ws(n){const{monitor:t}=n;let o=ut(t.value)??"-";const s=Dh(t.unit),r=ut(t.overlay),a=Number.parseFloat(`${o}`);Number.isNaN(a)||String(a).length>5&&(o=a.toPrecision(5));function c(){return t.comparator&&t.comparison?De(t.comparator,o,t.comparison)?"success":"danger":"secondary"}const l=c();Number.isNaN(a)||s!==void 0&&(o=`${o} ${s}`);const u=e.jsxs(X,{children:[e.jsx("h1",{children:t.name}),e.jsx(i.Badge,{bg:l,children:`${o}`})]});if(r){const f=`${r}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:f.includes(`
|
|
39
|
+
`)?e.jsx("pre",{children:f}):f}),children:u})}return u}function Th({value:n,unit:t,display_digits:o}){let s="";return n!==void 0&&(n===null?s="null":Number.isFinite(n)?s+=n.toFixed(o??2):s=`${n}`),t!==null&&t!==""&&(s=`${s} ${t}`),s}function Fh(n){const t=g.useRef({}),[o,s]=g.useState(void 0),{synoptic:r,fetchSVG:a,getHardwareGroupComponent:c,hardwareObjects:l}=n;g.useEffect(()=>{a(r.synoptic).then(p=>{s(p.data)})},[r]);const u=g.useCallback(p=>{var m,h;p in t.current&&((h=(m=t.current)==null?void 0:m[p].current)==null||h.showModal())},[t]),f=g.useMemo(()=>r.elements.map(p=>{var y,S,$,b;let m=!1,h;const w=p.ids&&((y=p.ids)==null?void 0:y.length)>0;if(w&&(m=!0,(S=p.ids)==null||S.forEach(v=>{v in l&&(l[v].properties.state_ok||(m=!1))})),p.state){const v=p.state.split("."),C=l[v[0]],I=C?C.properties[v[1]]:!1;Array.isArray(p.state_comparison)?(m=void 0,p.state_comparison.forEach(M=>{(De(M==null?void 0:M.comparator,M==null?void 0:M.comparison,I)??!1)&&(h=M.color)})):p.state_comparison?m=De(($=p.state_comparison)==null?void 0:$.comparator,(b=p.state_comparison)==null?void 0:b.comparison,I)??!1:m=!!I}let x=null;if(p.value){const v=p.value.split("."),C=l[v[0]];C&&(x=Th({value:C.properties[v[1]],unit:C.properties.unit,display_digits:p.value_display_digits}))}const j=p.name.toLowerCase();return[e.jsx(pe.SvgProxy,{selector:`.${j} .status`,class:`$ORIGINAL ${m!==void 0?m?"ok":"error":""}`,style:h?`fill: ${h};`:""},`${j}state`),e.jsx(pe.SvgProxy,{selector:`.${j} .value`,children:x},`${j}value`),e.jsx(pe.SvgProxy,{selector:`.${j} > rect`,onClick:()=>u(j)},`${j}handler`),e.jsx(pe.SvgProxy,{class:`$ORIGINAL ${w?"active":""}`,selector:`.${j}`},`${j}comp`)]}),[r,l]),d=g.useMemo(()=>r.elements.filter(p=>{var m;return p.ids&&((m=p.ids)==null?void 0:m.length)>0}).map(p=>{const m=p.name.toLowerCase(),h=g.createRef();return t.current[m]=h,e.jsx(Ih,{ref:h,title:p.name,showButton:!1,button:e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"fa fa-plus"}),"show"]}),children:c(p.ids??[])},`${m}pop`)}),[r]);return e.jsxs("div",{children:[e.jsx(pe.SvgLoader,{width:"100%",svgXML:o,className:`synoptic ${r.color_icons?"synoptic-color":""}`,children:f}),d]})}const Rh=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ah=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function js(n){var t;return e.jsxs(i.Alert,{variant:"danger",children:[n.message,e.jsx("br",{}),e.jsx("pre",{children:(t=n.error)==null?void 0:t.stack})]})}function Eh(n){const{error:t}=n;if(!(t instanceof se))return e.jsx(e.Fragment,{});function o(a,c=3){const l=ih(a.yamlNode),u=[];let f="";for(let d=1;d<l.length;d++){const{node:p,indexFromParent:m}=l[d];u.push(`${f}children:`),f+=" ".repeat(c),m===1?u.push(`${f}- type: ...`):(m??0>1)&&u.push(`${f}...`,`${f}...`,`${f}# children number ${m??0+1}`),u.push(`${f}- type: ${p.type}`),f+=" ".repeat(2)}return a instanceof he?a.keys.forEach(d=>{u.push(`${f}${d}: ... ${" ".repeat(50-f.length-d.length)}<-- unexpected key`)}):a instanceof Me?a.keys.forEach(d=>{u.push(`${f}???: ${" ".repeat(50-f.length-d.length)}<-- key **${d}** is expected`)}):a instanceof T&&u.push(`${f}${a.key}: ${" ".repeat(50-f.length-a.key.length)}<-- ${a.keyMessage}`),u.join(`
|
|
40
|
+
`)}const r=rh(t.yamlNode).name;if(t instanceof he){const a=t.keys.length===1?"key":"keys";return e.jsxs(i.Alert,{variant:"danger",children:["Unexpected ",a," ",t.keys.map((c,l)=>e.jsxs(e.Fragment,{children:[l!==0&&", ",e.jsx("b",{children:c})]}))," ","from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]})}if(t instanceof Me){const a=t.keys.length===1?"Key":"Keys";return e.jsxs(i.Alert,{variant:"danger",children:["Expected ",a," ",t.keys.map((c,l)=>e.jsxs(e.Fragment,{children:[l!==0&&", ",e.jsx("b",{children:c})]}))," ","from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]})}return t instanceof T?e.jsxs(i.Alert,{variant:"danger",children:["Error on key ",e.jsx("b",{children:t.key})," from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]}):e.jsx(js,{...n})}const ft={hasError:!1,message:"",error:void 0};class ys extends g.Component{constructor(o){super(o);ne(this,"reload",()=>{window.location.reload()});this.state=ft}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o){var s,r;if(o instanceof se||!this.props.unhandledComponentDidCatch){this.setState({hasError:!0,message:o.message,error:o});return}(r=(s=this.props).unhandledComponentDidCatch)==null||r.call(s,o,a=>{this.setState({hasError:!0,message:o.message,error:o,...a})})}componentDidUpdate(o,s){this.state.hasError&&s.error!==void 0&&o.resetKey!==this.props.resetKey&&this.setState(ft)}render(){if(this.state.hasError){const{UnhandledErrorComponent:o}=this.props,{hasError:s,...r}=this.state;return e.jsxs(i.Container,{className:"mt-2",children:[e.jsx("h4",{children:"Something went wrong"}),this.state.error instanceof se&&e.jsx(Eh,{message:this.state.message,error:this.state.error}),!(this.state.error instanceof se)&&e.jsx(e.Fragment,{children:o?e.jsx(o,{...r}):e.jsx(js,{message:this.state.message,error:this.state.error})}),e.jsxs("p",{children:["This error has been logged. Please"," ",e.jsxs(i.Button,{size:"sm",onClick:this.reload,children:[e.jsx("i",{className:"fa fa-refresh"})," Reload"]})," ","the application"]})]})}return this.props.children}}function kh(n){var o;const t=g.useMemo(()=>fs(n.layout),[n.layout]);return t.error?e.jsx("div",{className:`${n.className??""} ymllayout-main`,"data-testid":n.testid,children:e.jsxs(R,{children:[e.jsx(R.Header,{children:"Layout Error"}),e.jsxs(R.Contents,{children:[e.jsxs("p",{children:["File: ",t.name]}),e.jsx(i.Alert,{variant:"warning",children:e.jsx("pre",{className:"mb-0",children:t.error})})]})]})}):e.jsx("div",{className:`${n.className??""} ymllayout-main`,"data-testid":n.testid,children:e.jsx(ys,{resetKey:t,unhandledComponentDidCatch:n.unhandledComponentDidCatch,UnhandledErrorComponent:n.UnhandledErrorComponent,children:(o=t.children)==null?void 0:o.map((s,r)=>W(s,r))})})}const Je={hardwareproperty:ws,hardware:vs};function Ph(n,t){Je[n]=t}function Bh(){return Je}function Le(n){return e.jsxs(i.Col,{className:"monitor-panel-item bg-fatal",title:`Error from yaml configuration: ${n.message}`,children:[e.jsx("h1",{children:n.monitor.name}),e.jsx("div",{children:"Parsing error"})]})}function Gh(n){const t=P.map(n.monitors,(o,s)=>{const r=o.type??"hardwareproperty",a=Je[r];return a===void 0?e.jsx(Le,{monitor:o,message:`Type ${r} unsupported`},`m${s}`):e.jsx(a,{monitor:o},`m${s}`)});return e.jsx("div",{className:q.default({"ms-auto":n.margin==="start"},"me-auto","monitor-panel",{"monitor-panel-light":n.bg==="light"}),children:e.jsx(i.Container,{fluid:!0,children:e.jsx(i.Row,{className:"flex-nowrap",children:t})})})}function vs(n){const{monitor:t}=n,{id:o}=t,s=Ae(o),r=G(s),a=oe(s);if(o===void 0)return e.jsx(Le,{monitor:t,message:"'id' is missing"});if(typeof o!="string")return e.jsx(Le,{monitor:t,message:"'id' is invalid"});if(r===null)return e.jsx(D,{state:"NONE",variant:"danger",description:`hardware '${o}' was not found`});const{type:c="none"}=r,l={...r,actions:a},u=Ze(c,"monitor");return u?e.jsx(u,{hardware:l,options:{name:t.name},operator:!1,disabled:!1}):e.jsx(Te,{hardware:l})}exports.AirBearing=Nt;exports.AirBearingHardwareDesc=Ct;exports.AirBearingMocks=_t;exports.AirBearingProtected=bt;exports.AirBearingSimulator=St;exports.AirBearingState=Fe;exports.BaseHardwareDesc=yt;exports.BaseInfo=gt;exports.BaseMocks=jt;exports.BaseName=ht;exports.BaseProperty=xt;exports.BaseState=mt;exports.BeamlineHardwareDesc=$t;exports.Beamviewer=Ot;exports.BeamviewerHardwareDesc=Dt;exports.BeamviewerMocks=It;exports.BeamviewerSimulator=Mt;exports.COMPARATORS=Mh;exports.EnergyManagerDefault=Tt;exports.EnergyManagerHardwareDesc=Et;exports.EnergyManagerMocks=Rt;exports.EnergyManagerSimulator=At;exports.EnergyManagerState=Ue;exports.ErrorObject=Rm;exports.FiltersetDefault=Bt;exports.FiltersetHardwareDesc=Ht;exports.FiltersetMocks=Gt;exports.FiltersetSimulator=Lt;exports.FiltersetState=Pt;exports.Formatting=di;exports.Frontend=Vt;exports.FrontendHardwareDesc=zt;exports.FrontendMocks=Wt;exports.FullSizer=ls;exports.Gauge=Yt;exports.GaugeHardwareDesc=Qt;exports.GaugeIndicator=Pm;exports.GaugeMocks=Kt;exports.HardwareInputNumber=me;exports.HardwareNumericStep=ge;exports.HardwareSchema=Ah;exports.HardwareState=Sh;exports.HardwareTemplate=_;exports.HardwareTypes=Rh;exports.InfiniteKnob360=Cn;exports.KeyError=T;exports.Laser=Zt;exports.LaserHardwareDesc=en;exports.LaserHeating=tn;exports.LaserHeatingHardwareDesc=on;exports.LaserHeatingMocks=nn;exports.LaserMocks=Jt;exports.Light=sn;exports.LightHardwareDesc=an;exports.LightMocks=rn;exports.LimaBinning=fn;exports.LimaDefault=cn;exports.LimaDescription=mn;exports.LimaHardwareDesc=yn;exports.LimaImageRoi=pn;exports.LimaMocks=gn;exports.LimaShape=hn;exports.LimaSimulator=xn;exports.LimaSize=ln;exports.LimaState=Z;exports.LimaTransformation=dn;exports.LoadingObject=Dm;exports.MeasurementGroupDefault=vn;exports.MeasurementGroupHardwareDesc=_n;exports.MeasurementGroupMocks=Nn;exports.MeasurementGroupSimulator=bn;exports.MissingComponentObject=Em;exports.MissingKeysError=Me;exports.MissingObject=Fm;exports.MonitorHardware=vs;exports.MonitorHardwareProperty=ws;exports.MonitorPanel=Gh;exports.MonitorPanelItem=X;exports.MotorDefault=ce;exports.MotorHardwareDesc=Rn;exports.MotorMocks=In;exports.MotorRotation=$n;exports.MotorSimulator=Mn;exports.MotorState=we;exports.MotorText=Sn;exports.MultiState=vt;exports.Multiposition=An;exports.MultipositionDefault2=kn;exports.MultipositionHardwareDesc=Gn;exports.MultipositionMocks=Pn;exports.MultipositionSimulator=Bn;exports.NoObject=Mm;exports.None=ds;exports.NullObject=km;exports.NumericStep=Xt;exports.OpticDefault=Hn;exports.OpticHardwareDesc=qn;exports.OpticMocks=Un;exports.OpticSimulator=Vn;exports.OpticState=qe;exports.Panel=R;exports.ProcedureActions=Wn;exports.ProcedureExecution=Yn;exports.ProcedureFinishedState=zn;exports.ProcedureHardwareDesc=Xn;exports.ProcedureManage=Be;exports.ProcedureMocks=Qn;exports.ProcedureState=ye;exports.ProcedureValidate=Kn;exports.PumpDefault=ho;exports.PumpHardwareDesc=xo;exports.PumpMocks=go;exports.PusherDefault=wo;exports.PusherHardwareDesc=vo;exports.PusherMocks=jo;exports.PusherSimulator=yo;exports.PusherState=Ye;exports.RegulationDefault=eo;exports.RegulationHardwareDesc=so;exports.RegulationMocks=no;exports.RegulationPlot=We;exports.RegulationSimulator=oo;exports.ServiceDefault=No;exports.ServiceHardwareDesc=So;exports.ServiceMocks=_o;exports.ServiceProtected=bo;exports.ServiceState=Re;exports.ShutterDefault=ro;exports.ShutterHardwareDesc=uo;exports.ShutterMocks=co;exports.ShutterProtected=io;exports.ShutterSimulator=lo;exports.ShutterState=ve;exports.SlitDefault=fo;exports.SlitHardwareDesc=mo;exports.SlitMocks=po;exports.SlitState=ze;exports.State=D;exports.Synoptic=Fh;exports.Todo=hs;exports.TomoConfigHardwareDesc=ts;exports.TomoConfigLatencyTime=es;exports.TomoDetectorAcquisitionMode=ko;exports.TomoDetectorHardwareDesc=Bo;exports.TomoDetectorMocks=Po;exports.TomoDetectorSamplePixelSize=Ao;exports.TomoDetectorState=be;exports.TomoDetectorsDefault=Go;exports.TomoDetectorsHardwareDesc=Ho;exports.TomoDetectorsMocks=Lo;exports.TomoDetectorsState=Qe;exports.TomoFlatMotionDefault=Co;exports.TomoFlatMotionHardwareDesc=Mo;exports.TomoFlatMotionMocks=Oo;exports.TomoFlatMotionSimulator=Io;exports.TomoFlatMotionSmall=$o;exports.TomoFlatMotionState=Ne;exports.TomoHoloHardwareDesc=ss;exports.TomoHoloState=os;exports.TomoImagingActions=zo;exports.TomoImagingDefault=Vo;exports.TomoImagingExposureTime=qo;exports.TomoImagingHardwareDesc=Xo;exports.TomoImagingMocks=Ko;exports.TomoImagingSettleTime=Wo;exports.TomoImagingSimulator=Qo;exports.TomoImagingState=ae;exports.TomoImagingUpdateMode=Yo;exports.TomoReferencePositionDefault=Fo;exports.TomoReferencePositionHardwareDesc=Ro;exports.TomoSampleStageHardwareDesc=Zo;exports.TypeIcon=N;exports.ValveDefault=is;exports.ValveHardwareDesc=cs;exports.ValveMocks=as;exports.YAMLErrorBoundary=ys;exports.YAMLLayout=kh;exports.YamlAsserts=vh;exports.createMotorMock=Yl;exports.dynamicOp=De;exports.getAllHardwareDesc=_h;exports.getAllMonitors=Bh;exports.getHardwareVariantComponent=Ze;exports.getYamlComponents=th;exports.getYamlContainers=nh;exports.isLimaHardware=xe;exports.isMotorClockWise=Tn;exports.isMotorHardware=Dn;exports.isOpticHardware=Nd;exports.isProcedureHardware=Zn;exports.isTomoConfigHardware=ns;exports.isTomoDetectorHardware=Ke;exports.isTomoDetectorsHardware=Uo;exports.isTomoFlatMotionHardware=Do;exports.isTomoHoloHardware=rs;exports.isTomoReferencePositionHardware=lp;exports.isTomoSampleStageHardware=Jo;exports.limaGuessSubframes=jn;exports.motorLimits=Fn;exports.normalizeId=Ae;exports.registerHardwareVariant=bh;exports.registerMonitorComponent=Ph;exports.registerRuntimeHook=Da;exports.registerYamlComponent=us;exports.registerYamlComponents=eh;exports.registerYamlContainer=Jm;exports.renderYamlNode=W;exports.useHardware=G;exports.useHardwareChangeActions=oe;exports.useHardwareSchema=Ta;exports.useLimaHardware=wn;exports.useMotorHardware=U;exports.useMotorStates=je;exports.useOperator=Fa;exports.useProcedureHardware=kd;exports.useScanRunning=Ra;exports.useTomoConfigHardware=mm;exports.useTomoDetectorHardware=Mp;exports.useTomoDetectorsHardware=Hp;exports.useTomoFlatMotionHardware=cp;exports.useTomoHoloHardware=xm;exports.useTomoSampleStageHardware=um;exports.yamlComponents=ie;exports.yamlContainers=re;
|
|
41
41
|
//# sourceMappingURL=index.js.map
|