@esrf/daiquiri-lib 5.2.0 → 5.3.1
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.d.ts +95 -31
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3203 -2791
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/src/scss/_yml_layout.scss +63 -0
- package/src/scss/main.scss +1 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var so=Object.defineProperty;var ro=(n,t,o)=>t in n?so(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var ee=(n,t,o)=>(ro(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"),h=require("react"),P=require("lodash"),io=require("classnames"),ao=require("lodash/debounce"),co=require("semver");require("react-bootstrap-typeahead/css/Typeahead.css");require("react-bootstrap-typeahead/css/Typeahead.bs5.css");const Y=require("react-bootstrap-typeahead"),lo=require("@react-hookz/web"),E=require("@vallsv/rc-knob"),uo=require("js-quantities"),fo=require("debug"),ue=require("react-svgmt"),de=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},po=de(h),U=de(io),mo=de(ao),ho=de(co),Xe=de(uo),Ae=de(fo);function $e(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 Ze(n){const{hardware:t}=n;return e.jsx($e,{hardware:t})}function Je(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 et(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 go(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(go,{...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 xo(n){const t=n.online?"READY":"OFFLINE";return e.jsx(i.Badge,{bg:t==="READY"?"success":"warning",children:t})}function tt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fa-cog",online:t.online}),r=e.jsx(xo,{...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(),f=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:a()}),l&&e.jsx(i.InputGroup.Text,{children:l})]}),u=n.options.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:f,headerMode:u})}const oe=h.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 wo(n){const{hardware:t,options:o={}}=n,s=o.name??t.alias??t.name??t.id;return e.jsxs(oe,{children:[e.jsx("h1",{children:s}),e.jsx($e,{hardware:t})]})}const jo={state:Ze,name:Je,info:et,property:tt,monitor:wo},nt=jo,yo={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"},vo={$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},No={response:yo,schema:vo},bo={default:No};function M(n){const t={display:"inline-block",minWidth:""};return n.minWidth&&(t.minWidth=`${n.minWidth}em`),e.jsx("div",{style:t,children:e.jsx(i.Badge,{bg:n.variant,title:n.description,children:n.state})})}function ot(n){const{states:t,variants:o={},descriptions:s={},minWidth:r}=n,a=t[0]??"";if(t.length===0)return e.jsx(M,{state:"NO_STATE",variant:"fatal",description:"The device no not expose any state",minWidth:r});if(t.length===1)return e.jsx(M,{state:a,variant:o[a]??"fatal",description:s[a],minWidth:r});const c={display:"inline-block",minWidth:r?`${r}em`:""};function l(f){return e.jsx(i.Tooltip,{id:"device-state",...f,children:t.map((u,d)=>{const p=s[u],m=u.startsWith("_")?u.slice(1):u;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[u]??"fatal",children:m})}),e.jsx(i.Col,{sm:"9",className:"text-start lh-1 my-auto ps-1",children:p})]})})})}return e.jsx("div",{style:c,children:e.jsx(i.OverlayTrigger,{placement:"top",delay:{show:250,hide:400},overlay:l,children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx(i.Badge,{className:"rounded-end-0",bg:o[a]??"fatal",children:a}),e.jsxs(i.Badge,{className:"rounded-start-0",bg:"secondary",children:["+",t.length-1]})]})})})}function Oe(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(M,{state:o,minWidth:6,variant:r})}function _o(n){const{hardware:t}=n;return e.jsx(Oe,{hardware:t})}function Co(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 st(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(Oe,{hardware:t});function a(){return e.jsx(Co,{...n})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function He(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 So(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",f=c==="MOVING_ON",u=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(He,{icon:"fa fa-arrow-up",wasActivated:f,onClick:()=>{r()},disabled:s||l,title:"Turn on the air bearing",children:["Turn",e.jsx("br",{}),"on"]}),e.jsxs(He,{icon:"fa fa-arrow-down",wasActivated:u,onClick:()=>{a()},disabled:s||l,title:"Turn off the air bearing",children:["Turn",e.jsx("br",{}),"off"]})]})})})]})})]})}function $o(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(So,{...n})]})}function rt(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(Oe,{hardware:t});function a(){return e.jsx($o,{...n})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const Oo={default:st,protected:rt,state:_o},it=Oo,Io=["on","off","sync_hard"],Mo="airbearing",To="airbearing",Fo=!0,Do={state:"ON"},Ro="bliss",Ao=!1,Eo="airbearing",ko={callables:Io,id:Mo,name:To,online:Fo,properties:Do,protocol:Ro,require_staff:Ao,type:Eo},Po={default:ko};async function V(n){await new Promise(t=>{setTimeout(t,n)})}function W(n){const{name:t,alias:o=null,type:s,setProperty:r,call:a,properties:c,useHardwareContext:l=()=>null}=n,f=l(),u=h.useMemo(()=>{var g,w;const m={setProperty:r,call:a};return(w=f==null?void 0:(g=f.actions).updateHardwareChangeActions)==null||w.call(g,t,m),m},[]),d={id:t,name:t,alias:o,online:!0,properties:c,type:s,actions:u,user_tags:[],locked:null},p=h.useRef(null);return h.useEffect(()=>{(p.current===null||!P.isEqual(p.current,d))&&(p.current=d,f==null||f.actions.updateHardware(t,d))},[t,d]),e.jsx(e.Fragment,{})}function Bo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("ON");async function c(u,d){if(u==="on"){a("MOVING_ON"),await V(2e3),a("ON");return}if(u==="off"){a("MOVING_OFF"),await V(2e3),a("OFF");return}console.log("AirBearingSimulator: Unsupported call",u,d)}async function l(u,d){console.log("AirBearingSimulator: Unsupported setProperty",u,d)}const f={state:r};return e.jsx(W,{name:t,alias:o,type:"tomoflatmotion",call:c,setProperty:l,properties:f,useHardwareContext:s})}function Go(n){const[t,o]=h.useState(),[s,r]=h.useState(),{hardware:a,options:c={}}=n;function l(){const u=a.actions.call("read");return u!==void 0&&(console.log("pending"),u.then(d=>{o(d),r(void 0)}).catch(d=>{r(`${d}`)})),u}function f(u){return a.actions.setProperty("diode_range",u)}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:u=>{f(u.target.value)},defaultValue:a.properties.diode_range,children:P.map(a.properties.diode_ranges,u=>e.jsx("option",{value:u,children:u},u))})})]}),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 at(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(Go,{...n})]}),e.jsx("div",{className:"hw-content",children:e.jsx(i.Container,{style:{minWidth:"150px"},children:P.map(s,a=>e.jsx(h.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 Vo={default:at},ct=Vo,Lo=["foil","current","screen","led"],Uo="bv1",Ho="bv1",qo=!0,Wo={diode_range:"1uA",diode_ranges:["1mA","100uA","10uA","1uA","100nA","10nA"],foil:"NONE",led:"OFF",screen:"OUT",state:"ON"},zo="bliss",Ko=!0,Yo="beamviewer",Qo={callables:Lo,id:Uo,name:Ho,online:qo,properties:Wo,protocol:zo,require_staff:Ko,type:Yo},Xo={default:Qo},Zo=["1mA","100uA","10uA","1uA","100nA","10nA"];function Jo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("OFF"),[c,l]=h.useState("OUT"),[f,u]=h.useState("NONE"),[d,p]=h.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"?(u(j?"IN":"OUT"),null):(console.log("BeamviewerSimulator: Unsupported call",x,j),null)}async function g(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:f,diode_range:d,diode_ranges:Zo};return console.log(w),e.jsx(W,{name:t,alias:o,type:"optic",call:m,setProperty:g,properties:w,useHardwareContext:s})}function Ee(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(M,{state:r,minWidth:7,variant:c})}function es(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(u){t.actions.setProperty("source",`hardware:${u}`)}function f(u){const p=c===u?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:o,onClick:()=>{l(u)},title:`Select the source ${u}`,children:[e.jsx("i",{className:p})," ",u]},u)}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(u=>f(u))})]})}function lt(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,{energy:a,unit:c,source:l}=r,f=e.jsx(N,{name:"Energymanager",icon:"fam-hardware-multiposition",online:t.online}),u=e.jsx(Ee,{hardware:t});function d(w){return w===void 0?"Unknown":w===null?"∅":Number.isFinite(w)?w.toFixed(2):"∅"}const p=h.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(es,{...n}),c&&e.jsx(i.InputGroup.Text,{children:c})]})}const g=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:f,widgetState:u,widgetContent:m(),headerMode:g})}function ts(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 f=h.useMemo(()=>{if(r===void 0)return"Unknown";const p=r.slice(9);return p===""?"No source":p},[r]),u=l(a,c),d=u!=="∅"?"success":"danger";return e.jsxs(oe,{children:[e.jsx("h1",{children:o.name??f}),e.jsx(i.Badge,{bg:d,children:u})]})}const ns={default:lt,state:Ee,monitor:ts},dt=ns,os=[],ss="energymanager",rs="energymanager",is=!0,as={energy:15.2,unit:"keV",available_source_names:["hardware:pink_beam","hardware:dcm"],source:"hardware:pink_beam"},cs="bliss",ls=!1,ds="energymanager",us={callables:os,id:ss,name:rs,online:is,properties:as,protocol:cs,require_staff:ls,type:ds},fs={default:us},qe={pink_beam:1.2,dcm:15.6,dcm_off:null};function ps(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.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 f=h.useMemo(()=>Object.keys(qe).map(d=>d),[]),u={energy:qe[r]??null,unit:"keV",source:`hardware:${r}`,available_source_names:f};return e.jsx(W,{name:t,alias:o,type:"energymanager",call:c,setProperty:l,properties:u,useHardwareContext:s})}function ms(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 hs(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 gs(n){return n>0?(662607004e-42*299792458/(n*1e-10)/160218e-24*.001).toFixed(4):0}function xs(n,t){return Number.parseFloat(n.toFixed(t))}const ws=Object.freeze(Object.defineProperty({__proto__:null,formatEng:ms,round:xs,toEnergy:gs,toHoursMins:ut,ucfirst:hs},Symbol.toStringTag,{value:"Module"}));function js(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 ft(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(js,{...n})]})})]})}function ys(n){switch(n){case"OPEN":case"RUNNING":return"success"}return"danger"}function vs(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r="OFFLINE",status:a}=s,c=o.name??t.alias??t.name,l=ys(r),f=e.jsxs(oe,{children:[e.jsx("h1",{children:c}),e.jsx(i.Badge,{bg:l,children:`${r}`})]});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(`
|
|
2
|
-
`)?e.jsx("pre",{children:u}):u}),children:f})}return f}const
|
|
1
|
+
"use strict";var xo=Object.defineProperty;var wo=(n,t,o)=>t in n?xo(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var ne=(n,t,o)=>(wo(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"),h=require("react"),P=require("lodash"),jo=require("classnames"),yo=require("lodash/debounce"),vo=require("semver");require("react-bootstrap-typeahead/css/Typeahead.css");require("react-bootstrap-typeahead/css/Typeahead.bs5.css");const Q=require("react-bootstrap-typeahead"),No=require("@react-hookz/web"),E=require("@vallsv/rc-knob"),L=require("@h5web/lib");require("@h5web/lib/styles.css");const bo=require("js-quantities"),_o=require("debug"),fe=require("react-svgmt"),ue=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},So=ue(h),H=ue(jo),Co=ue(yo),$o=ue(vo),it=ue(bo),Pe=ue(_o);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 at(n){const{hardware:t}=n;return e.jsx(Te,{hardware:t})}function ct(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 lt(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 Oo(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(Oo,{...n})]})}function S(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 Io(n){const t=n.online?"READY":"OFFLINE";return e.jsx(i.Badge,{bg:t==="READY"?"success":"warning",children:t})}function dt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fa-cog",online:t.online}),r=e.jsx(Io,{...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(),f=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:a()}),l&&e.jsx(i.InputGroup.Text,{children:l})]}),u=n.options.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:f,headerMode:u})}const ee=h.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 Mo(n){const{hardware:t,options:o={}}=n,s=o.name??t.alias??t.name??t.id;return e.jsxs(ee,{children:[e.jsx("h1",{children:s}),e.jsx(Te,{hardware:t})]})}const To={state:at,name:ct,info:lt,property:dt,monitor:Mo},ut=To,Fo={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"},Do={$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},Ro={response:Fo,schema:Do},Ao={default:Ro};function T(n){const t={display:"inline-block",minWidth:""};return n.minWidth&&(t.minWidth=`${n.minWidth}em`),e.jsx("div",{style:t,children:e.jsx(i.Badge,{bg:n.variant,title:n.description,children:n.state})})}function ft(n){const{states:t,variants:o={},descriptions:s={},minWidth:r}=n,a=t[0]??"";if(t.length===0)return e.jsx(T,{state:"NO_STATE",variant:"fatal",description:"The device no not expose any state",minWidth:r});if(t.length===1)return e.jsx(T,{state:a,variant:o[a]??"fatal",description:s[a],minWidth:r});const c={display:"inline-block",minWidth:r?`${r}em`:""};function l(f){return e.jsx(i.Tooltip,{id:"device-state",...f,children:t.map((u,d)=>{const p=s[u],m=u.startsWith("_")?u.slice(1):u;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[u]??"fatal",children:m})}),e.jsx(i.Col,{sm:"9",className:"text-start lh-1 my-auto ps-1",children:p})]})})})}return e.jsx("div",{style:c,children:e.jsx(i.OverlayTrigger,{placement:"top",delay:{show:250,hide:400},overlay:l,children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx(i.Badge,{className:"rounded-end-0",bg:o[a]??"fatal",children:a}),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(T,{state:o,minWidth:6,variant:r})}function Eo(n){const{hardware:t}=n;return e.jsx(Fe,{hardware:t})}function ko(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 pt(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(ko,{...n})}const c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function Ke(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 Po(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",f=c==="MOVING_ON",u=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(Ke,{icon:"fa fa-arrow-up",wasActivated:f,onClick:()=>{r()},disabled:s||l,title:"Turn on the air bearing",children:["Turn",e.jsx("br",{}),"on"]}),e.jsxs(Ke,{icon:"fa fa-arrow-down",wasActivated:u,onClick:()=>{a()},disabled:s||l,title:"Turn off the air bearing",children:["Turn",e.jsx("br",{}),"off"]})]})})})]})})]})}function Bo(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(Po,{...n})]})}function mt(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(Bo,{...n})}const c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const Go={default:pt,protected:mt,state:Eo},ht=Go,Vo=["on","off","sync_hard"],Lo="airbearing",Uo="airbearing",Ho=!0,qo={state:"ON"},Wo="bliss",zo=!1,Ko="airbearing",Yo={callables:Vo,id:Lo,name:Uo,online:Ho,properties:qo,protocol:Wo,require_staff:zo,type:Ko},Qo={default:Yo};async function V(n){await new Promise(t=>{setTimeout(t,n)})}function q(n){const{name:t,alias:o=null,type:s,setProperty:r,call:a,properties:c,useHardwareContext:l=()=>null}=n,f=l(),u=h.useMemo(()=>{var g,j;const m={setProperty:r,call:a};return(j=f==null?void 0:(g=f.actions).updateHardwareChangeActions)==null||j.call(g,t,m),m},[]),d={id:t,name:t,alias:o,online:!0,properties:c,type:s,actions:u,user_tags:[],locked:null},p=h.useRef(null);return h.useEffect(()=>{(p.current===null||!P.isEqual(p.current,d))&&(p.current=d,f==null||f.actions.updateHardware(t,d))},[t,d]),e.jsx(e.Fragment,{})}function Xo(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("ON");async function c(u,d){if(u==="on"){a("MOVING_ON"),await V(2e3),a("ON");return}if(u==="off"){a("MOVING_OFF"),await V(2e3),a("OFF");return}console.log("AirBearingSimulator: Unsupported call",u,d)}async function l(u,d){console.log("AirBearingSimulator: Unsupported setProperty",u,d)}const f={state:r};return e.jsx(q,{name:t,alias:o,type:"tomoflatmotion",call:c,setProperty:l,properties:f,useHardwareContext:s})}function Zo(n){const[t,o]=h.useState(),[s,r]=h.useState(),{hardware:a,options:c={}}=n;function l(){const u=a.actions.call("read");return u!==void 0&&(console.log("pending"),u.then(d=>{o(d),r(void 0)}).catch(d=>{r(`${d}`)})),u}function f(u){return a.actions.setProperty("diode_range",u)}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:u=>{f(u.target.value)},defaultValue:a.properties.diode_range,children:P.map(a.properties.diode_ranges,u=>e.jsx("option",{value:u,children:u},u))})})]}),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 gt(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(Zo,{...n})]}),e.jsx("div",{className:"hw-content",children:e.jsx(i.Container,{style:{minWidth:"150px"},children:P.map(s,a=>e.jsx(h.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 Jo={default:gt},xt=Jo,es=["foil","current","screen","led"],ts="bv1",ns="bv1",os=!0,ss={diode_range:"1uA",diode_ranges:["1mA","100uA","10uA","1uA","100nA","10nA"],foil:"NONE",led:"OFF",screen:"OUT",state:"ON"},rs="bliss",is=!0,as="beamviewer",cs={callables:es,id:ts,name:ns,online:os,properties:ss,protocol:rs,require_staff:is,type:as},ls={default:cs},ds=["1mA","100uA","10uA","1uA","100nA","10nA"];function us(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("OFF"),[c,l]=h.useState("OUT"),[f,u]=h.useState("NONE"),[d,p]=h.useState("1uA");async function m(x,w){if(x==="read"){const y=Math.random();if(y<.1)throw new Error("Dummy error");return y}return x==="led"?(a(w?"ON":"OFF"),null):x==="screen"?(l(w?"IN":"OUT"),null):x==="foil"?(u(w?"IN":"OUT"),null):(console.log("BeamviewerSimulator: Unsupported call",x,w),null)}async function g(x,w){if(x==="diode_range"){p(w);return}console.log("BeamviewerSimulator: Unsupported setProperty",x,w)}const j={state:"ON",led:r,screen:c,foil:f,diode_range:d,diode_ranges:ds};return console.log(j),e.jsx(q,{name:t,alias:o,type:"optic",call:m,setProperty:g,properties:j,useHardwareContext:s})}function Be(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(T,{state:r,minWidth:7,variant:c})}function fs(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(u){t.actions.setProperty("source",`hardware:${u}`)}function f(u){const p=c===u?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:o,onClick:()=>{l(u)},title:`Select the source ${u}`,children:[e.jsx("i",{className:p})," ",u]},u)}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(u=>f(u))})]})}function wt(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,{energy:a,unit:c,source:l}=r,f=e.jsx(N,{name:"Energymanager",icon:"fam-hardware-multiposition",online:t.online}),u=e.jsx(Be,{hardware:t});function d(j){return j===void 0?"Unknown":j===null?"∅":Number.isFinite(j)?j.toFixed(2):"∅"}const p=h.useMemo(()=>{if(l===void 0)return"Unknown";const j=l.slice(9);return j===""?"No source":j},[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(fs,{...n}),c&&e.jsx(i.InputGroup.Text,{children:c})]})}const g=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:f,widgetState:u,widgetContent:m(),headerMode:g})}function ps(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 f=h.useMemo(()=>{if(r===void 0)return"Unknown";const p=r.slice(9);return p===""?"No source":p},[r]),u=l(a,c),d=u!=="∅"?"success":"danger";return e.jsxs(ee,{children:[e.jsx("h1",{children:o.name??f}),e.jsx(i.Badge,{bg:d,children:u})]})}const ms={default:wt,state:Be,monitor:ps},jt=ms,hs=[],gs="energymanager",xs="energymanager",ws=!0,js={energy:15.2,unit:"keV",available_source_names:["hardware:pink_beam","hardware:dcm"],source:"hardware:pink_beam"},ys="bliss",vs=!1,Ns="energymanager",bs={callables:hs,id:gs,name:xs,online:ws,properties:js,protocol:ys,require_staff:vs,type:Ns},_s={default:bs},Ye={pink_beam:1.2,dcm:15.6,dcm_off:null};function Ss(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.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 f=h.useMemo(()=>Object.keys(Ye).map(d=>d),[]),u={energy:Ye[r]??null,unit:"keV",source:`hardware:${r}`,available_source_names:f};return e.jsx(q,{name:t,alias:o,type:"energymanager",call:c,setProperty:l,properties:u,useHardwareContext:s})}function Cs(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 $s(n){return n.charAt(0).toUpperCase()+n.slice(1)}function yt(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 Os(n){return n>0?(662607004e-42*299792458/(n*1e-10)/160218e-24*.001).toFixed(4):0}function Is(n,t){return Number.parseFloat(n.toFixed(t))}const Ms=Object.freeze(Object.defineProperty({__proto__:null,formatEng:Cs,round:Is,toEnergy:Os,toHoursMins:yt,ucfirst:$s},Symbol.toStringTag,{value:"Module"}));function Ts(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:yt(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(Ts,{...n})]})})]})}function Fs(n){switch(n){case"OPEN":case"RUNNING":return"success"}return"danger"}function Ds(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r="OFFLINE",status:a}=s,c=o.name??t.alias??t.name,l=Fs(r),f=e.jsxs(ee,{children:[e.jsx("h1",{children:c}),e.jsx(i.Badge,{bg:l,children:`${r}`})]});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(`
|
|
2
|
+
`)?e.jsx("pre",{children:u}):u}),children:f})}return f}const Rs={default:vt,monitor:Ds},Nt=Rs,As=["open","close","reset"],Es="fe",ks="fe",Ps=!0,Bs={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
|
|
3
3
|
Mode : Beam Delivery
|
|
4
4
|
Automatic : Automatic opening active
|
|
5
5
|
Type : UHV
|
|
@@ -8,7 +8,7 @@ Module 1 Gate Valve 1: Open
|
|
|
8
8
|
Module 1 Gate Valve 2: Open
|
|
9
9
|
Module 2 Gate Valve 1: Open
|
|
10
10
|
|
|
11
|
-
`},
|
|
11
|
+
`},Gs="tango",Vs=!0,Ls="frontend",Us={callables:As,id:Es,name:ks,online:Ps,properties:Bs,protocol:Gs,require_staff:Vs,type:Ls},Hs={default:Us};function qs(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 bt(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(qs,{...n})]})})]})}const Ws={default:bt},_t=Ws,zs=["off","on"],Ks="pir121",Ys="pir121",Qs=!0,Xs={pressure:.0007999999797903001,state:"ON",status:`
|
|
12
12
|
Gauge is underrange - Channel B2 (4)
|
|
13
13
|
Rel. | Lower | Upper | SA | State
|
|
14
14
|
1 | 1.0e-6| 3.0e-6| 1 | ON
|
|
@@ -18,7 +18,7 @@ Rel. | Lower | Upper | SA | State
|
|
|
18
18
|
A | 4.0e-3| 1.0e-5| 6 | ON
|
|
19
19
|
B | 4.0e-3| 1.0e-5| 8 | ON
|
|
20
20
|
|
|
21
|
-
HDB Storage OK`},
|
|
21
|
+
HDB Storage OK`},Zs="tango",Js=!0,er="gauge",tr={callables:zs,id:Ks,name:Ys,online:Qs,properties:Xs,protocol:Zs,require_staff:Js,type:er},nr=["off","on"],or="pen121",sr="pen121",rr=!0,ir={pressure:13999999737279722e-23,state:"ON",status:`Gauge is ON - Channel B1 (3)
|
|
22
22
|
Rel. | Lower | Upper | SA | State
|
|
23
23
|
1 | 1.0e-6| 3.0e-6| 1 | ON
|
|
24
24
|
2 | 4.0e-3| 6.0e-3| 2 | ON
|
|
@@ -26,15 +26,15 @@ Rel. | Lower | Upper | SA | State
|
|
|
26
26
|
4 | 4.0e-3| 6.0e-3| 4 | ON
|
|
27
27
|
A | 4.0e-3| 1.0e-5| 6 | ON
|
|
28
28
|
B | 4.0e-3| 1.0e-5| 8 | ON
|
|
29
|
-
`},Ys="tango",Qs=!0,Xs="gauge",Zs={callables:Hs,id:qs,name:Ws,online:zs,properties:Ks,protocol:Ys,require_staff:Qs,type:Xs},Js={default:Us,default2:Zs},er=h.forwardRef((n,t)=>{const o=h.useRef(null),s=h.useRef(),[r,a]=h.useState(n.step),[c,l]=h.useState(!1),f=O=>{const z=t;if(o.current===null)return;let J=Number.parseFloat(z.current.value);if(o.current.value.startsWith("*")){const K=Number.parseFloat(o.current.value.replace("*",""));J=O?J*K:J/K}else{const K=Number.parseFloat(o.current.value);J+=O?K:-K}z.current.value=`${J}`,n.onStep&&n.onStep({target:z.current})},{onStep:u,step:d,overlay:p,incIcon:m,decIcon:g,swapIncDec:w,onKeyDown:x,onBlur:j,horizontalArrows:y,largeArrows:S,disabled:$,stepOnly:b,...v}=n,C=O=>{O.key==="ArrowUp"?(O.preventDefault(),l(!0),f(!0)):O.key==="ArrowDown"?(O.preventDefault(),l(!0),f(!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)),h.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 F=P.map(n.steps||[n.step],O=>e.jsx("option",{value:O,children:O},O)),k=m||g;return e.jsx("div",{className:U.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:F}),n.unit&&e.jsx("div",{children:n.unit}),!m&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{className:"step step-up",disabled:n.disabled,onClick:O=>f(!0)}),e.jsx(i.Button,{className:"step step-down",disabled:n.disabled,onClick:O=>f(!1)})]})]}),g&&w&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>f(!1),children:e.jsx("i",{className:`fa fa-fw fa-${g}`})}),m&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>f(!0),children:e.jsx("i",{className:`fa fa-fw fa-${m}`})}),g&&!w&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>f(!1),children:e.jsx("i",{className:`fa fa-fw fa-${g}`})})]})]})})}),gt=er;function Ie(n){const t=h.useRef(null),[o,s]=h.useState(!1),[r,a]=h.useState(!1);h.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 f(p){n.hardwareValue!==null&&s(p.target.value!==n.hardwareValue.toString())}function u(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),g=n.onMoveRequested(m);g&&g.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(gt,{id:n.id,className:U.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:n.readOnly?"text":"number",ref:t,precision:n.precision,onChange:f,onBlur:l,onStep:u,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(u){return t.actions.setProperty("power",u)}function a(u){return t.actions.call(u?"on":"off")}const c=t.properties.state,l=e.jsx(N,{name:"Laser",icon:"fam-hardware-laser",online:t.online}),f=e.jsx(M,{state:c,minWidth:6,variant:c==="ON"?"success":"warning"});return e.jsx(_,{hardware:t,widgetIcon:l,widgetState:f,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(Ie,{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 tr={default:xt},wt=tr,nr=[],or="yag1",sr="yag1",rr=!0,ir={power:5,state:"ON"},ar="bliss",cr=!1,lr="laser",dr={callables:nr,id:or,name:sr,online:rr,properties:ir,protocol:ar,require_staff:cr,type:lr},ur={default:dr};function fr(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 jt(n){const{hardware:t,options:o={},disabled:s}=n,[r,a]=h.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 f=t.properties.state,u=e.jsx(N,{name:"Laser Heating",icon:"fa-fire",online:t.online}),d=e.jsx(M,{state:f,minWidth:6,variant:f==="READY"?"success":"warning"});return e.jsx(_,{hardware:t,widgetIcon:u,widgetState:d,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(Ie,{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(fr,{hardware:t,disabled:n.disabled})]})})}const pr={default:jt},yt=pr,mr=[],hr="laserheating",gr="laserheating",xr=!0,wr={exposure_time:.5,state:"ON",background_mode:"READY",fit_wavelength:[500,650],current_calibration:"/path/to/file"},jr="bliss",yr=!1,vr="laserheating",Nr={callables:mr,id:hr,name:gr,online:xr,properties:wr,protocol:jr,require_staff:yr,type:vr},br={default:Nr};function vt(n){const t=h.useRef(null),{hardware:o,options:s={}}=n;function r(c){o.actions.setProperty("intensity",c)}const a=h.useCallback(mo.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 _r={default:vt},Nt=_r,Cr=[],Sr="light_vlm",$r="light_vlm",Or=!0,Ir={intensity:0,state:"ON",temperature:23.2},Mr="bliss",Tr=!1,Fr="light",Dr={callables:Cr,id:Sr,name:$r,online:Or,properties:Ir,protocol:Mr,require_staff:Tr,type:Fr},Rr={default:Dr};function Q(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(M,{state:a,minWidth:6,variant:l})}function Ar(n){const{hardware:t}=n;return e.jsx(Q,{hardware:t})}function We(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 bt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Q,{hardware:t}),a=o.header||"top";return a==="none"?e.jsx(We,{...n}):e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(We,{...n}),headerMode:a})}function ze(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 _t(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Q,{hardware:t}),a=o.header??"top";return a==="none"?e.jsx(ze,{...n}):e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(ze,{...n}),headerMode:a})}function X(n){const[t,o]=h.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 Er(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r,properties:a}=t,{rotation:c,flip:[l,f]}=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(X,{isActive:c===0,onAction:()=>r.setProperty("rotation",0),disabled:s,title:"Disable rotation transformation",children:"None"}),e.jsxs(X,{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(X,{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(X,{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(X,{isActive:l,onAction:()=>r.setProperty("flip",[!0,f]),disabled:s,title:"Enable horizontal flip transformation",children:["Horiz ",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),e.jsx(X,{isActive:!l,onAction:()=>r.setProperty("flip",[!1,f]),disabled:s,title:"Disable horizontal flip transformation",children:"No"})]})}),e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(X,{isActive:f,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(X,{isActive:!f,onAction:()=>r.setProperty("flip",[l,!1]),disabled:s,title:"Disable vertical flip transformation",children:"No"})]})})]})]})})]})}function kr(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(Er,{...n})]})}function Ct(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Q,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(kr,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const St="4.2em";function Pr(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:f,selectedMode:u,title:d}=l,m=f===u?"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",f)},title:d,children:[e.jsx("i",{className:m})," "," ",e.jsx(i.Badge,{style:{minWidth:St},children:f})]},f)}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 Br(n){const{hardware:t,options:o,disabled:s}=n,{properties:r={}}=t,{binning:a,binning_mode:c="SUM"}=r;function l(g){t.actions.setProperty("binning",[g,g])}const f=Qr(t),u=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]}`}),!u&&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:St},title:`Detector setup with binning ${c}`,children:c})}),!u&&f&&e.jsx(Pr,{...n})]})}function $t(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Q,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Br,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Gr(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 Ot(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Q,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Gr,{hardware:t})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Vr(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 Lr(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 Ur(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 It(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Q,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Ur,{hardware:t}),e.jsx(Vr,{hardware:t}),e.jsx(Lr,{hardware:t})]}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Hr(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],f=r[1]/c[1];function u(){return f>l?1/f:1/l}const d=u(),[p,m]=[100*l*d,100*f*d];function g(){const[C,I,F,k]=a;return[100*C/l,100*I/f,100*F/l,100*k/f]}function w(){const[C,I,F,k]=a;return[100*(C+F*.5)/l,100*(I+k*.5)/f]}const[x,j,y,S]=g(),[$,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 Mt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Q,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Hr,{...n})}),c=o.header??"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const D={};function qr(n){n.useHardware&&(D.useHardware&&console.warn("useHardware hook was already registered"),D.useHardware=n.useHardware),n.useHardwareChangeActions&&(D.useHardwareChangeActions&&console.warn("useHardwareChangeActions hook was already registered"),D.useHardwareChangeActions=n.useHardwareChangeActions),n.useHardwareSchema&&(D.useHardwareSchema&&console.warn("useHardwareSchema hook was already registered"),D.useHardwareSchema=n.useHardwareSchema),n.useOperator&&(D.useOperator&&console.warn("useOperator hook was already registered"),D.useOperator=n.useOperator),n.useScanRunning&&(D.useScanRunning&&console.warn("useScanRunning hook was already registered"),D.useScanRunning=n.useScanRunning)}function G(n){if(!D.useHardware)throw new Error("No `useHardware` hook registered");return D.useHardware(n)}function te(n){if(!D.useHardwareChangeActions)throw new Error("No `useHardwareChangeActions` hook registered");return D.useHardwareChangeActions(n)}function Wr(n){if(!D.useHardwareSchema)throw new Error("No `useHardwareSchema` hook registered");return D.useHardwareSchema(n)}function zr(){if(!D.useOperator)throw new Error("No `useOperator` hook registered");return D.useOperator()}function Kr(){if(!D.useScanRunning)throw new Error("No `useScanRunning` hook registered");return D.useScanRunning()}function me(n){return n.type==="lima"}function Tt(n){const t=G(n);return t===null||!me(t)?null:t}function Ft(n,t){const o=Math.ceil(n/t),s=n/o;return[o,s]}const Yr={default:bt,size:_t,transformation:Ct,binning:$t,imageroi:Ot,description:It,shape:Mt,state:Ar},Dt=Yr;function Qr(n){var t;return n.properties.binning_mode!==void 0&&ho.default.gte(((t=n.properties.static)==null?void 0:t.lima_version)??"0.0.0","1.10.4")}const Xr="lima_cam",Zr="lima_cam",Jr="bliss",ei="lima",ti=!0,ni=!1,oi={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"},si={id:Xr,name:Zr,protocol:Jr,type:ei,online:ti,require_staff:ni,properties:oi},ri="lima_cam",ii="lima_cam",ai="bliss",ci="lima",li=!0,di=!1,ui={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"},fi={id:ri,name:ii,protocol:ai,type:ci,online:li,require_staff:di,properties:ui},pi="lima_cam",mi="lima_cam",hi="bliss",gi="lima",xi=!0,wi=!1,ji={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"},yi={id:pi,name:mi,protocol:hi,type:gi,online:xi,require_staff:wi,properties:ji},vi="lima_cam",Ni="lima_cam",bi="bliss",_i="lima",Ci=!0,Si=!1,$i={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"},Oi={id:vi,name:Ni,protocol:bi,type:_i,online:Ci,require_staff:Si,properties:$i},Ii="lima_cam",Mi="lima_cam",Ti="bliss",Fi="lima",Di=!0,Ri=!1,Ai={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"},Ei={id:Ii,name:Mi,protocol:Ti,type:Fi,online:Di,require_staff:Ri,properties:Ai},ki={default:si,flip:fi,rot:yi,roicenter:Oi,squaredetector:Ei};function Pi(n){const{name:t,alias:o,useHardwareContext:s}=n,r=[1920,1920],a=[16e-6,16e-6],[c,l]=h.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 f(x,j){console.log("LimaSimulator: Unsupported call",x,j)}function u(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 g(x,j){return{...x,flip:[x.flip[0],j]}}async function w(x,j){if(x==="binning"){l(y=>u(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=>g(y,j));return}console.log("LimaSimulator: Unsupported setProperty",x,j)}return e.jsx(W,{name:t,alias:o,type:"lima",call:f,setProperty:w,properties:c,useHardwareContext:s})}function Bi(n,t){const{inputRef:o,referenceElementRef:s,onAddSelection:r,onRemoveSelection:a,...c}=n,l=h.useRef(),f=()=>{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)},u=()=>{r&&r(t.results).then(()=>{f()})},d=()=>{const p=t.text?[...t.selected].filter(m=>m.toLowerCase().indexOf(t.text.toLowerCase())!==-1):[...t.selected];a&&a(p).then(()=>{f()})};return e.jsxs(i.InputGroup,{children:[e.jsx(Y.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:u,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 Gi(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 Vi(n,t,o,s){const a=[...o.selected].filter(f=>f.toLowerCase().indexOf(o.text.toLowerCase())!==-1).sort().map(f=>e.jsx("a",{href:"#",className:"dropdown-item",onClick:()=>o.onRemove(f),children:e.jsx(Y.Highlighter,{search:o.text,children:f})},f)),l=[...o.results].sort().map((f,u)=>e.jsx(Y.MenuItem,{option:f,position:u,children:e.jsx(Y.Highlighter,{search:o.text,children:f})},f));return e.jsxs(Y.Menu,{...t,style:{...t.style,width:350},children:[s.pending&&e.jsx(Y.Menu.Header,{children:"Loading..."}),!s.pending&&e.jsxs(e.Fragment,{children:[e.jsx(Y.Menu.Header,{children:"Enabled"}),a,a.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items enabled"}),e.jsx(Y.Menu.Header,{children:"Available"}),l,l.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items available"})]})]})}function Li(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(f=>!t.properties.disabled.includes(f));function a(f){const u=f.filter(p=>!r.includes(p)),d=r.filter(p=>!f.includes(p));u.length>0&&u.forEach(p=>{t.actions.call("enable",p)}),d.length>0&&d.forEach(p=>{t.actions.call("disable",p)})}function c(f){const u=[];return f.forEach(d=>{const p=t.actions.call("enable",d);u.push(p)}),Promise.all(u)}function l(f){const u=[];return f.forEach(d=>{const p=t.actions.call("disable",d);u.push(p)}),Promise.all(u)}return e.jsx(Y.Typeahead,{disabled:o,id:`typeahead_mg_${t.name}`,multiple:!0,flip:!0,positionFixed:!0,renderInput:Bi,renderMenu:Gi({name:t.id})(Vi),onChange:a,inputProps:{onAddSelection:c,onRemoveSelection:l},selected:r,options:t.properties.available,selectHint:(f,u)=>u.key==="Enter"||f})}function Rt(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"})})})}),f=e.jsx(Li,{...n});return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:f,headerMode:a})}const Ui={default:Rt},At=Ui,Hi=[],qi="mg",Wi="mg",zi=!0,Ki={available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]},Yi="bliss",Qi=!1,Xi="measurementgroup",Zi={callables:Hi,id:qi,name:Wi,online:zi,properties:Ki,protocol:Yi,require_staff:Qi,type:Xi},Ji={default:Zi};function ea(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.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(g=>g!==d)}})}async function l(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.includes(d)?m:[...m,d]}})}async function f(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 u(d,p){console.log("MeasurementGroupSimulator: Unsupported setProperty",d,p)}return e.jsx(W,{name:t,alias:o,type:"measurementgroup",call:f,setProperty:u,properties:r,useHardwareContext:s})}const Fe={description:"Unknown state is exposed",variant:"fatal",priority:100},Ne={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:Fe};function he(n){const{hardware:t}=n,{locked:o=null}=t,{state:s=["UNKNOWN"]}=t.properties,[r,a]=h.useMemo(()=>{if(!t.online)return[["OFFLINE"],void 0];function c(p,m){const g=Ne[p]??Fe,w=Ne[m]??Fe;return g.priority-w.priority}const l=[...s,...o!==null?["LOCKED"]:[],...s.length===0?["NOT_READY"]:[]];l.sort(c);function f(p){const m=p.split(":",2);return m.length===1?[p,void 0]:m}const u={};return[l.map(p=>{if(p.startsWith("_")){const m=f(p);return m[1]!==void 0&&(u[m[0]]=m[1]),m[0]}return p==="LOCKED"?u[p]=`Locked by ${(o==null?void 0:o.reason)??" an object"}`:u[p]=Ne[p].description??"",p}),u]},[s,t.online,o]);return e.jsx(ot,{states:r,descriptions:a,minWidth:6,variants:Object.fromEntries(Object.entries(Ne).map(([c,l])=>[c,l.variant]))})}function ta(n){const{hardware:t}=n;return e.jsx(he,{hardware:t})}function fe(n){const t=h.useRef(null),[o,s]=h.useState(!1),[r,a]=h.useState(!1);function c(d){return n.precision!==void 0?Number.parseFloat(d).toFixed(n.precision):d}h.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 f(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 u(d){s(d.target.value!==n.hardwareValue.toString())}return e.jsx(i.Form.Control,{className:U.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:"number",ref:t,onChange:u,onKeyDown:f,disabled:n.readOnly||n.hardwareIsMoving||n.hardwareIsDisabled,step:n.step,onClick:d=>{d.stopPropagation()}})}function na(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(fe,{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(fe,{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 re(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=ge(s.state,r),f=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),u=e.jsx(he,{hardware:t}),d=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:f,widgetState:u,widgetContent:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(Ie,{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(na,{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 Ke(n){const{hardware:t,options:o={}}=n,s=ge(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:U.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 Et(n){const{hardware:t}=n,o=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),s=e.jsx(he,{hardware:t}),r=n.options?n.options.header:"top";return r==="none"?e.jsx(Ke,{...n}):e.jsx(_,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:e.jsx(Ke,{...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"},oa={up:0,right:-90,down:180,left:90};function kt(n){const{size:t,value:o=null,target:s=null,min:r=null,max:a=null,disabled:c=!1,readOnly:l=!1,origin:f="up",direction:u="clockwise",onChange:d=H=>{},onInteractiveChange:p=null,className:m}=n,[g,w]=h.useState(null);function x(){w(null)}function j(H){w(H),p&&p(H)}const y=8,S=5,$=12,b=t*.5,v=b-S-y,C=4,I=v-$-C/2,F=!c&&!l,k=5,O=g!==null?g:s;function z(H){return H.mouseRadius<v/3?{readOnly:!0}:H.ctrlKey?{steps:8}:b-y-S<=H.mouseRadius&&H.mouseRadius<=b+S?{steps:8}:{}}function J(){if(o===null||r===null||a===null)return null;const H=a-r;return H>=360?null:[(a-360)/360,(a-360+360-H)/360]}const K=J(),no=u==="clockwise"?360:-360,oo=oa[f]+(u==="clockwise"?0:360);return e.jsxs(E.Knob,{size:t,value:o,angleOffset:oo,angleRange:no,min:0,max:360,multiRotation:!0,onChange:d,onInteractiveChange:j,interactiveHook:z,onEnd:x,readOnly:!F,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:F?"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:g!==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:g!==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:g!==null?g:o,decimalPlace:1,marginBottom:t/2,className:"knob-text"})]})}function Pt(n){const{hardware:t,options:o={}}=n,s=lo.useDebouncedCallback(m=>{t.actions.call("move",m)},[t.actions],100),r=ge(t.properties.state,t.user_tags),a=r.MOVING?t.properties.target:void 0,c=Gt(t,o),l=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor-r",online:t.online}),f=Vt(t),u=e.jsx(he,{hardware:t}),d=e.jsx(kt,{className:"mx-auto my-auto",size:100,value:t.properties.position,min:f[0],max:f[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:u,widgetContent:d,headerMode:p})}function sa(n,t){return n?t.FAULT?"danger":t.MOVING?"transient":"secondary":"secondary"}function ra(n){const{hardware:t,options:o={}}=n,{online:s=!1,properties:r={}}=t,{state:a,position:c,unit:l=null,display_digits:f}=r,u=ge(a,[]),d=o.name??t.alias??t.name??t.id,p=sa(s,u);function m(){let w="";return c!==void 0&&(c===null?w="null":Number.isFinite(c)?w+=c.toFixed(f??2):w=`${c}`),l!==null&&l!==""&&(w=`${w} ${l}`),w}const g=m();return e.jsxs(oe,{children:[e.jsx("h1",{children:d}),e.jsx(i.Badge,{bg:p,children:g})]})}function ge(n,t=[]){return h.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 Bt(n){return n.type==="motor"}function L(n){const t=G(n);return t===null||!Bt(t)?null:t}const ia={default:re,text:Et,rotation:Pt,state:ta,monitor:ra};function Gt(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 Vt(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 Lt=ia,aa=["move","stop","wait","rmove"],ca="omega",la="omega 123",da=!0,ua={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},fa="bliss",pa=!1,ma="motor",ha=[],ga={callables:aa,id:ca,name:la,online:da,properties:ua,protocol:fa,require_staff:pa,type:ma,user_tags:ha},xa=["move","stop","wait","rmove"],wa="omega",ja="omega 123",ya=!0,va={offset:0,sign:1,acceleration:300,limits:[-10,190],position:100,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3},Na="bliss",ba=!1,_a="motor",Ca=[],Sa={callables:xa,id:wa,name:ja,online:ya,properties:va,protocol:Na,require_staff:ba,type:_a,user_tags:Ca},$a=["move","wait","stop","rmove"],Oa="omega",Ia="omega 123",Ma=!0,Ta={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["UNKNOWN"],target:null,tolerance:1e-4,unit:"deg",velocity:null},Fa="bliss",Da=!1,Ra="motor",Aa=[],Ea={callables:$a,id:Oa,name:Ia,online:Ma,properties:Ta,protocol:Fa,require_staff:Da,type:Ra,user_tags:Aa},ka=["move","wait","stop","rmove"],Pa="omega",Ba="omega 123",Ga=!0,Va={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:[],target:null,tolerance:1e-4,unit:"deg",velocity:null},La="bliss",Ua=!1,Ha="motor",qa=[],Wa={callables:ka,id:Pa,name:Ba,online:Ga,properties:Va,protocol:La,require_staff:Ua,type:Ha,user_tags:qa},za=["move","wait","stop","rmove"],Ka="omega",Ya="omega 123",Qa=!1,Xa={},Za="bliss",Ja=!1,ec="motor",tc=[],nc={callables:za,id:Ka,name:Ya,online:Qa,properties:Xa,protocol:Za,require_staff:Ja,type:ec,user_tags:tc},oc=["move","wait","stop","rmove"],sc="omega",rc="omega 123",ic=!0,ac={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["OFF"],target:null,tolerance:1e-4,unit:"deg",velocity:null},cc="bliss",lc=!1,dc="motor",uc=[],fc={callables:oc,id:sc,name:rc,online:ic,properties:ac,protocol:cc,require_staff:lc,type:dc,user_tags:uc},pc={default:ga,halfMotor:Sa,unknownMotor:Ea,notReadyMotor:Wa,disconnectedMotor:nc,powerOffMotor:fc};function mc(n,t){return{id:n,name:n,type:"motor",properties:{position:t,unit:"mm",limits:[-100,100]},online:!0}}function hc(n){const{name:t="omega",minLimit:o=-999999999,maxLimit:s=999999999,initialPosition:r=0,initialVelocity:a=1e3,useHardwareContext:c=()=>null}=n,[l,f]=h.useState(r),[u,d]=h.useState(["READY"]),[p,m]=h.useState(null),g=h.useRef(Date.now()),w=c(),x=()=>{const v=Date.now(),C=(v-g.current)/1e3;let I;if(g.current=v,p!==null&&p!==l){let F,k;const O=C*a;if(O>Math.abs(l-p))I=p,F=["READY"],k=null;else{const z=p>l?1:-1;I=l+z*O,F=["MOVING"],k=p}f(I),d(F),m(k)}},j=h.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=h.useCallback((v,C)=>(console.log("MotorSimulator: Unsupported setProperty",v,C),Promise.resolve()),[]);h.useEffect(()=>{const v=setInterval(()=>{x()},500);return()=>clearInterval(v)});const S=h.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:u,tolerance:1e-4,unit:"mm",velocity:a,target:p,display_digits:3},type:"motor",actions:S,user_tags:[],locked:null},b=h.useRef(null);return h.useEffect(()=>{b.current!==null&&P.isEqual(b.current,$)||(b.current=$,w==null||w.actions.updateHardware(t,$))},[t,$]),e.jsx(e.Fragment,{})}function ke(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 Ut(n){const{hardware:t,options:o={}}=n,s=h.useRef(null);h.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(ke,{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 Ht=h.forwardRef(({title:n,children:t,bsPrefix:o,rootCloseEvent:s,variant:r,size:a,menuRole:c,renderMenuOnMount:l,disabled:f,href:u,id:d,menuVariant:p,flip:m,style:g,className:w,popperConfig:x,...j},y)=>e.jsxs(i.Dropdown,{ref:y,...j,children:[e.jsx(i.DropdownToggle,{id:d,href:u,size:a,variant:r,disabled:f,childBsPrefix:o,style:g,className:w,children:n}),e.jsx(i.DropdownMenu,{popperConfig:x,role:c,renderOnMount:l,rootCloseEvent:s,variant:p,flip:m,children:t})]}));Ht.displayName="DropdownButton2";const gc=Ht;function xc(n){const{currentPositionId:t,position:o,disabled:s,onSelect:r,filter:a}=n,c=o.position,l=c===t,f=l?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return h.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:"1",children:e.jsx("i",{className:f})}),e.jsx(i.Col,{sm:"2",children:e.jsx(i.Badge,{className:"small w-100",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:"1"}),e.jsx(i.Col,{sm:"11",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 wc(n,t){if(n===null)return null;for(const o of t)if(n===o.position)return o;return null}function jc(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(),f=h.useMemo(()=>{if(o)return"Moving...";const u=wc(t,a);return u===null?"Position not described":u.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:f,style:{flex:"1 1 0",minWidth:0},children:f})]})}function qt(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 f(S){t.actions.call("stop")}const u=e.jsx(N,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),d=e.jsx(ke,{hardware:t}),p=a?"moving":null;function m(){var $;const S=(($=t.properties)==null?void 0:$.position)??null;return S==="unknown"?null:S}const g=m(),[w,x]=h.useState("");function j(){return e.jsxs(i.InputGroup,{className:"flex-nowrap",style:{alignItems:"stretch"},children:[e.jsxs(gc,{variant:"secondary",title:e.jsx(jc,{positionId:g,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(xc,{currentPositionId:g,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:f,children:e.jsx("i",{className:"fa fa-fw fa-times"})})]})}const y=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:u,widgetState:d,widgetContent:j(),headerMode:y})}const yc={state:ke,default:Ut,default2:qt},Wt=yc,vc=["move","stop"],Nc="beamstop",bc="beamstop",_c=!0,Cc={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"},Sc="bliss",$c=!1,Oc="multiposition",Ic={callables:vc,id:Nc,name:bc,online:_c,properties:Cc,protocol:Sc,require_staff:$c,type:Oc},Mc={default:Ic};function Tc(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("empty"),[c,l]=h.useState("READY");async function f(p,m){if(p==="move"){l("MOVING"),a("unknown"),await V(2e3),l("READY"),a(m);return}if(p==="stop"){a("unknown"),await V(2e3);return}console.log("MultipositionSimulator: Unsupported call",p,m)}async function u(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(W,{name:t,alias:o,type:"multiposition",call:f,setProperty:u,properties:d,useHardwareContext:s})}function Pe(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(M,{state:o,minWidth:6,variant:r})}function Fc(n){const{hardware:t}=n;return e.jsx(Pe,{hardware:t})}function Dc(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,u=[...s.available_magnifications??[]];u.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 g(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:U.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:u.map((w,x)=>g(x,w))})]})]})}function Rc(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(zt,{...n})]})})]})]})}function zt(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,f]=t.properties.magnification_range||[null,null],u=h.useRef(null),d=h.useRef(null),[p,m]=h.useState(!1),g=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(!u||!u.current){console.log("formRef not yet defined");return}if(b.key==="Enter"){m(!1);const{value:v}=u.current,C=Number.parseFloat(v);if(l!==null&&C<l||f!==null&&C>f)return;w(C)}else b.key==="Escape"?(u.current.value=s.toFixed(g),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(!u||!u.current){console.error("formRef is not set");return}const v=Number.parseFloat(u.current.value);j(v),d.current&&(d.current.value=v.toString())}function S(b){if(!u||!u.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),u.current.value=v.toFixed(g)}function $(){if(!d||!d.current){console.error("rangeRef is not set");return}const b=Number.parseFloat(d.current.value);w(b)}return h.useEffect(()=>{if(!u||!u.current){console.error("formRef is not set");return}p||(u.current.value=s.toFixed(g)),d.current&&(d.current.value=s.toString())},[g,p,s]),e.jsxs(e.Fragment,{children:[e.jsx(i.Form.Control,{className:p?"form-control-edited":"",type:"number",ref:u,defaultValue:s.toFixed(g),onChange:y,disabled:c,step:10**-g,onKeyDown:x}),l!==null&&f!==null&&e.jsx(i.Form.Control,{ref:d,disabled:c,type:"range",min:l,max:f,step:10**-g,onChange:S,onMouseUp:$,defaultValue:s})]})}function Ac(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:U.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(zt,{...n,mode:"move"})]})})]})]})}function Ec(n){return e.jsx(i.Form.Control,{className:"border-light",type:"text",disabled:!0,defaultValue:"Missing"})}function Kt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fam-hardware-optic",online:t.online}),r=e.jsx(Pe,{hardware:t});function a(){function l(){return t.online?t.properties.available_magnifications?Dc:t.properties.magnification_range?Ac:Rc:Ec}const f=l();return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{className:"border-light",children:"×"}),e.jsx(f,{...n})]})}const c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function kc(n){return n.type==="optic"}const Pc={default:Kt,state:Fc},Yt=Pc,Bc=["magnification","reset","open"],Gc="optic",Vc="optic",Lc=!0,Uc={state:"READY",magnification:10,target_magnification:null,available_magnifications:[5,7.5,10],magnification_range:null},Hc="bliss",qc=!1,Wc="optic",be={callables:Bc,id:Gc,name:Vc,online:Lc,properties:Uc,protocol:Hc,require_staff:qc,type:Wc},zc={default:be,fixed:be,off:be,range:be};function Kc(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]=h.useState({state:"READY",magnification:10,target_magnification:null,...a()});async function f(p){let m=c.magnification;l(x=>({...x,state:"MOVING",target_magnification:p})),await V(100);const g=.2*(m<p?1:-1);function w(x){l(j=>({...j,magnification:x}))}for(;Math.abs(p-m)>=Math.abs(g)*1.01;)m+=g,w(m),await V(100);l(x=>({...x,state:"READY",magnification:p,target_magnification:null}))}async function u(p,m){if(p==="move"){await f(m);return}console.log("OpticSimulator: Unsupported call",p,m)}async function d(p,m){if(p==="magnification"){l(g=>({...g,magnifications:m}));return}console.log("OpticSimulator: Unsupported setProperty",p,m)}return e.jsx(W,{name:t,alias:o,type:"optic",call:u,setProperty:d,properties:c,useHardwareContext:r})}function xe(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(M,{state:o,minWidth:6,variant:r})}function Yc(n){const{hardware:t}=n;return e.jsx(xe,{hardware:t})}function Qc(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(u){o.foreground?t.actions.call("run_foreground"):t.actions.call("start")}function f(u){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:f,disabled:s||!c,variant:"primary",children:"Abort"})]})}function De(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(xe,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(Qc,{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 Xc(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(Zc,{hardware:t})}function Zc(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 Qt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(xe,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx("div",{children:e.jsx("h3",{children:e.jsx(Xc,{hardware:t})})})}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Jc(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 Xt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(xe,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(Jc,{hardware:t,disabled:!n.operator})}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const el={default:De,manage:De,execution:Qt,validate:Xt,state:Yc},Zt=el;function Jt(n){return n.type==="procedure"}function tl(n){const t=G(n);return t===null||!Jt(t)?null:t}const nl=["start","abort","clear","validate"],ol="procedure",sl="procedure",rl="procedure",il="bliss",al=!1,cl=!0,ll={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"}}},dl={callables:nl,type:ol,id:sl,name:rl,protocol:il,require_staff:al,online:cl,properties:ll},ul={standby:dl};function we(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(M,{state:s,minWidth:6,variant:r()})}function fl(n){const{hardware:t}=n;return e.jsx(we,{hardware:t,useReadyState:!0})}function pl(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 en(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(we,{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(),[f,u]=c(l),p={OPEN:"danger",CLOSED:"success",MOVING:"transient",DISABLED:"secondary",STANDBY:"danger",FAULT:"fatal",UNKNOWN:"warning"}[l]||"danger";function m(){t.actions.call(u)}const g=e.jsxs(i.ButtonGroup,{className:"d-flex flex-nowrap",children:[e.jsx(i.Button,{variant:p,onClick:m,disabled:n.disabled||u==="",children:f}),o.extended&&e.jsx(pl,{...n})]}),w=n.options.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:g,headerMode:w})}function ml(n){var f;const{hardware:t,options:o={}}=n;function s(){t.actions.call("open")}function r(){t.actions.call("close")}const a=((f=t.properties)==null?void 0:f.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 tn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(we,{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 f=a(),u=c(f),p={OPEN:"success",CLOSED:"danger",MOVING:"transient",DISABLED:"secondary",STANDBY:"success",FAULT:"fatal",UNKNOWN:"fatal"}[f],m=l(u),g=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(ml,{...n})]}),w=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:g,headerMode:w})}function hl(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(oe,{children:[e.jsx("h1",{children:c}),e.jsx(we,{hardware:t})]});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(`
|
|
30
|
-
`)?e.jsx("pre",{children:f}):f}),children:l})}return l}const
|
|
31
|
-
`,valid:!0},
|
|
32
|
-
`,valid:!0},
|
|
29
|
+
`},ar="tango",cr=!0,lr="gauge",dr={callables:nr,id:or,name:sr,online:rr,properties:ir,protocol:ar,require_staff:cr,type:lr},ur={default:tr,default2:dr},fr=h.forwardRef((n,t)=>{const o=h.useRef(null),s=h.useRef(),[r,a]=h.useState(n.step),[c,l]=h.useState(!1),f=O=>{const K=t;if(o.current===null)return;let te=Number.parseFloat(K.current.value);if(o.current.value.startsWith("*")){const Y=Number.parseFloat(o.current.value.replace("*",""));te=O?te*Y:te/Y}else{const Y=Number.parseFloat(o.current.value);te+=O?Y:-Y}K.current.value=`${te}`,n.onStep&&n.onStep({target:K.current})},{onStep:u,step:d,overlay:p,incIcon:m,decIcon:g,swapIncDec:j,onKeyDown:x,onBlur:w,horizontalArrows:y,largeArrows:_,disabled:$,stepOnly:b,...v}=n,C=O=>{O.key==="ArrowUp"?(O.preventDefault(),l(!0),f(!0)):O.key==="ArrowDown"?(O.preventDefault(),l(!0),f(!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)),h.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const I=()=>{s.current&&clearTimeout(s.current),l(!1),w&&w()};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||g;return e.jsx("div",{className:H.default("numeric-step",{"numeric-step-large":_,"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&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{className:"step step-up",disabled:n.disabled,onClick:O=>f(!0)}),e.jsx(i.Button,{className:"step step-down",disabled:n.disabled,onClick:O=>f(!1)})]})]}),g&&j&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>f(!1),children:e.jsx("i",{className:`fa fa-fw fa-${g}`})}),m&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>f(!0),children:e.jsx("i",{className:`fa fa-fw fa-${m}`})}),g&&!j&&e.jsx(i.Button,{disabled:n.disabled,onClick:O=>f(!1),children:e.jsx("i",{className:`fa fa-fw fa-${g}`})})]})]})})}),St=fr;function he(n){const t=h.useRef(null),[o,s]=h.useState(!1),[r,a]=h.useState(!1);h.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 f(p){n.hardwareValue!==null&&s(p.target.value!==n.hardwareValue.toString())}function u(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),g=n.onMoveRequested(m);g&&g.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(St,{id:n.id,className:H.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:n.readOnly?"text":"number",ref:t,precision:n.precision,onChange:f,onBlur:l,onStep:u,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 Ct(n){const{hardware:t,options:o={},disabled:s}=n;function r(u){return t.actions.setProperty("power",u)}function a(u){return t.actions.call(u?"on":"off")}const c=t.properties.state,l=e.jsx(N,{name:"Laser",icon:"fam-hardware-laser",online:t.online}),f=e.jsx(T,{state:c,minWidth:6,variant:c==="ON"?"success":"warning"});return e.jsx(S,{hardware:t,widgetIcon:l,widgetState:f,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(he,{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 pr={default:Ct},$t=pr,mr=[],hr="yag1",gr="yag1",xr=!0,wr={power:5,state:"ON"},jr="bliss",yr=!1,vr="laser",Nr={callables:mr,id:hr,name:gr,online:xr,properties:wr,protocol:jr,require_staff:yr,type:vr},br={default:Nr};function _r(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 Ot(n){const{hardware:t,options:o={},disabled:s}=n,[r,a]=h.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 f=t.properties.state,u=e.jsx(N,{name:"Laser Heating",icon:"fa-fire",online:t.online}),d=e.jsx(T,{state:f,minWidth:6,variant:f==="READY"?"success":"warning"});return e.jsx(S,{hardware:t,widgetIcon:u,widgetState:d,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(he,{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(_r,{hardware:t,disabled:n.disabled})]})})}const Sr={default:Ot},It=Sr,Cr=[],$r="laserheating",Or="laserheating",Ir=!0,Mr={exposure_time:.5,state:"ON",background_mode:"READY",fit_wavelength:[500,650],current_calibration:"/path/to/file"},Tr="bliss",Fr=!1,Dr="laserheating",Rr={callables:Cr,id:$r,name:Or,online:Ir,properties:Mr,protocol:Tr,require_staff:Fr,type:Dr},Ar={default:Rr};function Mt(n){const t=h.useRef(null),{hardware:o,options:s={}}=n;function r(c){o.actions.setProperty("intensity",c)}const a=h.useCallback(Co.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 Er={default:Mt},Tt=Er,kr=[],Pr="light_vlm",Br="light_vlm",Gr=!0,Vr={intensity:0,state:"ON",temperature:23.2},Lr="bliss",Ur=!1,Hr="light",qr={callables:kr,id:Pr,name:Br,online:Gr,properties:Vr,protocol:Lr,require_staff:Ur,type:Hr},Wr={default:qr};function X(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(T,{state:a,minWidth:6,variant:l})}function zr(n){const{hardware:t}=n;return e.jsx(X,{hardware:t})}function Qe(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 Ft(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(X,{hardware:t}),a=o.header||"top";return a==="none"?e.jsx(Qe,{...n}):e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(Qe,{...n}),headerMode:a})}function Xe(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 Dt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(X,{hardware:t}),a=o.header??"top";return a==="none"?e.jsx(Xe,{...n}):e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(Xe,{...n}),headerMode:a})}function Z(n){const[t,o]=h.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 Kr(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r,properties:a}=t,{rotation:c,flip:[l,f]}=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(Z,{isActive:c===0,onAction:()=>r.setProperty("rotation",0),disabled:s,title:"Disable rotation transformation",children:"None"}),e.jsxs(Z,{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(Z,{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(Z,{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(Z,{isActive:l,onAction:()=>r.setProperty("flip",[!0,f]),disabled:s,title:"Enable horizontal flip transformation",children:["Horiz ",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),e.jsx(Z,{isActive:!l,onAction:()=>r.setProperty("flip",[!1,f]),disabled:s,title:"Disable horizontal flip transformation",children:"No"})]})}),e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(Z,{isActive:f,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(Z,{isActive:!f,onAction:()=>r.setProperty("flip",[l,!1]),disabled:s,title:"Disable vertical flip transformation",children:"No"})]})})]})]})})]})}function Yr(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(Kr,{...n})]})}function Rt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(X,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Yr,{...n})}),c=o.header??"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const At="4.2em";function Qr(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:f,selectedMode:u,title:d}=l,m=f===u?"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",f)},title:d,children:[e.jsx("i",{className:m})," "," ",e.jsx(i.Badge,{style:{minWidth:At},children:f})]},f)}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 Xr(n){const{hardware:t,options:o,disabled:s}=n,{properties:r={}}=t,{binning:a,binning_mode:c="SUM"}=r;function l(g){t.actions.setProperty("binning",[g,g])}const f=ci(t),u=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]}`}),!u&&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:At},title:`Detector setup with binning ${c}`,children:c})}),!u&&f&&e.jsx(Qr,{...n})]})}function Et(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(X,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Xr,{...n})}),c=o.header??"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Zr(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 kt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(X,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(Zr,{hardware:t})}),c=o.header??"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Jr(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 ei(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 ti(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 Pt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(X,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(ti,{hardware:t}),e.jsx(Jr,{hardware:t}),e.jsx(ei,{hardware:t})]}),c=o.header??"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function ni(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],f=r[1]/c[1];function u(){return f>l?1/f:1/l}const d=u(),[p,m]=[100*l*d,100*f*d];function g(){const[C,I,M,k]=a;return[100*C/l,100*I/f,100*M/l,100*k/f]}function j(){const[C,I,M,k]=a;return[100*(C+M*.5)/l,100*(I+k*.5)/f]}const[x,w,y,_]=g(),[$,b]=j();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:`${w}%`,width:`${y}%`,height:`${_}%`}}),e.jsxs("span",{className:"position-absolute",style:{left:`${$}%`,top:`${b}%`,transform:"translate(-50%, -50%)"},children:[a[2],"×",a[3]]})]})})}function Bt(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(X,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(ni,{...n})}),c=o.header??"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const D={};function oi(n){n.useHardware&&(D.useHardware&&console.warn("useHardware hook was already registered"),D.useHardware=n.useHardware),n.useHardwareChangeActions&&(D.useHardwareChangeActions&&console.warn("useHardwareChangeActions hook was already registered"),D.useHardwareChangeActions=n.useHardwareChangeActions),n.useHardwareSchema&&(D.useHardwareSchema&&console.warn("useHardwareSchema hook was already registered"),D.useHardwareSchema=n.useHardwareSchema),n.useOperator&&(D.useOperator&&console.warn("useOperator hook was already registered"),D.useOperator=n.useOperator),n.useScanRunning&&(D.useScanRunning&&console.warn("useScanRunning hook was already registered"),D.useScanRunning=n.useScanRunning)}function G(n){if(!D.useHardware)throw new Error("No `useHardware` hook registered");return D.useHardware(n)}function oe(n){if(!D.useHardwareChangeActions)throw new Error("No `useHardwareChangeActions` hook registered");return D.useHardwareChangeActions(n)}function si(n){if(!D.useHardwareSchema)throw new Error("No `useHardwareSchema` hook registered");return D.useHardwareSchema(n)}function ri(){if(!D.useOperator)throw new Error("No `useOperator` hook registered");return D.useOperator()}function ii(){if(!D.useScanRunning)throw new Error("No `useScanRunning` hook registered");return D.useScanRunning()}function ge(n){return n.type==="lima"}function Gt(n){const t=G(n);return t===null||!ge(t)?null:t}function Vt(n,t){const o=Math.ceil(n/t),s=n/o;return[o,s]}const ai={default:Ft,size:Dt,transformation:Rt,binning:Et,imageroi:kt,description:Pt,shape:Bt,state:zr},Lt=ai;function ci(n){var t;return n.properties.binning_mode!==void 0&&$o.default.gte(((t=n.properties.static)==null?void 0:t.lima_version)??"0.0.0","1.10.4")}const li="lima_cam",di="lima_cam",ui="bliss",fi="lima",pi=!0,mi=!1,hi={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"},gi={id:li,name:di,protocol:ui,type:fi,online:pi,require_staff:mi,properties:hi},xi="lima_cam",wi="lima_cam",ji="bliss",yi="lima",vi=!0,Ni=!1,bi={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"},_i={id:xi,name:wi,protocol:ji,type:yi,online:vi,require_staff:Ni,properties:bi},Si="lima_cam",Ci="lima_cam",$i="bliss",Oi="lima",Ii=!0,Mi=!1,Ti={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"},Fi={id:Si,name:Ci,protocol:$i,type:Oi,online:Ii,require_staff:Mi,properties:Ti},Di="lima_cam",Ri="lima_cam",Ai="bliss",Ei="lima",ki=!0,Pi=!1,Bi={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"},Gi={id:Di,name:Ri,protocol:Ai,type:Ei,online:ki,require_staff:Pi,properties:Bi},Vi="lima_cam",Li="lima_cam",Ui="bliss",Hi="lima",qi=!0,Wi=!1,zi={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"},Ki={id:Vi,name:Li,protocol:Ui,type:Hi,online:qi,require_staff:Wi,properties:zi},Yi={default:gi,flip:_i,rot:Fi,roicenter:Gi,squaredetector:Ki};function Qi(n){const{name:t,alias:o,useHardwareContext:s}=n,r=[1920,1920],a=[16e-6,16e-6],[c,l]=h.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 f(x,w){console.log("LimaSimulator: Unsupported call",x,w)}function u(x,w){const y=[Math.round(a[0]*w[0]),Math.round(a[1]*w[1])],_=[Math.round(r[0]/w[0]),Math.round(r[1]/w[1])];return{...x,binning:w,pixel_size:y,roi:[0,0,..._],size:_}}function d(x,w){return{...x,binning_mode:w}}function p(x,w){return{...x,rotation:w}}function m(x,w){return{...x,flip:[w,x.flip[1]]}}function g(x,w){return{...x,flip:[x.flip[0],w]}}async function j(x,w){if(x==="binning"){l(y=>u(y,w));return}if(x==="binning_mode"){l(y=>d(y,w));return}if(x==="rotation"){l(y=>p(y,w));return}if(x==="flip_x"){l(y=>m(y,w));return}if(x==="flip_y"){l(y=>g(y,w));return}console.log("LimaSimulator: Unsupported setProperty",x,w)}return e.jsx(q,{name:t,alias:o,type:"lima",call:f,setProperty:j,properties:c,useHardwareContext:s})}function Xi(n,t){const{inputRef:o,referenceElementRef:s,onAddSelection:r,onRemoveSelection:a,...c}=n,l=h.useRef(),f=()=>{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)},u=()=>{r&&r(t.results).then(()=>{f()})},d=()=>{const p=t.text?[...t.selected].filter(m=>m.toLowerCase().indexOf(t.text.toLowerCase())!==-1):[...t.selected];a&&a(p).then(()=>{f()})};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:u,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 Zi(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 Ji(n,t,o,s){const a=[...o.selected].filter(f=>f.toLowerCase().indexOf(o.text.toLowerCase())!==-1).sort().map(f=>e.jsx("a",{href:"#",className:"dropdown-item",onClick:()=>o.onRemove(f),children:e.jsx(Q.Highlighter,{search:o.text,children:f})},f)),l=[...o.results].sort().map((f,u)=>e.jsx(Q.MenuItem,{option:f,position:u,children:e.jsx(Q.Highlighter,{search:o.text,children:f})},f));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 ea(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(f=>!t.properties.disabled.includes(f));function a(f){const u=f.filter(p=>!r.includes(p)),d=r.filter(p=>!f.includes(p));u.length>0&&u.forEach(p=>{t.actions.call("enable",p)}),d.length>0&&d.forEach(p=>{t.actions.call("disable",p)})}function c(f){const u=[];return f.forEach(d=>{const p=t.actions.call("enable",d);u.push(p)}),Promise.all(u)}function l(f){const u=[];return f.forEach(d=>{const p=t.actions.call("disable",d);u.push(p)}),Promise.all(u)}return e.jsx(Q.Typeahead,{disabled:o,id:`typeahead_mg_${t.name}`,multiple:!0,flip:!0,positionFixed:!0,renderInput:Xi,renderMenu:Zi({name:t.id})(Ji),onChange:a,inputProps:{onAddSelection:c,onRemoveSelection:l},selected:r,options:t.properties.available,selectHint:(f,u)=>u.key==="Enter"||f})}function Ut(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"})})})}),f=e.jsx(ea,{...n});return e.jsx(S,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:f,headerMode:a})}const ta={default:Ut},Ht=ta,na=[],oa="mg",sa="mg",ra=!0,ia={available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]},aa="bliss",ca=!1,la="measurementgroup",da={callables:na,id:oa,name:sa,online:ra,properties:ia,protocol:aa,require_staff:ca,type:la},ua={default:da};function fa(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.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(g=>g!==d)}})}async function l(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.includes(d)?m:[...m,d]}})}async function f(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 u(d,p){console.log("MeasurementGroupSimulator: Unsupported setProperty",d,p)}return e.jsx(q,{name:t,alias:o,type:"measurementgroup",call:f,setProperty:u,properties:r,useHardwareContext:s})}const Ae={description:"Unknown state is exposed",variant:"fatal",priority:100},_e={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:Ae};function xe(n){const{hardware:t}=n,{locked:o=null}=t,{state:s=["UNKNOWN"]}=t.properties,[r,a]=h.useMemo(()=>{if(!t.online)return[["OFFLINE"],void 0];function c(p,m){const g=_e[p]??Ae,j=_e[m]??Ae;return g.priority-j.priority}const l=[...s,...o!==null?["LOCKED"]:[],...s.length===0?["NOT_READY"]:[]];l.sort(c);function f(p){const m=p.split(":",2);return m.length===1?[p,void 0]:m}const u={};return[l.map(p=>{if(p.startsWith("_")){const m=f(p);return m[1]!==void 0&&(u[m[0]]=m[1]),m[0]}return p==="LOCKED"?u[p]=`Locked by ${(o==null?void 0:o.reason)??" an object"}`:u[p]=_e[p].description??"",p}),u]},[s,t.online,o]);return e.jsx(ft,{states:r,descriptions:a,minWidth:6,variants:Object.fromEntries(Object.entries(_e).map(([c,l])=>[c,l.variant]))})}function pa(n){const{hardware:t}=n;return e.jsx(xe,{hardware:t})}function pe(n){const t=h.useRef(null),[o,s]=h.useState(!1),[r,a]=h.useState(!1);function c(d){return n.precision!==void 0?Number.parseFloat(d).toFixed(n.precision):d}h.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 f(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 u(d){s(d.target.value!==n.hardwareValue.toString())}return e.jsx(i.Form.Control,{className:H.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:"number",ref:t,onChange:u,onKeyDown:f,disabled:n.readOnly||n.hardwareIsMoving||n.hardwareIsDisabled,step:n.step,onClick:d=>{d.stopPropagation()}})}function ma(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(pe,{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(pe,{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 ie(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=we(s.state,r),f=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),u=e.jsx(xe,{hardware:t}),d=n.options?n.options.header:"top";return e.jsx(S,{hardware:t,widgetIcon:f,widgetState:u,widgetContent:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(he,{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(ma,{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 Ze(n){const{hardware:t,options:o={}}=n,s=we(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:H.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 qt(n){const{hardware:t}=n,o=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),s=e.jsx(xe,{hardware:t}),r=n.options?n.options.header:"top";return r==="none"?e.jsx(Ze,{...n}):e.jsx(S,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:e.jsx(Ze,{...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"},ha={up:0,right:-90,down:180,left:90};function Wt(n){const{size:t,value:o=null,target:s=null,min:r=null,max:a=null,disabled:c=!1,readOnly:l=!1,origin:f="up",direction:u="clockwise",onChange:d=W=>{},onInteractiveChange:p=null,className:m}=n,[g,j]=h.useState(null);function x(){j(null)}function w(W){j(W),p&&p(W)}const y=8,_=5,$=12,b=t*.5,v=b-_-y,C=4,I=v-$-C/2,M=!c&&!l,k=5,O=g!==null?g:s;function K(W){return W.mouseRadius<v/3?{readOnly:!0}:W.ctrlKey?{steps:8}:b-y-_<=W.mouseRadius&&W.mouseRadius<=b+_?{steps:8}:{}}function te(){if(o===null||r===null||a===null)return null;const W=a-r;return W>=360?null:[(a-360)/360,(a-360+360-W)/360]}const Y=te(),ho=u==="clockwise"?360:-360,go=ha[f]+(u==="clockwise"?0:360);return e.jsxs(E.Knob,{size:t,value:o,angleOffset:go,angleRange:ho,min:0,max:360,multiRotation:!0,onChange:d,onInteractiveChange:w,interactiveHook:K,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)"}),Y&&e.jsx(E.Range,{percentageFrom:Y[0],percentageTo:Y[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:g!==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:g!==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:g!==null?g:o,decimalPlace:1,marginBottom:t/2,className:"knob-text"})]})}function zt(n){const{hardware:t,options:o={}}=n,s=No.useDebouncedCallback(m=>{t.actions.call("move",m)},[t.actions],100),r=we(t.properties.state,t.user_tags),a=r.MOVING?t.properties.target:void 0,c=Yt(t,o),l=e.jsx(N,{name:"Motor",icon:"fam-hardware-motor-r",online:t.online}),f=Qt(t),u=e.jsx(xe,{hardware:t}),d=e.jsx(Wt,{className:"mx-auto my-auto",size:100,value:t.properties.position,min:f[0],max:f[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(S,{hardware:t,widgetIcon:l,widgetState:u,widgetContent:d,headerMode:p})}function ga(n,t){return n?t.FAULT?"danger":t.MOVING?"transient":"secondary":"secondary"}function xa(n){const{hardware:t,options:o={}}=n,{online:s=!1,properties:r={}}=t,{state:a,position:c,unit:l=null,display_digits:f}=r,u=we(a,[]),d=o.name??t.alias??t.name??t.id,p=ga(s,u);function m(){let j="";return c!==void 0&&(c===null?j="null":Number.isFinite(c)?j+=c.toFixed(f??2):j=`${c}`),l!==null&&l!==""&&(j=`${j} ${l}`),j}const g=m();return e.jsxs(ee,{children:[e.jsx("h1",{children:d}),e.jsx(i.Badge,{bg:p,children:g})]})}function we(n,t=[]){return h.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 Kt(n){return n.type==="motor"}function U(n){const t=G(n);return t===null||!Kt(t)?null:t}const wa={default:ie,text:qt,rotation:zt,state:pa,monitor:xa};function Yt(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 Qt(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 Xt=wa,ja=["move","stop","wait","rmove"],ya="omega",va="omega 123",Na=!0,ba={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},_a="bliss",Sa=!1,Ca="motor",$a=[],Oa={callables:ja,id:ya,name:va,online:Na,properties:ba,protocol:_a,require_staff:Sa,type:Ca,user_tags:$a},Ia=["move","stop","wait","rmove"],Ma="omega",Ta="omega 123",Fa=!0,Da={offset:0,sign:1,acceleration:300,limits:[-10,190],position:100,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3},Ra="bliss",Aa=!1,Ea="motor",ka=[],Pa={callables:Ia,id:Ma,name:Ta,online:Fa,properties:Da,protocol:Ra,require_staff:Aa,type:Ea,user_tags:ka},Ba=["move","wait","stop","rmove"],Ga="omega",Va="omega 123",La=!0,Ua={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["UNKNOWN"],target:null,tolerance:1e-4,unit:"deg",velocity:null},Ha="bliss",qa=!1,Wa="motor",za=[],Ka={callables:Ba,id:Ga,name:Va,online:La,properties:Ua,protocol:Ha,require_staff:qa,type:Wa,user_tags:za},Ya=["move","wait","stop","rmove"],Qa="omega",Xa="omega 123",Za=!0,Ja={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:[],target:null,tolerance:1e-4,unit:"deg",velocity:null},ec="bliss",tc=!1,nc="motor",oc=[],sc={callables:Ya,id:Qa,name:Xa,online:Za,properties:Ja,protocol:ec,require_staff:tc,type:nc,user_tags:oc},rc=["move","wait","stop","rmove"],ic="omega",ac="omega 123",cc=!1,lc={},dc="bliss",uc=!1,fc="motor",pc=[],mc={callables:rc,id:ic,name:ac,online:cc,properties:lc,protocol:dc,require_staff:uc,type:fc,user_tags:pc},hc=["move","wait","stop","rmove"],gc="omega",xc="omega 123",wc=!0,jc={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["OFF"],target:null,tolerance:1e-4,unit:"deg",velocity:null},yc="bliss",vc=!1,Nc="motor",bc=[],_c={callables:hc,id:gc,name:xc,online:wc,properties:jc,protocol:yc,require_staff:vc,type:Nc,user_tags:bc},Sc={default:Oa,halfMotor:Pa,unknownMotor:Ka,notReadyMotor:sc,disconnectedMotor:mc,powerOffMotor:_c};function Cc(n,t){return{id:n,name:n,type:"motor",properties:{position:t,unit:"mm",limits:[-100,100]},online:!0}}function $c(n){const{name:t="omega",minLimit:o=-999999999,maxLimit:s=999999999,initialPosition:r=0,initialVelocity:a=1e3,useHardwareContext:c=()=>null}=n,[l,f]=h.useState(r),[u,d]=h.useState(["READY"]),[p,m]=h.useState(null),g=h.useRef(Date.now()),j=c(),x=()=>{const v=Date.now(),C=(v-g.current)/1e3;let I;if(g.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 K=p>l?1:-1;I=l+K*O,M=["MOVING"],k=p}f(I),d(M),m(k)}},w=h.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=h.useCallback((v,C)=>(console.log("MotorSimulator: Unsupported setProperty",v,C),Promise.resolve()),[]);h.useEffect(()=>{const v=setInterval(()=>{x()},500);return()=>clearInterval(v)});const _=h.useMemo(()=>{var C,I;const v={setProperty:y,call:w};return(I=j==null?void 0:(C=j.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:u,tolerance:1e-4,unit:"mm",velocity:a,target:p,display_digits:3},type:"motor",actions:_,user_tags:[],locked:null},b=h.useRef(null);return h.useEffect(()=>{b.current!==null&&P.isEqual(b.current,$)||(b.current=$,j==null||j.actions.updateHardware(t,$))},[t,$]),e.jsx(e.Fragment,{})}function Ge(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 Zt(n){const{hardware:t,options:o={}}=n,s=h.useRef(null);h.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(Ge,{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 Jt=h.forwardRef(({title:n,children:t,bsPrefix:o,rootCloseEvent:s,variant:r,size:a,menuRole:c,renderMenuOnMount:l,disabled:f,href:u,id:d,menuVariant:p,flip:m,style:g,className:j,popperConfig:x,...w},y)=>e.jsxs(i.Dropdown,{ref:y,...w,children:[e.jsx(i.DropdownToggle,{id:d,href:u,size:a,variant:r,disabled:f,childBsPrefix:o,style:g,className:j,children:n}),e.jsx(i.DropdownMenu,{popperConfig:x,role:c,renderOnMount:l,rootCloseEvent:s,variant:p,flip:m,children:t})]}));Jt.displayName="DropdownButton2";const Oc=Jt;function Ic(n){const{currentPositionId:t,position:o,disabled:s,onSelect:r,filter:a}=n,c=o.position,l=c===t,f=l?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return h.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:"1",children:e.jsx("i",{className:f})}),e.jsx(i.Col,{sm:"2",children:e.jsx(i.Badge,{className:"small w-100",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:"1"}),e.jsx(i.Col,{sm:"11",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 Mc(n,t){if(n===null)return null;for(const o of t)if(n===o.position)return o;return null}function Tc(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(),f=h.useMemo(()=>{if(o)return"Moving...";const u=Mc(t,a);return u===null?"Position not described":u.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:f,style:{flex:"1 1 0",minWidth:0},children:f})]})}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(_){t.actions.call("move",_)}function f(_){t.actions.call("stop")}const u=e.jsx(N,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),d=e.jsx(Ge,{hardware:t}),p=a?"moving":null;function m(){var $;const _=(($=t.properties)==null?void 0:$.position)??null;return _==="unknown"?null:_}const g=m(),[j,x]=h.useState("");function w(){return e.jsxs(i.InputGroup,{className:"flex-nowrap",style:{alignItems:"stretch"},children:[e.jsxs(Oc,{variant:"secondary",title:e.jsx(Tc,{positionId:g,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:_=>x(_.target.value),value:j}),e.jsx(i.CloseButton,{disabled:j==="",onClick:()=>{x("")}})]}),s.positions.map(_=>e.jsx(Ic,{currentPositionId:g,position:_,onSelect:$=>{l($)},disabled:c,filter:j})),o.search&&j!==""&&e.jsxs(e.Fragment,{children:[e.jsx(i.Dropdown.Divider,{}),e.jsx(i.Dropdown.Item,{onClick:_=>{x(""),_.stopPropagation()},children:"Display all the positions..."})]})]}),a&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:f,children:e.jsx("i",{className:"fa fa-fw fa-times"})})]})}const y=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:u,widgetState:d,widgetContent:w(),headerMode:y})}const Fc={state:Ge,default:Zt,default2:en},tn=Fc,Dc=["move","stop"],Rc="beamstop",Ac="beamstop",Ec=!0,kc={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"},Pc="bliss",Bc=!1,Gc="multiposition",Vc={callables:Dc,id:Rc,name:Ac,online:Ec,properties:kc,protocol:Pc,require_staff:Bc,type:Gc},Lc={default:Vc};function Uc(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("empty"),[c,l]=h.useState("READY");async function f(p,m){if(p==="move"){l("MOVING"),a("unknown"),await V(2e3),l("READY"),a(m);return}if(p==="stop"){a("unknown"),await V(2e3);return}console.log("MultipositionSimulator: Unsupported call",p,m)}async function u(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(q,{name:t,alias:o,type:"multiposition",call:f,setProperty:u,properties:d,useHardwareContext:s})}function Ve(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(T,{state:o,minWidth:6,variant:r})}function Hc(n){const{hardware:t}=n;return e.jsx(Ve,{hardware:t})}function qc(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,u=[...s.available_magnifications??[]];u.sort((j,x)=>j>x?1:x>j?-1:0);const d=n.disabled||!t.online||!c,p=o.digits||2;function m(j){t.actions?t.actions.call("move",j):console.error("Change request was triggered with:",j)}function g(j,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${j}`)}return e.jsxs(e.Fragment,{children:[e.jsx(B,{value:l.toFixed(p),className:H.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:u.map((j,x)=>g(x,j))})]})]})}function Wc(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(nn,{...n})]})})]})]})}function nn(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,f]=t.properties.magnification_range||[null,null],u=h.useRef(null),d=h.useRef(null),[p,m]=h.useState(!1),g=o.digits||2;function j(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(!u||!u.current){console.log("formRef not yet defined");return}if(b.key==="Enter"){m(!1);const{value:v}=u.current,C=Number.parseFloat(v);if(l!==null&&C<l||f!==null&&C>f)return;j(C)}else b.key==="Escape"?(u.current.value=s.toFixed(g),d.current&&(d.current.value=s.toString()),m(!1)):console.log(b.key)}function w(b){b!==s&&!p&&m(!0),b===s&&p&&m(!1)}function y(b){if(!u||!u.current){console.error("formRef is not set");return}const v=Number.parseFloat(u.current.value);w(v),d.current&&(d.current.value=v.toString())}function _(b){if(!u||!u.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);w(v),u.current.value=v.toFixed(g)}function $(){if(!d||!d.current){console.error("rangeRef is not set");return}const b=Number.parseFloat(d.current.value);j(b)}return h.useEffect(()=>{if(!u||!u.current){console.error("formRef is not set");return}p||(u.current.value=s.toFixed(g)),d.current&&(d.current.value=s.toString())},[g,p,s]),e.jsxs(e.Fragment,{children:[e.jsx(i.Form.Control,{className:p?"form-control-edited":"",type:"number",ref:u,defaultValue:s.toFixed(g),onChange:y,disabled:c,step:10**-g,onKeyDown:x}),l!==null&&f!==null&&e.jsx(i.Form.Control,{ref:d,disabled:c,type:"range",min:l,max:f,step:10**-g,onChange:_,onMouseUp:$,defaultValue:s})]})}function zc(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:H.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(nn,{...n,mode:"move"})]})})]})]})}function Kc(n){return e.jsx(i.Form.Control,{className:"border-light",type:"text",disabled:!0,defaultValue:"Missing"})}function on(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fam-hardware-optic",online:t.online}),r=e.jsx(Ve,{hardware:t});function a(){function l(){return t.online?t.properties.available_magnifications?qc:t.properties.magnification_range?zc:Wc:Kc}const f=l();return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{className:"border-light",children:"×"}),e.jsx(f,{...n})]})}const c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function Yc(n){return n.type==="optic"}const Qc={default:on,state:Hc},sn=Qc,Xc=["magnification","reset","open"],Zc="optic",Jc="optic",el=!0,tl={state:"READY",magnification:10,target_magnification:null,available_magnifications:[5,7.5,10],magnification_range:null},nl="bliss",ol=!1,sl="optic",Se={callables:Xc,id:Zc,name:Jc,online:el,properties:tl,protocol:nl,require_staff:ol,type:sl},rl={default:Se,fixed:Se,off:Se,range:Se};function il(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]=h.useState({state:"READY",magnification:10,target_magnification:null,...a()});async function f(p){let m=c.magnification;l(x=>({...x,state:"MOVING",target_magnification:p})),await V(100);const g=.2*(m<p?1:-1);function j(x){l(w=>({...w,magnification:x}))}for(;Math.abs(p-m)>=Math.abs(g)*1.01;)m+=g,j(m),await V(100);l(x=>({...x,state:"READY",magnification:p,target_magnification:null}))}async function u(p,m){if(p==="move"){await f(m);return}console.log("OpticSimulator: Unsupported call",p,m)}async function d(p,m){if(p==="magnification"){l(g=>({...g,magnifications:m}));return}console.log("OpticSimulator: Unsupported setProperty",p,m)}return e.jsx(q,{name:t,alias:o,type:"optic",call:u,setProperty:d,properties:c,useHardwareContext:r})}function je(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(T,{state:o,minWidth:6,variant:r})}function al(n){const{hardware:t}=n;return e.jsx(je,{hardware:t})}function cl(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(u){o.foreground?t.actions.call("run_foreground"):t.actions.call("start")}function f(u){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:f,disabled:s||!c,variant:"primary",children:"Abort"})]})}function Ee(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(je,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(cl,{hardware:t,disabled:!n.operator,options:o})}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function ll(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(dl,{hardware:t})}function dl(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 rn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(je,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx("div",{children:e.jsx("h3",{children:e.jsx(ll,{hardware:t})})})}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function ul(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 an(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(je,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(ul,{hardware:t,disabled:!n.operator})}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const fl={default:Ee,manage:Ee,execution:rn,validate:an,state:al},cn=fl;function ln(n){return n.type==="procedure"}function pl(n){const t=G(n);return t===null||!ln(t)?null:t}const ml=["start","abort","clear","validate"],hl="procedure",gl="procedure",xl="procedure",wl="bliss",jl=!1,yl=!0,vl={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"}}},Nl={callables:ml,type:hl,id:gl,name:xl,protocol:wl,require_staff:jl,online:yl,properties:vl},bl={standby:Nl};function dn(n){return n==="OFF"?"danger":n==="READY"?"success":n==="MOVING"?"transient":"warning"}function Je({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 un(n){var p,m;const{hardware:t,options:o={}}=n,{showOutput:s=!0,step:r,steps:a}=o;function c(g){return t.actions.call(g)}function l(g){return t.actions.setProperty("setpoint",g)}const f=t.properties.state,u=e.jsx(N,{name:"RegulationLoop",icon:"fa-repeat",online:t.online}),d=e.jsxs(e.Fragment,{children:[e.jsx(T,{state:f,minWidth:6,variant:dn(f)}),!t.properties.is_softloop&&e.jsx(Je,{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(Je,{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(S,{hardware:t,widgetIcon:u,widgetState:d,widgetContent:e.jsxs(e.Fragment,{children:[e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(he,{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 _l(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{state:r}=s,a=o.name??t.alias??t.name,c=dn(r);let l=t.properties.input_value;return Number.isFinite(l)&&(l=l.toFixed(2)),e.jsxs(ee,{children:[e.jsx("h1",{children:a}),e.jsxs(i.Badge,{bg:c,children:[l," ",t.properties.input_unit]})]})}function Sl({curves:n}){const t=n[0].x??[],o=L.useValueToIndexScale(t,!0),{abscissaConfig:s}=L.useVisCanvasContext();return e.jsx(L.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 et=["#1f77b4","#ff7f0e","#d62728","#2ca02c"],tt=[.1,1],nt=6;function ot(n){const{data:t,xAxisTitle:o,yAxisTitle:s,title:r}=n,a=t.flatMap((f,u)=>{const d=f.x;let p=f.y;return d.length<p.length&&(p=p.slice(0,d.length)),[{color:f.color??et[u%et.length],name:f.name,x:[...L.getAxisValues(d,p.length)],y:p}]}),c=L.useCombinedDomain(L.useDomains(a.map(f=>f.x)))||tt,l=L.useCombinedDomain(L.useDomains(a.map(f=>f.y)))||tt;return e.jsxs(L.VisCanvas,{title:r,abscissaConfig:{visDomain:c,showGrid:!0,label:o},ordinateConfig:{visDomain:l,showGrid:!0,label:s},raycasterThreshold:nt,children:[a.map(f=>e.jsx(L.DataCurve,{abscissas:f.x,ordinates:f.y,color:f.color,glyphSize:nt,glyphType:L.GlyphType.Circle},f.name)),e.jsx(L.Zoom,{}),e.jsx(L.Pan,{}),e.jsx(Sl,{curves:a})]})}const Ce=100;function $e(n,t){const[o,s]=h.useState(new Array(n).fill(null)),r=h.useRef(0);function a(l){s(f=>{const u=[...f];return r.current===n-1?(u.shift(),u.push(l)):(u[r.current]=l,r.current=(r.current+1)%n),u})}function c(){return o.filter(l=>l!==null)}return{read:c,write:a,name:t}}function Le(n){const{hardware:t,options:o}=n,{showOutput:s=!0,plotHeight:r,plotWidth:a}=o,c=$e(Ce,"Time"),l=$e(Ce,"Input"),f=$e(Ce,"Output"),u=$e(Ce,"Setpoint");h.useEffect(()=>{c.write(Date.now()),l.write(t.properties.input_value),f.write(t.properties.output_value),u.write(t.properties.setpoint)},[t.properties]);const d=Date.now(),p=c.read().map(w=>-(d-w)/1e3),m=[l,u].map(w=>({name:w.name,x:p,y:w.read()})),g=[f].map(w=>({name:w.name,x:p,y:w.read()})),j={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(ot,{data:[...m,j,x],title:"Input",xAxisTitle:"Time (s)",yAxisTitle:t.properties.input_unit}),s&&e.jsx(ot,{data:g,title:"Output",xAxisTitle:"Time (s)",yAxisTitle:t.properties.output_unit})]})})}function Cl(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(Le,{...n})})]});return e.jsx(i.OverlayTrigger,{trigger:"click",placement:r,overlay:c,children:e.jsx(i.Button,{children:o.buttonTitle??"Plot"})})}const $l={default:un,plot:Le,popupplot:Cl,monitor:_l},fn=$l,Ol=null,Il=[],Ml=null,Tl="regulation",Fl=!0,Dl={deadband:.05,input_unit:"degC",input_value:10.029739616019928,is_monitoring:!1,output_unit:"Volt",output_value:8.556047391201504,setpoint:10,state:"READY"},Rl="regulation",Al=[],El={alias:Ol,errors:Il,locked:Ml,name:Tl,online:Fl,properties:Dl,type:Rl,user_tags:Al},kl={default:El};function Pl(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("READY"),[c,l]=h.useState(0),[f,u]=h.useState(0),[d,p]=h.useState(10),m=h.useRef(Date.now()),g=()=>{const y=Date.now(),_=(y-m.current)/1e3;let $,b;if(m.current=y,d!==null&&d!==c){let v;const C=_*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($),u(b),a(v)}};async function j(y,_){console.log("RegulationSimulator: Unsupported call",y,_)}async function x(y,_){y==="setpoint"&&p(_),console.log("RegulationSimulator: Unsupported setProperty",y,_)}h.useEffect(()=>{const y=setInterval(()=>{g()},500);return()=>clearInterval(y)});const w={state:r,deadband:.05,input_unit:"degC",input_value:c,is_monitoring:!0,output_unit:"Volt",output_value:f,setpoint:d};return e.jsx(q,{name:t,alias:o,type:"regulation",call:j,setProperty:x,properties:w,useHardwareContext:s})}function ye(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(T,{state:s,minWidth:6,variant:r()})}function Bl(n){const{hardware:t}=n;return e.jsx(ye,{hardware:t,useReadyState:!0})}function Gl(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 pn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(ye,{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(),[f,u]=c(l),p={OPEN:"danger",CLOSED:"success",MOVING:"transient",DISABLED:"secondary",STANDBY:"danger",FAULT:"fatal",UNKNOWN:"warning"}[l]||"danger";function m(){t.actions.call(u)}const g=e.jsxs(i.ButtonGroup,{className:"d-flex flex-nowrap",children:[e.jsx(i.Button,{variant:p,onClick:m,disabled:n.disabled||u==="",children:f}),o.extended&&e.jsx(Gl,{...n})]}),j=n.options.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:g,headerMode:j})}function Vl(n){var f;const{hardware:t,options:o={}}=n;function s(){t.actions.call("open")}function r(){t.actions.call("close")}const a=((f=t.properties)==null?void 0:f.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 mn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(ye,{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 f=a(),u=c(f),p={OPEN:"success",CLOSED:"danger",MOVING:"transient",DISABLED:"secondary",STANDBY:"success",FAULT:"fatal",UNKNOWN:"fatal"}[f],m=l(u),g=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(Vl,{...n})]}),j=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:g,headerMode:j})}function Ll(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(ee,{children:[e.jsx("h1",{children:c}),e.jsx(ye,{hardware:t})]});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(`
|
|
30
|
+
`)?e.jsx("pre",{children:f}):f}),children:l})}return l}const Ul={default:pn,protected:mn,state:Bl,monitor:Ll},hn=Ul,Hl=["reset","open","close","toggle"],ql="abs1",Wl="abs1",zl=!0,Kl={closed_text:"",open_text:"",state:"OPEN",status:`Pneumatic Beam Shutter is open
|
|
31
|
+
`,valid:!0},Yl="tango",Ql=!0,Xl="shutter",Zl={callables:Hl,id:ql,name:Wl,online:zl,properties:Kl,protocol:Yl,require_staff:Ql,type:Xl},Jl=["reset","open","close","toggle"],ed="abs1",td="abs1",nd=!0,od={closed_text:"",open_text:"",state:"CLOSED",status:`Pneumatic Beam Shutter is closed
|
|
32
|
+
`,valid:!0},sd="tango",rd=!0,id="shutter",ad={callables:Jl,id:ed,name:td,online:nd,properties:od,protocol:sd,require_staff:rd,type:id},cd={default:Zl,closed:ad};function ld(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("OPEN");async function c(u,d){if(u==="open"){a("MOVING"),await V(2e3),a("OPEN");return}if(u==="close"){a("MOVING"),await V(2e3),a("CLOSED");return}console.log("ShutterSimulator: Unsupported call",u,d)}async function l(u,d){console.log("ShutterSimulator: Unsupported setProperty",u,d)}const f={state:r,closed_text:"",open_text:"",status:`Shutter is ${r}`,valid:!0};return e.jsx(q,{name:t,alias:o,type:"shutter",call:c,setProperty:l,properties:f,useHardwareContext:s})}function dd(n){var d,p,m,g;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),f=(g=t.hoffset)==null?void 0:g.slice(9),u=U(f);return h.useMemo(()=>{var j,x,w,y;return{vgap:((j=s==null?void 0:s.properties)==null?void 0:j.state)??null,hgap:((x=a==null?void 0:a.properties)==null?void 0:x.state)??null,voffset:((w=l==null?void 0:l.properties)==null?void 0:w.state)??null,hoffset:((y=u==null?void 0:u.properties)==null?void 0:y.state)??null}},[s,a,l,u])}function Ue(n){const{hardware:t}=n,o=dd(t),[s,r,a]=h.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(T,{state:s,description:a,variant:r,minWidth:6})}function ud(n){const{hardware:t}=n;return e.jsx(Ue,{hardware:t})}function fd(n){var x,w,y,_;const{properties:t}=n,o=(x=t.vgap)==null?void 0:x.slice(9),s=U(o),r=oe(o),a=(w=t.hgap)==null?void 0:w.slice(9),c=U(a),l=oe(a),f=(y=t.voffset)==null?void 0:y.slice(9),u=U(f),d=oe(f),p=(_=t.hoffset)==null?void 0:_.slice(9),m=U(p),g=oe(p);function j($,b){return $===null?null:{...$,actions:b}}return{vgap:j(s,r),hgap:j(c,l),voffset:j(u,d),hoffset:j(m,g)}}function pd(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(ie,{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(ie,{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(ie,{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(ie,{hardware:r.voffset,options:{header:"none"},disabled:s,operator:o})})]})]})})]})}function md(n){const{hardware:t,options:o={}}=n,s=fd(t),{readonly:r=!1}=o;function a(m){var x,w;const g=((x=m==null?void 0:m.properties)==null?void 0:x.position)??null;if(g===null)return"∅";const j=o.precision??((w=m==null?void 0:m.properties)==null?void 0:w.display_digits)??void 0;return j!==void 0?g.toFixed(j):`${g}`}const[c,l,f,u,d,p]=h.useMemo(()=>{var b,v,C,I,M,k,O,K;const m=`${a(s.hgap)} × ${a(s.vgap)}`,g=((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"),w=`${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)??[],...((K=s.voffset)==null?void 0:K.properties.state)??[]]).has("MOVING");return[m,g,x,w,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:H.default({"hw-moving":f})}),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:u,title:"Offset",className:H.default({"hw-moving":p})}),e.jsx(i.InputGroup.Text,{children:d}),!r&&e.jsx(pd,{...n,resolved:s})]})}function gn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Slit",icon:"fam-hardware-motor",online:t.online}),r=e.jsx(Ue,{hardware:t}),a=e.jsx(md,{...n}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const hd={default:gn,state:ud},gd=hd,xd="s1",wd="s1",jd=!0,yd={vgap:"hardware:s1vg",voffset:"hardware:s1vo",hgap:"hardware:s1hg",hoffset:"hardware:s1ho"},vd="slit",Nd={id:xd,name:wd,online:jd,properties:yd,type:vd},bd="s1",_d="s1",Sd=!0,Cd={vgap:"hardware:",voffset:"hardware:",hgap:"hardware:s1hg",hoffset:"hardware:s1ho"},$d="slit",Od={id:bd,name:_d,online:Sd,properties:Cd,type:$d},Id="s1",Md="s1",Td=!0,Fd={vgap:"hardware:s1vg",voffset:"hardware:s1vo",hgap:"hardware:",hoffset:"hardware:"},Dd="slit",Rd={id:Id,name:Md,online:Td,properties:Fd,type:Dd},Ad={default:Nd,horizontal:Od,vertical:Rd};function Ed(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 xn(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(Ed,{...n})]})})]})}const kd={default:xn},wn=kd,Pd=["off","on"],Bd="ip121",Gd="ip121",Vd=!0,Ld={current:.0003000000142492354,pressure:26000000730164174e-23,state:"ON",status:`Pump is ON
|
|
33
33
|
Modes: Step/Protect
|
|
34
34
|
ID21/v-var-ctrl/121 - Serial line OK
|
|
35
35
|
Pump size: 75-55-40 SC/T
|
|
36
|
-
`,voltage:6998},gd="tango",xd=!0,wd="pump",jd={callables:ud,id:fd,name:pd,online:md,properties:hd,protocol:gd,require_staff:xd,type:wd},yd={default:jd};function Ge(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(M,{state:o,minWidth:6,variant:r})}function vd(n){const{hardware:t}=n;return e.jsx(Ge,{hardware:t})}function _e(n){const{text:t,icon:o,leftIcon:s=o,rightIcon:r=o,iconLocation:a="left",onAction:c,onActionChange:l,disabled:f=!1,variant:u,style:d={},className:p=""}=n,[m,g]=h.useState(!1),w=r&&a==="right",x=s&&a==="left";return e.jsx(i.Button,{variant:u,style:d,className:p,onClick:()=>{l==null||l(!0),g(!0),c().finally(()=>{g(!1),l==null||l(!1)})},disabled:f,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 Nd(n){const{className:t,hardware:o,options:s={},style:r={},leftToRight:a}=n,{state:c}=o.properties??"OFFLINE",f=!(c==="IN_TOUCH")||n.disabled;function u(d){const{distance:p,style:m}=d;return e.jsx(_e,{text:`${p}`,style:m,variant:"secondary",onAction:()=>o.actions.call("push",p),disabled:f,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(u,{distance:5,style:{gridColumn:a?3:1,gridRow:1}}),e.jsx(u,{distance:.5,style:{gridColumn:2,gridRow:1}}),e.jsx(u,{distance:.05,style:{gridColumn:a?1:3,gridRow:1}}),e.jsx(u,{distance:2,style:{gridColumn:a?3:1,gridRow:2}}),e.jsx(u,{distance:.2,style:{gridColumn:2,gridRow:2}}),e.jsx(u,{distance:.02,style:{gridColumn:a?1:3,gridRow:2}}),e.jsx(u,{distance:1,style:{gridColumn:a?3:1,gridRow:3}}),e.jsx(u,{distance:.1,style:{gridColumn:2,gridRow:3}}),e.jsx(u,{distance:.01,style:{gridColumn:a?1:3,gridRow:3}})]})}function bd(n){const{hardware:t,options:o,disabled:s,leftToRight:r}=n,{state:a}=t.properties??"OFFLINE",c=a==="RETRACTED",l=a==="IN_TOUCH",f=a==="LOST",[u,d]=h.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||f?"fas fa-dizzy":"fa fa-smile"} fa-3x my-auto`,style:{gridColumn:r?2:1,gridRow:1}}),e.jsx(Nd,{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(_e,{text:"In",onAction:()=>t.actions.call("move_in"),onActionChange:g=>{d(g)},disabled:l||s||u,style:{width:"5em"},iconLocation:"left",icon:"fa fa-fw fa-arrow-left"}),e.jsx(_e,{text:"Out",onAction:()=>t.actions.call("move_out"),onActionChange:g=>{d(g)},disabled:c||s||u,style:{width:"5em"},leftIcon:"fa fa-fw fa-arrow-left",rightIcon:"fa fa-fw fa-arrow-right"}),r&&e.jsx(_e,{text:"In",onAction:()=>t.actions.call("move_in"),onActionChange:g=>{d(g)},disabled:l||s||u,style:{width:"5em"},iconLocation:"right",icon:"fa fa-fw fa-arrow-right"})]})]})}function an(n){const{hardware:t,options:o={}}=n,s=(o.orientation??"left-right")==="left-right",r=e.jsx(N,{name:"Pusher",icon:"fa-hand-point-right",online:t.online}),a=e.jsx(Ge,{hardware:t});function c(){return e.jsx(bd,{...n,leftToRight:s})}const l=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:c(),headerMode:l})}const _d={default:an,state:vd},cn=_d,Cd=["move_in","move_out","push","sync_hard"],Sd="pusher",$d="pusher",Od=!0,Id={state:"RETRACTED"},Md="bliss",Td=!1,Fd="pusher",Dd={callables:Cd,id:Sd,name:$d,online:Od,properties:Id,protocol:Md,require_staff:Td,type:Fd},Rd={default:Dd};function Ad(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("RETRACTED");async function c(u,d){if(u==="move_in"){a("MOVING_IN"),await V(2e3),a("IN_TOUCH");return}if(u==="move_out"){a("MOVING_OUT"),await V(2e3),a("RETRACTED");return}if(u==="push"){await V(100);return}console.log("PusherSimulator: Unsupported call",u,d)}async function l(u,d){console.log("PusherSimulator: Unsupported setProperty",u,d)}const f={state:r};return e.jsx(W,{name:t,alias:o,type:"pusher",call:c,setProperty:l,properties:f,useHardwareContext:s})}function Me(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(M,{state:o,minWidth:6,variant:r})}function Ed(n){const{hardware:t}=n;return e.jsx(Me,{hardware:t})}function ln(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(Me,{hardware:t});function a(){t.actions.call("start")}function c(){t.actions.call("restart")}function l(){t.actions.call("stop")}function f(){return t.properties?t.properties.state:"UNKNOWN"}function u(b){return b.charAt(0).toUpperCase()+b.slice(1).toLowerCase()}const d=f(),p=u(d),g={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:g,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 kd(n){var f;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=((f=t.properties)==null?void 0:f.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 dn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(Me,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(g){return g.charAt(0).toUpperCase()+g.slice(1).toLowerCase()}const l=a(),u={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:u,style:{minWidth:"10em"},value:d,className:"text-center"}),e.jsx(kd,{...n})]}),m=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:p,headerMode:m})}const Pd={default:ln,protected:dn,state:Ed},un=Pd,Bd=["start","stop","restart"],Gd="service1",Vd="service1",Ld=!0,Ud={state:"RUNNING"},Hd="multivisor",qd=!0,Wd="service",zd={callables:Bd,id:Gd,name:Vd,online:Ld,properties:Ud,protocol:Hd,require_staff:qd,type:Wd},Kd={default:zd};function je(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(M,{state:o,minWidth:6,variant:r,description:a})}function Yd(n){const{hardware:t}=n;return e.jsx(je,{hardware:t})}function Qd(n){const{motion:t}=n,s=t.axisRef.slice(9),r=L(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 Xd(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 Zd(n){const{motion:t,actions:o,axisRef:s,disabled:r}=n,a=h.useMemo(()=>{for(const d of t)if(d.axisRef===s)return!0;return!1},[t,s]),c=s.slice(9),l=L(c),f=(l==null?void 0:l.alias)??(l==null?void 0:l.name)??(l==null?void 0:l.id)??c;function u(){o.call("update_axis",{axis_ref:s,relative_position:0})}return e.jsx(i.Button,{className:"ms-1",variant:a?"primary":"secondary",onClick:()=>{a||u()},title:a?"This axis is already part of the motion":"Use this axis in the motion",disabled:r,children:f})}function Jd(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=L(a),l=n.disabled||!(c!=null&&c.online),f=h.useRef(null),[u,d]=h.useState(!1),p=3,m=((x=c==null?void 0:c.properties)==null?void 0:x.unit)??"";function g(j){if(!f||!f.current)console.log("formRef not yet defined");else if(j.key==="Enter"){d(!1);const y=Number.parseFloat(f.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"?(f.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&&!u&&d(!0),S===r&&u&&d(!1)}return h.useEffect(()=>{!f||!f.current?console.log("formRef not yet defined"):u||(f.current.value=r.toFixed(p))},[u,r]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:u?"form-control-edited":"",type:"number",ref:f,defaultValue:r.toFixed(p),onChange:w,disabled:l,onKeyDown:g}),e.jsx(i.InputGroup.Text,{children:m})]})}function eu(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 fn(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,a=gn(t),c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(je,{hardware:t}),f=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(Zd,{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(h.Fragment,{children:[e.jsx(Qd,{motion:d}),e.jsx(eu,{motion:d,actions:t.actions,disabled:s||!a}),e.jsx(Jd,{motion:d,actions:t.actions,disabled:s||!a}),e.jsx(Xd,{motion:d,actions:t.actions,disabled:s||!a})]},`motion${p}`))]})})]})]}),u=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:f,headerMode:u})}function tu(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=L(a),l=n.disabled||!(c!=null&&c.online),f=h.useRef(null),[u,d]=h.useState(!1),p=3,m=((b=c==null?void 0:c.properties)==null?void 0:b.unit)??"",g=(c==null?void 0:c.alias)??(c==null?void 0:c.name)??(c==null?void 0:c.id)??"none";function w(v){if(!f||!f.current)console.log("formRef not yet defined");else if(v.key==="Enter"){d(!1);const C=Number.parseFloat(f.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"?(f.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&&!u&&d(!0),I===r&&u&&d(!1)}h.useEffect(()=>{!f||!f.current?console.log("formRef not yet defined"):u||(f.current.value=r.toFixed(p))},[u,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:g}),e.jsx(i.InputGroup.Text,{className:`bg-${S}`,title:$,style:{width:"3em"},children:y}),e.jsx(i.Form.Control,{className:u?"form-control-edited":"",type:"number",ref:f,defaultValue:r.toFixed(p),onChange:x,disabled:l,onKeyDown:w}),e.jsx(i.InputGroup.Text,{children:m})]})}function pn(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,a=gn(t),c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(je,{hardware:t}),f=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(tu,{actions:t.actions,motion:d,disabled:s||!a},d.axisRef))})]}),u=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:f,headerMode:u})}function nu(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(je,{hardware:t}),f=a==="IN",u=a==="OUT";function d(){return f?"1 / 3":u?"3 / 5":"2 / 4"}const p=d(),m=f?"fa-face-grin-beam-sweat":"fa-smile",g=f?"The sample is in front of the beam":u?"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:g})}),x=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:w,headerMode:x})}const ou={default:fn,small:pn,state:Yd,sample_location:nu},mn=ou;function hn(n){return n.type==="tomoflatmotion"}function su(n){const t=G(n);return t===null||!hn(t)?null:t}function gn(n){const{properties:t={}}=n,{state:o="UNKNOWN"}=t;return["IN","READY"].includes(o)}const ru="tomoflatmotion",iu="tomoflatmotion",au=!0,cu={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}]},lu="bliss",du=!1,uu="tomoflatmotion",fu={id:ru,name:iu,online:au,properties:cu,protocol:lu,require_staff:du,type:uu},pu=["move","stop","wait","rmove"],mu="sy",hu="sy",gu=!0,xu={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},wu="bliss",ju=!1,yu="motor",vu=[],Nu={callables:pu,id:mu,name:hu,online:gu,properties:xu,protocol:wu,require_staff:ju,type:yu,user_tags:vu},bu=["move","stop","wait","rmove"],_u="sy2",Cu="sy2",Su=!0,$u={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Ou="bliss",Iu=!1,Mu="motor",Tu=[],Fu={callables:bu,id:_u,name:Cu,online:Su,properties:$u,protocol:Ou,require_staff:Iu,type:Mu,user_tags:Tu},Du={default:fu,sy:Nu,sy2:Fu};function Ru(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.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(u,d){const p=[];let m=!1;return u.motion.forEach(g=>{if(g.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(g)}),m||p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null}),{...u,motion:p}}async function l(u,d){if(u==="update_axis"){a(p=>c(p,d));return}console.log("TomoFlatMotionSimulator: Unsupported call",u,d)}async function f(u,d){console.log("TomoFlatMotionSimulator: Unsupported setProperty",u,d)}return e.jsx(W,{name:t,alias:o,type:"tomoflatmotion",call:l,setProperty:f,properties:r,useHardwareContext:s})}function xn(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r}=t,{label:a}=o,[c,l]=h.useState(void 0),[f,u]=h.useState(!1),d=e.jsx(N,{name:"TomoReferencePositionSchema",icon:"fam-hardware-motor",online:t.online});function p(x){l(void 0),u(!0),r.call("move_to_reference").catch(j=>{l(`${j}`)}).finally(()=>{u(!1)})}const m=e.jsx(e.Fragment,{}),g=e.jsxs(i.Button,{onClick:p,variant:c===void 0?"secondary":"danger",disabled:s||f,className:"w-100",children:[c&&e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-1",title:c}),!c&&f&&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:g,headerMode:w})}function Au(n){return n.type==="tomoreferenceposition"}const Eu={default:xn},wn=Eu;function ye(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(M,{state:r,minWidth:6,variant:c})}function ku(n){const{hardware:t}=n;return e.jsx(ye,{hardware:t})}function Pu(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 Bu(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(fe,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.sample_pixel_size_mode!=="USER"})}function Gu(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(Pu,{...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(Bu,{...n}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function Vu(n,t,o){return h.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=Xe.default(n,t);return[r(a.to(o).scalar),s(o)]},[n,t,o])}function jn(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(ye,{hardware:t}),[c,l]=Vu(t.properties.sample_pixel_size,"um",s),f=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(Gu,{...n})]}),u=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:f,headerMode:u})}function ae(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 ae(n*r,"mm",o,void 0)}return Number.NaN}if(o==="px"){if(s!==void 0){const r=ae(n,t,"mm",void 0),a=s.to("mm").scalar;return r/a}return Number.NaN}try{return Xe.default(n,t).to(o).scalar}catch{return console.error(`Convertion ${t}->${o} is not provided`),Number.NaN}}function yn(n){return n.startsWith("u")?`μ${n.slice(1)}`:n}function ie(n){return!n||!n.startsWith("hardware:")?null:n.slice(9)}function Lu(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{sample_pixel_size:r,detector:a=null}=s,c=Tt(ie(a)),{properties:l={}}=c??{},{size:f}=l,u=o.display_unit??"mm",d=o.digits??3,p=e.jsx(N,{name:"TomoDetector",icon:"fa-eye",online:t.online}),m=e.jsx(ye,{hardware:t}),g=h.useMemo(()=>{if(r==null||f===null||f===void 0)return"∅";const j=ae(f[0]*r,"um",u),y=ae(f[1]*r,"um",u);return`${j.toFixed(d)} × ${y.toFixed(d)}`},[r,f,u,d]),w=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:g}),e.jsx(i.InputGroup.Text,{children:yn(u)})]}),x=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:p,widgetState:m,widgetContent:w,headerMode:x})}function Uu(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 Hu(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(fe,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.state!=="READY"})}function qu(n){const t=G(n);return t!==null&&me(t)?t:null}function Wu(n){var c;const{hardware:t}=n,{properties:o}=t,s=((c=o.detector)==null?void 0:c.slice(9))??"",r=qu(s),a=te(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(Uu,{...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(Hu,{hardware:r,actions:a}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function vn(n){const{hardware:t}=n,o=e.jsx(N,{name:"TomoDetector",icon:"fa-cog",online:t.online}),s=e.jsx(ye,{hardware:t}),r=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:t.properties.acq_mode}),e.jsx(Wu,{...n})]}),a=n.options?n.options.header:"top";return e.jsx(_,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:r,headerMode:a})}const zu={samplepixelsize:jn,acquisitionmode:vn,fieldofview:Lu,state:ku},Nn=zu;function Ve(n){return n.type==="tomodetector"}function Ku(n){const t=G(n);return t===null||!Ve(t)?null:t}const Yu="tomodet1",Qu="tomodet1",Xu=!0,Zu={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"},Ju="bliss",ef=!1,tf="tomodetector",nf={id:Yu,name:Qu,online:Xu,properties:Zu,protocol:Ju,require_staff:ef,type:tf},of={default:nf};function Le(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(M,{state:o,minWidth:6,variant:r})}function sf(n){const{hardware:t}=n;return e.jsx(Le,{hardware:t})}function rf(n){const{hardware:t}=n,{properties:o}=t,{detectors:s}=o,r=ie(o.active_detector),a=ie(o.target_detector),c=o.state==="READY",l=n.disabled||!t.online||!c;function f(d){t.actions?t.actions.call("mount",d):console.error("Change request was triggered with:",d)}function u(d){const p=ie(d),g=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:()=>{f(p)},children:[e.jsx("i",{className:g})," ",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=>u(d))})]})}function bn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Le,{hardware:t}),{properties:a}=t,c=a.state==="MOUNTING",l=ie(a.active_detector),f=ie(a.target_detector);function u(){return e.jsxs(i.InputGroup,{children:[e.jsx(B,{className:U.default({"hw-moving":c}),value:f||l||"No detector"}),e.jsx(rf,{...n})]})}const d=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:u(),headerMode:d})}const af={default:bn,state:sf},_n=af;function Cn(n){return n.type==="tomodetectors"}function cf(n){const t=G(n);return t===null||!Cn(t)?null:t}const lf="tomodetectors",df="tomodetectors",uf=!0,ff={state:"READY",active_detector:"hardware:limadetector1",detectors:["hardware:limadetector1","hardware:limadetector2","hardware:limadetector3"]},pf="bliss",mf=!1,hf="optic",gf={id:lf,name:df,online:uf,properties:ff,protocol:pf,require_staff:mf,type:hf},xf={default:gf};function se(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(M,{state:o,minWidth:6,variant:r})}function wf(n){const{hardware:t}=n;return e.jsx(se,{hardware:t})}function jf(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 yf(n){const{hardware:t}=n,o=t.properties.exposure_time??0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=2;function f(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 u(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 h.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:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function vf(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 Sn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(se,{hardware:t}),a=e.jsxs(i.Container,{children:[e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(jf,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(yf,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(vf,{hardware:t,disabled:n.disabled})})})]}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Nf(n){const{style:t,className:o,value:s,decimals:r=2,allowNullAsEmpty:a=!1,disabled:c=!1}=n,[l,f]=h.useState(void 0),u=l!==void 0,d=h.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=h.useCallback(y=>y===null||d===void 0?null:ae(y,d,n.unit,n.pixelSize),[n.unit,d,n.pixelSize]),m=h.useCallback(y=>y===null||d===void 0?null:ae(y,n.unit,d,n.pixelSize),[n.unit,d,n.pixelSize]);function g(y){return(y??"")===""?null:Number.parseFloat(y)}function w(){var $;if(l===void 0||!a&&l==="")return;let y;try{y=g(l)}catch{return}const S=p(y);($=n.onAccepted)==null||$.call(n,S),f(void 0)}function x(){var y;l!==void 0&&((y=n.onAborted)==null||y.call(n),f(void 0))}const j=h.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:u?"#FFFF80":void 0},disabled:c,onChange:y=>{f(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 bf(n){const{onAccepted:t,...o}=n;return e.jsx(Nf,{...o,allowNullAsEmpty:!1,onAccepted:t})}function _f(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(bf,{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:yn(a)})]})}function Cf(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(!me(o)||!Ve(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]=Ft(t,r);return e.jsxs("div",{className:"text-center",title:"Decompisiton of the accumulation",children:[c," × ",l.toFixed(3)]})}function $n(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(se,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(_f,{hardware:t,disabled:n.disabled,options:o}),e.jsx(Cf,{exposureTime:t.properties.exposure_time})]}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Sf(n){const{hardware:t}=n,o=t.properties.settle_time||0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(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 u(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 h.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:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function On(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(se,{hardware:t}),a=e.jsx(Sf,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Te(n){const[t,o]=h.useState(!1),[s,r]=h.useState(void 0),{text:a,disabled:c,onAction:l,onStarted:f,onTerminated:u,title:d}=n;function p(m){f==null||f(),r(void 0),o(!0),l().catch(g=>{r(`${g}`)}).finally(()=>{o(!1),u==null||u()})}return e.jsxs(i.Button,{onClick:p,disabled:c||t,variant:s===void 0?"primary":"danger",className:U.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 $f(){const n=G("ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector");return n===null||!me(n)?null:n}function Of(n){const{hardware:t,restoreSample:o}=n,[s,r]=h.useState(!1),a=n.disabled||!t.online||s,c=$f(),l=(c==null?void 0:c.properties.state)==="OFFLINE";function f(){r(!0)}function u(){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(Te,{onAction:d,onStarted:f,onTerminated:u,disabled:a||l,text:"Proj",title:"Take a projection"}),e.jsx(Te,{onAction:m,onStarted:f,onTerminated:u,disabled:a||l,text:"Flat",title:"Take a flat"}),e.jsx(Te,{onAction:p,onStarted:f,onTerminated:u,disabled:a||l,text:"Dark",title:"Take a dark"})]})}function In(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(se,{hardware:t}),c=e.jsx(Of,{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 If(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 Mn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(se,{hardware:t}),a=e.jsx(If,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const Mf={default:Sn,exposuretime:$n,settletime:On,actions:In,updatemode:Mn,state:wf},Tn=Mf,Tf="tomoimaging",Ff="tomoimaging",Df=!0,Rf={state:"READY",update_on_move:!1,exposure_time:1},Af="bliss",Ef=!1,kf="optic",Pf={id:Tf,name:Ff,online:Df,properties:Rf,protocol:Af,require_staff:Ef,type:kf},Bf={default:Pf};function Gf(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState({state:"READY",update_on_move:!0,exposure_time:1,settle_time:0});function c(u){a(d=>({...d,state:u}))}async function l(u,d){if(u==="take_dark"){c("ACQUIRING"),await V(2e3),c("READY");return}if(u==="take_flat"){c("ACQUIRING"),await V(2e3),c("READY");return}if(u==="take_proj"){c("ACQUIRING"),await V(2e3),c("READY");return}console.log("TomoImagingSimulator: Unsupported call",u,d)}async function f(u,d){a(p=>({...p,[u]:d}))}return e.jsx(W,{name:t,alias:o,type:"tomoimaging",call:l,setProperty:f,properties:r,useHardwareContext:s})}const Vf={},Lf=Vf;function Fn(n){return n.type==="tomosamplestage"}function Uf(n){const t=G(n);return t===null||!Fn(t)?null:t}function Hf(n){const{hardware:t}=n,o=t.properties.latency_time||0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(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 u(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 h.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:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Dn(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(Hf,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(_,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const qf={latencytime:Dn},Rn=qf;function An(n){return n.type==="tomoconfig"}function Wf(n){const t=G(n);return t===null||!An(t)?null:t}function En(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(M,{state:o,minWidth:6,variant:r})}function zf(n){const{hardware:t}=n;return e.jsx(En,{hardware:t})}const Kf={state:zf},Yf=Kf;function kn(n){return n.type==="tomoholo"}function Qf(n){const t=G(n);return t===null||!kn(t)?null:t}function Xf(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 Pn(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(Xf,{...n})]})})]})}const Zf={default:Pn},Bn=Zf,Jf=["close","reset","open"],ep="rv12",tp="rv12",np=!0,op={state:"CLOSED",status:`Pneumatic is closed
|
|
37
|
-
`},sp="tango",rp=!1,ip="valve",ap={callables:Jf,id:ep,name:tp,online:np,properties:op,protocol:sp,require_staff:rp,type:ip},cp={default:ap},lp=Ae.default("daiquiri.components.hardware.NoObject");function dp(n){if(n.options.emptyifnone)return lp('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 up(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 fp=Ae.default("daiquiri.components.hardware.MissingObject");function pp(n){if(n.options.emptyifnone)return fp('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 mp(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 hp=Ae.default("daiquiri.components.hardware.MissingComponentObject");function gp(n){const{options:t}=n,{variant:o="default"}=t;if(t.emptyifnone)return hp('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 xp(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 Gn(n){const[t,o]=h.useState({}),s=h.useRef(null);return h.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 wp(n){const{size:t,value:o,min:s,max:r,lowWarning:a,hiWarning:c,lowDanger:l,hiDanger:f}=n;function u(j){return j===null?null:(j-s)/(r-s)}const d=h.useMemo(()=>{const j=l===void 0?void 0:u(l),y=f===void 0?void 0:u(f),S=a===void 0?void 0:u(a),$=c===void 0?void 0:u(c);return{lowPercentDanger:j,hiPercentDanger:y,lowPercentWarning:S,hiPercentWarning:$}},[s,r,a,c,l,f]),p=h.useMemo(()=>o===null?"value":l!==void 0&&o<=l||f!==void 0&&o>=f?"value value-danger":a!==void 0&&o<=a||c!==void 0&&o>=c?"value value-warning":"value",[o,l,f,a,c]),m=t/2-15,g=t/10,w=t/10*3;function x(j){return g+(w-g)*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:u(o),width:10,height:t/2-15,radius:2,type:"triangle",color:"black"}),e.jsx(E.Value,{className:p,value:o})]})}function jp(n){return e.jsx("div",{className:"panel-header",style:n.style,children:n.children})}function yp(n){return e.jsx("div",{className:`panel-contents ${n.className}`,style:n.style,children:n.children})}function R(n){const t=n.scroll?Gn:h.Fragment;return e.jsx("div",{className:`panel ${n.className??""}`,style:n.style,children:e.jsx(t,{children:n.children})})}R.Header=jp;R.Contents=yp;function Vn(n){return e.jsx(e.Fragment,{})}function vp(n){const{providers:t={},yamlNode:o,label:s,...r}=n;return qn(o,"label",s),ve(o,r),e.jsx("div",{children:s})}function Np({yamlNode:n,panel:t}){const{type:o,style:s,children:r,...a}=n;return ve(n,a),e.jsx(i.Row,{className:"ymllayout-row gx-0",style:s,children:P.map(r,(c,l)=>q(c,l,t))})}function bp({yamlNode:n,panel:t}){const{type:o,style:s,xs:r,children:a,...c}=n;return ve(n,c),zn(n,"xs",r),e.jsx(i.Col,{className:U.default("yamymllayout-col",{col:!!r}),style:s,xs:r,children:P.map(n.children,(l,f)=>q(l,f,t))})}function _p({yamlNode:n,panel:t}){const o=n.options||{};return e.jsx(i.Container,{className:"ymllayout-container",...o,children:P.map(n.children,(s,r)=>q(s,r,t))})}function Cp(n){const{yamlNode:t}=n,o=t.options||{},s={};return o.centerContent&&(s.margin="auto"),e.jsxs(R,{className:"ymllayout-panel",...o,children:[t.title&&e.jsx(R.Header,{children:t.title}),e.jsx(R.Contents,{style:s,children:P.map(t.children,(r,a)=>q(r,a,!1))})]})}const Sp=()=>Math.random().toString(36).slice(2,15)+Math.random().toString(36).slice(2,15);function $p({yamlNode:n,panel:t}){const o=[];return P.each(n.children,(s,r)=>{o.push(e.jsx(i.Tab,{eventKey:Sp(),title:s.title,children:q(s,0,!1)},r))}),t?e.jsxs(R,{className:"ymllayout-tabs",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 Op(n){const{node:t}=n,{type:o,title:s,...r}=t;return Un(t,r),e.jsx("div",{className:"ymllayout-form-header",style:{gridColumn:"1 / 3"},children:e.jsx("h3",{children:s})})}function Ip(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 f=a(),u={_parentNode:t._parentNode,_indexFromParent:t._indexFromParent,type:"hardware",id:f,variant:"name",emptyifnone:!0};return q(u,"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 Mp(n){const{node:t,row:o}=n,{titlealign:s,title:r,stateinheader:a=!1,variant:c,id:l,...f}=t;let u,d;if(f.type==="hardware")if(u={...f,id:l,variant:c},a){const p={...f,id:l,variant:"state",emptyifnone:!0};d=q(p,"k",!1)}else d=null;else u=f,d=null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{gridColumn:1,alignSelf:s??"center"},children:e.jsx(Ip,{node:t,state:d,row:o})}),e.jsx("div",{style:{gridColumn:2,alignSelf:"center",overflow:"auto"},children:q(u,"k",!1)})]})}function Tp(n){const{yamlNode:t,panel:o}=n,{type:s,children:r,options:a={},title:c,...l}=t;return Un(t,l),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"},children:P.map(r,(f,u)=>f.type==="formheader"?e.jsx(Op,{node:f,row:u},u):f.type==="none"?e.jsx(po.default.Fragment,{},u):e.jsx(Mp,{node:f,row:u},u))})})]})}function Fp(n){const{yamlNode:t,panel:o}=n;return e.jsx("div",{className:"ymllayout-grid",style:{gridTemplateColumns:t.columns,gridTemplateRows:t.rows},children:P.map(t.children,(s,r)=>{const{columnSpan:a=1,rowSpan:c=1,...l}=s,f=a>1?`span ${a}`:void 0,u=c>1?`span ${c}`:void 0;return e.jsx("div",{className:"ymllayout-grid-cell",style:{gridColumn:f,gridRow:u},children:q(l,r,o)},r)})})}const ce={row:Np,col:bp,container:_p,panel:Cp,tabs:$p,form:Tp,grid:Fp};function Dp(n,t){le[n]&&console.warn(`yaml registration: The type ${n} is already a component. The component will not be reachable anymore.`),ce[n]&&console.warn(`yaml registration: The type ${n} is already a container. The previous container will be dropped.`),ce[n]=t}const le={todo:Kn,none:Vn,label:vp};function Ln(n,t){le[n]&&console.warn(`yaml registration: The type ${n} is already a component. The previous component will be dropped.`),ce[n]&&console.warn(`yaml registration: The type ${n} is already a container. This component will not be used.`),le[n]=t}function Rp(n){Object.entries(n).forEach(([t,o])=>Ln(t,o))}function Ap(n){const{yamlNode:t,panel:o}=n,{type:s,style:r,scroll:a,title:c,...l}=t;if(!(s in le))return e.jsx(R,{children:e.jsx(R.Contents,{children:e.jsxs(i.Alert,{variant:"warning",children:['Unknown component "',s,'"']})})});const f=le[t.type];return o?e.jsx(R,{style:r,scroll:a,children:e.jsxs(h.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:[c&&e.jsx(R.Header,{children:c}),e.jsx(R.Contents,{children:e.jsx(f,{...l,yamlNode:t})})]})}):e.jsx(h.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:e.jsx(f,{...l,yamlNode:t})})}function q(n,t,o=!0){if(!n)return e.jsx(e.Fragment,{});const{type:s}=n,r=s&&s in ce?ce[s]:Ap;return e.jsx(r,{yamlNode:n,panel:o},t)}function Un(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new pe(n,Object.keys(r))}class ne extends Error{constructor(o,s){super(o);ee(this,"yamlNode");this.yamlNode=s}}class pe extends ne{constructor(o,s){super(`Unexpected keys: ${s.join(", ")}`,o);ee(this,"keys");this.keys=s}}class Ce extends ne{constructor(o,s){super(`Keys ${s.join(", ")} are missing`,o);ee(this,"keys");this.keys=s}}class T extends ne{constructor(o,s,r){super(`Key ${s} error: ${r}`,o);ee(this,"key");ee(this,"keyMessage");this.key=s,this.keyMessage=r}}function Ep(n){let t=n;for(;t._parentNode;)t=t._parentNode;return t}function kp(n){const t=[];let o=n;for(;o;)t.push({node:o,indexFromParent:o._indexFromParent}),o=o._parentNode;return t.reverse(),t}function Hn(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)=>Hn(a,s,c))}return Object.freeze(s),s}function Pp(n,t,o){if(n&&o===void 0)throw new Ce(n,[t])}function qn(n,t,o){if(typeof o!="string")throw new T(n,t,"A string is expected")}function Bp(n,t,o){if(typeof o!="boolean")throw new T(n,t,"A boolean is expected")}function Gp(n,t,o){if(typeof o!="number")throw new T(n,t,"A number is expected")}function Vp(n,t,o){if(o!==void 0&&typeof o!="boolean")throw new T(n,t,"An optional boolean is expected")}function Wn(n,t,o){if(o!==void 0&&typeof o!="string")throw new T(n,t,"An optional string is expected")}function Lp(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 Up(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 Hp(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 zn(n,t,o){if(o!==void 0&&typeof o!="number")throw new T(n,t,"An optional number is expected")}function qp(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 Wp(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 ve(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new pe(n,Object.keys(r))}function zp(n,t,o){if(o!=="last"&&typeof o!="number")throw new T(n,t,'"last" or a number is expected')}function Kp(n,t,o){if(o!==void 0&&o!=="h5web"&&o!=="plotly")throw new T(n,t,'"h5web" or "plotly" string is expected')}function Yp(n,t,o){if(o!==void 0&&!Array.isArray(o))throw new T(n,t,"A list is expected")}function Qp(n,t,o){if(o!==void 0&&(o===null||typeof o!="object"))throw new T(n,t,"A list is expected")}function Xp(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(f=>typeof f=="string"&&!(f in a));if(c.length>0)throw new pe(n,Object.keys(c.map(f=>`${t}/${f}`)));const l=o;Object.entries(a).forEach(([f,u])=>{typeof f=="string"&&u(n,`${t}/${f}`,l[f])})}const Zp=Object.freeze(Object.defineProperty({__proto__:null,assertBoolean:Bp,assertDataCollectionId:zp,assertKeyExpected:Pp,assertNoUnknownKeys:ve,assertNumber:Gp,assertOptionalArgs:Yp,assertOptionalBackend:Kp,assertOptionalBoolean:Vp,assertOptionalKwargs:Qp,assertOptionalListOfType:Wp,assertOptionalNumber:zn,assertOptionalNumberList:qp,assertOptionalString:Wn,assertOptionalStringList:Hp,assertOptionalStringOrStringList:Up,assertString:qn,assertStringList:Lp,assertStringMappingRecord:Xp},Symbol.toStringTag,{value:"Module"}));function Kn(n){const{providers:t={},yamlNode:o,message:s,...r}=n;return Wn(o,"message",s),ve(o,r),e.jsx(i.Alert,{variant:"warning",className:"mb-0",children:s??"TODO"})}const Z={},Jp={airbearing:it,base:nt,beamviewer:ct,energymanager:dt,frontend:pt,gauge:ht,laser:yt,laserheating:wt,light:Nt,lima:Dt,measurementgroup:At,motor:Lt,multiposition:Wt,optic:Yt,procedure:Zt,pump:rn,pusher:cn,service:un,shutter:nn,tomoconfig:Rn,tomodetector:Nn,tomodetectors:_n,tomoflatmotion:mn,tomoimaging:Tn,tomoreferenceposition:wn,valve:Bn};Object.entries(Jp).forEach(([n,t])=>{Z[n]={...t}});function em(n,t,o){n in Z||(Z[n]={}),t in Z[n]&&console.warn(`Hardware variant ${n}/${t} already existes. Overwrite.`),Z[n][t]=o}function Ue(n,t){if(n in Z){const s=Z[n];if(t in s)return s[t]}const o=Z.base;return t in o?o[t]:null}function tm(n){const{hardware:t,options:o={}}=n,{emptyifnone:s=!1}=o;if(t===null)return s?e.jsx(e.Fragment,{}):e.jsx(M,{state:"NONE",variant:"danger",description:"No hardware"});const{type:r}=t;switch(r){case"missing":return e.jsx(M,{state:"MISSING",variant:"danger",description:"Hardware not available"});case"error":return e.jsx(M,{state:"ERROR",variant:"danger",description:"Error to load the hardware"});case"loading":return e.jsx(M,{state:"LOADING",variant:"warning",description:"The hardware was requested"})}const a=Ue(r,"state");if(!a)return e.jsx($e,{hardware:t});const c={setProperty:(l,f)=>Promise.resolve(),call:(l,...f)=>Promise.resolve()};return e.jsx(a,{hardware:{...t,actions:c},options:{name:t.name},operator:!1,disabled:!1})}function nm(n){const{title:t,children:o,buttons:s,cancelText:r,footer:a=!0,showClose:c=!0,show:l=!1,actions:f={},otherButtons:u,bodyClassName:d,size:p="lg",fullscreen:m}=n,{onShow:g,onClose:w}=f;return e.jsxs(i.Modal,{fullscreen:m,size:p,"aria-labelledby":"modal-title",centered:!0,onShow:g,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:[u&&e.jsx("div",{className:"form-other-buttons",children:u}),s,c&&e.jsx(i.Button,{onClick:w,children:r||"Close"})]})]})}function om(n){return n.condition?n.wrap(n.children):n.children}const sm=h.forwardRef((n,t)=>{const[o,s]=h.useState(!1),{showButton:r=!0}=n,a=h.useRef(null);function c(){s(!1),n.onClose&&n.onClose()}function l(){c()}h.useImperativeHandle(t,()=>({showModal:()=>s(!0),close:()=>l()}));const f=n.modalClass||nm;return e.jsxs(e.Fragment,{children:[r&&e.jsx(om,{condition:n.tooltip,wrap:u=>e.jsx(i.OverlayTrigger,{placement:n.tooltipPlacement||"top",overlay:e.jsx(i.Tooltip,{id:"tooltip1",children:n.tooltip}),children:u}),children:e.jsx(i.Button,{onClick:()=>{s(!0)},...n.buttonProps,ref:a,children:n.button})}),e.jsx(f,{target:a,show:o,actions:{onClose:l},title:n.title,buttons:n.buttons,children:n.children})]})}),rm=sm,Se=(n,t,o)=>{const s={">":(r,a)=>r>a,"<":(r,a)=>r<a,">=":(r,a)=>r>=a,"<=":(r,a)=>r<=a,"==":(r,a)=>r===a,"!=":(r,a)=>r!==a,in:(r,a)=>a.indexOf(r)>-1};if(n in s)return s[n](t,o)};function Yn(n,t,o){const s=n.split(t);return o?[s.slice(0,-o).join(t)].concat(s.slice(-o)):s}function Qn(n){return n===null?null:n.startsWith("$")?n.slice(1):n}function Ye(n){const t=n!==void 0?Yn(n,".",1):[null,""],o=G(Qn(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 im(n){const t=n!==void 0&&!n.includes("."),o=n!==void 0?Yn(n,".",1):[null,""],s=G(Qn(o[0]));if(t)return n;if(s&&s.properties&&o[1]!==null)return`${s.properties[o[1]]}`}function Xn(n){const{monitor:t}=n;let o=Ye(t.value)??"-";const s=im(t.unit),r=Ye(t.overlay),a=Number.parseFloat(`${o}`);Number.isNaN(a)||String(a).length>5&&(o=a.toPrecision(5));function c(){return t.comparator&&t.comparison?Se(t.comparator,o,t.comparison)?"success":"danger":"secondary"}const l=c();Number.isNaN(a)||s!==void 0&&(o=`${o} ${s}`);const f=e.jsxs(oe,{children:[e.jsx("h1",{children:t.name}),e.jsx(i.Badge,{bg:l,children:`${o}`})]});if(r){const u=`${r}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:u.includes(`
|
|
38
|
-
`)?e.jsx("pre",{children:u}):u}),children:f})}return f}function
|
|
39
|
-
`)}const r=Ep(t.yamlNode).name;if(t instanceof pe){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 Ce){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(Zn,{...n})}const Qe={hasError:!1,message:"",error:void 0};class Jn extends h.Component{constructor(o){super(o);ee(this,"reload",()=>{window.location.reload()});this.state=Qe}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o){var s,r;if(o instanceof ne||!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(Qe)}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 ne&&e.jsx(um,{message:this.state.message,error:this.state.error}),!(this.state.error instanceof ne)&&e.jsx(e.Fragment,{children:o?e.jsx(o,{...r}):e.jsx(Zn,{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 fm(n){var o;const t=h.useMemo(()=>Hn(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(Jn,{resetKey:t,unhandledComponentDidCatch:n.unhandledComponentDidCatch,UnhandledErrorComponent:n.UnhandledErrorComponent,children:(o=t.children)==null?void 0:o.map((s,r)=>q(s,r))})})}const eo={hardwareproperty:Xn,hardware:to};function pm(n,t){eo[n]=t}function Re(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 mm(n){const t=P.map(n.monitors,(o,s)=>{const r=o.type??"hardwareproperty",a=eo[r];return a===void 0?e.jsx(Re,{monitor:o,message:`Type ${r} unsupported`},`m${s}`):e.jsx(a,{monitor:o},`m${s}`)});return e.jsx("div",{className:U.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 hm(n){return n===void 0||n===null||typeof n!="string"?null:n.startsWith("$")?n.slice(1):n}function to(n){const{monitor:t}=n,{id:o}=t,s=hm(o),r=G(s),a=te(s);if(o===void 0)return e.jsx(Re,{monitor:t,message:"'id' is missing"});if(typeof o!="string")return e.jsx(Re,{monitor:t,message:"'id' is invalid"});if(r===null)return e.jsx(M,{state:"NONE",variant:"danger",description:`hardware '${o}' was not found`});const{type:c="none"}=r,l={...r,actions:a},f=Ue(c,"monitor");return f?e.jsx(f,{hardware:l,options:{name:t.name},operator:!1,disabled:!1}):e.jsx($e,{hardware:l})}exports.AirBearing=st;exports.AirBearingMocks=Po;exports.AirBearingProtected=rt;exports.AirBearingSimulator=Bo;exports.AirBearingState=Oe;exports.AirBearingVariants=it;exports.BaseInfo=et;exports.BaseMocks=bo;exports.BaseName=Je;exports.BaseProperty=tt;exports.BaseState=Ze;exports.BaseVariants=nt;exports.Beamviewer=at;exports.BeamviewerMocks=Xo;exports.BeamviewerSimulator=Jo;exports.BeamviewerVariants=ct;exports.EnergyManagerDefault=lt;exports.EnergyManagerMocks=fs;exports.EnergyManagerSimulator=ps;exports.EnergyManagerState=Ee;exports.EnergyManagerVariants=dt;exports.ErrorObject=mp;exports.Formatting=ws;exports.Frontend=ft;exports.FrontendMocks=Fs;exports.FrontendVariants=pt;exports.FullSizer=Gn;exports.Gauge=mt;exports.GaugeIndicator=wp;exports.GaugeMocks=Js;exports.GaugeVariants=ht;exports.HardwareInputNumber=fe;exports.HardwareNumericStep=Ie;exports.HardwareSchema=dm;exports.HardwareState=tm;exports.HardwareTemplate=_;exports.HardwareTypes=lm;exports.InfiniteKnob360=kt;exports.KeyError=T;exports.Laser=xt;exports.LaserHeating=jt;exports.LaserHeatingMocks=br;exports.LaserHeatingVariants=yt;exports.LaserMocks=ur;exports.LaserVariants=wt;exports.Light=vt;exports.LightMocks=Rr;exports.LightVariants=Nt;exports.LimaBinning=$t;exports.LimaDefault=bt;exports.LimaDescription=It;exports.LimaImageRoi=Ot;exports.LimaMocks=ki;exports.LimaShape=Mt;exports.LimaSimulator=Pi;exports.LimaSize=_t;exports.LimaState=Q;exports.LimaTransformation=Ct;exports.LimaVariants=Dt;exports.LoadingObject=up;exports.MeasurementGroupDefault=Rt;exports.MeasurementGroupMocks=Ji;exports.MeasurementGroupSimulator=ea;exports.MeasurementGroupVariants=At;exports.MissingComponentObject=gp;exports.MissingKeysError=Ce;exports.MissingObject=pp;exports.MonitorHardware=to;exports.MonitorHardwareProperty=Xn;exports.MonitorPanel=mm;exports.MonitorPanelItem=oe;exports.MotorDefault=re;exports.MotorMocks=pc;exports.MotorRotation=Pt;exports.MotorSimulator=hc;exports.MotorState=he;exports.MotorText=Et;exports.MotorVariants=Lt;exports.MultiState=ot;exports.Multiposition=Ut;exports.MultipositionDefault2=qt;exports.MultipositionMocks=Mc;exports.MultipositionSimulator=Tc;exports.MultipositionVariants=Wt;exports.NoObject=dp;exports.None=Vn;exports.NullObject=xp;exports.NumericStep=gt;exports.OpticDefault=Kt;exports.OpticMocks=zc;exports.OpticSimulator=Kc;exports.OpticState=Pe;exports.OpticVariants=Yt;exports.Panel=R;exports.ProcedureExecution=Qt;exports.ProcedureManage=De;exports.ProcedureMocks=ul;exports.ProcedureState=xe;exports.ProcedureValidate=Xt;exports.ProcedureVariants=Zt;exports.PumpDefault=sn;exports.PumpMocks=yd;exports.PumpVariants=rn;exports.PusherDefault=an;exports.PusherMocks=Rd;exports.PusherSimulator=Ad;exports.PusherState=Ge;exports.PusherVariants=cn;exports.ServiceDefault=ln;exports.ServiceMocks=Kd;exports.ServiceProtected=dn;exports.ServiceState=Me;exports.ServiceVariants=un;exports.ShutterDefault=en;exports.ShutterMocks=Al;exports.ShutterProtected=tn;exports.ShutterSimulator=El;exports.ShutterState=we;exports.ShutterVariants=nn;exports.SlitDefault=on;exports.SlitMocks=cd;exports.SlitState=Be;exports.SlitVariants=Ul;exports.State=M;exports.Synoptic=cm;exports.Todo=Kn;exports.TomoConfigLatencyTime=Dn;exports.TomoConfigVariants=Rn;exports.TomoDetectorAcquisitionMode=vn;exports.TomoDetectorMocks=of;exports.TomoDetectorSamplePixelSize=jn;exports.TomoDetectorState=ye;exports.TomoDetectorVariants=Nn;exports.TomoDetectorsDefault=bn;exports.TomoDetectorsMocks=xf;exports.TomoDetectorsState=Le;exports.TomoDetectorsVariants=_n;exports.TomoFlatMotionDefault=fn;exports.TomoFlatMotionMocks=Du;exports.TomoFlatMotionSimulator=Ru;exports.TomoFlatMotionSmall=pn;exports.TomoFlatMotionState=je;exports.TomoFlatMotionVariants=mn;exports.TomoHoloState=En;exports.TomoHoloVariants=Yf;exports.TomoImagingActions=In;exports.TomoImagingDefault=Sn;exports.TomoImagingExposureTime=$n;exports.TomoImagingMocks=Bf;exports.TomoImagingSettleTime=On;exports.TomoImagingSimulator=Gf;exports.TomoImagingState=se;exports.TomoImagingUpdateMode=Mn;exports.TomoImagingVariants=Tn;exports.TomoReferencePositionDefault=xn;exports.TomoReferencePositionVariants=wn;exports.TomoSampleStageVariants=Lf;exports.TypeIcon=N;exports.ValveDefault=Pn;exports.ValveMocks=cp;exports.ValveVariants=Bn;exports.YAMLErrorBoundary=Jn;exports.YAMLLayout=fm;exports.YamlAsserts=Zp;exports.createMotorMock=mc;exports.dynamicOp=Se;exports.getHardwareVariantComponent=Ue;exports.isLimaHardware=me;exports.isMotorClockWise=Gt;exports.isMotorHardware=Bt;exports.isOpticHardware=kc;exports.isProcedureHardware=Jt;exports.isTomoConfigHardware=An;exports.isTomoDetectorHardware=Ve;exports.isTomoDetectorsHardware=Cn;exports.isTomoFlatMotionHardware=hn;exports.isTomoHoloHardware=kn;exports.isTomoReferencePositionHardware=Au;exports.isTomoSampleStageHardware=Fn;exports.limaGuessSubframes=Ft;exports.motorLimits=Vt;exports.registerHardwareVariant=em;exports.registerMonitorComponent=pm;exports.registerRuntimeHook=qr;exports.registerYamlComponent=Ln;exports.registerYamlComponents=Rp;exports.registerYamlContainer=Dp;exports.renderYamlNode=q;exports.useHardware=G;exports.useHardwareChangeActions=te;exports.useHardwareSchema=Wr;exports.useLimaHardware=Tt;exports.useMotorHardware=L;exports.useMotorStates=ge;exports.useOperator=zr;exports.useProcedureHardware=tl;exports.useScanRunning=Kr;exports.useTomoConfigHardware=Wf;exports.useTomoDetectorHardware=Ku;exports.useTomoDetectorsHardware=cf;exports.useTomoFlatMotionHardware=su;exports.useTomoHoloHardware=Qf;exports.useTomoSampleStageHardware=Uf;exports.yamlComponents=le;exports.yamlContainers=ce;
|
|
36
|
+
`,voltage:6998},Ud="tango",Hd=!0,qd="pump",Wd={callables:Pd,id:Bd,name:Gd,online:Vd,properties:Ld,protocol:Ud,require_staff:Hd,type:qd},zd={default:Wd};function He(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(T,{state:o,minWidth:6,variant:r})}function Kd(n){const{hardware:t}=n;return e.jsx(He,{hardware:t})}function Oe(n){const{text:t,icon:o,leftIcon:s=o,rightIcon:r=o,iconLocation:a="left",onAction:c,onActionChange:l,disabled:f=!1,variant:u,style:d={},className:p=""}=n,[m,g]=h.useState(!1),j=r&&a==="right",x=s&&a==="left";return e.jsx(i.Button,{variant:u,style:d,className:p,onClick:()=>{l==null||l(!0),g(!0),c().finally(()=>{g(!1),l==null||l(!1)})},disabled:f,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,j&&e.jsxs(e.Fragment,{children:[" ",e.jsx("i",{className:m?"fa-solid fa-fw fa-cog fa-spin":r})]})]})})}function Yd(n){const{className:t,hardware:o,options:s={},style:r={},leftToRight:a}=n,{state:c}=o.properties??"OFFLINE",f=!(c==="IN_TOUCH")||n.disabled;function u(d){const{distance:p,style:m}=d;return e.jsx(Oe,{text:`${p}`,style:m,variant:"secondary",onAction:()=>o.actions.call("push",p),disabled:f,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(u,{distance:5,style:{gridColumn:a?3:1,gridRow:1}}),e.jsx(u,{distance:.5,style:{gridColumn:2,gridRow:1}}),e.jsx(u,{distance:.05,style:{gridColumn:a?1:3,gridRow:1}}),e.jsx(u,{distance:2,style:{gridColumn:a?3:1,gridRow:2}}),e.jsx(u,{distance:.2,style:{gridColumn:2,gridRow:2}}),e.jsx(u,{distance:.02,style:{gridColumn:a?1:3,gridRow:2}}),e.jsx(u,{distance:1,style:{gridColumn:a?3:1,gridRow:3}}),e.jsx(u,{distance:.1,style:{gridColumn:2,gridRow:3}}),e.jsx(u,{distance:.01,style:{gridColumn:a?1:3,gridRow:3}})]})}function Qd(n){const{hardware:t,options:o,disabled:s,leftToRight:r}=n,{state:a}=t.properties??"OFFLINE",c=a==="RETRACTED",l=a==="IN_TOUCH",f=a==="LOST",[u,d]=h.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||f?"fas fa-dizzy":"fa fa-smile"} fa-3x my-auto`,style:{gridColumn:r?2:1,gridRow:1}}),e.jsx(Yd,{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(Oe,{text:"In",onAction:()=>t.actions.call("move_in"),onActionChange:g=>{d(g)},disabled:l||s||u,style:{width:"5em"},iconLocation:"left",icon:"fa fa-fw fa-arrow-left"}),e.jsx(Oe,{text:"Out",onAction:()=>t.actions.call("move_out"),onActionChange:g=>{d(g)},disabled:c||s||u,style:{width:"5em"},leftIcon:"fa fa-fw fa-arrow-left",rightIcon:"fa fa-fw fa-arrow-right"}),r&&e.jsx(Oe,{text:"In",onAction:()=>t.actions.call("move_in"),onActionChange:g=>{d(g)},disabled:l||s||u,style:{width:"5em"},iconLocation:"right",icon:"fa fa-fw fa-arrow-right"})]})]})}function jn(n){const{hardware:t,options:o={}}=n,s=(o.orientation??"left-right")==="left-right",r=e.jsx(N,{name:"Pusher",icon:"fa-hand-point-right",online:t.online}),a=e.jsx(He,{hardware:t});function c(){return e.jsx(Qd,{...n,leftToRight:s})}const l=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:c(),headerMode:l})}const Xd={default:jn,state:Kd},yn=Xd,Zd=["move_in","move_out","push","sync_hard"],Jd="pusher",eu="pusher",tu=!0,nu={state:"RETRACTED"},ou="bliss",su=!1,ru="pusher",iu={callables:Zd,id:Jd,name:eu,online:tu,properties:nu,protocol:ou,require_staff:su,type:ru},au={default:iu};function cu(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("RETRACTED");async function c(u,d){if(u==="move_in"){a("MOVING_IN"),await V(2e3),a("IN_TOUCH");return}if(u==="move_out"){a("MOVING_OUT"),await V(2e3),a("RETRACTED");return}if(u==="push"){await V(100);return}console.log("PusherSimulator: Unsupported call",u,d)}async function l(u,d){console.log("PusherSimulator: Unsupported setProperty",u,d)}const f={state:r};return e.jsx(q,{name:t,alias:o,type:"pusher",call:c,setProperty:l,properties:f,useHardwareContext:s})}function De(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(T,{state:o,minWidth:6,variant:r})}function lu(n){const{hardware:t}=n;return e.jsx(De,{hardware:t})}function vn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(De,{hardware:t});function a(){t.actions.call("start")}function c(){t.actions.call("restart")}function l(){t.actions.call("stop")}function f(){return t.properties?t.properties.state:"UNKNOWN"}function u(b){return b.charAt(0).toUpperCase()+b.slice(1).toLowerCase()}const d=f(),p=u(d),g={STOPPED:"danger",STARTING:"transient",RUNNING:"success",BACKOFF:"warning",STOPPING:"transient",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"secondary",OFFLINE:"secondary"}[d]||"danger";function j(){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 w=j(),y=x(),_=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(B,{variant:g,className:"text-center",style:{minWidth:"8em"},value:p}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${w.variant}`,onClick:w.callback,disabled:w.disabled,title:w.title,children:e.jsx("i",{className:`${w.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(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:_,headerMode:$})}function du(n){var f;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=((f=t.properties)==null?void 0:f.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 Nn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(De,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(g){return g.charAt(0).toUpperCase()+g.slice(1).toLowerCase()}const l=a(),u={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:u,style:{minWidth:"10em"},value:d,className:"text-center"}),e.jsx(du,{...n})]}),m=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:p,headerMode:m})}const uu={default:vn,protected:Nn,state:lu},bn=uu,fu=["start","stop","restart"],pu="service1",mu="service1",hu=!0,gu={state:"RUNNING"},xu="multivisor",wu=!0,ju="service",yu={callables:fu,id:pu,name:mu,online:hu,properties:gu,protocol:xu,require_staff:wu,type:ju},vu={default:yu};function ve(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(T,{state:o,minWidth:6,variant:r,description:a})}function Nu(n){const{hardware:t}=n;return e.jsx(ve,{hardware:t})}function bu(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 _u(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 Su(n){const{motion:t,actions:o,axisRef:s,disabled:r}=n,a=h.useMemo(()=>{for(const d of t)if(d.axisRef===s)return!0;return!1},[t,s]),c=s.slice(9),l=U(c),f=(l==null?void 0:l.alias)??(l==null?void 0:l.name)??(l==null?void 0:l.id)??c;function u(){o.call("update_axis",{axis_ref:s,relative_position:0})}return e.jsx(i.Button,{className:"ms-1",variant:a?"primary":"secondary",onClick:()=>{a||u()},title:a?"This axis is already part of the motion":"Use this axis in the motion",disabled:r,children:f})}function Cu(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),f=h.useRef(null),[u,d]=h.useState(!1),p=3,m=((x=c==null?void 0:c.properties)==null?void 0:x.unit)??"";function g(w){if(!f||!f.current)console.log("formRef not yet defined");else if(w.key==="Enter"){d(!1);const y=Number.parseFloat(f.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 w.key==="Escape"?(f.current.value=r.toFixed(p),d(!1)):console.log(w.key)}function j(w){const{value:y}=w.target;if(y===void 0)return;const _=Number.parseFloat(y);_!==r&&!u&&d(!0),_===r&&u&&d(!1)}return h.useEffect(()=>{!f||!f.current?console.log("formRef not yet defined"):u||(f.current.value=r.toFixed(p))},[u,r]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:u?"form-control-edited":"",type:"number",ref:f,defaultValue:r.toFixed(p),onChange:j,disabled:l,onKeyDown:g}),e.jsx(i.InputGroup.Text,{children:m})]})}function $u(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 _n(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,a=On(t),c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(ve,{hardware:t}),f=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(Su,{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(h.Fragment,{children:[e.jsx(bu,{motion:d}),e.jsx($u,{motion:d,actions:t.actions,disabled:s||!a}),e.jsx(Cu,{motion:d,actions:t.actions,disabled:s||!a}),e.jsx(_u,{motion:d,actions:t.actions,disabled:s||!a})]},`motion${p}`))]})})]})]}),u=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:f,headerMode:u})}function Ou(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),f=h.useRef(null),[u,d]=h.useState(!1),p=3,m=((b=c==null?void 0:c.properties)==null?void 0:b.unit)??"",g=(c==null?void 0:c.alias)??(c==null?void 0:c.name)??(c==null?void 0:c.id)??"none";function j(v){if(!f||!f.current)console.log("formRef not yet defined");else if(v.key==="Enter"){d(!1);const C=Number.parseFloat(f.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"?(f.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&&!u&&d(!0),I===r&&u&&d(!1)}h.useEffect(()=>{!f||!f.current?console.log("formRef not yet defined"):u||(f.current.value=r.toFixed(p))},[u,r]);function w(){return t.absolute_position!==null?["ABS","warning","Absolute displacement"]:t.relative_position!==null?["REL","none","Relative displacement"]:["ERR","danger","Unknown motion kind"]}const[y,_,$]=w();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:g}),e.jsx(i.InputGroup.Text,{className:`bg-${_}`,title:$,style:{width:"3em"},children:y}),e.jsx(i.Form.Control,{className:u?"form-control-edited":"",type:"number",ref:f,defaultValue:r.toFixed(p),onChange:x,disabled:l,onKeyDown:j}),e.jsx(i.InputGroup.Text,{children:m})]})}function Sn(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r={}}=t,a=On(t),c=e.jsx(N,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),l=e.jsx(ve,{hardware:t}),f=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(Ou,{actions:t.actions,motion:d,disabled:s||!a},d.axisRef))})]}),u=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:f,headerMode:u})}function Iu(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(ve,{hardware:t}),f=a==="IN",u=a==="OUT";function d(){return f?"1 / 3":u?"3 / 5":"2 / 4"}const p=d(),m=f?"fa-face-grin-beam-sweat":"fa-smile",g=f?"The sample is in front of the beam":u?"The sample is out of the beam":"",j=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:g})}),x=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:j,headerMode:x})}const Mu={default:_n,small:Sn,state:Nu,sample_location:Iu},Cn=Mu;function $n(n){return n.type==="tomoflatmotion"}function Tu(n){const t=G(n);return t===null||!$n(t)?null:t}function On(n){const{properties:t={}}=n,{state:o="UNKNOWN"}=t;return["IN","READY"].includes(o)}const Fu="tomoflatmotion",Du="tomoflatmotion",Ru=!0,Au={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}]},Eu="bliss",ku=!1,Pu="tomoflatmotion",Bu={id:Fu,name:Du,online:Ru,properties:Au,protocol:Eu,require_staff:ku,type:Pu},Gu=["move","stop","wait","rmove"],Vu="sy",Lu="sy",Uu=!0,Hu={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},qu="bliss",Wu=!1,zu="motor",Ku=[],Yu={callables:Gu,id:Vu,name:Lu,online:Uu,properties:Hu,protocol:qu,require_staff:Wu,type:zu,user_tags:Ku},Qu=["move","stop","wait","rmove"],Xu="sy2",Zu="sy2",Ju=!0,ef={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},tf="bliss",nf=!1,of="motor",sf=[],rf={callables:Qu,id:Xu,name:Zu,online:Ju,properties:ef,protocol:tf,require_staff:nf,type:of,user_tags:sf},af={default:Bu,sy:Yu,sy2:rf};function cf(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.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(u,d){const p=[];let m=!1;return u.motion.forEach(g=>{if(g.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(g)}),m||p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null}),{...u,motion:p}}async function l(u,d){if(u==="update_axis"){a(p=>c(p,d));return}console.log("TomoFlatMotionSimulator: Unsupported call",u,d)}async function f(u,d){console.log("TomoFlatMotionSimulator: Unsupported setProperty",u,d)}return e.jsx(q,{name:t,alias:o,type:"tomoflatmotion",call:l,setProperty:f,properties:r,useHardwareContext:s})}function In(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r}=t,{label:a}=o,[c,l]=h.useState(void 0),[f,u]=h.useState(!1),d=e.jsx(N,{name:"TomoReferencePositionSchema",icon:"fam-hardware-motor",online:t.online});function p(x){l(void 0),u(!0),r.call("move_to_reference").catch(w=>{l(`${w}`)}).finally(()=>{u(!1)})}const m=e.jsx(e.Fragment,{}),g=e.jsxs(i.Button,{onClick:p,variant:c===void 0?"secondary":"danger",disabled:s||f,className:"w-100",children:[c&&e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-1",title:c}),!c&&f&&e.jsx("i",{className:"fa-solid fa-cog fa-spin me-1"}),a??"Back to reference position"]}),j=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:d,widgetState:m,widgetContent:g,headerMode:j})}function lf(n){return n.type==="tomoreferenceposition"}const df={default:In},Mn=df;function Ne(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(T,{state:r,minWidth:6,variant:c})}function uf(n){const{hardware:t}=n;return e.jsx(Ne,{hardware:t})}function ff(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 pf(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(pe,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.sample_pixel_size_mode!=="USER"})}function mf(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(ff,{...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(pf,{...n}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function hf(n,t,o){return h.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=it.default(n,t);return[r(a.to(o).scalar),s(o)]},[n,t,o])}function Tn(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(Ne,{hardware:t}),[c,l]=hf(t.properties.sample_pixel_size,"um",s),f=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(mf,{...n})]}),u=n.options?n.options.header:"top";return e.jsx(S,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:f,headerMode:u})}function ce(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 ce(n*r,"mm",o,void 0)}return Number.NaN}if(o==="px"){if(s!==void 0){const r=ce(n,t,"mm",void 0),a=s.to("mm").scalar;return r/a}return Number.NaN}try{return it.default(n,t).to(o).scalar}catch{return console.error(`Convertion ${t}->${o} is not provided`),Number.NaN}}function Fn(n){return n.startsWith("u")?`μ${n.slice(1)}`:n}function ae(n){return!n||!n.startsWith("hardware:")?null:n.slice(9)}function gf(n){const{hardware:t,options:o={}}=n,{properties:s={}}=t,{sample_pixel_size:r,detector:a=null}=s,c=Gt(ae(a)),{properties:l={}}=c??{},{size:f}=l,u=o.display_unit??"mm",d=o.digits??3,p=e.jsx(N,{name:"TomoDetector",icon:"fa-eye",online:t.online}),m=e.jsx(Ne,{hardware:t}),g=h.useMemo(()=>{if(r==null||f===null||f===void 0)return"∅";const w=ce(f[0]*r,"um",u),y=ce(f[1]*r,"um",u);return`${w.toFixed(d)} × ${y.toFixed(d)}`},[r,f,u,d]),j=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:g}),e.jsx(i.InputGroup.Text,{children:Fn(u)})]}),x=n.options?n.options.header:"top";return e.jsx(S,{hardware:t,widgetIcon:p,widgetState:m,widgetContent:j,headerMode:x})}function xf(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 wf(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(pe,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.state!=="READY"})}function jf(n){const t=G(n);return t!==null&&ge(t)?t:null}function yf(n){var c;const{hardware:t}=n,{properties:o}=t,s=((c=o.detector)==null?void 0:c.slice(9))??"",r=jf(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(xf,{...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(wf,{hardware:r,actions:a}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function Dn(n){const{hardware:t}=n,o=e.jsx(N,{name:"TomoDetector",icon:"fa-cog",online:t.online}),s=e.jsx(Ne,{hardware:t}),r=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(B,{value:t.properties.acq_mode}),e.jsx(yf,{...n})]}),a=n.options?n.options.header:"top";return e.jsx(S,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:r,headerMode:a})}const vf={samplepixelsize:Tn,acquisitionmode:Dn,fieldofview:gf,state:uf},Rn=vf;function qe(n){return n.type==="tomodetector"}function Nf(n){const t=G(n);return t===null||!qe(t)?null:t}const bf="tomodet1",_f="tomodet1",Sf=!0,Cf={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"},$f="bliss",Of=!1,If="tomodetector",Mf={id:bf,name:_f,online:Sf,properties:Cf,protocol:$f,require_staff:Of,type:If},Tf={default:Mf};function We(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(T,{state:o,minWidth:6,variant:r})}function Ff(n){const{hardware:t}=n;return e.jsx(We,{hardware:t})}function Df(n){const{hardware:t}=n,{properties:o}=t,{detectors:s}=o,r=ae(o.active_detector),a=ae(o.target_detector),c=o.state==="READY",l=n.disabled||!t.online||!c;function f(d){t.actions?t.actions.call("mount",d):console.error("Change request was triggered with:",d)}function u(d){const p=ae(d),g=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:()=>{f(p)},children:[e.jsx("i",{className:g})," ",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=>u(d))})]})}function An(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"Optic",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(We,{hardware:t}),{properties:a}=t,c=a.state==="MOUNTING",l=ae(a.active_detector),f=ae(a.target_detector);function u(){return e.jsxs(i.InputGroup,{children:[e.jsx(B,{className:H.default({"hw-moving":c}),value:f||l||"No detector"}),e.jsx(Df,{...n})]})}const d=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:u(),headerMode:d})}const Rf={default:An,state:Ff},En=Rf;function kn(n){return n.type==="tomodetectors"}function Af(n){const t=G(n);return t===null||!kn(t)?null:t}const Ef="tomodetectors",kf="tomodetectors",Pf=!0,Bf={state:"READY",active_detector:"hardware:limadetector1",detectors:["hardware:limadetector1","hardware:limadetector2","hardware:limadetector3"]},Gf="bliss",Vf=!1,Lf="optic",Uf={id:Ef,name:kf,online:Pf,properties:Bf,protocol:Gf,require_staff:Vf,type:Lf},Hf={default:Uf};function re(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(T,{state:o,minWidth:6,variant:r})}function qf(n){const{hardware:t}=n;return e.jsx(re,{hardware:t})}function Wf(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 zf(n){const{hardware:t}=n,o=t.properties.exposure_time??0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=2;function f(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 u(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 h.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:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Kf(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 Pn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(re,{hardware:t}),a=e.jsxs(i.Container,{children:[e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Wf,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(zf,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Kf,{hardware:t,disabled:n.disabled})})})]}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Yf(n){const{style:t,className:o,value:s,decimals:r=2,allowNullAsEmpty:a=!1,disabled:c=!1}=n,[l,f]=h.useState(void 0),u=l!==void 0,d=h.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=h.useCallback(y=>y===null||d===void 0?null:ce(y,d,n.unit,n.pixelSize),[n.unit,d,n.pixelSize]),m=h.useCallback(y=>y===null||d===void 0?null:ce(y,n.unit,d,n.pixelSize),[n.unit,d,n.pixelSize]);function g(y){return(y??"")===""?null:Number.parseFloat(y)}function j(){var $;if(l===void 0||!a&&l==="")return;let y;try{y=g(l)}catch{return}const _=p(y);($=n.onAccepted)==null||$.call(n,_),f(void 0)}function x(){var y;l!==void 0&&((y=n.onAborted)==null||y.call(n),f(void 0))}const w=h.useMemo(()=>{const y=m(s);return y===null?"":y.toFixed(r)},[s]);return e.jsx(i.Form.Control,{value:l??w??void 0,className:o,step:n.step,type:"number",style:{...t,backgroundColor:u?"#FFFF80":void 0},disabled:c,onChange:y=>{f(y.target.value)},onBlur:()=>{x()},onKeyDown:y=>/^[ a-z]$/i.test(y.key)?(y.preventDefault(),!1):(y.stopPropagation(),y.key==="Enter"?j():y.key==="Escape"&&x(),!0)})}function Qf(n){const{onAccepted:t,...o}=n;return e.jsx(Yf,{...o,allowNullAsEmpty:!1,onAccepted:t})}function Xf(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(Qf,{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:Fn(a)})]})}function Zf(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(!ge(o)||!qe(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]=Vt(t,r);return e.jsxs("div",{className:"text-center",title:"Decompisiton of the accumulation",children:[c," × ",l.toFixed(3)]})}function Bn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(re,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Xf,{hardware:t,disabled:n.disabled,options:o}),e.jsx(Zf,{exposureTime:t.properties.exposure_time})]}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Jf(n){const{hardware:t}=n,o=t.properties.settle_time||0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(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 u(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 h.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:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Gn(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(re,{hardware:t}),a=e.jsx(Jf,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Re(n){const[t,o]=h.useState(!1),[s,r]=h.useState(void 0),{text:a,disabled:c,onAction:l,onStarted:f,onTerminated:u,title:d}=n;function p(m){f==null||f(),r(void 0),o(!0),l().catch(g=>{r(`${g}`)}).finally(()=>{o(!1),u==null||u()})}return e.jsxs(i.Button,{onClick:p,disabled:c||t,variant:s===void 0?"primary":"danger",className:H.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 ep(){const n=G("ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector");return n===null||!ge(n)?null:n}function tp(n){const{hardware:t,restoreSample:o}=n,[s,r]=h.useState(!1),a=n.disabled||!t.online||s,c=ep(),l=(c==null?void 0:c.properties.state)==="OFFLINE";function f(){r(!0)}function u(){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(Re,{onAction:d,onStarted:f,onTerminated:u,disabled:a||l,text:"Proj",title:"Take a projection"}),e.jsx(Re,{onAction:m,onStarted:f,onTerminated:u,disabled:a||l,text:"Flat",title:"Take a flat"}),e.jsx(Re,{onAction:p,onStarted:f,onTerminated:u,disabled:a||l,text:"Dark",title:"Take a dark"})]})}function Vn(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(re,{hardware:t}),c=e.jsx(tp,{hardware:t,disabled:n.disabled,restoreSample:s}),l=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:c,headerMode:l})}function np(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 Ln(n){const{hardware:t,options:o={}}=n,s=e.jsx(N,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(re,{hardware:t}),a=e.jsx(np,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const op={default:Pn,exposuretime:Bn,settletime:Gn,actions:Vn,updatemode:Ln,state:qf},Un=op,sp="tomoimaging",rp="tomoimaging",ip=!0,ap={state:"READY",update_on_move:!1,exposure_time:1},cp="bliss",lp=!1,dp="optic",up={id:sp,name:rp,online:ip,properties:ap,protocol:cp,require_staff:lp,type:dp},fp={default:up};function pp(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState({state:"READY",update_on_move:!0,exposure_time:1,settle_time:0});function c(u){a(d=>({...d,state:u}))}async function l(u,d){if(u==="take_dark"){c("ACQUIRING"),await V(2e3),c("READY");return}if(u==="take_flat"){c("ACQUIRING"),await V(2e3),c("READY");return}if(u==="take_proj"){c("ACQUIRING"),await V(2e3),c("READY");return}console.log("TomoImagingSimulator: Unsupported call",u,d)}async function f(u,d){a(p=>({...p,[u]:d}))}return e.jsx(q,{name:t,alias:o,type:"tomoimaging",call:l,setProperty:f,properties:r,useHardwareContext:s})}const mp={},hp=mp;function Hn(n){return n.type==="tomosamplestage"}function gp(n){const t=G(n);return t===null||!Hn(t)?null:t}function xp(n){const{hardware:t}=n,o=t.properties.latency_time||0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(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 u(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 h.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:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function qn(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(xp,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(S,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const wp={latencytime:qn},Wn=wp;function zn(n){return n.type==="tomoconfig"}function jp(n){const t=G(n);return t===null||!zn(t)?null:t}function Kn(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(T,{state:o,minWidth:6,variant:r})}function yp(n){const{hardware:t}=n;return e.jsx(Kn,{hardware:t})}const vp={state:yp},Np=vp;function Yn(n){return n.type==="tomoholo"}function bp(n){const t=G(n);return t===null||!Yn(t)?null:t}function _p(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 Qn(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(_p,{...n})]})})]})}const Sp={default:Qn},Xn=Sp,Cp=["close","reset","open"],$p="rv12",Op="rv12",Ip=!0,Mp={state:"CLOSED",status:`Pneumatic is closed
|
|
37
|
+
`},Tp="tango",Fp=!1,Dp="valve",Rp={callables:Cp,id:$p,name:Op,online:Ip,properties:Mp,protocol:Tp,require_staff:Fp,type:Dp},Ap={default:Rp},Ep=Pe.default("daiquiri.components.hardware.NoObject");function kp(n){if(n.options.emptyifnone)return Ep('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(S,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Pp(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(S,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}const Bp=Pe.default("daiquiri.components.hardware.MissingObject");function Gp(n){if(n.options.emptyifnone)return Bp('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(S,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Vp(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(S,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const Lp=Pe.default("daiquiri.components.hardware.MissingComponentObject");function Up(n){const{options:t}=n,{variant:o="default"}=t;if(t.emptyifnone)return Lp('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(S,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Hp(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(S,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Zn(n){const[t,o]=h.useState({}),s=h.useRef(null);return h.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 qp(n){const{size:t,value:o,min:s,max:r,lowWarning:a,hiWarning:c,lowDanger:l,hiDanger:f}=n;function u(w){return w===null?null:(w-s)/(r-s)}const d=h.useMemo(()=>{const w=l===void 0?void 0:u(l),y=f===void 0?void 0:u(f),_=a===void 0?void 0:u(a),$=c===void 0?void 0:u(c);return{lowPercentDanger:w,hiPercentDanger:y,lowPercentWarning:_,hiPercentWarning:$}},[s,r,a,c,l,f]),p=h.useMemo(()=>o===null?"value":l!==void 0&&o<=l||f!==void 0&&o>=f?"value value-danger":a!==void 0&&o<=a||c!==void 0&&o>=c?"value value-warning":"value",[o,l,f,a,c]),m=t/2-15,g=t/10,j=t/10*3;function x(w){return g+(j-g)*w}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:u(o),width:10,height:t/2-15,radius:2,type:"triangle",color:"black"}),e.jsx(E.Value,{className:p,value:o})]})}function Wp(n){return e.jsx("div",{className:"panel-header",style:n.style,children:n.children})}function zp(n){return e.jsx("div",{className:`panel-contents ${n.className}`,style:n.style,children:n.children})}function R(n){const t=n.scroll?Zn:h.Fragment;return e.jsx("div",{className:`panel ${n.className??""}`,style:n.style,children:e.jsx(t,{children:n.children})})}R.Header=Wp;R.Contents=zp;function Jn(n){return e.jsx(e.Fragment,{})}function Kp(n){const{providers:t={},yamlNode:o,label:s,...r}=n;return oo(o,"label",s),be(o,r),e.jsx("div",{children:s})}function Yp({yamlNode:n,panel:t}){const{type:o,style:s,children:r,...a}=n;return be(n,a),e.jsx(i.Row,{className:"ymllayout-row gx-0",style:s,children:P.map(r,(c,l)=>z(c,l,t))})}function Qp({yamlNode:n,panel:t}){const{type:o,style:s,xs:r,children:a,...c}=n;return be(n,c),ro(n,"xs",r),e.jsx(i.Col,{className:H.default("yamymllayout-col",{col:!!r}),style:s,xs:r,children:P.map(n.children,(l,f)=>z(l,f,t))})}function Xp({yamlNode:n,panel:t}){const o=n.options||{};return e.jsx(i.Container,{className:"ymllayout-container",...o,children:P.map(n.children,(s,r)=>z(s,r,t))})}function Zp(n){const{yamlNode:t}=n,o=t.options||{},s={};return o.centerContent&&(s.margin="auto"),e.jsxs(R,{className:"ymllayout-panel",...o,children:[t.title&&e.jsx(R.Header,{children:t.title}),e.jsx(R.Contents,{style:s,children:P.map(t.children,(r,a)=>z(r,a,!1))})]})}const Jp=()=>Math.random().toString(36).slice(2,15)+Math.random().toString(36).slice(2,15);function em({yamlNode:n,panel:t}){const o=[];return P.each(n.children,(s,r)=>{o.push(e.jsx(i.Tab,{eventKey:Jp(),title:s.title,children:z(s,0,!1)},r))}),t?e.jsxs(R,{className:"ymllayout-tabs",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 tm(n){const{node:t}=n,{type:o,title:s,...r}=t;return to(t,r),e.jsx("div",{className:"ymllayout-form-header",style:{gridColumn:"1 / 3"},children:e.jsx("h3",{children:s})})}function nm(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 f=a(),u={_parentNode:t._parentNode,_indexFromParent:t._indexFromParent,type:"hardware",id:f,variant:"name",emptyifnone:!0};return z(u,"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 om(n){const{node:t,row:o}=n,{titlealign:s,title:r,stateinheader:a=!1,variant:c,id:l,...f}=t;let u,d;if(f.type==="hardware")if(u={...f,id:l,variant:c},a){const p={...f,id:l,variant:"state",emptyifnone:!0};d=z(p,"k",!1)}else d=null;else u=f,d=null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{gridColumn:1,alignSelf:s??"center"},children:e.jsx(nm,{node:t,state:d,row:o})}),e.jsx("div",{style:{gridColumn:2,alignSelf:"center",overflow:"auto"},children:z(u,"k",!1)})]})}function sm(n){const{yamlNode:t,panel:o}=n,{type:s,children:r,options:a={},title:c,...l}=t;return to(t,l),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"},children:P.map(r,(f,u)=>f.type==="formheader"?e.jsx(tm,{node:f,row:u},u):f.type==="none"?e.jsx(So.default.Fragment,{},u):e.jsx(om,{node:f,row:u},u))})})]})}function rm(n){const{yamlNode:t,panel:o}=n;return e.jsx("div",{className:"ymllayout-grid",style:{gridTemplateColumns:t.columns,gridTemplateRows:t.rows},children:P.map(t.children,(s,r)=>{const{columnSpan:a=1,rowSpan:c=1,...l}=s,f=a>1?`span ${a}`:void 0,u=c>1?`span ${c}`:void 0;return e.jsx("div",{className:"ymllayout-grid-cell",style:{gridColumn:f,gridRow:u},children:z(l,r,o)},r)})})}const le={row:Yp,col:Qp,container:Xp,panel:Zp,tabs:em,form:sm,grid:rm};function im(n,t){de[n]&&console.warn(`yaml registration: The type ${n} is already a component. The component will not be reachable anymore.`),le[n]&&console.warn(`yaml registration: The type ${n} is already a container. The previous container will be dropped.`),le[n]=t}const de={todo:io,none:Jn,label:Kp};function eo(n,t){de[n]&&console.warn(`yaml registration: The type ${n} is already a component. The previous component will be dropped.`),le[n]&&console.warn(`yaml registration: The type ${n} is already a container. This component will not be used.`),de[n]=t}function am(n){Object.entries(n).forEach(([t,o])=>eo(t,o))}function cm(n){const{yamlNode:t,panel:o}=n,{type:s,style:r,scroll:a,title:c,...l}=t;if(!(s in de))return e.jsx(R,{children:e.jsx(R.Contents,{children:e.jsxs(i.Alert,{variant:"warning",children:['Unknown component "',s,'"']})})});const f=de[t.type];return o?e.jsx(R,{style:r,scroll:a,children:e.jsxs(h.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:[c&&e.jsx(R.Header,{children:c}),e.jsx(R.Contents,{children:e.jsx(f,{...l,yamlNode:t})})]})}):e.jsx(h.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:e.jsx(f,{...l,yamlNode:t})})}function z(n,t,o=!0){if(!n)return e.jsx(e.Fragment,{});const{type:s}=n,r=s&&s in le?le[s]:cm;return e.jsx(r,{yamlNode:n,panel:o},t)}function to(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new me(n,Object.keys(r))}class se extends Error{constructor(o,s){super(o);ne(this,"yamlNode");this.yamlNode=s}}class me extends se{constructor(o,s){super(`Unexpected keys: ${s.join(", ")}`,o);ne(this,"keys");this.keys=s}}class Ie extends se{constructor(o,s){super(`Keys ${s.join(", ")} are missing`,o);ne(this,"keys");this.keys=s}}class F 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 lm(n){let t=n;for(;t._parentNode;)t=t._parentNode;return t}function dm(n){const t=[];let o=n;for(;o;)t.push({node:o,indexFromParent:o._indexFromParent}),o=o._parentNode;return t.reverse(),t}function no(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)=>no(a,s,c))}return Object.freeze(s),s}function um(n,t,o){if(n&&o===void 0)throw new Ie(n,[t])}function oo(n,t,o){if(typeof o!="string")throw new F(n,t,"A string is expected")}function fm(n,t,o){if(typeof o!="boolean")throw new F(n,t,"A boolean is expected")}function pm(n,t,o){if(typeof o!="number")throw new F(n,t,"A number is expected")}function mm(n,t,o){if(o!==void 0&&typeof o!="boolean")throw new F(n,t,"An optional boolean is expected")}function so(n,t,o){if(o!==void 0&&typeof o!="string")throw new F(n,t,"An optional string is expected")}function hm(n,t,o){if(!Array.isArray(o))throw new F(n,t,"A list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new F(n,t,"A list of string is expected")})}function gm(n,t,o){if(o!==void 0&&typeof o!="string"){if(!Array.isArray(o))throw new F(n,t,"An optional string or list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new F(n,t,"An optional string or list of string is expected")})}}function xm(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new F(n,t,"An optional list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new F(n,t,"A optional list of string is expected")})}}function ro(n,t,o){if(o!==void 0&&typeof o!="number")throw new F(n,t,"An optional number is expected")}function wm(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new F(n,t,"An optional list of numbers is expected");o.forEach(s=>{if(typeof s!="number")throw new F(n,t,"An optional list of numbers is expected")})}}function jm(n,t,o,s,r){if(o!==void 0){if(!Array.isArray(o))throw new F(n,t,`An optional list of ${r} is expected`);o.forEach(a=>{if(!s(a))throw new F(n,t,`An optional list of type ${r} is expected`)})}}function be(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new me(n,Object.keys(r))}function ym(n,t,o){if(o!=="last"&&typeof o!="number")throw new F(n,t,'"last" or a number is expected')}function vm(n,t,o){if(o!==void 0&&o!=="h5web"&&o!=="plotly")throw new F(n,t,'"h5web" or "plotly" string is expected')}function Nm(n,t,o){if(o!==void 0&&!Array.isArray(o))throw new F(n,t,"A list is expected")}function bm(n,t,o){if(o!==void 0&&(o===null||typeof o!="object"))throw new F(n,t,"A list is expected")}function _m(n,t,o,s){const{optional:r,schema:a}=s;if(r&&o===void 0)return;if(!o||typeof o!="object")throw new F(n,t,"A mapping is expected");const c=Object.keys(o).filter(f=>typeof f=="string"&&!(f in a));if(c.length>0)throw new me(n,Object.keys(c.map(f=>`${t}/${f}`)));const l=o;Object.entries(a).forEach(([f,u])=>{typeof f=="string"&&u(n,`${t}/${f}`,l[f])})}const Sm=Object.freeze(Object.defineProperty({__proto__:null,assertBoolean:fm,assertDataCollectionId:ym,assertKeyExpected:um,assertNoUnknownKeys:be,assertNumber:pm,assertOptionalArgs:Nm,assertOptionalBackend:vm,assertOptionalBoolean:mm,assertOptionalKwargs:bm,assertOptionalListOfType:jm,assertOptionalNumber:ro,assertOptionalNumberList:wm,assertOptionalString:so,assertOptionalStringList:xm,assertOptionalStringOrStringList:gm,assertString:oo,assertStringList:hm,assertStringMappingRecord:_m},Symbol.toStringTag,{value:"Module"}));function io(n){const{providers:t={},yamlNode:o,message:s,...r}=n;return so(o,"message",s),be(o,r),e.jsx(i.Alert,{variant:"warning",className:"mb-0",children:s??"TODO"})}const J={},Cm={airbearing:ht,base:ut,beamviewer:xt,energymanager:jt,frontend:Nt,gauge:_t,laser:It,laserheating:$t,light:Tt,lima:Lt,measurementgroup:Ht,motor:Xt,multiposition:tn,optic:sn,procedure:cn,pump:wn,pusher:yn,regulation:fn,service:bn,shutter:hn,tomoconfig:Wn,tomodetector:Rn,tomodetectors:En,tomoflatmotion:Cn,tomoimaging:Un,tomoreferenceposition:Mn,valve:Xn};Object.entries(Cm).forEach(([n,t])=>{J[n]={...t}});function $m(n,t,o){n in J||(J[n]={}),t in J[n]&&console.warn(`Hardware variant ${n}/${t} already existes. Overwrite.`),J[n][t]=o}function ze(n,t){if(n in J){const s=J[n];if(t in s)return s[t]}const o=J.base;return t in o?o[t]:null}function Om(n){const{hardware:t,options:o={}}=n,{emptyifnone:s=!1}=o;if(t===null)return s?e.jsx(e.Fragment,{}):e.jsx(T,{state:"NONE",variant:"danger",description:"No hardware"});const{type:r}=t;switch(r){case"missing":return e.jsx(T,{state:"MISSING",variant:"danger",description:"Hardware not available"});case"error":return e.jsx(T,{state:"ERROR",variant:"danger",description:"Error to load the hardware"});case"loading":return e.jsx(T,{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,f)=>Promise.resolve(),call:(l,...f)=>Promise.resolve()};return e.jsx(a,{hardware:{...t,actions:c},options:{name:t.name},operator:!1,disabled:!1})}function Im(n){const{title:t,children:o,buttons:s,cancelText:r,footer:a=!0,showClose:c=!0,show:l=!1,actions:f={},otherButtons:u,bodyClassName:d,size:p="lg",fullscreen:m}=n,{onShow:g,onClose:j}=f;return e.jsxs(i.Modal,{fullscreen:m,size:p,"aria-labelledby":"modal-title",centered:!0,onShow:g,onHide:j,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:[u&&e.jsx("div",{className:"form-other-buttons",children:u}),s,c&&e.jsx(i.Button,{onClick:j,children:r||"Close"})]})]})}function Mm(n){return n.condition?n.wrap(n.children):n.children}const Tm=h.forwardRef((n,t)=>{const[o,s]=h.useState(!1),{showButton:r=!0}=n,a=h.useRef(null);function c(){s(!1),n.onClose&&n.onClose()}function l(){c()}h.useImperativeHandle(t,()=>({showModal:()=>s(!0),close:()=>l()}));const f=n.modalClass||Im;return e.jsxs(e.Fragment,{children:[r&&e.jsx(Mm,{condition:n.tooltip,wrap:u=>e.jsx(i.OverlayTrigger,{placement:n.tooltipPlacement||"top",overlay:e.jsx(i.Tooltip,{id:"tooltip1",children:n.tooltip}),children:u}),children:e.jsx(i.Button,{onClick:()=>{s(!0)},...n.buttonProps,ref:a,children:n.button})}),e.jsx(f,{target:a,show:o,actions:{onClose:l},title:n.title,buttons:n.buttons,children:n.children})]})}),Fm=Tm,Me=(n,t,o)=>{const s={">":(r,a)=>r>a,"<":(r,a)=>r<a,">=":(r,a)=>r>=a,"<=":(r,a)=>r<=a,"==":(r,a)=>r===a,"!=":(r,a)=>r!==a,in:(r,a)=>a.indexOf(r)>-1};if(n in s)return s[n](t,o)};function ao(n,t,o){const s=n.split(t);return o?[s.slice(0,-o).join(t)].concat(s.slice(-o)):s}function co(n){return n===null?null:n.startsWith("$")?n.slice(1):n}function st(n){const t=n!==void 0?ao(n,".",1):[null,""],o=G(co(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 Dm(n){const t=n!==void 0&&!n.includes("."),o=n!==void 0?ao(n,".",1):[null,""],s=G(co(o[0]));if(t)return n;if(s&&s.properties&&o[1]!==null)return`${s.properties[o[1]]}`}function lo(n){const{monitor:t}=n;let o=st(t.value)??"-";const s=Dm(t.unit),r=st(t.overlay),a=Number.parseFloat(`${o}`);Number.isNaN(a)||String(a).length>5&&(o=a.toPrecision(5));function c(){return t.comparator&&t.comparison?Me(t.comparator,o,t.comparison)?"success":"danger":"secondary"}const l=c();Number.isNaN(a)||s!==void 0&&(o=`${o} ${s}`);const f=e.jsxs(ee,{children:[e.jsx("h1",{children:t.name}),e.jsx(i.Badge,{bg:l,children:`${o}`})]});if(r){const u=`${r}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:u.includes(`
|
|
38
|
+
`)?e.jsx("pre",{children:u}):u}),children:f})}return f}function Rm({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 Am(n){const t=h.useRef({}),[o,s]=h.useState(void 0),{synoptic:r,fetchSVG:a,getHardwareGroupComponent:c,hardwareObjects:l}=n;h.useEffect(()=>{a(r.synoptic).then(p=>{s(p.data)})},[r]);const f=h.useCallback(p=>{var m,g;p in t.current&&((g=(m=t.current)==null?void 0:m[p].current)==null||g.showModal())},[t]),u=h.useMemo(()=>r.elements.map(p=>{var y,_,$,b;let m=!1,g;const j=p.ids&&((y=p.ids)==null?void 0:y.length)>0;if(j&&(m=!0,(_=p.ids)==null||_.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=>{(Me(M==null?void 0:M.comparator,M==null?void 0:M.comparison,I)??!1)&&(g=M.color)})):p.state_comparison?m=Me(($=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=Rm({value:C.properties[v[1]],unit:C.properties.unit,display_digits:p.value_display_digits}))}const w=p.name.toLowerCase();return[e.jsx(fe.SvgProxy,{selector:`.${w} .status`,class:`$ORIGINAL ${m!==void 0?m?"ok":"error":""}`,style:g?`fill: ${g};`:""},`${w}state`),e.jsx(fe.SvgProxy,{selector:`.${w} .value`,children:x},`${w}value`),e.jsx(fe.SvgProxy,{selector:`.${w} > rect`,onClick:()=>f(w)},`${w}handler`),e.jsx(fe.SvgProxy,{class:`$ORIGINAL ${j?"active":""}`,selector:`.${w}`},`${w}comp`)]}),[r,l]),d=h.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(),g=h.createRef();return t.current[m]=g,e.jsx(Fm,{ref:g,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(fe.SvgLoader,{width:"100%",svgXML:o,className:`synoptic ${r.color_icons?"synoptic-color":""}`,children:u}),d]})}const Em=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),km=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function uo(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 Pm(n){const{error:t}=n;if(!(t instanceof se))return e.jsx(e.Fragment,{});function o(a,c=3){const l=dm(a.yamlNode),f=[];let u="";for(let d=1;d<l.length;d++){const{node:p,indexFromParent:m}=l[d];f.push(`${u}children:`),u+=" ".repeat(c),m===1?f.push(`${u}- type: ...`):(m??0>1)&&f.push(`${u}...`,`${u}...`,`${u}# children number ${m??0+1}`),f.push(`${u}- type: ${p.type}`),u+=" ".repeat(2)}return a instanceof me?a.keys.forEach(d=>{f.push(`${u}${d}: ... ${" ".repeat(50-u.length-d.length)}<-- unexpected key`)}):a instanceof Ie?a.keys.forEach(d=>{f.push(`${u}???: ${" ".repeat(50-u.length-d.length)}<-- key **${d}** is expected`)}):a instanceof F&&f.push(`${u}${a.key}: ${" ".repeat(50-u.length-a.key.length)}<-- ${a.keyMessage}`),f.join(`
|
|
39
|
+
`)}const r=lm(t.yamlNode).name;if(t instanceof me){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 Ie){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 F?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(uo,{...n})}const rt={hasError:!1,message:"",error:void 0};class fo extends h.Component{constructor(o){super(o);ne(this,"reload",()=>{window.location.reload()});this.state=rt}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(rt)}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(Pm,{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(uo,{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 Bm(n){var o;const t=h.useMemo(()=>no(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(fo,{resetKey:t,unhandledComponentDidCatch:n.unhandledComponentDidCatch,UnhandledErrorComponent:n.UnhandledErrorComponent,children:(o=t.children)==null?void 0:o.map((s,r)=>z(s,r))})})}const po={hardwareproperty:lo,hardware:mo};function Gm(n,t){po[n]=t}function ke(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 Vm(n){const t=P.map(n.monitors,(o,s)=>{const r=o.type??"hardwareproperty",a=po[r];return a===void 0?e.jsx(ke,{monitor:o,message:`Type ${r} unsupported`},`m${s}`):e.jsx(a,{monitor:o},`m${s}`)});return e.jsx("div",{className:H.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 Lm(n){return n===void 0||n===null||typeof n!="string"?null:n.startsWith("$")?n.slice(1):n}function mo(n){const{monitor:t}=n,{id:o}=t,s=Lm(o),r=G(s),a=oe(s);if(o===void 0)return e.jsx(ke,{monitor:t,message:"'id' is missing"});if(typeof o!="string")return e.jsx(ke,{monitor:t,message:"'id' is invalid"});if(r===null)return e.jsx(T,{state:"NONE",variant:"danger",description:`hardware '${o}' was not found`});const{type:c="none"}=r,l={...r,actions:a},f=ze(c,"monitor");return f?e.jsx(f,{hardware:l,options:{name:t.name},operator:!1,disabled:!1}):e.jsx(Te,{hardware:l})}exports.AirBearing=pt;exports.AirBearingMocks=Qo;exports.AirBearingProtected=mt;exports.AirBearingSimulator=Xo;exports.AirBearingState=Fe;exports.AirBearingVariants=ht;exports.BaseInfo=lt;exports.BaseMocks=Ao;exports.BaseName=ct;exports.BaseProperty=dt;exports.BaseState=at;exports.BaseVariants=ut;exports.Beamviewer=gt;exports.BeamviewerMocks=ls;exports.BeamviewerSimulator=us;exports.BeamviewerVariants=xt;exports.EnergyManagerDefault=wt;exports.EnergyManagerMocks=_s;exports.EnergyManagerSimulator=Ss;exports.EnergyManagerState=Be;exports.EnergyManagerVariants=jt;exports.ErrorObject=Vp;exports.Formatting=Ms;exports.Frontend=vt;exports.FrontendMocks=Hs;exports.FrontendVariants=Nt;exports.FullSizer=Zn;exports.Gauge=bt;exports.GaugeIndicator=qp;exports.GaugeMocks=ur;exports.GaugeVariants=_t;exports.HardwareInputNumber=pe;exports.HardwareNumericStep=he;exports.HardwareSchema=km;exports.HardwareState=Om;exports.HardwareTemplate=S;exports.HardwareTypes=Em;exports.InfiniteKnob360=Wt;exports.KeyError=F;exports.Laser=Ct;exports.LaserHeating=Ot;exports.LaserHeatingMocks=Ar;exports.LaserHeatingVariants=It;exports.LaserMocks=br;exports.LaserVariants=$t;exports.Light=Mt;exports.LightMocks=Wr;exports.LightVariants=Tt;exports.LimaBinning=Et;exports.LimaDefault=Ft;exports.LimaDescription=Pt;exports.LimaImageRoi=kt;exports.LimaMocks=Yi;exports.LimaShape=Bt;exports.LimaSimulator=Qi;exports.LimaSize=Dt;exports.LimaState=X;exports.LimaTransformation=Rt;exports.LimaVariants=Lt;exports.LoadingObject=Pp;exports.MeasurementGroupDefault=Ut;exports.MeasurementGroupMocks=ua;exports.MeasurementGroupSimulator=fa;exports.MeasurementGroupVariants=Ht;exports.MissingComponentObject=Up;exports.MissingKeysError=Ie;exports.MissingObject=Gp;exports.MonitorHardware=mo;exports.MonitorHardwareProperty=lo;exports.MonitorPanel=Vm;exports.MonitorPanelItem=ee;exports.MotorDefault=ie;exports.MotorMocks=Sc;exports.MotorRotation=zt;exports.MotorSimulator=$c;exports.MotorState=xe;exports.MotorText=qt;exports.MotorVariants=Xt;exports.MultiState=ft;exports.Multiposition=Zt;exports.MultipositionDefault2=en;exports.MultipositionMocks=Lc;exports.MultipositionSimulator=Uc;exports.MultipositionVariants=tn;exports.NoObject=kp;exports.None=Jn;exports.NullObject=Hp;exports.NumericStep=St;exports.OpticDefault=on;exports.OpticMocks=rl;exports.OpticSimulator=il;exports.OpticState=Ve;exports.OpticVariants=sn;exports.Panel=R;exports.ProcedureExecution=rn;exports.ProcedureManage=Ee;exports.ProcedureMocks=bl;exports.ProcedureState=je;exports.ProcedureValidate=an;exports.ProcedureVariants=cn;exports.PumpDefault=xn;exports.PumpMocks=zd;exports.PumpVariants=wn;exports.PusherDefault=jn;exports.PusherMocks=au;exports.PusherSimulator=cu;exports.PusherState=He;exports.PusherVariants=yn;exports.RegulationDefault=un;exports.RegulationMocks=kl;exports.RegulationPlot=Le;exports.RegulationSimulator=Pl;exports.RegulationVariants=fn;exports.ServiceDefault=vn;exports.ServiceMocks=vu;exports.ServiceProtected=Nn;exports.ServiceState=De;exports.ServiceVariants=bn;exports.ShutterDefault=pn;exports.ShutterMocks=cd;exports.ShutterProtected=mn;exports.ShutterSimulator=ld;exports.ShutterState=ye;exports.ShutterVariants=hn;exports.SlitDefault=gn;exports.SlitMocks=Ad;exports.SlitState=Ue;exports.SlitVariants=gd;exports.State=T;exports.Synoptic=Am;exports.Todo=io;exports.TomoConfigLatencyTime=qn;exports.TomoConfigVariants=Wn;exports.TomoDetectorAcquisitionMode=Dn;exports.TomoDetectorMocks=Tf;exports.TomoDetectorSamplePixelSize=Tn;exports.TomoDetectorState=Ne;exports.TomoDetectorVariants=Rn;exports.TomoDetectorsDefault=An;exports.TomoDetectorsMocks=Hf;exports.TomoDetectorsState=We;exports.TomoDetectorsVariants=En;exports.TomoFlatMotionDefault=_n;exports.TomoFlatMotionMocks=af;exports.TomoFlatMotionSimulator=cf;exports.TomoFlatMotionSmall=Sn;exports.TomoFlatMotionState=ve;exports.TomoFlatMotionVariants=Cn;exports.TomoHoloState=Kn;exports.TomoHoloVariants=Np;exports.TomoImagingActions=Vn;exports.TomoImagingDefault=Pn;exports.TomoImagingExposureTime=Bn;exports.TomoImagingMocks=fp;exports.TomoImagingSettleTime=Gn;exports.TomoImagingSimulator=pp;exports.TomoImagingState=re;exports.TomoImagingUpdateMode=Ln;exports.TomoImagingVariants=Un;exports.TomoReferencePositionDefault=In;exports.TomoReferencePositionVariants=Mn;exports.TomoSampleStageVariants=hp;exports.TypeIcon=N;exports.ValveDefault=Qn;exports.ValveMocks=Ap;exports.ValveVariants=Xn;exports.YAMLErrorBoundary=fo;exports.YAMLLayout=Bm;exports.YamlAsserts=Sm;exports.createMotorMock=Cc;exports.dynamicOp=Me;exports.getHardwareVariantComponent=ze;exports.isLimaHardware=ge;exports.isMotorClockWise=Yt;exports.isMotorHardware=Kt;exports.isOpticHardware=Yc;exports.isProcedureHardware=ln;exports.isTomoConfigHardware=zn;exports.isTomoDetectorHardware=qe;exports.isTomoDetectorsHardware=kn;exports.isTomoFlatMotionHardware=$n;exports.isTomoHoloHardware=Yn;exports.isTomoReferencePositionHardware=lf;exports.isTomoSampleStageHardware=Hn;exports.limaGuessSubframes=Vt;exports.motorLimits=Qt;exports.registerHardwareVariant=$m;exports.registerMonitorComponent=Gm;exports.registerRuntimeHook=oi;exports.registerYamlComponent=eo;exports.registerYamlComponents=am;exports.registerYamlContainer=im;exports.renderYamlNode=z;exports.useHardware=G;exports.useHardwareChangeActions=oe;exports.useHardwareSchema=si;exports.useLimaHardware=Gt;exports.useMotorHardware=U;exports.useMotorStates=we;exports.useOperator=ri;exports.useProcedureHardware=pl;exports.useScanRunning=ii;exports.useTomoConfigHardware=jp;exports.useTomoDetectorHardware=Nf;exports.useTomoDetectorsHardware=Af;exports.useTomoFlatMotionHardware=Tu;exports.useTomoHoloHardware=bp;exports.useTomoSampleStageHardware=gp;exports.yamlComponents=de;exports.yamlContainers=le;
|
|
40
40
|
//# sourceMappingURL=index.js.map
|