import{C as g,q as S}from"./index-6e368050.js";import{c as f,d as l,e as h,f as w,g as v,h as k}from"./SVGHelpers-c6cd7f31.js";function y(e,t){t.classHierarchy.push("vtkSphereHandleRepresentation"),t.displayMapper=l.newInstance(),t.displayActor=S.newInstance({parentProp:e}),t.displayActor.setMapper(t.displayMapper),t.displayMapper.setInputConnection(e.getOutputPort()),e.addActor(t.displayActor),t.alwaysVisibleActors=[t.displayActor],e.getGlyphResolution=()=>t._pipeline.glyph.getPhiResolution(),e.setGlyphResolution=a=>t._pipeline.glyph.setPhiResolution(a)||t._pipeline.glyph.setThetaResolution(a);function i(a){if(t.displayCallback){const s=[],n=e.getRepresentationStates();for(let r=0;r{t.displayCallback=a,t.displayMapper.setCallback(a?i:null)}}function o(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};f.extend(e,t,i),y(e,t)}const M=g.newInstance(o,"vtkSphereHandleRepresentation");var x={newInstance:M,extend:o};function T(e,t){t.classHierarchy.push("vtkLabelWidgetProp"),t._isDragging=!1,e.setText=a=>{t.widgetState.getText().setText(a),t._interactor.render()},e.getText=()=>t.widgetState.getText().getText(),e.setDisplayCallback=a=>t.representations[0].setDisplayCallback(a);function i(a){return a.altKey||a.controlKey||a.shiftKey}e.handleLeftButtonPress=a=>{var n,r;if(!t.activeState||!t.activeState.getActive()||!t.pickable||i(a))return g.VOID;const s=((r=(n=t.activeState)==null?void 0:n.getManipulator)==null?void 0:r.call(n))??t.manipulator;if(t.activeState===t.widgetState.getMoveHandle()&&s){const{worldCoords:c}=s.handleEvent(a,t._apiSpecificRenderWindow),p=t.widgetState.getMoveHandle();p.setOrigin(c),t.widgetState.getText().setOrigin(p.getOrigin()),e.loseFocus()}else t.dragable&&(t._isDragging=!0,t._apiSpecificRenderWindow.setCursor("grabbing"),t._interactor.requestAnimation(e));return e.invokeStartInteractionEvent(),g.EVENT_ABORT},e.handleLeftButtonRelease=()=>!t.activeState||!t.activeState.getActive()||!t.pickable?g.VOID:(t._isDragging?(t._apiSpecificRenderWindow.setCursor("pointer"),t.widgetState.deactivate(),t._interactor.cancelAnimation(e),t._isDragging=!1):t.activeState!==t.widgetState.getMoveHandle()&&t.widgetState.deactivate(),(t.hasFocus&&!t.activeState||t.activeState&&!t.activeState.getActive())&&(t._widgetManager.enablePicking(),t._interactor.render()),e.invokeEndInteractionEvent(),g.EVENT_ABORT),e.handleMouseMove=a=>{var n,r;const s=((r=(n=t.activeState)==null?void 0:n.getManipulator)==null?void 0:r.call(n))??t.manipulator;if(s&&t.pickable&&t.dragable&&t.activeState&&t.activeState.getActive()&&!i(a)){const{worldCoords:c}=s.handleEvent(a,t._apiSpecificRenderWindow);if(c.length&&(t.activeState===t.widgetState.getMoveHandle()||t._isDragging))return t.activeState.setOrigin(c),t.widgetState.getText().setOrigin(t.activeState.getOrigin()),e.invokeInteractionEvent(),g.EVENT_ABORT}return g.VOID},e.reset=()=>{t.widgetState.getMoveHandle().setOrigin(null),t.widgetState.getText().setOrigin(null),t.widgetState.getText().setText("")},e.grabFocus=()=>{t.hasFocus||(e.reset(),t.activeState=t.widgetState.getMoveHandle(),t.widgetState.getMoveHandle().activate(),t._interactor.requestAnimation(e),e.invokeStartInteractionEvent()),t.hasFocus=!0},e.loseFocus=()=>{t.hasFocus&&(t._interactor.cancelAnimation(e),e.invokeEndInteractionEvent()),t.widgetState.deactivate(),t.widgetState.getMoveHandle().deactivate(),t.activeState=null,t.hasFocus=!1,t._widgetManager.enablePicking(),t._interactor.render()}}function _(){return h.createBuilder().addStateFromMixin({labels:["moveHandle"],mixins:["origin","color","scale1","visible","manipulator"],name:"moveHandle",initialValues:{scale1:10,visible:!1}}).addStateFromMixin({labels:["SVGtext"],mixins:["origin","color","text","visible","manipulator"],name:"text",initialValues:{visible:!0}}).build()}function R(e,t){t.classHierarchy.push("vtkLabelWidget");const i={...e};t.methodsToLink=["scaleInPixels"],e.getRepresentationsForViewType=a=>{switch(a){case v.DEFAULT:case v.GEOMETRY:case v.SLICE:case v.VOLUME:default:return[{builder:x,labels:["moveHandle"]}]}},e.setManipulator=a=>{i.setManipulator(a),t.widgetState.getMoveHandle().setManipulator(a),t.widgetState.getText().setManipulator(a)},e.setManipulator(t.manipulator||k.newInstance({useCameraNormal:!0}))}function d(e){return{behavior:T,widgetState:_(),...e}}function u(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.assign(t,d(i)),w.extend(e,t,i),g.setGet(e,t,["manipulator"]),R(e,t)}const E=g.newInstance(u,"vtkLabelWidget");var O={newInstance:E,extend:u};export{O as v};