@vertexvis/viewer-toolkit-react 0.0.3-canary.21 → 0.0.3-canary.23
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/bundle.cjs.js +1 -1
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/bundle.esm.js.map +1 -1
- package/dist/components/scene-tree/scene-tree-search/__tests__/scene-tree-search-information-for-toolbar.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/__tests__/scene-tree-search-options-popover.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search-bar.d.ts +3 -1
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search-information-for-toolbar.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search-options-popover.d.ts +5 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search.d.ts +3 -1
- package/dist/components/toolbar/toolbar-divider.d.ts +1 -1
- package/dist/index.css +2 -2
- package/dist/index.d.ts +5 -2
- package/dist/state/scene-tree/columns/columns.d.ts +1 -1
- package/dist/state/scene-tree/columns/open-column-popover.d.ts +3 -1
- package/dist/state/scene-tree/search/actions.d.ts +7 -0
- package/dist/state/scene-tree/search/index.d.ts +1 -0
- package/dist/state/scene-tree/search/search.d.ts +12 -0
- package/package.json +4 -4
package/dist/bundle.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("pino"),n=require("recoil"),a=require("@vertexvis/utils"),s=require("react"),i=require("@vertexvis/geometry"),o=require("@vertexvis/ui-react"),l=require("classnames"),r=require("@vertexvis/viewer"),c=require("@vertexvis/viewer-react"),u=require("@vertexvis/ui/loader"),d=require("@vertexvis/viewer/loader");function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var m=_interopNamespaceDefault(s);function __rest(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(n[a[s]]=e[a[s]]);return n}"function"==typeof SuppressedError&&SuppressedError;const p=t({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?p.error(t,e):p.error(e)},logger_info=(e,t)=>{null!=t?p.info(t,e):p.info(e)},logger_warn=(e,t)=>{null!=t?p.warn(t,e):p.warn(e)},logger_debug=(e,t)=>{null!=t?p.debug(t,e):p.debug(e)};class h{}function useActionCallback(e,t=[]){const a=t instanceof h?void 0:t;return n.useRecoilCallback((t=>e(Object.assign(Object.assign({},t),{snapshot:Object.defineProperties(t.snapshot,{getPromiseRequired:{configurable:!0,value:createGetPromiseRequiredWrapper(t.snapshot)},tryGetPromise:{configurable:!0,value:createTryGetPromiseWrapper(t.snapshot)}})}))),a)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,a=__rest(t,["snapshot"]);return async(...t)=>{const s=n.retain();try{const s=undefined;return await e(Object.assign(Object.assign({},a),{snapshot:n}))(...t)}finally{s()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const a=await e.getPromise(t);if(null==a)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return a}}function createTryGetPromiseWrapper(e){return async t=>{try{return{value:await e.getPromise(t)}}catch(e){return logger_debug(`Error encountered retrieving Recoil value. [key={${t.key}}]`,e),{error:e}}}}const g=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),f=n.atom({key:"viewerElementId",default:"vertex-viewer"}),v=n.atom({key:"viewerInitialSceneReady",default:!1}),b=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),V=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),C=n.selector({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(g))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),S=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),w=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(S))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const s=await e.getPromise(C),i=await s();a.length>0&&await(null==i?void 0:i.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=s.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=s.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),i=s.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const s=a.UUID.create();await e(t,s,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:i,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(C),a=await n(),s=await e.getPromiseRequired(k);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:s})}))}}const j=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(C),s=await a();await(null==s?void 0:s.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:j}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(C),s=await a();await(null==s?void 0:s.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:j}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(k,t)}))}}const k=n.atom({key:"viewerCameraType",default:"perspective"});class A{constructor(){this.interactionStarted=!1}initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){var e;this.interactionStarted||(await(null===(e=this.api)||void 0===e?void 0:e.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){var e;await(null===(e=this.api)||void 0===e?void 0:e.endInteraction()),this.interactionStarted=!1}}const create=(e,t=0)=>({normal:e,offset:t}),forAxis=(e,t)=>{switch(e){case"x":return x(t);case"y":return y(t);case"z":return z(t)}},x=e=>create(i.Vector3.left(),-e),y=e=>create(i.Vector3.down(),-e),z=e=>create(i.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},T={x:i.Vector3.left(),y:i.Vector3.down(),z:i.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||i.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||i.Vector3.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,a)=>e&&e.normal&&[["x",t],["y",n],["z",a]].filter((t=>0===i.Vector3.magnitude(i.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>i.Vector3.dot(i.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return i.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:i.Vector3.multiply(e.normal,i.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=i.Vector3.normalize(e.normal),a=i.Vector3.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,s)=>{const o=n.viewAll(),l=getAxis(e,t),r=null!=a&&null!=l?create(l,i.Vector3.dot(l,s||i.BoundingBox.center(a))):forAxis(e,o.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[i.Vector3.create(e.min.x,e.min.y,e.min.z),i.Vector3.create(e.min.x,e.min.y,e.max.z),i.Vector3.create(e.min.x,e.max.y,e.min.z),i.Vector3.create(e.min.x,e.max.y,e.max.z),i.Vector3.create(e.max.x,e.max.y,e.max.z),i.Vector3.create(e.max.x,e.max.y,e.min.z),i.Vector3.create(e.max.x,e.min.y,e.max.z),i.Vector3.create(e.max.x,e.min.y,e.min.z)]}function equals(e,t){return e.min.x===t.min.x&&e.min.y===t.min.y&&e.min.z===t.min.z&&e.max.x===t.max.x&&e.max.y===t.max.y&&e.max.z===t.max.z}const P="#999999",E=1,R={default:5,min:0,max:10},I=n.atom({key:"crossSectioningEnabled",default:!1}),M=n.atom({key:"crossSectioningHighlightColor",default:P}),N=n.atom({key:"crossSectioningBorderWidth",default:1}),O=n.atom({key:"crossSectioningPlanes",default:[]}),L=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),B=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(w)}}),_=n.atom({key:"crossSectioningIsInteractive",default:!1}),D=n.atom({key:"crossSectioningActiveAxis",default:"x"}),H=n.atom({key:"crossSectioningAvailableAxes",default:T}),F=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(O);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),U=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(O),n=e(B),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>i.Vector3.dot(e,isNegativeNormal(t[0])?i.Vector3.multiply(t[0].normal,i.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return R}}),W=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(O),n=e(F),a=e(U);return t.length>0?t[0].offset*n:a.default}}),G=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),K=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),$=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),q=n.atom({key:"crossSectioningInteractionHandler",default:new A,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const a=n.useRecoilValue(q);s.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(a))}),[e,t,a])}const Y=n.atom({key:"hitResultsTapDetails",default:void 0}),X=n.atom({key:"hitResultsLongPressDetails",default:void 0}),Z=n.atom({key:"previousHitResult",default:void 0}),J=n.atom({key:"currentHitResult",default:void 0}),Q=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,a,s,o,l,r,c;const u=e(Y),d=e(X),m=null!=u?u:d,p=e(C),h=await p(),g=null==h?void 0:h.sceneViewId,f=null==h?void 0:h.raycaster();if(null!=m&&null!=f&&null!=g){const e=await f.hitItems(m.position),u=((null==e?void 0:e.hits)||[])[0];if(null!=u)return{id:null===(t=u.itemId)||void 0===t?void 0:t.hex,normal:i.Vector3.create((null===(n=null==u?void 0:u.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==u?void 0:u.hitNormal)||void 0===a?void 0:a.y)||0,(null===(s=null==u?void 0:u.hitNormal)||void 0===s?void 0:s.z)||0),position:i.Vector3.create((null===(o=null==u?void 0:u.hitPoint)||void 0===o?void 0:o.x)||0,(null===(l=null==u?void 0:u.hitPoint)||void 0===l?void 0:l.y)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.z)||0),meta:m.metaKey||m.ctrlKey||!1,metadata:[],ancestors:(null===(c=null==u?void 0:u.ancestors)||void 0===c?void 0:c.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[]}}}}),ee=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=i.Vector3.dot(i.Vector3.normalize(e.up),t),a=Math.abs(n)>.98?i.Vector3.normalize(i.Vector3.scale(-n,e.viewVector)):e.up,s=i.Vector3.add(i.Vector3.scale(i.Vector3.distance(e.position,e.lookAt),i.Vector3.multiply(t,i.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:s})}{const a=i.Vector3.angleTo(i.Vector3.normalize(e.viewVector),t),s=null!=n?i.BoundingBox.center(n):e.lookAt,o=i.Vector3.normalize(i.Vector3.cross(i.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,s,o)}};function isParallelTo(e,t){const n=i.Angle.toDegrees(i.Vector3.angleTo(e,t));return 0===n||180===n}const te=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(N),n=await e.getPromise(M),s=await e.getPromise(O),i=await e.getPromise(C),o=await i();await(null==o?void 0:o.crossSectioning().update({sectionPlanes:s,highlightColor:n?a.Color.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const s=await a.getPromise(C),i=await s();if(null!=i){const a=i.camera().viewAll();n(H),t(O,[towardsCamera(i.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(Q).then((e=>e.value)),s=await t.getPromise(C),i=await s();if(null!=a&&null!=i){const t=fromHit(a,i.camera());n(O,null!=t?[t]:[]),n(H,null!=t?{x:t.normal}:T),await e()}}))),s=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(O),s=undefined;await n.getPromise(I)||(e(I,!0),0===a.length&&await t())})),o=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(I)&&(t(I),t(G),t(K),t($),t(O),t(L),t(D),await e())}));return{enable:s,disable:o,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(I)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(I)||await s(),e(G,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(G)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t($),e(K,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(K)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(K),e($,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e($)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(q);e(_,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(q);e(_),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const s=await n.getPromise(O);if(s.length>0){const i=await n.getPromise(F),o=await n.getPromise(U),l=i<0?-1*o.max:o.min,r=i<0?-1*o.min:o.max,c=s.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*i,l),r)})));t(O,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(O);t(O,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(O),n=await e.getPromise(g),a=await(null==n?void 0:n.scene());t.length>0&&null!=a&&await alignToNormal(a.camera(),t[0].normal,a.boundingBox()).render({animation:{milliseconds:te}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async s=>{const o=await a.getPromise(O),l=await a.getPromise(H),r=await a.getPromise(B),c=await a.getPromise(L),u=await a.getPromise(g),d=await(null==u?void 0:u.scene()),m=l[s],p=null!=m&&o.length>0&&isParallelTo(o[0].normal,m)&&!isNaN(i.Vector3.angleTo(o[0].normal,m));if(null!=d&&!p){const e=await a.tryGetPromise(Q).then((e=>e.value));t(D,s),t(O,[toAxis(s,l,d.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n($),await e()}))),updateAlignment:useActionCallback((({set:e,reset:a})=>async(i,o)=>{a(K),e(L,{mode:i,hitPending:"global"!==i&&null==o}),"global"===i?(a(D),a(H),await t()):"surface"===i&&null!=o&&(await s(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(L);a.hitPending&&(e(L,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(L);n.hitPending&&e(L,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var ne=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:te,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:P,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:R,crossSectioningActiveAxis:D,crossSectioningAdditionalToolsOpen:G,crossSectioningAlignment:L,crossSectioningAlignmentToolsOpen:K,crossSectioningAvailableAxes:H,crossSectioningAxisToolsOpen:$,crossSectioningBorderWidth:N,crossSectioningEnabled:I,crossSectioningHighlightColor:M,crossSectioningInteractionHandler:q,crossSectioningIsInteractive:_,crossSectioningOffsetScalar:F,crossSectioningPlaneDisplayOffset:W,crossSectioningPlanes:O,crossSectioningSliderRange:U,crossSectioningTargetBoundingBox:B,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=s.useState();return s.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),s.useCallback((s=>{const handler=()=>{e(s)};null!=n&&clearTimeout(n),a(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,a=__rest(t,["onInput"]);const i=useDebouncedCallback((e=>{null==n||n(e)}),500),l=s.useCallback((e=>{const t=e.target;i(t.value)}),[i]);return e.jsx(o.VertexColorPicker,Object.assign({onInput:l},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const a=useCrossSectioningActions(),[s,i]=n.useRecoilState(M);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:s,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{i(e),await a.reapply()}})},VertexSlider=t=>{var{value:n,defaultValue:a,leftLabel:i,rightLabel:r,onChange:c,onValueChange:u,onValueInput:d}=t,m=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[p,h]=s.useState(a);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[i&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:i}),e.jsx(o.VertexSlider,Object.assign({className:l("w-full",{"mt-0.5":null!=i||null!=r}),value:null!=n?n:p,onValueChange:e=>{h(e.detail.value),null==c||c(e.detail.value),null==u||u(e)},onValueInput:e=>{h(e.detail.value),null==c||c(e.detail.value),null==d||d(e)}},m)),r&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:r})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const a=useCrossSectioningActions(),[s,i]=n.useRecoilState(N);return e.jsx(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:s,valueLabelDisplay:"auto",onValueInput:async e=>{i(e.detail.value),await a.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexCrossSectionAppearanceColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:n})]})}function PanelSection({header:t,children:n}){return e.jsxs("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e.jsx("div",{className:"my-2 text-base text-neutral-700",children:t}),n]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const a=useCrossSectioningActions(),[s,i]=n.useRecoilState(M),[l,r]=n.useRecoilState(N),c=s!==P||1!==l;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(o.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(P),r(1),null==t||t(),await a.reapply()},disabled:!c})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Cross Sectioning",e.jsx(VertexCrossSectionAppearanceReset,{onReset:t})]}),children:e.jsx(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a})})}const ae=.5,se="#444444",ie=n.atom({key:"featureEdgesSelectedColor",default:se}),oe=n.atom({key:"featureEdgesLineThickness",default:ae}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(ie);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(oe);return e.jsx(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:t,onUpdateFeatureEdgesThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexFeatureEdgesColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexFeatureEdgesThicknessSlider,{onUpdate:n})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[a,s]=n.useRecoilState(ie),[i,l]=n.useRecoilState(oe),r=i!==ae||a!==se;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(o.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(se),l(ae),null==t||t()},disabled:!r})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:t,onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Feature Edges",e.jsx(VertexFeatureEdgesReset,{onReset:t})]}),children:e.jsx(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a})})}function contextMenuItemIsRow(e){var t;return null!=e&&null!=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.id)}const le=n.atom({key:"contextMenuActive",default:void 0}),re=n.atom({key:"contextMenuPosition",default:void 0}),ce=n.atom({key:"contextMenuTarget",default:void 0}),ue=n.atom({key:"contextMenuItem",default:void 0}),de=n.atom({key:"contextMenuActions",default:[]}),me=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(le)?e(re):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,a=null==t?void 0:t.clientY;e(re,i.Point.create(n,a)),e(ce,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,s,o)=>{const l=await e.getPromise(re),r=await e.getPromise(le);if(null!=l&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=i.Point.create(e,r),u=null!=l?i.Point.distance(l,c):0,d=null==s||s(n);u<2&&d&&(null==o||o(n,null!=l?l:c),t(le,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,s)=>{if(null==a||a(t)){const a=i.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(re,a),e(ce,t.target),e(le,n),null==s||s(t,a)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(ee,!!n),e(le),e(de),e(re)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(ee)))}}function targetWithinMenu(e){return e.target instanceof Element&&isChildOf("vertex-menu",e.target)}function targetShouldSkipNextHit(e){return e.target instanceof Element&&isChildOf("vertex-viewer",e.target)}function isChildOf(e,t){return null!=t.closest(e)}const pe=n.atom({key:"boxSelectionEnabled",default:!1}),xe=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(pe,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(pe),e(xe)})),setOperationType:useActionCallback((({set:e})=>t=>{e(xe,t)}))});async function whenComponentReady(e,t){return null!=e&&null!=e.nodeName&&await customElements.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):void 0}const he=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),ge=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),fe=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(ge);s.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const ve=2,ye=n.atom({key:"isEditingPreciseMeasurement",default:!1}),be=n.atom({key:"preciseMeasurementOutcome",default:void 0}),Ve=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),Ce=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),Se=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),we=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(Se).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,a){const i=n.useSetRecoilState(Se),o=n.useSetRecoilState(be),l=n.useSetRecoilState(Ve),r=n.useSetRecoilState(Ce),c=n.useRecoilValue(Ve);s.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{i(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,i]),s.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{o(e),null==a||a(e)}))})),()=>null==t?void 0:t.dispose()}),[e,o]),s.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==c||c.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,c]),s.useEffect((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),s.useEffect((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementOverlays)}))}),[e,r])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),s=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ve);null==t||t.clearEntities()})),i=useActionCallback((()=>async(e={})=>{await s(),n(e),a()})),o=useActionCallback((({set:e,reset:n})=>async a=>{await i(),"point-to-point"===a?t():(n(be),n(Se),e(ye,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await i(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await o(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(ye),a=await e.getPromise(he);n?await s():a&&(t(ge),t(fe))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(fe)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(fe,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(he)?await i():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ye)?await i():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(he,!0),n.keepExistingMeasurement||e(ge)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(he),t.keepExistingMeasurement||(e(fe),e(ge))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(ye),e(be),e(Se)}))}const je=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(he)||e(ye)}),ke=n.selector({key:"measurementPanelModel",get:({get:e})=>e(ge)||e(be)}),Ae=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(Ce)}),Te=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(ye)?e(we):void 0}}),Pe=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(je)&&null!=e(ke)}),Ee=3e3,Re=n.atom({key:"applicationMessageToast",default:void 0}),Ie=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(Ie,null!=t?Object.assign(Object.assign({},t),{id:a.UUID.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Re,null!=t?Object.assign(Object.assign({},t),{id:a.UUID.create()}):void 0)}))});var Me;!function(e){e.HIDE_ITEM="Hide Item",e.SHOW_ONLY_SELECTED="Show Only Selected",e.HIDE_SELECTED="Hide Selected",e.SHOW_ONLY_ITEM="Show Only Item",e.SHOW_ALL="Show All",e.HIDE_ALL="Hide All",e.SELECT_FILTERED_ITEMS="Select Filtered Items",e.INVERT_SELECTION="Invert Selection",e.CLEAR_ALL_TRANSFORMS="Clear All Transforms",e.CLEAR_SELECTED_TRANSFORMS="Clear Selected Transforms",e.CLEAR_SELECTION="Clear Selection",e.DESELECTING_ITEMS="Deselecting Items",e.SELECTING_ITEMS="Selecting Items",e.SELECTING_ONLY_ITEM="Selecting Only Item",e.SELECTING_ANCESTOR="Selecting Ancestor",e.APPLY_MATERIAL_OVERRIDE_TO_ALL="Apply Material Override To All",e.APPLY_MATERIAL_OVERRIDE_TO_SELECTION="Apply Material Override To Selection",e.CLEAR_ALL_MATERIAL_OVERRIDES="Clear All Material Overrides",e.CLEAR_SELECTED_MATERIAL_OVERRIDES="Clear Selected Material Overrides",e.SET_PHANTOM_ALL="Set Phantom All",e.SET_PHANTOM_SELECTED_ITEMS="Set Phantom Selected Items",e.CLEAR_PHANTOM_ALL="Clear Phantom All",e.CLEAR_PHANTOM_SELECTED_ITEMS="Clear Phantom Selected Items",e.SET_PHANTOM_NON_SELECTED_ITEMS="Set Phantom Non Selected Items",e.RESTORE_PHANTOM_OVERRIDES="Restore Phantom Overrides",e.SET_ITEM_AS_END_ITEM="Set Item as End Item",e.UNSET_ITEM_AS_END_ITEM="Unset Item as End Item",e.SHOW_ANNOTATION="Show Annotation",e.HIDE_ANNOTATION="Hide Annotation"}(Me||(Me={}));const Ne=n.atomFamily({key:"selectionSelectedItems",default:void 0}),Oe=n.atom({key:"selectionSelectedItemIds",default:[]}),Le=n.atom({key:"selectionLastSelected",default:void 0}),Be=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),_e=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),De=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(Le),s=e(Oe);return null!==(n=null===(t=null==a?void 0:a.ancestors)||void 0===t?void 0:t.find((e=>s.includes(e))))&&void 0!==n?n:null==a?void 0:a.id}}),He=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),Fe=n.atom({key:"selectionVisibleSummary",default:void 0}),ze=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(Fe))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),Ue=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(Fe);return null!=(null==t?void 0:t.boundingBox)?i.BoundingBox.center(t.boundingBox):i.Vector3.origin()}}),We=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(Oe),n=undefined;return e(ze)>0||t.length>0}}),Ge=n.atom({key:"transformWidgetEnabled",default:!1}),Ke=n.atom({key:"transformWidgetPosition",default:void 0}),$e=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),qe=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e($e);if(null!=t)return t}}),Ye=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),Xe=n.atom({key:"transformWidgetSyncToSelection",default:!1}),Ze=n.atom({key:"transformWidgetIsInteracting",default:!1}),Je=n.atomFamily({key:"appliedItemTransform",default:void 0}),Qe=n.atom({key:"appliedItemTransformIds",default:[]}),et=n.atom({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Ue);e(Ke,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Ke),s=await t.getPromise(_e),i=await t.getPromise(Oe),o=await t.getPromise(ze);null==a&&(i.length>0||s||o>0)&&await n(),e(Xe,!0)})),s=useActionCallback((({set:e})=>async t=>{e(Ke,null!=t?t:void 0)})),o=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(qe),s=undefined;(await e.getPromise(Qe)).forEach((e=>{n(Je(e))})),null!=a&&t(Ye,a)}))),l=useActionCallback((({set:e,reset:t})=>n=>{t(Ye),e($e,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(i,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Ee}),t(Ge,!0),o?await n():null==i?await a():await s(i)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Ge),e($e)})),setTransformWidgetOrientation:l,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Ye),e($e)})),setTransformWidgetPosition:s,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ke))),invalidateTransforms:o,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(Ze,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Xe,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Xe))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(He),n=await e.getPromise(Fe),a=undefined;if(await e.getPromise(Xe)){const e=null==n?void 0:n.boundingBox,a=null!=e&&null!=(null==t?void 0:t.boundingBox)&&equals(e,t.boundingBox);null==e||a||await s(i.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Xe),null!=t?(await s(null==t?void 0:t.position),l(i.Vector3.eulerTo(i.Vector3.up(),t.normal))):(e(Ke),l(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Me.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(Ke,void 0),e(Ge,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Me.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(Ke,void 0),e(Ge,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Q).then((e=>e.value)),a=await e.getPromise(fe);null==n&&null!=(null==a?void 0:a.start)&&null!=a.end&&await t.resetMeasurement()}))),s=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Q).then((e=>e.value));await n.orientToHitResult(t)}))),i=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Q).then((e=>e.value));e(ue,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(J,await e.tryGetPromise(Q).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:l},...r)=>{const c=await t.getPromise(je),u=await t.getPromise(L),d=2!==(null==l?void 0:l.buttons)&&!(null==l?void 0:l.altKey);l.altKey||l.ctrlKey||l.metaKey||l.shiftKey;const m=d&&!u.hitPending&&!c,p=await t.tryGetPromise(Q).then((e=>e.value));n(Z,p),n(Y,l),await a(),m&&(r.forEach((e=>e())),await s()),await i(),await e.sectionCurrentHit(),await o()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Y),t(X,a.detail),await e.tryGetPromise(Q),await i(),await o()})))}},tt=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,s=undefined,i=undefined;return{tapDetails:e(Y),longPressDetails:e(X),previousHitResult:e(Z),currentHitResult:e(J)}}});var nt=Object.freeze({__proto__:null,currentHitResult:J,hitResult:Q,hitResultsLongPressDetails:X,hitResultsSkipNextTap:ee,hitResultsTapDetails:Y,hitState:tt,previousHitResult:Z,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Oe)).forEach((e=>t(Ne(e))))})),a=useActionCallback((({snapshot:e,reset:n,set:a})=>async(s,i)=>{var o,l;const r=await e.getPromise(Ne(s.id)),c=await e.getPromise(Oe),d=null===(l=[...null!==(o=s.ancestors)&&void 0!==o?o:[]])||void 0===l?void 0:l.reverse().find((e=>!c.includes(e)));null!=r&&null!=d?(a(Ne(d),{id:d}),a(Oe,(e=>[...e,d])),t.execute(Me.SELECTING_ANCESTOR,t.selectItemsTransform(d))):(null==i?void 0:i.clear)?(a(Ne(s.id),s),a(Oe,[s.id]),t.execute(Me.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(s.id))):(a(Ne(s.id),s),a(Oe,(e=>[...e,s.id])),t.execute(Me.SELECTING_ITEMS,t.selectItemsTransform(s.id))),u(s),a(Le,s),a(Be,!0),n(_e)})),s=useActionCallback((({reset:e,set:n})=>async a=>{e(Ne(a)),e(_e),n(Oe,(e=>e.filter((e=>e!==a)))),t.execute(Me.DESELECTING_ITEMS,t.deselectItemsTransform(a))})),i=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Ne(t.id));null!=n?await s(n.id):await a(t)})),o=useActionCallback((({snapshot:t,reset:n,set:s})=>async(i,o={})=>{const l=await t.getPromise(Ne(i.id)),r=await t.getPromise(Oe);if(r.filter((e=>{var t;return e!==i.id&&!(null===(t=i.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>n(Ne(e)))),n(_e),l)if(o.ignoreAncestorSelection)n(Oe),n(Ne(l.id));else{const e=r.filter((e=>{var t;return e===i.id||(null===(t=i.ancestors)||void 0===t?void 0:t.includes(e))}));s(Oe,e)}else n(Oe);e.clearTransformWidgetOrientation(),await a(i,{clear:!0})})),l=useActionCallback((({reset:t})=>async()=>{await n(),t(Oe),t(Le),t(Be),t(_e),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),r=useActionCallback((()=>async()=>{await l(),t.execute(Me.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(_e,t)})),u=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:a,toggleSelection:i,clearAndSelect:o,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Q).then((e=>e.value)),n=await e.getPromise(Y),a=(null==n?void 0:n.metaKey)||(null==n?void 0:n.ctrlKey)||(null==n?void 0:n.shiftKey);null==t||a?null!=t&&a?await i(t):await r():await o(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(a,s)=>{s.selected?(await n(),e(Ne(a.id),a),s.multiSelect?e(Oe,(e=>[...e.filter((e=>e!==a.id)),a.id])):e(Oe,[a.id]),u(a),e(Le,a),e(Be,!1),e(_e,!!s.multiSelect)):(t(Ne(a.id)),t(_e),e(Oe,(e=>e.filter((e=>e!==a.id)))))})),deselect:s,clearSelection:r,resetSelectionState:l,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:u}}const at=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,s=undefined;return{selectedItemIds:e(Oe),lastSelected:e(Le),highestSelectedAncestorId:e(De)}}});var st=Object.freeze({__proto__:null,selectionBoundingBoxCenter:Ue,selectionHighestSelectedAncestor:De,selectionIsActive:We,selectionLastSelectWasMultiSelect:_e,selectionLastSelected:Le,selectionLastSelectionFromViewer:Be,selectionPreviousVisibleSummary:He,selectionSelectedItemIds:Oe,selectionSelectedItems:Ne,selectionState:at,selectionVisibleCount:ze,selectionVisibleSummary:Fe,useSelectionActions:useSelectionActions});const it=255,ot=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),lt=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),rt=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),ct=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),ut=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Le);if(null!=t)return e(rt(t.id))}}),dt=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),mt=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),pt=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(ct);t(ot),n.forEach((e=>t(rt(e)))),t(ct)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(ot,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(ot)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(lt)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const s=await t.getPromise(Oe);a(ot),s.forEach((e=>a(rt(e)))),n(ct,(e=>e.filter((e=>!s.includes(e))))),await e.execute(Me.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(Me.CLEAR_ALL_MATERIAL_OVERRIDES,(e=>e.where((e=>e.all())).clearMaterialOverrides()),(e=>e.where((e=>e.withSelected())).select()))})),clearState:t,updateOpacity:useActionCallback((({set:e})=>t=>{e(lt,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(ot),s=await t.getPromise(lt),i=await t.getPromise(Oe),o=await t.getPromise(ut),l=null!=a?a:o,r=null!=s?s:null==o?void 0:o.opacity;if(null!=l){const t=Object.assign(Object.assign({},l),{opacity:null!=r?r:l.opacity});await e.execute(Me.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),i.forEach((e=>n(rt(e),t))),n(ct,(e=>[...e,...i]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(pt,!0),e(dt,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(pt),e(dt)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(ot),s=await t.getPromise(lt);if(null!=a){const i=await t.getPromise(ct),o=Object.assign(Object.assign({},a),{opacity:null!=s?s:a.opacity});await e.execute(Me.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),i.forEach((e=>n(rt(e))));const l=await t.getPromise(dt);null==l||l(o),n(pt),n(dt)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(mt,!1)}))}},xt="#FFFFFF",ht=n.atom({key:"viewerBackgroundSelectedColor",default:xt}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValueLoadable(ut),i=n.useRecoilValue(ot),l=n.useRecoilValue(mt),r=m.useMemo((()=>"hasValue"===s.state?null!=i?i:s.contents:i),[s,i]);return e.jsx(o.VertexTooltip,{content:"Apply to All",children:e.jsx(o.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==r,onClick:async()=>{l?a.confirmApplyAll(t):(await a.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),a=n.useRecoilValue(pt),[i,l]=s.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),l(!1)};return a?e.jsxs(o.VertexDialog,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e.jsx("div",{slot:"heading",children:"Apply to All Parts"}),e.jsx("div",{className:"max-w-lg break-words pr-2",children:"This will apply the same material to all parts in the model. Any previous material changes will be lost."}),e.jsxs("div",{className:"flex mt-8 gap-2 items-center",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:i,onValueChanged:e=>{l(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(o.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(o.VertexButton,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await t.applyAll(),i&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}function createColorMaterialWithId(e,t=a.UUID.create()){return Object.assign({id:t},r.ColorMaterial.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const s=useSceneItemMaterialActions(),i=n.useRecoilValueLoadable(ut),o=n.useRecoilValue(ot),l=m.useMemo((()=>"hasValue"===i.state?null!=o?o:i.contents:o),[i,o]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=l?a.Color.toHexString(l.diffuse):void 0,onValueChanged:()=>{s.apply(),null==t||t(l)},onInput:async e=>{s.updateColor(createColorMaterialWithId(e)),await s.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValue(lt),i=n.useRecoilValueLoadable(ut),l=m.useMemo((()=>{var e,t;return"hasValue"===i.state?null!==(t=null!=s?s:null===(e=i.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:it:null!=s?s:it}),[s,i]),r=useDebouncedCallback((()=>{a.apply()}),500),c=m.useCallback((e=>{a.updateOpacity(e.detail.value),r(e.detail.value)}),[r,a]),u=m.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e.jsx(o.VertexTooltip,{className:"flex w-full",content:u?"Select a part and apply a color to enable opacity":`${Math.floor(l/it*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:u,value:null!=l?l:it,step:5,min:0,max:it,onValueChange:e=>{a.updateOpacity(e.detail.value),a.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({onApplyMaterial:t,onApplyMaterialToAll:a,onApplyOpacity:i}){const o=useSceneItemMaterialActions(),l=n.useRecoilValue(Le);return s.useEffect((()=>{o.clearCurrentColor(),o.clearCurrentOpacity()}),[null==l?void 0:l.id]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(VertexSceneItemMaterialColorPicker,{onApply:t}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:a})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSceneItemMaterialOpacitySlider,{onApply:i}),e.jsx(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:t,tooltip:n,children:a})=>{const[i,r]=s.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(o.VertexDropdownMenu,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${t}`,placement:"bottom-end",onMenuOpened:()=>r(!0),onMenuClosed:()=>r(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(o.VertexTooltip,{content:n,disabled:i,placement:"bottom",children:e.jsxs(o.VertexButton,{className:l("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":i}),"data-testid":`reset-button-${t}`,variant:"plaintext",children:[e.jsx(o.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(o.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:a})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:a})=>{const s=useSceneItemMaterialActions(),i=n.useRecoilValue(We);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{s.clear(),null==t||t()},disabled:!i,children:"Clear selected materials"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{s.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({onClearMaterial:t,onClearAllMaterials:n,onApplyMaterial:a,onApplyMaterialToAll:s,onApplyOpacity:i}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Material",e.jsx(VertexSceneItemMaterialClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexMaterialControls,{onApplyMaterial:a,onApplyMaterialToAll:s,onApplyOpacity:i})})}const gt="#ffff00",ft=35,vt=1,yt=n.atom({key:"selectionHighlightingSelectedColor",default:gt}),bt=n.atom({key:"selectionHighlightingSelectedOpacity",default:ft}),Vt=n.atom({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(yt);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(Vt);return e.jsx(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(bt);return e.jsx(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:t,onUpdateSelectionHighlightOpacity:n,onUpdateSelectionHighlightLineThickness:a}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexSelectionHighlightingColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSelectionHighlightingOpacitySlider,{onUpdate:n}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:a})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[a,s]=n.useRecoilState(yt),[i,l]=n.useRecoilState(bt),[r,c]=n.useRecoilState(Vt),u=a!==gt||i!==ft||1!==r;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(o.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(gt),l(ft),c(1),null==t||t()},disabled:!u})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Selection Highlighting",e.jsx(VertexSelectionHighlightingReset,{onReset:t})]}),children:e.jsx(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:s})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(ht);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexViewerBackgroundColorPicker,{onUpdate:t})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[a,s]=n.useRecoilState(ht),i=a!==xt;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Background Color",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(xt),null==t||t()},disabled:!i})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:t,onUpdateViewerBackgroundColor:n}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Viewer Background",e.jsx(VertexViewerBackgroundReset,{onReset:t})]}),children:e.jsx(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:n})})}const isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,a=e instanceof HTMLElement&&"true"===e.contentEditable,s=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,i=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,o=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,l=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||s||i||o||l},useRecoilReducer=({reducer:e,atom:t})=>{const a=undefined,s=undefined;return[n.useRecoilValue(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const a=undefined;return n.useRecoilCallback((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[])},Ct=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,s,i;switch(t.type){case"push-key-binding":const o=undefined;return null!=(null===(n=e.bindings[t.binding.keyBind])||void 0===n?void 0:n.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:[...null!==(a=e.bindings[t.binding.keyBind])&&void 0!==a?a:[],t.binding]})});case"remove-key-binding":const l=undefined;return null==(null===(s=e.bindings[t.binding.keyBind])||void 0===s?void 0:s.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(i=e.bindings[t.binding.keyBind])&&void 0!==i?i:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Ct});function pressedValue(e,t){return e.includes("!")?!t[e.replace("!","")]&&!t[e.replace("!","").toLowerCase()]:t[e]||t[e.toLowerCase()]}function isPressed(e,t){const n=e.split("||");return n.length>1?n.some((e=>pressedValue(e,t))):pressedValue(n[0],t)}function allPressed(e,t){const n=undefined;return e.split("+").every((e=>isPressed(e,t)))}function matchingSingleFnBindings(e,t,n){return e.filter((e=>!e.repeat)).filter((e=>{var a;return null!=e.keyBind&&null!=n&&(null===(a=e.keyBind)||void 0===a?void 0:a.includes(n))&&allPressed(e.keyBind,t)})).map((e=>e.fn))}function matchingOffBindings(e,t,n){return e.filter((e=>e.off&&e.active&&null!=e.keyBind&&null==n&&!allPressed(e.keyBind,t))).map((e=>e.off))}const useApplyKeyBinding=e=>{const[t,n]=useKeyBindingState();s.useEffect((()=>{const s=a.UUID.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:s,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:s})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();s.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),a=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),a&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,a]=useKeyBindingState(),i=s.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,Object.assign(Object.assign({},n.pressed),{[e]:!0})))).forEach((e=>{const t=n.bindings[e],s=t.length>0?t[t.length-1]:void 0;null!=s&&(s.fn(),a({type:"remove-key-binding",binding:s}))}))}),[n]);s.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),i(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),s=matchingSingleFnBindings(n.applyBindings,t,e.key),o=matchingOffBindings(n.applyBindings,t,e.key);(s.length>0||o.length>0)&&e.preventDefault()}},handleKeyUp=e=>{a({type:"set-key-pressed",key:e.key,pressed:!1})};return window.addEventListener("keydown",handleKeyDown),window.addEventListener("keyup",handleKeyUp),()=>{window.removeEventListener("keydown",handleKeyDown),window.removeEventListener("keyup",handleKeyUp)}}),[i,n.applyBindings,n.pressed]),s.useEffect((()=>{const e=matchingSingleFnBindings(n.applyBindings,n.pressed,n.lastPressed),t=matchingOffBindings(n.applyBindings,n.pressed,n.lastPressed);e.forEach((e=>e())),t.forEach((e=>e()))}),[n.pressed,n.lastPressed]),s.useEffect((()=>{const t=n.applyBindings.filter((e=>e.repeat&&null!=e.keyBind&&allPressed(e.keyBind,n.pressed))).map((e=>e.fn));if(t.length>0){const n=setInterval((()=>{t.forEach((e=>e()))}),e);return()=>{clearInterval(n)}}return()=>{}}),[n.applyBindings,n.lastPressed])},VertexBoxSelectionButton=()=>{const t=useBoxSelectionActions(),a=n.useRecoilValue(pe);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>a,cancelPredicate:()=>!a},[a]),e.jsx(o.VertexTooltip,{content:"Box Selection",children:e.jsx(o.VertexIconButton,{iconName:"box-cursor",iconColor:a?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:a?t.disable:t.enable})})},St=1,VertexResizableContent=t=>{var{className:n,style:a,displayShadow:s,heading:i,id:r,initialScale:c,placement:u="left",children:d,onResize:m}=t,p=__rest(t,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const h="left"===u||"right"===u,g="top"===u;function getHorizontalResizeDirection(){switch(u){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===u?"top":"none"}const f=null!=c?c:1;return e.jsx(o.VertexResizable,Object.assign({id:r,"data-testid":`resizable-content-position-${u}`,className:l(n,"pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300",{"border-r min-w-75 max-w-half":"left"===u,"sidebar-shadow-right":"left"===u&&s,"border-l min-w-75 max-w-half":"right"===u,"sidebar-shadow-left":"right"===u&&s,"border-t bottom-0 fixed":"top"===u,"min-h-12 sheet":g}),style:Object.assign({maxHeight:"top"===u?window.innerHeight:void 0},a),initialHorizontalScale:h?c:void 0,initialVerticalScale:g?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===u||"top"===u?"absolute":"relative",onResizeEnd:()=>null==m?void 0:m()},p,{children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===u&&e.jsx("div",{className:"flex justify-center w-full",children:e.jsx("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),i,e.jsx("div",{className:l("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===u}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromiseRequired(C),n={milliseconds:500},a=await t();await(null==a?void 0:a.camera().viewAll().render({animation:n}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[s,o]=m.useState(),[l,r]=m.useState();m.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=s&&clearTimeout(s),r(i.Point.create(a.touches[0].clientX,a.touches[0].clientY)),o(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=s&&null!=l&&i.Point.distance(l,i.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(s),null==a||a())},handleTouchEnd=()=>{null!=s&&clearTimeout(s)};return null==e||e.addEventListener("touchstart",handleTouchStart),null==e||e.addEventListener("touchmove",handleTouchMove),null==e||e.addEventListener("touchend",handleTouchEnd),()=>{null==e||e.removeEventListener("touchstart",handleTouchStart),null==e||e.removeEventListener("touchmove",handleTouchMove),null==e||e.removeEventListener("touchend",handleTouchEnd)}}),[e,s,l])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:a,disableBackdrop:i,openPredicate:r,onOpen:c,onClose:u,children:d})=>{const m=useContextMenuActions(),p=n.useRecoilValue(le),h=n.useRecoilValue(me),g=s.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=p===a;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:m.clearActiveContextMenu,addPredicate:()=>null!=p&&p===a,cancelPredicate:()=>null==p},[p]);const v=s.useMemo((()=>null!=t?t:null!=r?window:void 0),[t,r]);return useLongPress({target:v,callback:e=>m.longPress(e,a,r,c),onMovement:()=>m.clearActiveContextMenu()}),s.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&p===a){const t=targetShouldSkipNextHit(e);m.clearActiveContextMenu(t)}};if(i)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[i,a,p]),s.useEffect((()=>{const handlePointerDown=e=>{m.pointerDown(e)},handlePointerUp=e=>{m.pointerUp(e,a,r,c)},handleContextMenu=e=>m.contextMenu(e,r);return null==v||v.addEventListener("pointerdown",handlePointerDown),null==v||v.addEventListener("pointerup",handlePointerUp),null==v||v.addEventListener("contextmenu",handleContextMenu),()=>{null==v||v.removeEventListener("pointerdown",handlePointerDown),null==v||v.removeEventListener("pointerup",handlePointerUp),null==v||v.removeEventListener("contextmenu",handleContextMenu)}}),[t,a,r]),e.jsx("div",{className:l({hidden:!f}),children:e.jsx(o.VertexMenu,{"data-testid":`${a}-context-menu`,open:asBooleanAttribute(f),position:h,fallbackPlacements:g,backdrop:!i,onMenuClosed:()=>{m.clearActiveContextMenu(),null==u||u()},children:e.jsx("div",{className:"pt-1",children:d})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=n.useRecoilValue(Fe),s=useViewerCameraActions();return e.jsxs(o.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:()=>{null!=(null==a?void 0:a.boundingBox)&&s.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),a=n.useRecoilValue(ue);return e.jsxs(o.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(a)?null===(e=null==a?void 0:a.node.id)||void 0===e?void 0:e.hex:null==a?void 0:a.id;null!=s&&t.flyToById(s)},disabled:asBooleanAttribute(null==a),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=n.useRecoilValue(g),t=undefined,a=undefined,i=undefined,o=undefined,l=undefined,r=undefined;return{sceneItemsOperation:s.useCallback((async(t,n)=>{const a=await(null==e?void 0:e.scene());null==n?await(null==a?void 0:a.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==a?void 0:a.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:s.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withSelected())).show()])).execute()}),[e]),hideSelected:s.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).hide()])).execute()}),[e]),showOnlyItem:s.useCallback((async t=>{const n=await(null==e?void 0:e.scene());null==n||n.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withItemIds([t]))).show()])).execute()}),[e]),ghostSelected:s.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!0)])).execute()}),[e]),unGhostSelected:s.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.hide()))},children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(ue),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:t.id;null!=s&&a.sceneItemsOperation((e=>e.hide()),[s])},disabled:asBooleanAttribute(null==t),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.show()))},children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(ue),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:null==t?void 0:t.id;null!=s&&a.showOnlyItem(s)},disabled:asBooleanAttribute(null==t),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Selected"})]})};n.atom({key:"sceneTreeLoaderVisible",default:!1});const wt=n.atom({key:"sceneTreeElement",default:void 0}),jt=n.atom({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,s)=>{var i,o;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await s.deselectItem(a):a.selected?await s.selectItem(a,{recurseParent:!0}):a.selected||await s.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const s=await t.getPromise(Le);e.syncSelection({id:null===(i=a.id)||void 0===i?void 0:i.hex,ancestors:null!==(o=null==s?void 0:s.ancestors)&&void 0!==o?o:[]},{selected:!n.metaKey&&!n.ctrlKey||!a.selected,multiSelect:n.shiftKey||n.metaKey||n.ctrlKey})}})),toggleExpansion:useActionCallback((()=>(e,t,n)=>{n.toggleExpandItem(t)})),toggleVisibility:useActionCallback((()=>(e,t,n)=>{n.toggleItemVisibility(t)})),flyToRow:useActionCallback((({snapshot:e})=>async n=>{var a;const s=await e.getPromise(wt),i=await(null==s?void 0:s.getRowAtClientY(n));null!=(null===(a=null==i?void 0:i.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(i.node.id.hex)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(wt),s=await(null==a?void 0:a.getRowAtClientY(n));e(ue,s)}))}}const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Unghost Selected"})]})},DefaultSceneTreeContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(o.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const a=useSceneTreeActions(),s=n.useRecoilValue(wt),i=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:s,onOpen:async(e,t)=>{const n=e;await a.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:i?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHidePartMenuItem,{}),e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(o.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=s.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:a,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},kt=35,At=n.atom({key:"sceneItemGhostingSelectedOpacity",default:kt}),Tt=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),Pt=n.atom({key:"appliedItemPhantomStateIds",default:[]}),Et=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Le);return null!=n&&(null!==(t=e(Tt(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[a,s]=n.useRecoilState(At);return e.jsx(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Pt)).forEach((e=>t(Tt(e)))),t(Pt)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const s=await t.getPromise(Oe);s.forEach((e=>n(Tt(e),a))),n(Pt,(e=>[...e,...s])),await e.execute(Me.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(a)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const s=await t.getPromise(Oe);s.forEach((e=>a(Tt(e)))),n(Pt,(e=>e.filter((e=>!s.includes(e))))),await e.execute(Me.CLEAR_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),clearAllPhantomState:useActionCallback((()=>async()=>{await t(),await e.execute(Me.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}},VertexSceneItemGhostingToggle=({onApply:t})=>{const a=useSceneItemPhantomActions(),s=n.useRecoilValue(We),i=n.useRecoilValueLoadable(Et);return e.jsx(o.VertexTooltip,{content:"Select a part to display as ghost",disabled:s,children:e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!s,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await a.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:t,onApplyOpacity:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexSceneItemGhostingToggle,{onApply:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e.jsx(VertexSceneItemGhostingOpacitySlider,{onApply:n})]})}const VertexSceneItemGhostingClear=({onClear:t,onClearAll:a})=>{const s=useSceneItemPhantomActions(),i=n.useRecoilValue(Et);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await s.clearPhantomState(),null==t||t()},disabled:!i,children:"Clear ghosting for selected"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await s.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:a,onApplyOpacity:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Ghosting",e.jsx(VertexSceneItemGhostingClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexGhostingControls,{onApplyGhostingChange:a,onApplyOpacity:s})})}function VertexMeasurementContextMenu({onDelete:t}){const a=n.useRecoilValue(ce);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(o.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=a&&t(a.id),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}const Rt=n.atom({key:"lengthUnit",default:"cm"}),It=n.atom({key:"decimalPlace",default:"2"});var Mt,Nt;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Mt||(Mt={})),function(e){e[e.mm=1]="mm",e[e.cm=.1]="cm",e[e.m=.001]="m",e[e.in=.03937007874015748]="in",e[e.ft=.0032808398950131233]="ft"}(Nt||(Nt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Nt[t]},convertTo=(e,t)=>{const n=undefined;return e*Nt[t]},formatWithUnit=(e,t,n)=>`${e.toFixed(n)} ${t}`,formatDistance=(e,t,n)=>formatWithUnit(convertTo(e,t),t,n),createDistanceFormatter=(e,t)=>n=>formatDistance(n,e,t);function toUnitType(e){switch(e){case"cm":return"centimeters";case"m":return"meters";case"in":return"inches";case"ft":return"feet";default:return"millimeters"}}function useDockedPlacement(e,t){const[n,a]=m.useState(i.Point.create(0,0));return m.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),s=i.Point.create(n.left,n.bottom),o=i.Point.create(n.right,n.bottom);a("left"===t?s:o)}}),[e,t]),n}function VertexMeasurementDetails({placement:t}){const a=useMeasurementActions(),s=n.useRecoilValue(g),i=n.useRecoilValue(f),r=useDockedPlacement(null!=s?s:null,t),u=n.useRecoilValue(ke),d=n.useRecoilValue(Ae),m=n.useRecoilValue(Te),p=n.useRecoilValue(Pe),h=n.useRecoilValue(Rt),v=n.useRecoilValue(It);return e.jsx(o.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${i}`,position:r,children:e.jsxs("div",{className:"flex flex-col leading-4 min-w-40",children:[e.jsxs("div",{className:"pb-2 flex justify-between",children:[e.jsx("div",{className:"w-full",children:"Measurement"}),e.jsx("div",{className:l("-mt-1 relative",{hidden:!p}),children:e.jsx(o.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(o.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:a.resetMeasurement})})})]}),e.jsx(c.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:l("gap-y-1.5 text-xs",{hidden:null==u}),measurementOutcome:u,measurementOverlays:d,distanceUnits:toUnitType(h),fractionalDigits:parseInt(v,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:l("text-xs",{hidden:null==m}),children:m})]})})}function useCallbackRef(e){var t;const[n,a]=s.useState((t=void 0,null)),i=undefined;return{element:n,callback:s.useCallback((e=>a(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,onPointToPointMeasurementChange:a}){const i=useMeasurementActions(),o=n.useRecoilValue(g),l=n.useRecoilValue(he),r=n.useRecoilValue(fe),u=n.useRecoilValue(Rt),d=n.useRecoilValue(It),{callback:m,element:p}=useCallbackRef();usePointToPointMeasurement(p);const h=s.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};i.setEditedPointToPointMeasurement(t),null==a||a(t)}),[i]);return l?e.jsxs(e.Fragment,{children:[e.jsx(c.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:m,viewer:null!=o?o:void 0,mode:"replace",start:null==r?void 0:r.start,end:null==r?void 0:r.end,invalid:null==r?void 0:r.invalid,units:toUnitType(u),fractionalDigits:parseInt(d,10),showAxisReferenceLines:!0,onEditEnd:h}),e.jsx(VertexMeasurementDetails,{placement:t}),e.jsx(VertexMeasurementContextMenu,{onDelete:i.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(he);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>a,cancelPredicate:()=>!a},[a,t]),e.jsx(o.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(o.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Ot=n.atom({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:t,onEntitiesChanged:a,onOutcomeChanged:s})=>{var i,o,l,r;const u=n.useRecoilValue(g),d=n.useRecoilValue(Ot),m=n.useRecoilValue(ye),{callback:p,element:h}=useCallbackRef();return usePreciseMeasurementModel(h,a,s),m?e.jsxs(e.Fragment,{children:[e.jsx(c.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:p,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(i=null==d?void 0:d.network)||void 0===i?void 0:i.apiHost,renderingHost:null===(o=null==d?void 0:d.network)||void 0===o?void 0:o.renderingHost,sceneTreeHost:null===(l=null==d?void 0:d.network)||void 0===l?void 0:l.sceneTreeHost,sceneViewHost:null===(r=null==d?void 0:d.network)||void 0===r?void 0:r.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(ye);return e.jsx(o.VertexTooltip,{content:"Precise Measurement",children:e.jsx(o.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(Ie),a=n.useRecoilValue(Re);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(o.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=a&&e.jsx(o.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id)]})}const Lt={binding:"{{row.node.name}}",label:"Name",metadataKeyName:"VERTEX_SCENE_ITEM_NAME"};function mapToColumn(e,t){return{label:"name"===e.toLowerCase()?"Name (Property)":e,binding:`{{row.metadata.${e}}}`,initialWidth:t,minWidth:t/2}}const Bt=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(jt);return null!=t?await t.fetchMetadataKeys():[]}}),_t=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Bt).filter((e=>e!==Lt.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),Dt=n.atom({key:"sceneTreeColumnsSelectedMetadataColumnNames",default:[]}),Ht=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(Dt),n=e(wt),a=null==n?void 0:n.clientWidth;if(null!=a&&a>0){const e=1/(t.length+1)*a,n=(a-e)/t.length;return t.reduce(((e,t)=>{const a=mapToColumn(t,n);return Object.assign(Object.assign({},e),{[a.label]:a})}),{Name:Object.assign(Object.assign({},Lt),{initialWidth:e,minWidth:n})})}return{Name:Lt}}}),Ft=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Ht))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e,snapshot:t})=>async n=>{e(Dt,n);const a=await t.getPromise(jt);null==a||a.setMetadataKeys(n)}))}}const zt=16,Ut=-8;var Wt;function useOpenColumnPopover({buttonElement:e}){const[t,n]=m.useState(!1),[a,s]=m.useState(),[i,o]=m.useState(),l=m.useCallback((()=>{if(t)n(!1);else{const t=null==e?void 0:e.getBoundingClientRect();if(null!=t){const e=t.x>window.innerWidth/2?Wt.LEFT:Wt.RIGHT;s({x:e===Wt.LEFT?t.left-zt:t.right+zt,y:t.top+Ut}),o(e),n(!0)}}}),[t,e]),r=m.useCallback((()=>{n(!1)}),[]);return{open:t,position:a,direction:i,handleOpen:l,handleClose:r}}!function(e){e.LEFT="left",e.RIGHT="right"}(Wt||(Wt={}));const VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:a,children:s})=>{const i="string"==typeof s?s.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(o.VertexToggle,{"data-testid":`scene-tree-metadata-check-${i}`,variant:"check",checked:t,disabled:n,onValueChanged:e=>null==a?void 0:a(e.detail)}),e.jsx("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${i}`,onClick:()=>{n||null==a||a(!t)},children:s})]})},VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const a=useSceneTreeColumnActions(),s=n.useRecoilValueLoadable(_t),i=n.useRecoilValue(Dt),[r,c]=m.useState(i),[u,d]=m.useState(""),{element:p,callback:h}=useCallbackRef(),{open:g,position:f,direction:v,handleOpen:b,handleClose:V}=useOpenColumnPopover({buttonElement:p}),C=v===Wt.LEFT?"left-end":"right-start",S=m.useMemo((()=>{if("hasValue"===s.state){const e=s.contents.filter((e=>r.indexOf(e)<0)),t=undefined;return[...[...r].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[r,s.state,s.contents]),w=m.useMemo((()=>S),[g]);return e.jsxs(e.Fragment,{children:[e.jsx(o.VertexTooltip,{content:"Configure Columns",placement:"top",children:e.jsx(o.VertexIconButton,{"data-testid":"scene-tree-column-popover-button",ref:h,iconName:"columns-add",iconSize:"sm",onClick:()=>{b()}})}),g&&e.jsx(o.VertexPopover,{"data-testid":"scene-tree-column-popover",open:g,backdrop:!1,position:f,resizeBehavior:"fixed",placement:C,className:"z-popover",children:e.jsxs("div",{className:l("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!g}),children:[e.jsxs("div",{className:"flex items-center text-[0.875rem] p-3",children:[e.jsxs("div",{className:"pr-2",children:[e.jsx("div",{className:"text-[0.875rem]",children:"Assembly Properties"}),e.jsx("div",{className:"text-[0.75rem] text-neutral-700 mt-1.5",children:"Select up to six properties to appear in the Assembly panel."})]}),e.jsx(o.VertexIconButton,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{d(""),V()}})]}),e.jsx(o.VertexTextfield,{className:"flex w-full px-2 overflow-hidden border-b border-neutral-300 pb-2",id:"scene-tree-available-columns-search-bar","data-testid":"scene-tree-available-columns-search-bar",multiline:!1,placeholder:"Filter properties",type:"text",onInputInput:e=>{const t=e.detail.value;null!=t&&d(t.toLowerCase())}}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:Lt.label}),"hasValue"===s.state&&w.filter((e=>""===u||e.toLowerCase().includes(u))).map((t=>e.jsx(VertexSceneTreeMetadataCheck,{checked:r.includes(t),disabled:r.length>=6&&!r.includes(t),onChange:e=>{c(e?[...r,t]:r.filter((e=>e!==t)))},children:t},t)))]}),e.jsxs("div",{className:"flex items-center p-3 border-t border-neutral-300 space-x-4",children:[e.jsx("div",{className:"text-[0.75rem] text-[var(--vertex-ui-blue-700)] cursor-pointer","data-testid":"scene-tree-column-clear-selection",onClick:()=>c([]),children:"Clear selection"}),e.jsx("div",{className:"flex-grow"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(o.VertexButton,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{d(""),V()},children:"Cancel"}),e.jsx(o.VertexButton,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await a.setActive(r),null==t||t(r),d(""),V()},children:"Apply"})]})]})]})})]})},targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=undefined;return n.useRecoilCallback((({set:t})=>n=>{t(e,n)}),[])}var Gt;function styleFromOptionalFont(e){return null!=e?{"--scene-tree-default-font-family":styleFromFontFace(e.fontFace),"--scene-tree-default-font-color":e.color}:{}}function styleFromOptionalBackgroundColors(e){const t=null==e?void 0:e.depthColors,n=null!=t?Object.keys(t).reduce(((e,n)=>Object.assign(Object.assign({},e),{[`--scene-tree-row-background-color-depth-${n}`]:t[parseInt(n)]})),{}):{};return null!=e?Object.assign(Object.assign({},n),{"--scene-tree-hovered-row-background-color":e.hovered,"--scene-tree-selected-row-background-color":e.selected,"--scene-tree-row-background-color":e.defaultColor}):{}}function styleFromFontFace(e){return e===Gt.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Gt||(Gt={}));const Kt=n.atom({key:"sceneTreeSearchActive",default:!1}),VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const a=n.useSetRecoilState(Kt);return e.jsx(o.VertexTooltip,{className:"flex ml-auto",content:"Scene Tree Search",children:e.jsx(o.VertexIconButton,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{a(!0),null==t||t()}})})},VertexSceneTreeSearchBar=({onSearch:t,onClearSearch:a,onExitSearchMode:s,children:i})=>{const l=n.useRecoilValue(wt),[r,u]=n.useRecoilState(Kt),[d,p]=m.useState(!1),{element:h,callback:g}=useCallbackRef(),f=null==(null==h?void 0:h.value)||""===(null==h?void 0:h.value)||d,v=f?"Exit Search":"Clear Search";return m.useEffect((()=>{r&&(null==h||h.setFocus())}),[h,r]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(c.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:g,controller:null==l?void 0:l.controller,onBlur:()=>{f&&(u(!1),null==s||s())},onSearch:()=>{null==t||t(null==h?void 0:h.value)},onInput:()=>{p(!1)},children:i}),e.jsx(o.VertexTooltip,{className:"self-center pr-1 pl-2",content:v,children:e.jsx(o.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"close-circle-fill",iconSize:"sm",variant:"plain",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{f?(u(!1),null==s||s()):(await(null==h?void 0:h.clear()),await(null==h?void 0:h.setFocus()),p(!0),null==a||a())}})})]})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:a,onSearch:s,onClearSearch:i,children:o})=>{const l=n.useRecoilValue(Kt);return e.jsxs(c.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[l&&e.jsx(VertexSceneTreeSearchBar,{onSearch:s,onClearSearch:i,onExitSearchMode:a,children:o}),!l&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(wt);return e.jsx(o.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(o.VertexIcon,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{null==t||t.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=n.useRecoilValue(wt);return e.jsx(o.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(o.VertexIcon,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{null==t||t.expandAll()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:t})=>e.jsx(c.VertexSceneTreeToolbar,{className:"h-10 border-b border-neutral-300 box-border",children:e.jsxs("div",{className:"flex w-full text-neutral-700 items-center gap mx-2",children:[e.jsx(VertexSceneTreeExpandAll,{}),e.jsx(VertexSceneTreeCollapseAll,{}),e.jsx("div",{className:"ml-auto",children:e.jsx(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:t})})]})}),VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:s,onVisibleSceneTreeColumnsChange:i,children:o})=>{const l=null!=o&&!1!==o;return e.jsx("div",{slot:"header",className:"flex flex-col",children:l?o:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:s,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:i})]})})},VertexSceneTreeTableLayout=t=>{const a=n.useRecoilValue(Ht),s=n.useRecoilValue(Ft),i=[];return e.jsx(c.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},t,{children:s.map(((t,n)=>{var o;const r=a[t],u=null!==(o=i[n])&&void 0!==o?o:r.initialWidth;return e.jsxs(c.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:u,minWidth:r.minWidth,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${l("truncate",{"pl-2":0===n,"pr-2":n===s.length-1})}">\n ${r.label}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${r.binding}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${0===n?"expand-toggle":""}\n ${n===s.length-1?"isolate-button visibility-toggle":""}>\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=r.binding?r.binding:"--"}" \n placement="${n!==s.length-1?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${r.binding}</div>\n </div>\n </vertex-tooltip>\n </div>\n \n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},r.label)}))}))},VertexSceneTree=t=>{var{id:a,font:s,backgroundColors:i,children:o,style:r,onPointerDown:u,onClick:d,onToggleSelection:m,onToggleExpansion:p,onToggleVisibility:h,className:f,rowData:v}=t,b=__rest(t,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const V=n.useRecoilValue(Ot),C=useSelectionActions(),S=useSceneTreeActions(),w=n.useRecoilValue(g),j=useRecoilRef({state:wt}),k=null!=o&&!1!==o,wrappedExpansionHandler=(e,t,n)=>{S.toggleExpansion(e,t,n),null==p||p(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{S.toggleSelection(e,t,n),null==m||m(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{S.toggleVisibility(e,t,n),null==h||h(e,t,n)},handleClick=e=>{e.altKey&&S.flyToRow(e.clientY),null==d||d(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&C.clearSelection(),null==u||u(e)},A=n.useSetRecoilState(jt),handleFirstRowRendered=e=>{var t;A(e.target.controller),null===(t=null==b?void 0:b.onFirstRowRendered)||void 0===t||t.call(b,e)};return e.jsx("div",{className:l("flex flex-col w-full h-full",f),children:e.jsx("div",{className:"flex group h-full",children:e.jsx(c.VertexSceneTree,Object.assign({id:null!=a?a:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:V,ref:j,className:"flex-1",style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(s)),styleFromOptionalBackgroundColors(i)),r),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:w,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==v?void 0:v(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)}},b,{onFirstRowRendered:handleFirstRowRendered,children:k?o:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeHeader,{}),e.jsx(VertexSceneTreeTableLayout,{}),e.jsx(VertexSceneTreeContextMenu,{})]})}))})})},VertexDecimalPlaceSelector=({onApply:t})=>{const[a,s]=n.useRecoilState(It);return e.jsxs(o.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{s(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{className:"py-1.5 px-3",children:"0"}),e.jsx("div",{className:"py-1.5 px-3",children:"1"}),e.jsx("div",{className:"py-1.5 px-3",children:"2"}),e.jsx("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:t})=>{const[a,s]=n.useRecoilState(Rt);return e.jsxs(o.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{s(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e.jsx("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e.jsx("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e.jsx("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e.jsx("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e.jsx(VertexLengthUnitSelector,{onApply:t})]}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e.jsx(VertexDecimalPlaceSelector,{onApply:n})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsx(PanelSection,{header:e.jsx("div",{className:"flex items-center text-base",children:"Units"}),children:e.jsx(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}const $t=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),qt=n.atom({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?$t:qt,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?$t:qt,void 0)}))}}function DefaultAppearancePanel(){return e.jsxs("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e.jsx(VertexMaterialPanelSection,{}),e.jsx(VertexGhostingPanelSection,{}),e.jsx(VertexFeatureEdgesPanelSection,{}),e.jsx(VertexViewerBackgroundPanelSection,{}),e.jsx(VertexSelectionHighlightingPanelSection,{}),e.jsx(VertexCrossSectionAppearancePanelSection,{})]})}function DefaultSettingsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:t,onClearAll:a})=>{const s=useTransformActions(),i=n.useRecoilValue(We);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-selected-transforms",onClick:async()=>{await s.clearSelectedTransforms(),null==t||t()},disabled:!i,children:"Clear selected transforms"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-all-transforms",onClick:async()=>{await s.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const a=useTransformActions(),s=n.useRecoilValue(Ge),i=n.useSetRecoilState(et);return e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:s,onValueChanged:async()=>{s?(a.disableTransformWidget(),null==t||t(!1)):(i("world"),await a.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:t}){return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Enable manipulator"})]})})}function VertexTransformPanelSection({onClearTransforms:t,onClearAllTransforms:n,onToggleTransformsManipulator:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e.jsx(VertexTransformClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexTransformControls,{onToggleTransformsManipulator:a})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const Yt="Appearance",Xt="Settings",Zt="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,a=getHeading(n.useRecoilValue(qt));return e.jsx("div",{className:"flex flex-col w-full items-center z-overlay pointer-events-none md:pointer-events-auto py-3 px-4 border-b border-neutral-300",children:e.jsx("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:a})})};function getHeading(e){switch(e){case"appearance":return Yt;case"settings":return Xt;case"transforms":return Zt;default:return"None"}}function VertexViewerRightOpenedPanel(){const t=n.useRecoilValue(qt),a=s.useMemo((()=>["appearance","settings","transforms"]),[]);return e.jsx(e.Fragment,{children:null!=t&&a.includes(t)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{}),placement:"right",children:["appearance"===t&&e.jsx(DefaultAppearancePanel,{}),"transforms"===t&&e.jsx(DefaultTransformsPanel,{}),"settings"===t&&e.jsx(DefaultSettingsPanel,{})]})})}function Sidebar({children:t}){return e.jsx("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:t,iconName:n,active:a,responsive:i,disabled:r,content:c,tooltipPlacement:u,children:d,onSelect:m,onDeselect:p}){return e.jsx("div",{className:l({"text-[var(--vertex-ui-blue-700)]":a===t&&!r,"text-neutral-700 hover:text-neutral-800":a!==t&&!r,"cursor-pointer hover:bg-neutral-200":!r,"text-neutral-400":r,"rounded-full md:p-3":i,"p-3":!i&&null==d,"px-3 py-1":null!=d}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{r||(a===t?p():m())},children:e.jsxs(o.VertexTooltip,{placement:null!=u?u:void 0,content:s.isValidElement(c)?void 0:c,children:[e.jsx("div",{slot:"content",children:c}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(o.VertexIcon,{name:n}),d]})]})})}function VertexViewerRightSidebar(){const t=usePanelActions(),a=n.useRecoilValue(qt);return e.jsx("div",{className:"flex flex-col flex-shrink-0 items-center relative border-neutral-300 border-l bg-white h-full top-0 min-w-12 w-12",children:e.jsxs(Sidebar,{children:[e.jsx(SidebarIcon,{name:"appearance",active:a,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{t.openPrimary("appearance","right")},onDeselect:()=>t.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:a,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:()=>{t.openPrimary("transforms","right")},onDeselect:()=>t.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:a,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{t.openPrimary("settings","right")},onDeselect:()=>t.closePrimary("right")})]})})}const VertexPopupButton=t=>{var{open:n,children:a}=t,s=__rest(t,["open","children"]);const i=a.find((e=>e.type===Anchor)),r=a.filter((e=>e.type!==Anchor));return null==i?e.jsx(e.Fragment,{}):e.jsxs(o.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},s,{children:[i,e.jsx("div",{className:l("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:r})]}))},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(o.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerToolbarDivider(){return e.jsx("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1 items-center mt-1"})}function VertexViewerCrossSectionAlignmentPopoverMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(K),s=n.useRecoilValue(L),getBaseIcon=()=>`align-to-${null==s?void 0:s.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:t.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==s?void 0:s.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==s?void 0:s.hitPending)},[null==s?void 0:s.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(o.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:a?t.closeAlignmentTools:t.openAlignmentTools,children:e.jsx(o.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(c.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(o.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("global"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-global",iconName:"align-to-global",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Global"})}),e.jsx(o.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("surface"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-surface",iconName:"align-to-surface",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue($),i=n.useRecoilValue(O),l=n.useRecoilValueLoadable(H),r=s.useMemo((()=>{const e=i.length>0&&"hasValue"===l.state?axis(i[0],xAxis(l.contents),yAxis(l.contents),zAxis(l.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[l.state,l.contents,i]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(o.VertexIconButton,{onClick:a?t.closeAxisTools:t.openAxisTools,iconName:r,"data-testid":"align-plane-icon",iconColor:"secondary",children:e.jsx(o.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(c.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(o.VertexIconButton,{"data-testid":"align-plane-x-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(o.VertexIconButton,{className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",variant:"plain",iconColor:"secondary",iconName:"axis-y","data-testid":"align-plane-y-axis-button",onClick:()=>t.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(o.VertexIconButton,{"data-testid":"align-plane-z-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e.jsx("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:t,onOffsetChange:a}){const i=n.useRecoilValue(Rt),l=n.useRecoilValue(It),[r,c]=s.useState(convertTo(t,i));s.useEffect((()=>{c(convertTo(t,i))}),[i,t]);const u=createDistanceFormatter(i,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(r+e,i);a(t)},handleSubmit=e=>{e.preventDefault(),a(convertFrom(r,i))},handleBlur=()=>{a(convertFrom(r,i))};return e.jsx(o.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(o.VertexTextfield,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:u(parseFloat(t.toFixed(3))),onInputInput:e=>{c(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>handleIncrementalUpdate(-1),children:e.jsx(o.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>handleIncrementalUpdate(1),children:e.jsx(o.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Jt=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(G),i=n.useRecoilValueLoadable(U),l=n.useRecoilValueLoadable(W),r=s.useRef(),u=s.useMemo((()=>"hasValue"===i.state?i.contents:R),[i.state,i.contents]),d=s.useMemo((()=>"hasValue"===l.state?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(r.current),r.current=window.setTimeout((()=>{t.endInteraction()}),Jt),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAdditionalTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e.jsx("div",{className:"-ml-px py-1.5",children:e.jsx(o.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(c.VertexViewerToolbarGroup,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexViewerCrossSectionAlignmentPopoverMenu,{}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(o.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary"})}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary"})}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:d,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==i.state),min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state?l.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),a=n.useRecoilValue(I);return e.jsxs(e.Fragment,{children:[e.jsx(o.VertexTooltip,{content:a?"Hide Section":"Show Section",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:a?"primary":"secondary",onClick:()=>a?t.disable():t.enable()})}),e.jsx(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=n.useRecoilValue(g);return e.jsx(o.VertexTooltip,{content:"Fit All",children:e.jsx(o.VertexIconButton,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(null==t?void 0:t.scene());await(null==e?void 0:e.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(v),[i,l]=n.useRecoilState(V),[r,c]=n.useRecoilState(b);return s.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(o.VertexTooltip,{content:"Pan",children:e.jsx(o.VertexIconButton,{iconName:"pan",iconColor:"pan"===i?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(l("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(v),[i,l]=n.useRecoilState(V),[r,c]=n.useRecoilState(b);return s.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(o.VertexTooltip,{content:"Rotate",children:e.jsx(o.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===i?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(l("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(v),[i,l]=n.useRecoilState(V),[r,c]=n.useRecoilState(b);return s.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(o.VertexTooltip,{content:"Zoom",children:e.jsx(o.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===i?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(l("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(c.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(c.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexRotateButton,{}),e.jsx(VertexPanButton,{}),e.jsx(VertexZoomButton,{}),e.jsx(VertexFitAllButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexBoxSelectionButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexViewerCrossSectionButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexPointToPointMeasurementTool,{}),e.jsx(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=null!=t&&!1!==t;return e.jsx(c.VertexViewerToolbar,{placement:"bottom-center",children:n?e.jsx(c.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:i,onRotationChange:o}){const l=useTransformActions(),r=n.useRecoilValue(Xe),u=n.useRecoilValue(Ge),d=n.useRecoilValue(Ke),m=n.useRecoilValue(Ye),p=n.useRecoilValueLoadable(qe),h=n.useRecoilValue(Rt),g=n.useRecoilValue(It),f=s.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=s.useMemo((()=>{const e=undefined;return u&&(null!=f||r)}),[u,f,r]);return e.jsx(e.Fragment,{children:v&&e.jsx(c.VertexViewerTransformWidget,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?f:void 0,decimalPlaces:parseInt(g,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:null==a||a,onInteractionStarted:()=>{l.disableSelectionSync(),l.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{l.invalidateTransforms(),l.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await l.setTransformWidgetPosition(e.detail),null==i||i(e.detail)},onRotationChanged:e=>{l.setTransformWidgetOrientation(e.detail),null==o||o(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),s=useTransformActions(),i=useViewerSceneActions(),handleReset=async()=>{await n.disable(),await a.resetSelectionState(),s.clearTransformWidgetPosition(),null==t||t(),await i.reset()};return e.jsx(o.VertexTooltip,{content:"Reset View",children:e.jsx(o.VertexIconButton,{iconName:"reset",className:"flex bg-white opacity-70 hover:opacity-100 text-neutral-900 hover:text-neutral-700 hover:bg-neutral-200 rounded p-1 cursor-pointer","data-testid":"viewer-reset-tool-button",onClick:handleReset,variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const s=await n.getPromise(Fe);t(S,a.detail.scene),t(Fe,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(He,s);const i=undefined;await n.getPromise(Ge)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:a}=useCallbackRef(),s=useBoxSelectionActions(),i=useTransformActions(),o=n.useRecoilValue(xe);return m.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===o&&(i.clearTransformWidgetOrientation(),i.clearTransformWidgetPosition(),i.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,o]),useApplyKeyBinding({keyBind:"Shift",fn:m.useCallback((()=>s.setOperationType("select")),[]),off:m.useCallback((()=>s.setOperationType("clearAndSelect")),[])}),e.jsx(c.VertexViewerBoxQueryTool,{ref:a,"data-testid":"viewer-box-query-tool",operationType:o})};function VertexViewerCameraTypeMenu({open:t,onOpen:a,onDismiss:s,onCameraTypeChange:i}){const r=useViewerCameraActions(),c=n.useRecoilValue(k);return e.jsxs(o.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:s,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:l("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!t,"opacity-100 text-neutral-700 bg-neutral-200":t}),children:e.jsx(o.VertexTooltip,{content:"Change View",children:e.jsx(o.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===c?"cube-orthographic":"cube-perspective",children:e.jsx(o.VertexIcon,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),e.jsxs("div",{className:"w-36",children:[e.jsx("div",{className:"pt-1"}),e.jsxs(o.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{r.updateCameraType("perspective"),null==i||i("perspective")},children:[e.jsx(o.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:l({"text-[var(--vertex-ui-blue-700)]":"perspective"===c})}),e.jsx("div",{className:l("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===c}),children:"Perspective"})]}),e.jsxs(o.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{r.updateCameraType("orthographic"),null==i||i("orthographic")},children:[e.jsx(o.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:l({"text-[var(--vertex-ui-blue-700)]":"orthographic"===c})}),e.jsx("div",{className:l("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===c}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:a}=t,i=__rest(t,["placement","children"]);const o=Array.isArray(a)?a:[a],l=o.filter((e=>!s.isValidElement(e)||e.type!==c.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),r=o.find((e=>s.isValidElement(e)&&e.type===c.VertexViewerViewCube)),[u,d]=s.useState(!1);return e.jsxs(c.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=r?r:e.jsx(c.VertexViewerViewCube,Object.assign({className:"m-7"},i)),0===l.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:u,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e.jsx("div",{className:"mt-3",children:l})]})},VertexViewer=t=>{var{id:a,className:i,disableSelection:o,onTap:r,onLongpress:u,onFrameDrawn:d,onSceneReady:m,viewerRefCallback:p,children:h}=t,b=__rest(t,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const V=n.useRecoilValue(Ot),C=useRecoilRef({state:g}),S=useViewerCameraActions(),w=useHitActions(),j=useSelectionActions(),A=useViewerFrameActions(),[T,P]=n.useRecoilState(v),E=n.useRecoilValue(k),R=n.useRecoilValue(L),I=n.useRecoilValue(pe),[M,N]=n.useRecoilState(f);s.useEffect((()=>{null!=a&&N(a)}),[a]);const O=n.useRecoilValue(At),B=s.useMemo((()=>({opacity:O/100})),[O]),_=n.useRecoilValue(ie),D=n.useRecoilValue(oe),H=s.useMemo((()=>({color:_,width:D})),[_,D]),F=n.useRecoilValue(ht),U=n.useRecoilValue(yt),W=n.useRecoilValue(bt),G=n.useRecoilValue(Vt),K=s.useMemo((()=>({color:U,opacity:W/100,lineWidth:G})),[U,W,G]),$=n.useRecoilValue(ye),q=null!=h&&!1!==h;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(c.VertexViewer,Object.assign({id:M,"data-testid":"vertex-viewer",ref:null!=p?p:C,className:l("flex w-full h-full",i,{"cursor-crosshair":R.hitPending}),style:{"--viewer-background":F},config:V,cameraType:T?E:void 0,onCameraTypeChanged:e=>{T&&S.updateCameraType(e.detail)},phantom:B,featureLines:H,selectionHighlighting:K,featureMaps:$?"final":void 0,onTap:e=>{const t=[...o?[]:[j.selectCurrentHit]];w.tap(e,...t),null==r||r(e)},onLongpress:e=>{w.longPress(e),null==u||u(e)},onFrameDrawn:e=>{A.frameDrawn(e),null==d||d(e)},onSceneReady:e=>{T||P(!0),null==m||m(e)}},b,{children:[I&&e.jsx(VertexBoxSelectionTool,{}),q?h:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerViewCube,{}),e.jsx(VertexToolbar,{}),e.jsx(VertexViewerContextMenu,{})]})]}))};function toSdkConfig(e){return isOnlyNetworkConfig(e)?{network:e}:e}function isOnlyNetworkConfig(e){const t=undefined;return null!=e.renderingHost}const VertexViewerToolkitEventListener=({onHitStateChange:t,onSelectionStateChange:a})=>{const i=n.useRecoilValue(tt),o=n.useRecoilValue(at);return s.useEffect((()=>{null==t||t(i)}),[i,t]),s.useEffect((()=>{null==a||a(o)}),[o,a]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:a,autoDefineCustomElements:i,children:o,config:l}=t,r=__rest(t,["override","autoDefineCustomElements","children","config"]);return s.useEffect((()=>{(null==i||i)&&(d.defineCustomElements(),u.defineCustomElements())}),[i]),e.jsx(n.RecoilRoot,{override:a,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},r)),e.jsx(VertexViewerToolkitRootConfig,{config:l,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const i=n.useSetRecoilState(Ot);return s.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;i(e)}),[t,i]),e.jsx(e.Fragment,{children:a})};var Qt=Object.freeze({__proto__:null,get AssemblyFontFace(){return Gt}});exports.CrossSection=ne,exports.Hits=nt,exports.SceneTree=Qt,exports.Selection=st,exports.VertexApplicationMessages=VertexApplicationMessages,exports.VertexBoxSelectionButton=VertexBoxSelectionButton,exports.VertexContextMenu=VertexContextMenu,exports.VertexCrossSectionAppearanceColorPicker=VertexCrossSectionAppearanceColorPicker,exports.VertexCrossSectionAppearanceControls=VertexCrossSectionAppearanceControls,exports.VertexCrossSectionAppearanceLineThicknessSlider=VertexCrossSectionAppearanceLineThicknessSlider,exports.VertexCrossSectionAppearancePanelSection=VertexCrossSectionAppearancePanelSection,exports.VertexCrossSectionAppearanceReset=VertexCrossSectionAppearanceReset,exports.VertexDecimalPlaceSelector=VertexDecimalPlaceSelector,exports.VertexFeatureEdgesColorPicker=VertexFeatureEdgesColorPicker,exports.VertexFeatureEdgesControls=VertexFeatureEdgesControls,exports.VertexFeatureEdgesPanelSection=VertexFeatureEdgesPanelSection,exports.VertexFeatureEdgesReset=VertexFeatureEdgesReset,exports.VertexFeatureEdgesThicknessSlider=VertexFeatureEdgesThicknessSlider,exports.VertexFitAllButton=VertexFitAllButton,exports.VertexFitSelectedMenuItem=VertexFitSelectedMenuItem,exports.VertexFlyToMenuItem=VertexFlyToMenuItem,exports.VertexGhostingControls=VertexGhostingControls,exports.VertexGhostingPanelSection=VertexGhostingPanelSection,exports.VertexHideAllMenuItem=VertexHideAllMenuItem,exports.VertexHidePartMenuItem=VertexHidePartMenuItem,exports.VertexHideSelectedMenuItem=VertexHideSelectedMenuItem,exports.VertexLengthUnitSelector=VertexLengthUnitSelector,exports.VertexMaterialControls=VertexMaterialControls,exports.VertexMaterialPanelSection=VertexMaterialPanelSection,exports.VertexMeasurementContextMenu=VertexMeasurementContextMenu,exports.VertexMeasurementDetails=VertexMeasurementDetails,exports.VertexPanButton=VertexPanButton,exports.VertexPointToPointMeasurement=VertexPointToPointMeasurement,exports.VertexPointToPointMeasurementTool=VertexPointToPointMeasurementTool,exports.VertexPreciseMeasurement=VertexPreciseMeasurement,exports.VertexPreciseMeasurementTool=VertexPreciseMeasurementTool,exports.VertexResizableContent=VertexResizableContent,exports.VertexRotateButton=VertexRotateButton,exports.VertexSceneItemGhostingClear=VertexSceneItemGhostingClear,exports.VertexSceneItemGhostingOpacitySlider=VertexSceneItemGhostingOpacitySlider,exports.VertexSceneItemGhostingToggle=VertexSceneItemGhostingToggle,exports.VertexSceneItemMaterialClear=VertexSceneItemMaterialClear,exports.VertexSceneItemMaterialColorPicker=VertexSceneItemMaterialColorPicker,exports.VertexSceneItemMaterialOpacitySlider=VertexSceneItemMaterialOpacitySlider,exports.VertexSceneTree=VertexSceneTree,exports.VertexSceneTreeColumnPopover=VertexSceneTreeColumnPopover,exports.VertexSceneTreeContextMenu=VertexSceneTreeContextMenu,exports.VertexSceneTreeHeader=VertexSceneTreeHeader,exports.VertexSceneTreeTableLayout=VertexSceneTreeTableLayout,exports.VertexSelectionHighlightingColorPicker=VertexSelectionHighlightingColorPicker,exports.VertexSelectionHighlightingControls=VertexSelectionHighlightingControls,exports.VertexSelectionHighlightingLineThicknessSlider=VertexSelectionHighlightingLineThicknessSlider,exports.VertexSelectionHighlightingOpacitySlider=VertexSelectionHighlightingOpacitySlider,exports.VertexSelectionHighlightingPanelSection=VertexSelectionHighlightingPanelSection,exports.VertexSelectionHighlightingReset=VertexSelectionHighlightingReset,exports.VertexShowAllMenuItem=VertexShowAllMenuItem,exports.VertexShowOnlyMenuItem=VertexShowOnlyMenuItem,exports.VertexShowOnlySelectedMenuItem=VertexShowOnlySelectedMenuItem,exports.VertexToolbar=VertexToolbar,exports.VertexTransformClear=VertexTransformClear,exports.VertexTransformControls=VertexTransformControls,exports.VertexTransformManipulatorToggle=VertexTransformManipulatorToggle,exports.VertexTransformPanelSection=VertexTransformPanelSection,exports.VertexTransformWidget=VertexTransformWidget,exports.VertexUnitsControls=VertexUnitsControls,exports.VertexUnitsPanelSection=VertexUnitsPanelSection,exports.VertexViewer=VertexViewer,exports.VertexViewerBackgroundColorPicker=VertexViewerBackgroundColorPicker,exports.VertexViewerBackgroundControls=VertexViewerBackgroundControls,exports.VertexViewerBackgroundPanelSection=VertexViewerBackgroundPanelSection,exports.VertexViewerBackgroundReset=VertexViewerBackgroundReset,exports.VertexViewerContextMenu=VertexViewerContextMenu,exports.VertexViewerCrossSectionButton=VertexViewerCrossSectionButton,exports.VertexViewerRightOpenedPanel=VertexViewerRightOpenedPanel,exports.VertexViewerRightSidebar=VertexViewerRightSidebar,exports.VertexViewerSceneReset=VertexViewerSceneReset,exports.VertexViewerToolbarDivider=VertexViewerToolbarDivider,exports.VertexViewerToolkitRoot=VertexViewerToolkitRoot,exports.VertexViewerViewCube=VertexViewerViewCube,exports.VertexZoomButton=VertexZoomButton;
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("pino"),n=require("recoil"),a=require("@vertexvis/utils"),s=require("react"),l=require("@vertexvis/geometry"),i=require("@vertexvis/ui-react"),o=require("classnames"),r=require("@vertexvis/viewer"),c=require("@vertexvis/viewer-react"),u=require("@vertexvis/ui/loader"),d=require("@vertexvis/viewer/loader");function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var m=_interopNamespaceDefault(s);function __rest(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(n[a[s]]=e[a[s]]);return n}"function"==typeof SuppressedError&&SuppressedError;const p=t({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?p.error(t,e):p.error(e)},logger_info=(e,t)=>{null!=t?p.info(t,e):p.info(e)},logger_warn=(e,t)=>{null!=t?p.warn(t,e):p.warn(e)},logger_debug=(e,t)=>{null!=t?p.debug(t,e):p.debug(e)};class h{}function useActionCallback(e,t=[]){const a=t instanceof h?void 0:t;return n.useRecoilCallback((t=>e(Object.assign(Object.assign({},t),{snapshot:Object.defineProperties(t.snapshot,{getPromiseRequired:{configurable:!0,value:createGetPromiseRequiredWrapper(t.snapshot)},tryGetPromise:{configurable:!0,value:createTryGetPromiseWrapper(t.snapshot)}})}))),a)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,a=__rest(t,["snapshot"]);return async(...t)=>{const s=n.retain();try{const s=undefined;return await e(Object.assign(Object.assign({},a),{snapshot:n}))(...t)}finally{s()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const a=await e.getPromise(t);if(null==a)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return a}}function createTryGetPromiseWrapper(e){return async t=>{try{return{value:await e.getPromise(t)}}catch(e){return logger_debug(`Error encountered retrieving Recoil value. [key={${t.key}}]`,e),{error:e}}}}const g=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),f=n.atom({key:"viewerElementId",default:"vertex-viewer"}),v=n.atom({key:"viewerInitialSceneReady",default:!1}),b=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),S=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),C=n.selector({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(g))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),V=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),w=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(V))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const s=await e.getPromise(C),l=await s();a.length>0&&await(null==l?void 0:l.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=s.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=s.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),l=s.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const s=a.UUID.create();await e(t,s,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:l,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(C),a=await n(),s=await e.getPromiseRequired(k);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:s})}))}}const j=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(C),s=await a();await(null==s?void 0:s.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:j}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(C),s=await a();await(null==s?void 0:s.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:j}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(k,t)}))}}const k=n.atom({key:"viewerCameraType",default:"perspective"});class A{constructor(){this.interactionStarted=!1}initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){var e;this.interactionStarted||(await(null===(e=this.api)||void 0===e?void 0:e.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){var e;await(null===(e=this.api)||void 0===e?void 0:e.endInteraction()),this.interactionStarted=!1}}const create=(e,t=0)=>({normal:e,offset:t}),forAxis=(e,t)=>{switch(e){case"x":return x(t);case"y":return y(t);case"z":return z(t)}},x=e=>create(l.Vector3.left(),-e),y=e=>create(l.Vector3.down(),-e),z=e=>create(l.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},T={x:l.Vector3.left(),y:l.Vector3.down(),z:l.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||l.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||l.Vector3.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,a)=>e&&e.normal&&[["x",t],["y",n],["z",a]].filter((t=>0===l.Vector3.magnitude(l.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>l.Vector3.dot(l.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return l.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:l.Vector3.multiply(e.normal,l.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=l.Vector3.normalize(e.normal),a=l.Vector3.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,s)=>{const i=n.viewAll(),o=getAxis(e,t),r=null!=a&&null!=o?create(o,l.Vector3.dot(o,s||l.BoundingBox.center(a))):forAxis(e,i.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[l.Vector3.create(e.min.x,e.min.y,e.min.z),l.Vector3.create(e.min.x,e.min.y,e.max.z),l.Vector3.create(e.min.x,e.max.y,e.min.z),l.Vector3.create(e.min.x,e.max.y,e.max.z),l.Vector3.create(e.max.x,e.max.y,e.max.z),l.Vector3.create(e.max.x,e.max.y,e.min.z),l.Vector3.create(e.max.x,e.min.y,e.max.z),l.Vector3.create(e.max.x,e.min.y,e.min.z)]}function equals(e,t){return e.min.x===t.min.x&&e.min.y===t.min.y&&e.min.z===t.min.z&&e.max.x===t.max.x&&e.max.y===t.max.y&&e.max.z===t.max.z}const P="#999999",E=1,R={default:5,min:0,max:10},I=n.atom({key:"crossSectioningEnabled",default:!1}),N=n.atom({key:"crossSectioningHighlightColor",default:P}),M=n.atom({key:"crossSectioningBorderWidth",default:1}),O=n.atom({key:"crossSectioningPlanes",default:[]}),L=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),B=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(w)}}),D=n.atom({key:"crossSectioningIsInteractive",default:!1}),_=n.atom({key:"crossSectioningActiveAxis",default:"x"}),F=n.atom({key:"crossSectioningAvailableAxes",default:T}),H=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(O);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),U=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(O),n=e(B),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>l.Vector3.dot(e,isNegativeNormal(t[0])?l.Vector3.multiply(t[0].normal,l.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return R}}),W=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(O),n=e(H),a=e(U);return t.length>0?t[0].offset*n:a.default}}),G=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),K=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),$=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),q=n.atom({key:"crossSectioningInteractionHandler",default:new A,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const a=n.useRecoilValue(q);s.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(a))}),[e,t,a])}const Y=n.atom({key:"hitResultsTapDetails",default:void 0}),X=n.atom({key:"hitResultsLongPressDetails",default:void 0}),Z=n.atom({key:"previousHitResult",default:void 0}),J=n.atom({key:"currentHitResult",default:void 0}),Q=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,a,s,i,o,r,c;const u=e(Y),d=e(X),m=null!=u?u:d,p=e(C),h=await p(),g=null==h?void 0:h.sceneViewId,f=null==h?void 0:h.raycaster();if(null!=m&&null!=f&&null!=g){const e=await f.hitItems(m.position),u=((null==e?void 0:e.hits)||[])[0];if(null!=u)return{id:null===(t=u.itemId)||void 0===t?void 0:t.hex,normal:l.Vector3.create((null===(n=null==u?void 0:u.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==u?void 0:u.hitNormal)||void 0===a?void 0:a.y)||0,(null===(s=null==u?void 0:u.hitNormal)||void 0===s?void 0:s.z)||0),position:l.Vector3.create((null===(i=null==u?void 0:u.hitPoint)||void 0===i?void 0:i.x)||0,(null===(o=null==u?void 0:u.hitPoint)||void 0===o?void 0:o.y)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.z)||0),meta:m.metaKey||m.ctrlKey||!1,metadata:[],ancestors:(null===(c=null==u?void 0:u.ancestors)||void 0===c?void 0:c.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[]}}}}),ee=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=l.Vector3.dot(l.Vector3.normalize(e.up),t),a=Math.abs(n)>.98?l.Vector3.normalize(l.Vector3.scale(-n,e.viewVector)):e.up,s=l.Vector3.add(l.Vector3.scale(l.Vector3.distance(e.position,e.lookAt),l.Vector3.multiply(t,l.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:s})}{const a=l.Vector3.angleTo(l.Vector3.normalize(e.viewVector),t),s=null!=n?l.BoundingBox.center(n):e.lookAt,i=l.Vector3.normalize(l.Vector3.cross(l.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,s,i)}};function isParallelTo(e,t){const n=l.Angle.toDegrees(l.Vector3.angleTo(e,t));return 0===n||180===n}const te=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(M),n=await e.getPromise(N),s=await e.getPromise(O),l=await e.getPromise(C),i=await l();await(null==i?void 0:i.crossSectioning().update({sectionPlanes:s,highlightColor:n?a.Color.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const s=await a.getPromise(C),l=await s();if(null!=l){const a=l.camera().viewAll();n(F),t(O,[towardsCamera(l.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(Q).then((e=>e.value)),s=await t.getPromise(C),l=await s();if(null!=a&&null!=l){const t=fromHit(a,l.camera());n(O,null!=t?[t]:[]),n(F,null!=t?{x:t.normal}:T),await e()}}))),s=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(O),s=undefined;await n.getPromise(I)||(e(I,!0),0===a.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(I)&&(t(I),t(G),t(K),t($),t(O),t(L),t(_),await e())}));return{enable:s,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(I)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(I)||await s(),e(G,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(G)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t($),e(K,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(K)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(K),e($,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e($)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(q);e(D,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(q);e(D),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const s=await n.getPromise(O);if(s.length>0){const l=await n.getPromise(H),i=await n.getPromise(U),o=l<0?-1*i.max:i.min,r=l<0?-1*i.min:i.max,c=s.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*l,o),r)})));t(O,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(O);t(O,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(O),n=await e.getPromise(g),a=await(null==n?void 0:n.scene());t.length>0&&null!=a&&await alignToNormal(a.camera(),t[0].normal,a.boundingBox()).render({animation:{milliseconds:te}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async s=>{const i=await a.getPromise(O),o=await a.getPromise(F),r=await a.getPromise(B),c=await a.getPromise(L),u=await a.getPromise(g),d=await(null==u?void 0:u.scene()),m=o[s],p=null!=m&&i.length>0&&isParallelTo(i[0].normal,m)&&!isNaN(l.Vector3.angleTo(i[0].normal,m));if(null!=d&&!p){const e=await a.tryGetPromise(Q).then((e=>e.value));t(_,s),t(O,[toAxis(s,o,d.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n($),await e()}))),updateAlignment:useActionCallback((({set:e,reset:a})=>async(l,i)=>{a(K),e(L,{mode:l,hitPending:"global"!==l&&null==i}),"global"===l?(a(_),a(F),await t()):"surface"===l&&null!=i&&(await s(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(L);a.hitPending&&(e(L,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(L);n.hitPending&&e(L,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var ne=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:te,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:P,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:R,crossSectioningActiveAxis:_,crossSectioningAdditionalToolsOpen:G,crossSectioningAlignment:L,crossSectioningAlignmentToolsOpen:K,crossSectioningAvailableAxes:F,crossSectioningAxisToolsOpen:$,crossSectioningBorderWidth:M,crossSectioningEnabled:I,crossSectioningHighlightColor:N,crossSectioningInteractionHandler:q,crossSectioningIsInteractive:D,crossSectioningOffsetScalar:H,crossSectioningPlaneDisplayOffset:W,crossSectioningPlanes:O,crossSectioningSliderRange:U,crossSectioningTargetBoundingBox:B,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=s.useState();return s.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),s.useCallback((s=>{const handler=()=>{e(s)};null!=n&&clearTimeout(n),a(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,a=__rest(t,["onInput"]);const l=useDebouncedCallback((e=>{null==n||n(e)}),500),o=s.useCallback((e=>{const t=e.target;l(t.value)}),[l]);return e.jsx(i.VertexColorPicker,Object.assign({onInput:o},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const a=useCrossSectioningActions(),[s,l]=n.useRecoilState(N);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:s,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{l(e),await a.reapply()}})},VertexSlider=t=>{var{value:n,defaultValue:a,leftLabel:l,rightLabel:r,onChange:c,onValueChange:u,onValueInput:d}=t,m=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[p,h]=s.useState(a);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[l&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:l}),e.jsx(i.VertexSlider,Object.assign({className:o("w-full",{"mt-0.5":null!=l||null!=r}),value:null!=n?n:p,onValueChange:e=>{h(e.detail.value),null==c||c(e.detail.value),null==u||u(e)},onValueInput:e=>{h(e.detail.value),null==c||c(e.detail.value),null==d||d(e)}},m)),r&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:r})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const a=useCrossSectioningActions(),[s,l]=n.useRecoilState(M);return e.jsx(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:s,valueLabelDisplay:"auto",onValueInput:async e=>{l(e.detail.value),await a.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexCrossSectionAppearanceColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:n})]})}function PanelSection({header:t,children:n}){return e.jsxs("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e.jsx("div",{className:"my-2 text-base text-neutral-700",children:t}),n]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const a=useCrossSectioningActions(),[s,l]=n.useRecoilState(N),[o,r]=n.useRecoilState(M),c=s!==P||1!==o;return e.jsx("div",{className:"ml-auto",children:e.jsx(i.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(i.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{l(P),r(1),null==t||t(),await a.reapply()},disabled:!c})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Cross Sectioning",e.jsx(VertexCrossSectionAppearanceReset,{onReset:t})]}),children:e.jsx(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a})})}const ae=.5,se="#444444",le=n.atom({key:"featureEdgesSelectedColor",default:se}),ie=n.atom({key:"featureEdgesLineThickness",default:ae}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(le);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(ie);return e.jsx(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:t,onUpdateFeatureEdgesThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexFeatureEdgesColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexFeatureEdgesThicknessSlider,{onUpdate:n})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[a,s]=n.useRecoilState(le),[l,o]=n.useRecoilState(ie),r=l!==ae||a!==se;return e.jsx("div",{className:"ml-auto",children:e.jsx(i.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(i.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(se),o(ae),null==t||t()},disabled:!r})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:t,onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Feature Edges",e.jsx(VertexFeatureEdgesReset,{onReset:t})]}),children:e.jsx(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a})})}function contextMenuItemIsRow(e){var t;return null!=e&&null!=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.id)}const oe=n.atom({key:"contextMenuActive",default:void 0}),re=n.atom({key:"contextMenuPosition",default:void 0}),ce=n.atom({key:"contextMenuTarget",default:void 0}),ue=n.atom({key:"contextMenuItem",default:void 0}),de=n.atom({key:"contextMenuActions",default:[]}),me=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(oe)?e(re):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,a=null==t?void 0:t.clientY;e(re,l.Point.create(n,a)),e(ce,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,s,i)=>{const o=await e.getPromise(re),r=await e.getPromise(oe);if(null!=o&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=l.Point.create(e,r),u=null!=o?l.Point.distance(o,c):0,d=null==s||s(n);u<2&&d&&(null==i||i(n,null!=o?o:c),t(oe,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,s)=>{if(null==a||a(t)){const a=l.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(re,a),e(ce,t.target),e(oe,n),null==s||s(t,a)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(ee,!!n),e(oe),e(de),e(re)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(ee)))}}function targetWithinMenu(e){return e.target instanceof Element&&isChildOf("vertex-menu",e.target)}function targetShouldSkipNextHit(e){return e.target instanceof Element&&isChildOf("vertex-viewer",e.target)}function isChildOf(e,t){return null!=t.closest(e)}const pe=n.atom({key:"boxSelectionEnabled",default:!1}),xe=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(pe,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(pe),e(xe)})),setOperationType:useActionCallback((({set:e})=>t=>{e(xe,t)}))});async function whenComponentReady(e,t){return null!=e&&null!=e.nodeName&&await customElements.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):void 0}const he=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),ge=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),fe=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(ge);s.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const ve=2,ye=n.atom({key:"isEditingPreciseMeasurement",default:!1}),be=n.atom({key:"preciseMeasurementOutcome",default:void 0}),Se=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),Ce=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),Ve=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),we=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(Ve).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,a){const l=n.useSetRecoilState(Ve),i=n.useSetRecoilState(be),o=n.useSetRecoilState(Se),r=n.useSetRecoilState(Ce),c=n.useRecoilValue(Se);s.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{l(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,l]),s.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{i(e),null==a||a(e)}))})),()=>null==t?void 0:t.dispose()}),[e,i]),s.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==c||c.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,c]),s.useEffect((()=>{whenComponentReady(e,(()=>{o(null==e?void 0:e.measurementController)}))}),[e,o]),s.useEffect((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementOverlays)}))}),[e,r])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),s=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Se);null==t||t.clearEntities()})),l=useActionCallback((()=>async(e={})=>{await s(),n(e),a()})),i=useActionCallback((({set:e,reset:n})=>async a=>{await l(),"point-to-point"===a?t():(n(be),n(Ve),e(ye,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await l(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await i(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(ye),a=await e.getPromise(he);n?await s():a&&(t(ge),t(fe))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(fe)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(fe,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(he)?await l():await i("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ye)?await l():await i("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(he,!0),n.keepExistingMeasurement||e(ge)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(he),t.keepExistingMeasurement||(e(fe),e(ge))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(ye),e(be),e(Ve)}))}const je=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(he)||e(ye)}),ke=n.selector({key:"measurementPanelModel",get:({get:e})=>e(ge)||e(be)}),Ae=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(Ce)}),Te=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(ye)?e(we):void 0}}),Pe=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(je)&&null!=e(ke)}),Ee=3e3,Re=n.atom({key:"applicationMessageToast",default:void 0}),Ie=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(Ie,null!=t?Object.assign(Object.assign({},t),{id:a.UUID.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Re,null!=t?Object.assign(Object.assign({},t),{id:a.UUID.create()}):void 0)}))});var Ne;!function(e){e.HIDE_ITEM="Hide Item",e.SHOW_ONLY_SELECTED="Show Only Selected",e.HIDE_SELECTED="Hide Selected",e.SHOW_ONLY_ITEM="Show Only Item",e.SHOW_ALL="Show All",e.HIDE_ALL="Hide All",e.SELECT_FILTERED_ITEMS="Select Filtered Items",e.INVERT_SELECTION="Invert Selection",e.CLEAR_ALL_TRANSFORMS="Clear All Transforms",e.CLEAR_SELECTED_TRANSFORMS="Clear Selected Transforms",e.CLEAR_SELECTION="Clear Selection",e.DESELECTING_ITEMS="Deselecting Items",e.SELECTING_ITEMS="Selecting Items",e.SELECTING_ONLY_ITEM="Selecting Only Item",e.SELECTING_ANCESTOR="Selecting Ancestor",e.APPLY_MATERIAL_OVERRIDE_TO_ALL="Apply Material Override To All",e.APPLY_MATERIAL_OVERRIDE_TO_SELECTION="Apply Material Override To Selection",e.CLEAR_ALL_MATERIAL_OVERRIDES="Clear All Material Overrides",e.CLEAR_SELECTED_MATERIAL_OVERRIDES="Clear Selected Material Overrides",e.SET_PHANTOM_ALL="Set Phantom All",e.SET_PHANTOM_SELECTED_ITEMS="Set Phantom Selected Items",e.CLEAR_PHANTOM_ALL="Clear Phantom All",e.CLEAR_PHANTOM_SELECTED_ITEMS="Clear Phantom Selected Items",e.SET_PHANTOM_NON_SELECTED_ITEMS="Set Phantom Non Selected Items",e.RESTORE_PHANTOM_OVERRIDES="Restore Phantom Overrides",e.SET_ITEM_AS_END_ITEM="Set Item as End Item",e.UNSET_ITEM_AS_END_ITEM="Unset Item as End Item",e.SHOW_ANNOTATION="Show Annotation",e.HIDE_ANNOTATION="Hide Annotation"}(Ne||(Ne={}));const Me=n.atomFamily({key:"selectionSelectedItems",default:void 0}),Oe=n.atom({key:"selectionSelectedItemIds",default:[]}),Le=n.atom({key:"selectionLastSelected",default:void 0}),Be=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),De=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),_e=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(Le),s=e(Oe);return null!==(n=null===(t=null==a?void 0:a.ancestors)||void 0===t?void 0:t.find((e=>s.includes(e))))&&void 0!==n?n:null==a?void 0:a.id}}),Fe=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),He=n.atom({key:"selectionVisibleSummary",default:void 0}),ze=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(He))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),Ue=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(He);return null!=(null==t?void 0:t.boundingBox)?l.BoundingBox.center(t.boundingBox):l.Vector3.origin()}}),We=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(Oe),n=undefined;return e(ze)>0||t.length>0}}),Ge=n.atom({key:"transformWidgetEnabled",default:!1}),Ke=n.atom({key:"transformWidgetPosition",default:void 0}),$e=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),qe=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e($e);if(null!=t)return t}}),Ye=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),Xe=n.atom({key:"transformWidgetSyncToSelection",default:!1}),Ze=n.atom({key:"transformWidgetIsInteracting",default:!1}),Je=n.atomFamily({key:"appliedItemTransform",default:void 0}),Qe=n.atom({key:"appliedItemTransformIds",default:[]}),et=n.atom({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Ue);e(Ke,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Ke),s=await t.getPromise(De),l=await t.getPromise(Oe),i=await t.getPromise(ze);null==a&&(l.length>0||s||i>0)&&await n(),e(Xe,!0)})),s=useActionCallback((({set:e})=>async t=>{e(Ke,null!=t?t:void 0)})),i=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(qe),s=undefined;(await e.getPromise(Qe)).forEach((e=>{n(Je(e))})),null!=a&&t(Ye,a)}))),o=useActionCallback((({set:e,reset:t})=>n=>{t(Ye),e($e,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(l,i)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Ee}),t(Ge,!0),i?await n():null==l?await a():await s(l)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Ge),e($e)})),setTransformWidgetOrientation:o,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Ye),e($e)})),setTransformWidgetPosition:s,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ke))),invalidateTransforms:i,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(Ze,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Xe,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Xe))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Fe),n=await e.getPromise(He),a=undefined;if(await e.getPromise(Xe)){const e=null==n?void 0:n.boundingBox,a=null!=e&&null!=(null==t?void 0:t.boundingBox)&&equals(e,t.boundingBox);null==e||a||await s(l.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Xe),null!=t?(await s(null==t?void 0:t.position),o(l.Vector3.eulerTo(l.Vector3.up(),t.normal))):(e(Ke),o(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Ne.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(Ke,void 0),e(Ge,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Ne.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(Ke,void 0),e(Ge,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Q).then((e=>e.value)),a=await e.getPromise(fe);null==n&&null!=(null==a?void 0:a.start)&&null!=a.end&&await t.resetMeasurement()}))),s=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Q).then((e=>e.value));await n.orientToHitResult(t)}))),l=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Q).then((e=>e.value));e(ue,n)}))),i=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(J,await e.tryGetPromise(Q).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:o},...r)=>{const c=await t.getPromise(je),u=await t.getPromise(L),d=2!==(null==o?void 0:o.buttons)&&!(null==o?void 0:o.altKey);o.altKey||o.ctrlKey||o.metaKey||o.shiftKey;const m=d&&!u.hitPending&&!c,p=await t.tryGetPromise(Q).then((e=>e.value));n(Z,p),n(Y,o),await a(),m&&(r.forEach((e=>e())),await s()),await l(),await e.sectionCurrentHit(),await i()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Y),t(X,a.detail),await e.tryGetPromise(Q),await l(),await i()})))}},tt=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,s=undefined,l=undefined;return{tapDetails:e(Y),longPressDetails:e(X),previousHitResult:e(Z),currentHitResult:e(J)}}});var nt=Object.freeze({__proto__:null,currentHitResult:J,hitResult:Q,hitResultsLongPressDetails:X,hitResultsSkipNextTap:ee,hitResultsTapDetails:Y,hitState:tt,previousHitResult:Z,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Oe)).forEach((e=>t(Me(e))))})),a=useActionCallback((({snapshot:e,reset:n,set:a})=>async(s,l)=>{var i,o;const r=await e.getPromise(Me(s.id)),c=await e.getPromise(Oe),d=null===(o=[...null!==(i=s.ancestors)&&void 0!==i?i:[]])||void 0===o?void 0:o.reverse().find((e=>!c.includes(e)));null!=r&&null!=d?(a(Me(d),{id:d}),a(Oe,(e=>[...e,d])),t.execute(Ne.SELECTING_ANCESTOR,t.selectItemsTransform(d))):(null==l?void 0:l.clear)?(a(Me(s.id),s),a(Oe,[s.id]),t.execute(Ne.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(s.id))):(a(Me(s.id),s),a(Oe,(e=>[...e,s.id])),t.execute(Ne.SELECTING_ITEMS,t.selectItemsTransform(s.id))),u(s),a(Le,s),a(Be,!0),n(De)})),s=useActionCallback((({reset:e,set:n})=>async a=>{e(Me(a)),e(De),n(Oe,(e=>e.filter((e=>e!==a)))),t.execute(Ne.DESELECTING_ITEMS,t.deselectItemsTransform(a))})),l=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Me(t.id));null!=n?await s(n.id):await a(t)})),i=useActionCallback((({snapshot:t,reset:n,set:s})=>async(l,i={})=>{const o=await t.getPromise(Me(l.id)),r=await t.getPromise(Oe);if(r.filter((e=>{var t;return e!==l.id&&!(null===(t=l.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>n(Me(e)))),n(De),o)if(i.ignoreAncestorSelection)n(Oe),n(Me(o.id));else{const e=r.filter((e=>{var t;return e===l.id||(null===(t=l.ancestors)||void 0===t?void 0:t.includes(e))}));s(Oe,e)}else n(Oe);e.clearTransformWidgetOrientation(),await a(l,{clear:!0})})),o=useActionCallback((({reset:t})=>async()=>{await n(),t(Oe),t(Le),t(Be),t(De),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),r=useActionCallback((()=>async()=>{await o(),t.execute(Ne.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(De,t)})),u=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:a,toggleSelection:l,clearAndSelect:i,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Q).then((e=>e.value)),n=await e.getPromise(Y),a=(null==n?void 0:n.metaKey)||(null==n?void 0:n.ctrlKey)||(null==n?void 0:n.shiftKey);null==t||a?null!=t&&a?await l(t):await r():await i(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(a,s)=>{s.selected?(await n(),e(Me(a.id),a),s.multiSelect?e(Oe,(e=>[...e.filter((e=>e!==a.id)),a.id])):e(Oe,[a.id]),u(a),e(Le,a),e(Be,!1),e(De,!!s.multiSelect)):(t(Me(a.id)),t(De),e(Oe,(e=>e.filter((e=>e!==a.id)))))})),deselect:s,clearSelection:r,resetSelectionState:o,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:u}}const at=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,s=undefined;return{selectedItemIds:e(Oe),lastSelected:e(Le),highestSelectedAncestorId:e(_e)}}});var st=Object.freeze({__proto__:null,selectionBoundingBoxCenter:Ue,selectionHighestSelectedAncestor:_e,selectionIsActive:We,selectionLastSelectWasMultiSelect:De,selectionLastSelected:Le,selectionLastSelectionFromViewer:Be,selectionPreviousVisibleSummary:Fe,selectionSelectedItemIds:Oe,selectionSelectedItems:Me,selectionState:at,selectionVisibleCount:ze,selectionVisibleSummary:He,useSelectionActions:useSelectionActions});const lt=255,it=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),ot=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),rt=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),ct=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),ut=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Le);if(null!=t)return e(rt(t.id))}}),dt=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),mt=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),pt=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(ct);t(it),n.forEach((e=>t(rt(e)))),t(ct)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(it,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(it)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(ot)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const s=await t.getPromise(Oe);a(it),s.forEach((e=>a(rt(e)))),n(ct,(e=>e.filter((e=>!s.includes(e))))),await e.execute(Ne.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(Ne.CLEAR_ALL_MATERIAL_OVERRIDES,(e=>e.where((e=>e.all())).clearMaterialOverrides()),(e=>e.where((e=>e.withSelected())).select()))})),clearState:t,updateOpacity:useActionCallback((({set:e})=>t=>{e(ot,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(it),s=await t.getPromise(ot),l=await t.getPromise(Oe),i=await t.getPromise(ut),o=null!=a?a:i,r=null!=s?s:null==i?void 0:i.opacity;if(null!=o){const t=Object.assign(Object.assign({},o),{opacity:null!=r?r:o.opacity});await e.execute(Ne.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),l.forEach((e=>n(rt(e),t))),n(ct,(e=>[...e,...l]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(pt,!0),e(dt,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(pt),e(dt)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(it),s=await t.getPromise(ot);if(null!=a){const l=await t.getPromise(ct),i=Object.assign(Object.assign({},a),{opacity:null!=s?s:a.opacity});await e.execute(Ne.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(i))),l.forEach((e=>n(rt(e))));const o=await t.getPromise(dt);null==o||o(i),n(pt),n(dt)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(mt,!1)}))}},xt="#FFFFFF",ht=n.atom({key:"viewerBackgroundSelectedColor",default:xt}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValueLoadable(ut),l=n.useRecoilValue(it),o=n.useRecoilValue(mt),r=m.useMemo((()=>"hasValue"===s.state?null!=l?l:s.contents:l),[s,l]);return e.jsx(i.VertexTooltip,{content:"Apply to All",children:e.jsx(i.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==r,onClick:async()=>{o?a.confirmApplyAll(t):(await a.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),a=n.useRecoilValue(pt),[l,o]=s.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),o(!1)};return a?e.jsxs(i.VertexDialog,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e.jsx("div",{slot:"heading",children:"Apply to All Parts"}),e.jsx("div",{className:"max-w-lg break-words pr-2",children:"This will apply the same material to all parts in the model. Any previous material changes will be lost."}),e.jsxs("div",{className:"flex mt-8 gap-2 items-center",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:l,onValueChanged:e=>{o(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(i.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(i.VertexButton,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await t.applyAll(),l&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}function createColorMaterialWithId(e,t=a.UUID.create()){return Object.assign({id:t},r.ColorMaterial.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const s=useSceneItemMaterialActions(),l=n.useRecoilValueLoadable(ut),i=n.useRecoilValue(it),o=m.useMemo((()=>"hasValue"===l.state?null!=i?i:l.contents:i),[l,i]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=o?a.Color.toHexString(o.diffuse):void 0,onValueChanged:()=>{s.apply(),null==t||t(o)},onInput:async e=>{s.updateColor(createColorMaterialWithId(e)),await s.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValue(ot),l=n.useRecoilValueLoadable(ut),o=m.useMemo((()=>{var e,t;return"hasValue"===l.state?null!==(t=null!=s?s:null===(e=l.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:lt:null!=s?s:lt}),[s,l]),r=useDebouncedCallback((()=>{a.apply()}),500),c=m.useCallback((e=>{a.updateOpacity(e.detail.value),r(e.detail.value)}),[r,a]),u=m.useMemo((()=>"hasValue"!==l.state||null==l.contents),[l]);return e.jsx(i.VertexTooltip,{className:"flex w-full",content:u?"Select a part and apply a color to enable opacity":`${Math.floor(o/lt*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:u,value:null!=o?o:lt,step:5,min:0,max:lt,onValueChange:e=>{a.updateOpacity(e.detail.value),a.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({onApplyMaterial:t,onApplyMaterialToAll:a,onApplyOpacity:l}){const i=useSceneItemMaterialActions(),o=n.useRecoilValue(Le);return s.useEffect((()=>{i.clearCurrentColor(),i.clearCurrentOpacity()}),[null==o?void 0:o.id]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(VertexSceneItemMaterialColorPicker,{onApply:t}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:a})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSceneItemMaterialOpacitySlider,{onApply:l}),e.jsx(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:t,tooltip:n,children:a})=>{const[l,r]=s.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(i.VertexDropdownMenu,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${t}`,placement:"bottom-end",onMenuOpened:()=>r(!0),onMenuClosed:()=>r(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(i.VertexTooltip,{content:n,disabled:l,placement:"bottom",children:e.jsxs(i.VertexButton,{className:o("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":l}),"data-testid":`reset-button-${t}`,variant:"plaintext",children:[e.jsx(i.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(i.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:a})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:a})=>{const s=useSceneItemMaterialActions(),l=n.useRecoilValue(We);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e.jsx("div",{className:"pt-1"}),e.jsx(i.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{s.clear(),null==t||t()},disabled:!l,children:"Clear selected materials"}),e.jsx(i.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{s.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({onClearMaterial:t,onClearAllMaterials:n,onApplyMaterial:a,onApplyMaterialToAll:s,onApplyOpacity:l}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Material",e.jsx(VertexSceneItemMaterialClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexMaterialControls,{onApplyMaterial:a,onApplyMaterialToAll:s,onApplyOpacity:l})})}const gt="#ffff00",ft=35,vt=1,yt=n.atom({key:"selectionHighlightingSelectedColor",default:gt}),bt=n.atom({key:"selectionHighlightingSelectedOpacity",default:ft}),St=n.atom({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(yt);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(St);return e.jsx(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(bt);return e.jsx(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:t,onUpdateSelectionHighlightOpacity:n,onUpdateSelectionHighlightLineThickness:a}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexSelectionHighlightingColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSelectionHighlightingOpacitySlider,{onUpdate:n}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:a})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[a,s]=n.useRecoilState(yt),[l,o]=n.useRecoilState(bt),[r,c]=n.useRecoilState(St),u=a!==gt||l!==ft||1!==r;return e.jsx("div",{className:"ml-auto",children:e.jsx(i.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(i.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(gt),o(ft),c(1),null==t||t()},disabled:!u})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Selection Highlighting",e.jsx(VertexSelectionHighlightingReset,{onReset:t})]}),children:e.jsx(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:s})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(ht);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexViewerBackgroundColorPicker,{onUpdate:t})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[a,s]=n.useRecoilState(ht),l=a!==xt;return e.jsx("div",{className:"ml-auto",children:e.jsx(i.VertexTooltip,{content:"Reset Background Color",children:e.jsx(i.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(xt),null==t||t()},disabled:!l})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:t,onUpdateViewerBackgroundColor:n}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Viewer Background",e.jsx(VertexViewerBackgroundReset,{onReset:t})]}),children:e.jsx(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:n})})}const isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,a=e instanceof HTMLElement&&"true"===e.contentEditable,s=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,l=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,i=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,o=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||s||l||i||o},useRecoilReducer=({reducer:e,atom:t})=>{const a=undefined,s=undefined;return[n.useRecoilValue(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const a=undefined;return n.useRecoilCallback((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[])},Ct=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,s,l;switch(t.type){case"push-key-binding":const i=undefined;return null!=(null===(n=e.bindings[t.binding.keyBind])||void 0===n?void 0:n.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:[...null!==(a=e.bindings[t.binding.keyBind])&&void 0!==a?a:[],t.binding]})});case"remove-key-binding":const o=undefined;return null==(null===(s=e.bindings[t.binding.keyBind])||void 0===s?void 0:s.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(l=e.bindings[t.binding.keyBind])&&void 0!==l?l:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Ct});function pressedValue(e,t){return e.includes("!")?!t[e.replace("!","")]&&!t[e.replace("!","").toLowerCase()]:t[e]||t[e.toLowerCase()]}function isPressed(e,t){const n=e.split("||");return n.length>1?n.some((e=>pressedValue(e,t))):pressedValue(n[0],t)}function allPressed(e,t){const n=undefined;return e.split("+").every((e=>isPressed(e,t)))}function matchingSingleFnBindings(e,t,n){return e.filter((e=>!e.repeat)).filter((e=>{var a;return null!=e.keyBind&&null!=n&&(null===(a=e.keyBind)||void 0===a?void 0:a.includes(n))&&allPressed(e.keyBind,t)})).map((e=>e.fn))}function matchingOffBindings(e,t,n){return e.filter((e=>e.off&&e.active&&null!=e.keyBind&&null==n&&!allPressed(e.keyBind,t))).map((e=>e.off))}const useApplyKeyBinding=e=>{const[t,n]=useKeyBindingState();s.useEffect((()=>{const s=a.UUID.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:s,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:s})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();s.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),a=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),a&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,a]=useKeyBindingState(),l=s.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,Object.assign(Object.assign({},n.pressed),{[e]:!0})))).forEach((e=>{const t=n.bindings[e],s=t.length>0?t[t.length-1]:void 0;null!=s&&(s.fn(),a({type:"remove-key-binding",binding:s}))}))}),[n]);s.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),l(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),s=matchingSingleFnBindings(n.applyBindings,t,e.key),i=matchingOffBindings(n.applyBindings,t,e.key);(s.length>0||i.length>0)&&e.preventDefault()}},handleKeyUp=e=>{a({type:"set-key-pressed",key:e.key,pressed:!1})};return window.addEventListener("keydown",handleKeyDown),window.addEventListener("keyup",handleKeyUp),()=>{window.removeEventListener("keydown",handleKeyDown),window.removeEventListener("keyup",handleKeyUp)}}),[l,n.applyBindings,n.pressed]),s.useEffect((()=>{const e=matchingSingleFnBindings(n.applyBindings,n.pressed,n.lastPressed),t=matchingOffBindings(n.applyBindings,n.pressed,n.lastPressed);e.forEach((e=>e())),t.forEach((e=>e()))}),[n.pressed,n.lastPressed]),s.useEffect((()=>{const t=n.applyBindings.filter((e=>e.repeat&&null!=e.keyBind&&allPressed(e.keyBind,n.pressed))).map((e=>e.fn));if(t.length>0){const n=setInterval((()=>{t.forEach((e=>e()))}),e);return()=>{clearInterval(n)}}return()=>{}}),[n.applyBindings,n.lastPressed])},VertexBoxSelectionButton=()=>{const t=useBoxSelectionActions(),a=n.useRecoilValue(pe);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>a,cancelPredicate:()=>!a},[a]),e.jsx(i.VertexTooltip,{content:"Box Selection",children:e.jsx(i.VertexIconButton,{iconName:"box-cursor",iconColor:a?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:a?t.disable:t.enable})})},Vt=1,VertexResizableContent=t=>{var{className:n,style:a,displayShadow:s,heading:l,id:r,initialScale:c,placement:u="left",children:d,onResize:m}=t,p=__rest(t,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const h="left"===u||"right"===u,g="top"===u;function getHorizontalResizeDirection(){switch(u){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===u?"top":"none"}const f=null!=c?c:1;return e.jsx(i.VertexResizable,Object.assign({id:r,"data-testid":`resizable-content-position-${u}`,className:o(n,"pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300",{"border-r min-w-75 max-w-half":"left"===u,"sidebar-shadow-right":"left"===u&&s,"border-l min-w-75 max-w-half":"right"===u,"sidebar-shadow-left":"right"===u&&s,"border-t bottom-0 fixed":"top"===u,"min-h-12 sheet":g}),style:Object.assign({maxHeight:"top"===u?window.innerHeight:void 0},a),initialHorizontalScale:h?c:void 0,initialVerticalScale:g?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===u||"top"===u?"absolute":"relative",onResizeEnd:()=>null==m?void 0:m()},p,{children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===u&&e.jsx("div",{className:"flex justify-center w-full",children:e.jsx("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),l,e.jsx("div",{className:o("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===u}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromiseRequired(C),n={milliseconds:500},a=await t();await(null==a?void 0:a.camera().viewAll().render({animation:n}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[s,i]=m.useState(),[o,r]=m.useState();m.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=s&&clearTimeout(s),r(l.Point.create(a.touches[0].clientX,a.touches[0].clientY)),i(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=s&&null!=o&&l.Point.distance(o,l.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(s),null==a||a())},handleTouchEnd=()=>{null!=s&&clearTimeout(s)};return null==e||e.addEventListener("touchstart",handleTouchStart),null==e||e.addEventListener("touchmove",handleTouchMove),null==e||e.addEventListener("touchend",handleTouchEnd),()=>{null==e||e.removeEventListener("touchstart",handleTouchStart),null==e||e.removeEventListener("touchmove",handleTouchMove),null==e||e.removeEventListener("touchend",handleTouchEnd)}}),[e,s,o])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:a,disableBackdrop:l,openPredicate:r,onOpen:c,onClose:u,children:d})=>{const m=useContextMenuActions(),p=n.useRecoilValue(oe),h=n.useRecoilValue(me),g=s.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=p===a;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:m.clearActiveContextMenu,addPredicate:()=>null!=p&&p===a,cancelPredicate:()=>null==p},[p]);const v=s.useMemo((()=>null!=t?t:null!=r?window:void 0),[t,r]);return useLongPress({target:v,callback:e=>m.longPress(e,a,r,c),onMovement:()=>m.clearActiveContextMenu()}),s.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&p===a){const t=targetShouldSkipNextHit(e);m.clearActiveContextMenu(t)}};if(l)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[l,a,p]),s.useEffect((()=>{const handlePointerDown=e=>{m.pointerDown(e)},handlePointerUp=e=>{m.pointerUp(e,a,r,c)},handleContextMenu=e=>m.contextMenu(e,r);return null==v||v.addEventListener("pointerdown",handlePointerDown),null==v||v.addEventListener("pointerup",handlePointerUp),null==v||v.addEventListener("contextmenu",handleContextMenu),()=>{null==v||v.removeEventListener("pointerdown",handlePointerDown),null==v||v.removeEventListener("pointerup",handlePointerUp),null==v||v.removeEventListener("contextmenu",handleContextMenu)}}),[t,a,r]),e.jsx("div",{className:o({hidden:!f}),children:e.jsx(i.VertexMenu,{"data-testid":`${a}-context-menu`,open:asBooleanAttribute(f),position:h,fallbackPlacements:g,backdrop:!l,onMenuClosed:()=>{m.clearActiveContextMenu(),null==u||u()},children:e.jsx("div",{className:"pt-1",children:d})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=n.useRecoilValue(He),s=useViewerCameraActions();return e.jsxs(i.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:()=>{null!=(null==a?void 0:a.boundingBox)&&s.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),a=n.useRecoilValue(ue);return e.jsxs(i.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(a)?null===(e=null==a?void 0:a.node.id)||void 0===e?void 0:e.hex:null==a?void 0:a.id;null!=s&&t.flyToById(s)},disabled:asBooleanAttribute(null==a),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=n.useRecoilValue(g),t=undefined,a=undefined,l=undefined,i=undefined,o=undefined,r=undefined;return{sceneItemsOperation:s.useCallback((async(t,n)=>{const a=await(null==e?void 0:e.scene());null==n?await(null==a?void 0:a.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==a?void 0:a.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:s.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withSelected())).show()])).execute()}),[e]),hideSelected:s.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).hide()])).execute()}),[e]),showOnlyItem:s.useCallback((async t=>{const n=await(null==e?void 0:e.scene());null==n||n.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withItemIds([t]))).show()])).execute()}),[e]),ghostSelected:s.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!0)])).execute()}),[e]),unGhostSelected:s.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(i.VertexMenuItem,{"data-testid":"hide-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.hide()))},children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(ue),a=useSceneItemsOperations();return e.jsxs(i.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:t.id;null!=s&&a.sceneItemsOperation((e=>e.hide()),[s])},disabled:asBooleanAttribute(null==t),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(i.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(i.VertexMenuItem,{"data-testid":"show-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.show()))},children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(ue),a=useSceneItemsOperations();return e.jsxs(i.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:null==t?void 0:t.id;null!=s&&a.showOnlyItem(s)},disabled:asBooleanAttribute(null==t),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(i.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Selected"})]})};n.atom({key:"sceneTreeLoaderVisible",default:!1});const wt=n.atom({key:"sceneTreeElement",default:void 0}),jt=n.atom({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,s)=>{var l,i;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await s.deselectItem(a):a.selected?await s.selectItem(a,{recurseParent:!0}):a.selected||await s.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const s=await t.getPromise(Le);e.syncSelection({id:null===(l=a.id)||void 0===l?void 0:l.hex,ancestors:null!==(i=null==s?void 0:s.ancestors)&&void 0!==i?i:[]},{selected:!n.metaKey&&!n.ctrlKey||!a.selected,multiSelect:n.shiftKey||n.metaKey||n.ctrlKey})}})),toggleExpansion:useActionCallback((()=>(e,t,n)=>{n.toggleExpandItem(t)})),toggleVisibility:useActionCallback((()=>(e,t,n)=>{n.toggleItemVisibility(t)})),flyToRow:useActionCallback((({snapshot:e})=>async n=>{var a;const s=await e.getPromise(wt),l=await(null==s?void 0:s.getRowAtClientY(n));null!=(null===(a=null==l?void 0:l.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(l.node.id.hex)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(wt),s=await(null==a?void 0:a.getRowAtClientY(n));e(ue,s)}))}}const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(i.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(i.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Unghost Selected"})]})},DefaultSceneTreeContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(i.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const a=useSceneTreeActions(),s=n.useRecoilValue(wt),l=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:s,onOpen:async(e,t)=>{const n=e;await a.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:l?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHidePartMenuItem,{}),e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(i.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=s.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:a,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},kt=35,At=n.atom({key:"sceneItemGhostingSelectedOpacity",default:kt}),Tt=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),Pt=n.atom({key:"appliedItemPhantomStateIds",default:[]}),Et=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Le);return null!=n&&(null!==(t=e(Tt(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[a,s]=n.useRecoilState(At);return e.jsx(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Pt)).forEach((e=>t(Tt(e)))),t(Pt)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const s=await t.getPromise(Oe);s.forEach((e=>n(Tt(e),a))),n(Pt,(e=>[...e,...s])),await e.execute(Ne.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(a)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const s=await t.getPromise(Oe);s.forEach((e=>a(Tt(e)))),n(Pt,(e=>e.filter((e=>!s.includes(e))))),await e.execute(Ne.CLEAR_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),clearAllPhantomState:useActionCallback((()=>async()=>{await t(),await e.execute(Ne.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}},VertexSceneItemGhostingToggle=({onApply:t})=>{const a=useSceneItemPhantomActions(),s=n.useRecoilValue(We),l=n.useRecoilValueLoadable(Et);return e.jsx(i.VertexTooltip,{content:"Select a part to display as ghost",disabled:s,children:e.jsx(i.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!s,checked:"hasValue"===l.state&&l.contents,onValueChanged:async e=>{await a.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:t,onApplyOpacity:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexSceneItemGhostingToggle,{onApply:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e.jsx(VertexSceneItemGhostingOpacitySlider,{onApply:n})]})}const VertexSceneItemGhostingClear=({onClear:t,onClearAll:a})=>{const s=useSceneItemPhantomActions(),l=n.useRecoilValue(Et);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e.jsx("div",{className:"pt-1"}),e.jsx(i.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await s.clearPhantomState(),null==t||t()},disabled:!l,children:"Clear ghosting for selected"}),e.jsx(i.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await s.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:a,onApplyOpacity:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Ghosting",e.jsx(VertexSceneItemGhostingClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexGhostingControls,{onApplyGhostingChange:a,onApplyOpacity:s})})}function VertexMeasurementContextMenu({onDelete:t}){const a=n.useRecoilValue(ce);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(i.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=a&&t(a.id),children:[e.jsx(i.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}const Rt=n.atom({key:"lengthUnit",default:"cm"}),It=n.atom({key:"decimalPlace",default:"2"});var Nt,Mt;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Nt||(Nt={})),function(e){e[e.mm=1]="mm",e[e.cm=.1]="cm",e[e.m=.001]="m",e[e.in=.03937007874015748]="in",e[e.ft=.0032808398950131233]="ft"}(Mt||(Mt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Mt[t]},convertTo=(e,t)=>{const n=undefined;return e*Mt[t]},formatWithUnit=(e,t,n)=>`${e.toFixed(n)} ${t}`,formatDistance=(e,t,n)=>formatWithUnit(convertTo(e,t),t,n),createDistanceFormatter=(e,t)=>n=>formatDistance(n,e,t);function toUnitType(e){switch(e){case"cm":return"centimeters";case"m":return"meters";case"in":return"inches";case"ft":return"feet";default:return"millimeters"}}function useDockedPlacement(e,t){const[n,a]=m.useState(l.Point.create(0,0));return m.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),s=l.Point.create(n.left,n.bottom),i=l.Point.create(n.right,n.bottom);a("left"===t?s:i)}}),[e,t]),n}function VertexMeasurementDetails({placement:t}){const a=useMeasurementActions(),s=n.useRecoilValue(g),l=n.useRecoilValue(f),r=useDockedPlacement(null!=s?s:null,t),u=n.useRecoilValue(ke),d=n.useRecoilValue(Ae),m=n.useRecoilValue(Te),p=n.useRecoilValue(Pe),h=n.useRecoilValue(Rt),v=n.useRecoilValue(It);return e.jsx(i.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${l}`,position:r,children:e.jsxs("div",{className:"flex flex-col leading-4 min-w-40",children:[e.jsxs("div",{className:"pb-2 flex justify-between",children:[e.jsx("div",{className:"w-full",children:"Measurement"}),e.jsx("div",{className:o("-mt-1 relative",{hidden:!p}),children:e.jsx(i.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(i.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:a.resetMeasurement})})})]}),e.jsx(c.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:o("gap-y-1.5 text-xs",{hidden:null==u}),measurementOutcome:u,measurementOverlays:d,distanceUnits:toUnitType(h),fractionalDigits:parseInt(v,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:o("text-xs",{hidden:null==m}),children:m})]})})}function useCallbackRef(e){var t;const[n,a]=s.useState((t=void 0,null)),l=undefined;return{element:n,callback:s.useCallback((e=>a(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,onPointToPointMeasurementChange:a}){const l=useMeasurementActions(),i=n.useRecoilValue(g),o=n.useRecoilValue(he),r=n.useRecoilValue(fe),u=n.useRecoilValue(Rt),d=n.useRecoilValue(It),{callback:m,element:p}=useCallbackRef();usePointToPointMeasurement(p);const h=s.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};l.setEditedPointToPointMeasurement(t),null==a||a(t)}),[l]);return o?e.jsxs(e.Fragment,{children:[e.jsx(c.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:m,viewer:null!=i?i:void 0,mode:"replace",start:null==r?void 0:r.start,end:null==r?void 0:r.end,invalid:null==r?void 0:r.invalid,units:toUnitType(u),fractionalDigits:parseInt(d,10),showAxisReferenceLines:!0,onEditEnd:h}),e.jsx(VertexMeasurementDetails,{placement:t}),e.jsx(VertexMeasurementContextMenu,{onDelete:l.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(he);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>a,cancelPredicate:()=>!a},[a,t]),e.jsx(i.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(i.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Ot=n.atom({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:t,onEntitiesChanged:a,onOutcomeChanged:s})=>{var l,i,o,r;const u=n.useRecoilValue(g),d=n.useRecoilValue(Ot),m=n.useRecoilValue(ye),{callback:p,element:h}=useCallbackRef();return usePreciseMeasurementModel(h,a,s),m?e.jsxs(e.Fragment,{children:[e.jsx(c.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:p,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(l=null==d?void 0:d.network)||void 0===l?void 0:l.apiHost,renderingHost:null===(i=null==d?void 0:d.network)||void 0===i?void 0:i.renderingHost,sceneTreeHost:null===(o=null==d?void 0:d.network)||void 0===o?void 0:o.sceneTreeHost,sceneViewHost:null===(r=null==d?void 0:d.network)||void 0===r?void 0:r.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(ye);return e.jsx(i.VertexTooltip,{content:"Precise Measurement",children:e.jsx(i.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(Ie),a=n.useRecoilValue(Re);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(i.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=a&&e.jsx(i.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id)]})}const Lt={binding:"{{row.node.name}}",label:"Name",metadataKeyName:"VERTEX_SCENE_ITEM_NAME"};function mapToColumn(e,t){return{label:"name"===e.toLowerCase()?"Name (Property)":e,binding:`{{row.metadata.${e}}}`,initialWidth:t,minWidth:t/2}}const Bt=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(jt);return null!=t?await t.fetchMetadataKeys():[]}}),Dt=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Bt).filter((e=>e!==Lt.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),_t=n.atom({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),Ft=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(_t),n=e(wt),a=null==n?void 0:n.clientWidth;if(null!=a&&a>0){const e=1/(t.length+1)*a,n=(a-e)/t.length;return t.reduce(((e,t)=>{const a=mapToColumn(t,n);return Object.assign(Object.assign({},e),{[a.label]:a})}),{Name:Object.assign(Object.assign({},Lt),{initialWidth:e,minWidth:n})})}return{Name:Lt}}}),Ht=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Ft))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e,snapshot:t})=>async n=>{e(_t,n);const a=await t.getPromise(jt);null==a||a.setMetadataKeys(n)}))}}const zt=16,Ut=-8;var Wt;function useOpenColumnPopover({buttonElement:e,horizontalOffset:t,verticalOffset:n}){const[a,s]=m.useState(!1),[l,i]=m.useState(),[o,r]=m.useState(),c=m.useCallback((()=>{if(a)s(!1);else{const a=null==e?void 0:e.getBoundingClientRect();if(null!=a){const e=null!=t?t:zt,l=null!=n?n:Ut,o=a.x>window.innerWidth/2?Wt.LEFT:Wt.RIGHT;i({x:o===Wt.LEFT?a.left-e:a.right+e,y:a.top+l}),r(o),s(!0)}}}),[a,e]),u=m.useCallback((()=>{s(!1)}),[]);return{open:a,position:l,direction:o,handleOpen:c,handleClose:u}}!function(e){e.LEFT="left",e.RIGHT="right"}(Wt||(Wt={}));const Gt=n.atom({key:"sceneTreeSearchActive",default:!1}),Kt=n.atom({key:"sceneTreeSearchValue",default:void 0}),$t=n.atom({key:"sceneTreeSearchExactMatch",default:!1}),qt=n.atom({key:"sceneTreeSearchResultCount",default:0}),Yt=n.atom({key:"sceneTreeSearchActiveColumns",default:[]}),Xt=n.selector({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(Yt);return 0===t.length||t.includes(Lt.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=n.useSetRecoilState(qt);s.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var a;n=null===(a=null==e?void 0:e.controller)||void 0===a?void 0:a.stateChanged((e=>{void 0!==(null==e?void 0:e.totalFilteredRows)&&t(null==e?void 0:e.totalFilteredRows)}))})),()=>{null==n||n.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(Yt,t)})),t=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(wt),a=await e.getPromise($t),s=await e.getPromise(Yt),l=a?[Lt.metadataKeyName]:[],i=s.length>0?s:l;null==n||n.filterItems(t,{columns:i,exactMatch:a})})),n=useActionCallback((({snapshot:t})=>async(n,a)=>{const s=await t.getPromise(Yt);if(a)e(0===s.length?[Lt.metadataKeyName,n]:[...s,n]);else{const t=s.filter((e=>e!==n));e(t.every((e=>e===Lt.metadataKeyName))?[]:t)}})),a=useActionCallback((({set:e})=>t=>{e($t,t)}));return{setMetadataSearchKeys:e,updateSearchForActiveColumns:t,updateMetadataSearchAfterSearchKeysChange:n,setMetadataSearchExactMatch:a}},VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:a,children:s})=>{const l="string"==typeof s?s.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(i.VertexToggle,{"data-testid":`scene-tree-metadata-check-${l}`,variant:"check",checked:t,disabled:n,onValueChanged:e=>null==a?void 0:a(e.detail)}),e.jsx("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${l}`,onClick:()=>{n||null==a||a(!t)},children:s})]})},VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const a=useSceneTreeColumnActions(),s=useSceneTreeSearchActions(),l=n.useRecoilValue(Kt),r=n.useRecoilValueLoadable(Dt),c=n.useRecoilValue(_t),u=n.useRecoilValue(Yt),[d,p]=m.useState(c),[h,g]=m.useState(""),{element:f,callback:v}=useCallbackRef(),{open:b,position:S,direction:C,handleOpen:V,handleClose:w}=useOpenColumnPopover({buttonElement:f}),j=C===Wt.LEFT?"left-end":"right-start",k=m.useMemo((()=>{if("hasValue"===r.state){const e=r.contents.filter((e=>d.indexOf(e)<0)),t=undefined;return[...[...d].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[d,r.state,r.contents]),A=m.useMemo((()=>k),[b]);return e.jsxs(e.Fragment,{children:[e.jsx(i.VertexTooltip,{content:"Configure Columns",placement:"top",children:e.jsx(i.VertexIconButton,{"data-testid":"scene-tree-column-popover-button",ref:v,iconName:"columns-add",iconSize:"sm",onClick:()=>{V()}})}),b&&e.jsx(i.VertexPopover,{"data-testid":"scene-tree-column-popover",open:b,backdrop:!1,position:S,resizeBehavior:"fixed",placement:j,className:"z-popover",children:e.jsxs("div",{className:o("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!b}),children:[e.jsxs("div",{className:"flex items-center text-[0.875rem] p-3",children:[e.jsxs("div",{className:"pr-2",children:[e.jsx("div",{className:"text-[0.875rem]",children:"Assembly Properties"}),e.jsx("div",{className:"text-[0.75rem] text-neutral-700 mt-1.5",children:"Select up to six properties to appear in the Assembly panel."})]}),e.jsx(i.VertexIconButton,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{g(""),w()}})]}),e.jsx(i.VertexTextfield,{className:"flex w-full px-2 overflow-hidden border-b border-neutral-300 pb-2",id:"scene-tree-available-columns-search-bar","data-testid":"scene-tree-available-columns-search-bar",multiline:!1,placeholder:"Filter properties",type:"text",onInputInput:e=>{const t=e.detail.value;null!=t&&g(t.toLowerCase())}}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:Lt.label}),"hasValue"===r.state&&A.filter((e=>""===h||e.toLowerCase().includes(h))).map((t=>e.jsx(VertexSceneTreeMetadataCheck,{checked:d.includes(t),disabled:d.length>=6&&!d.includes(t),onChange:e=>{p(e?[...d,t]:d.filter((e=>e!==t)))},children:t},t)))]}),e.jsxs("div",{className:"flex items-center p-3 border-t border-neutral-300 space-x-4",children:[e.jsx("div",{className:"text-[0.75rem] text-[var(--vertex-ui-blue-700)] cursor-pointer","data-testid":"scene-tree-column-clear-selection",onClick:()=>p([]),children:"Clear selection"}),e.jsx("div",{className:"flex-grow"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(i.VertexButton,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{g(""),w()},children:"Cancel"}),e.jsx(i.VertexButton,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await a.setActive(d),null==t||t(d),g(""),w();const e=[Lt.metadataKeyName,...d],n=u.filter((t=>!e.includes(t)));n.length>0&&(await Promise.all(n.map((e=>s.updateMetadataSearchAfterSearchKeysChange(e,!1)))),null!=l&&await s.updateSearchForActiveColumns(l))},children:"Apply"})]})]})]})})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:t,onSearchForExactMatchChange:a})=>{const s=useSceneTreeSearchActions(),l=n.useRecoilValue(Xt),r=n.useRecoilValue(Yt),c=n.useRecoilValue(Kt),u=n.useRecoilValue($t),d=n.useRecoilValue(_t),{element:m,callback:p}=useCallbackRef(),{open:h,position:g,direction:f,handleOpen:v,handleClose:b}=useOpenColumnPopover({buttonElement:m,horizontalOffset:40}),S=f===Wt.LEFT?"left-end":"right-start";return e.jsxs(e.Fragment,{children:[e.jsx(i.VertexTooltip,{content:"Search Options",placement:"top",children:e.jsx(i.VertexIconButton,{"data-testid":"scene-tree-search-options-popover-button",ref:p,iconName:"gear",iconSize:"sm",onClick:()=>{v()}})}),e.jsx(i.VertexPopover,{"data-testid":"scene-tree-search-options-popover",open:h,backdrop:!1,position:g,resizeBehavior:"fixed",placement:S,className:"z-popover",children:e.jsxs("div",{className:o("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!h}),children:[e.jsxs("div",{className:"flex items-center text-[0.875rem] p-3 border-b border-neutral-300 pb-2",children:[e.jsx("div",{className:"pr-2 text-[0.875rem] whitespace-nowrap",children:"Column Properties Search"}),e.jsx(i.VertexIconButton,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{b()}})]}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx("div",{className:"text-[0.875rem] pb-2 pr-2",children:"Select properties to perform the search on:"}),e.jsx(VertexSceneTreeMetadataCheck,{checked:l,disabled:0===r.length||r.every((e=>e===Lt.metadataKeyName)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(Lt.metadataKeyName,e),null==t||t(),null!=c&&await s.updateSearchForActiveColumns(c)},children:Lt.label},Lt.metadataKeyName),d.map((n=>e.jsx(VertexSceneTreeMetadataCheck,{checked:r.includes(n),disabled:r.length>0&&r.every((e=>e===n)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(n,e),null==t||t(),null!=c&&await s.updateSearchForActiveColumns(c)},children:n},n)))]}),e.jsxs("div",{className:"flex p-3 border-t border-neutral-300",children:[e.jsx(i.VertexToggle,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:u,onValueChanged:async e=>{s.setMetadataSearchExactMatch(e.detail),null==a||a(),null!=c&&await s.updateSearchForActiveColumns(c)}}),e.jsx("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:t,onClearSearch:a,onExitSearchMode:s,onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o,children:r})=>{const u=n.useRecoilValue(wt),[d,p]=n.useRecoilState(Gt),[h,g]=n.useRecoilState(Kt);useSceneTreeSearch({sceneTreeElement:null!=u?u:null});const{element:f,callback:v}=useCallbackRef(),b=null==h||""===h,S=b?"Exit Search":"Clear Search";return m.useEffect((()=>{d&&(null==f||f.setFocus())}),[f,d]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(c.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:v,controller:null==u?void 0:u.controller,onBlur:()=>{b&&(p(!1),null==s||s())},onSearch:()=>{g(null==f?void 0:f.value),null==t||t(null==f?void 0:f.value)},children:r}),e.jsx("div",{className:"self-center px-1",onPointerDown:e=>{e.preventDefault()},children:e.jsx(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o})}),e.jsx(i.VertexTooltip,{className:"self-center pr-1",content:S,children:e.jsx(i.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"close-circle-fill",iconSize:"sm",variant:"plain",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{b?(p(!1),null==s||s()):(await(null==f?void 0:f.clear()),await(null==f?void 0:f.setFocus()),g(void 0),null==a||a())}})})]})};function VertexToolbarDivider(){return e.jsx("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1"})}const VertexSceneTreeSearchInformationForToolbar=()=>{const t=useSelectionActions(),a=n.useRecoilValue(wt),s=n.useRecoilValue(Kt),l=n.useRecoilValue(qt),o=undefined,r=undefined,c=`${l>=1e3?`${l}+`:`${l}`} ${1===l?"result":"results"}`;return e.jsxs(e.Fragment,{children:[e.jsx(VertexToolbarDivider,{}),e.jsxs("div",{className:"flex flex-row items-center overflow-hidden",children:[e.jsx("div",{className:"px-2 text-[0.8125rem] leading-4 text-neutral-900 truncate","data-testid":"search-result-info",children:`${c}`}),e.jsx(i.VertexTooltip,{className:"w-auto",content:"Select Results",placement:"top",children:e.jsx(i.VertexButton,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=a&&null!=s&&(await a.selectFilteredItems(s),t.toggleLastSelectWasMultiSelect(!0))},children:e.jsxs("div",{className:"flex h-6 items-center gap-1",children:[e.jsx(i.VertexIcon,{size:"sm",name:"check-circle"}),e.jsx("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=undefined;return n.useRecoilCallback((({set:t})=>n=>{t(e,n)}),[])}var Zt;function styleFromOptionalFont(e){return null!=e?{"--scene-tree-default-font-family":styleFromFontFace(e.fontFace),"--scene-tree-default-font-color":e.color}:{}}function styleFromOptionalBackgroundColors(e){const t=null==e?void 0:e.depthColors,n=null!=t?Object.keys(t).reduce(((e,n)=>Object.assign(Object.assign({},e),{[`--scene-tree-row-background-color-depth-${n}`]:t[parseInt(n)]})),{}):{};return null!=e?Object.assign(Object.assign({},n),{"--scene-tree-hovered-row-background-color":e.hovered,"--scene-tree-selected-row-background-color":e.selected,"--scene-tree-row-background-color":e.defaultColor}):{}}function styleFromFontFace(e){return e===Zt.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Zt||(Zt={}));const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const a=n.useSetRecoilState(Gt);return e.jsx(i.VertexTooltip,{className:"flex ml-auto",content:"Scene Tree Search",children:e.jsx(i.VertexIconButton,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{a(!0),null==t||t()}})})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:a,onSearch:s,onClearSearch:l,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:o,children:r})=>{const u=n.useRecoilValue(Gt);return e.jsxs(c.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[u&&e.jsx(VertexSceneTreeSearchBar,{onSearch:s,onClearSearch:l,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:o,children:r}),!u&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(wt);return e.jsx(i.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(i.VertexIcon,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{null==t||t.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=n.useRecoilValue(wt);return e.jsx(i.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(i.VertexIcon,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{null==t||t.expandAll()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:t})=>{const a=n.useRecoilValue(Kt),s=null==a||""===a;return e.jsx(c.VertexSceneTreeToolbar,{className:"h-10 border-b border-neutral-300 box-border",children:e.jsxs("div",{className:"flex w-full text-neutral-700 items-center gap mx-2",children:[e.jsx(VertexSceneTreeExpandAll,{}),e.jsx(VertexSceneTreeCollapseAll,{}),!s&&e.jsx(VertexSceneTreeSearchInformationForToolbar,{}),e.jsx("div",{className:"ml-auto",children:e.jsx(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:t})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:s,onVisibleSceneTreeColumnsChange:l,children:i})=>{const o=null!=i&&!1!==i;return e.jsx("div",{slot:"header",className:"flex flex-col",children:o?i:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:s,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:l})]})})},VertexSceneTreeTableLayout=t=>{const a=n.useRecoilValue(Ft),s=n.useRecoilValue(Ht),l=[];return e.jsx(c.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},t,{children:s.map(((t,n)=>{var i;const r=a[t],u=null!==(i=l[n])&&void 0!==i?i:r.initialWidth;return e.jsxs(c.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:u,minWidth:r.minWidth,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${o("truncate",{"pl-2":0===n,"pr-2":n===s.length-1})}">\n ${r.label}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${r.binding}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${0===n?"expand-toggle":""}\n ${n===s.length-1?"isolate-button visibility-toggle":""}>\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=r.binding?r.binding:"--"}" \n placement="${n!==s.length-1?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${r.binding}</div>\n </div>\n </vertex-tooltip>\n </div>\n \n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},r.label)}))}))},VertexSceneTree=t=>{var{id:a,font:l,backgroundColors:i,children:r,style:u,onPointerDown:d,onClick:m,onToggleSelection:p,onToggleExpansion:h,onToggleVisibility:f,className:v,rowData:b}=t,S=__rest(t,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const C=useSceneTreeActions(),V=useSelectionActions(),w=n.useRecoilValue(Ot),j=n.useRecoilValue(g),k=n.useRecoilValue(Yt),A=n.useRecoilValue($t),T=n.useRecoilValue(Kt),P=null==T||""===T,E=useRecoilRef({state:wt}),R=null!=r&&!1!==r,wrappedExpansionHandler=(e,t,n)=>{C.toggleExpansion(e,t,n),null==h||h(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{C.toggleSelection(e,t,n),null==p||p(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{C.toggleVisibility(e,t,n),null==f||f(e,t,n)},handleClick=e=>{e.altKey&&C.flyToRow(e.clientY),null==m||m(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&V.clearSelection(),null==d||d(e)},I=n.useSetRecoilState(jt),handleFirstRowRendered=e=>{var t;I(e.target.controller),null===(t=null==S?void 0:S.onFirstRowRendered)||void 0===t||t.call(S,e)},N=s.useMemo((()=>({metadataSearchKeys:k,exactMatch:A})),[k,A]);return e.jsx("div",{className:o("flex flex-col w-full h-full",v),children:e.jsx("div",{className:"flex group h-full",children:e.jsx(c.VertexSceneTree,Object.assign({id:null!=a?a:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:w,ref:E,className:o("flex-1",{filtered:!P}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(l)),styleFromOptionalBackgroundColors(i)),u),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:j,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==b?void 0:b(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)},searchOptions:N},S,{onFirstRowRendered:handleFirstRowRendered,children:R?r:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeHeader,{}),e.jsx(VertexSceneTreeTableLayout,{}),e.jsx(VertexSceneTreeContextMenu,{})]})}))})})},VertexDecimalPlaceSelector=({onApply:t})=>{const[a,s]=n.useRecoilState(It);return e.jsxs(i.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{s(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{className:"py-1.5 px-3",children:"0"}),e.jsx("div",{className:"py-1.5 px-3",children:"1"}),e.jsx("div",{className:"py-1.5 px-3",children:"2"}),e.jsx("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:t})=>{const[a,s]=n.useRecoilState(Rt);return e.jsxs(i.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{s(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e.jsx("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e.jsx("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e.jsx("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e.jsx("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e.jsx(VertexLengthUnitSelector,{onApply:t})]}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e.jsx(VertexDecimalPlaceSelector,{onApply:n})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsx(PanelSection,{header:e.jsx("div",{className:"flex items-center text-base",children:"Units"}),children:e.jsx(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}const Jt=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),Qt=n.atom({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Jt:Qt,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Jt:Qt,void 0)}))}}function DefaultAppearancePanel(){return e.jsxs("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e.jsx(VertexMaterialPanelSection,{}),e.jsx(VertexGhostingPanelSection,{}),e.jsx(VertexFeatureEdgesPanelSection,{}),e.jsx(VertexViewerBackgroundPanelSection,{}),e.jsx(VertexSelectionHighlightingPanelSection,{}),e.jsx(VertexCrossSectionAppearancePanelSection,{})]})}function DefaultSettingsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:t,onClearAll:a})=>{const s=useTransformActions(),l=n.useRecoilValue(We);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e.jsx("div",{className:"pt-1"}),e.jsx(i.VertexMenuItem,{"data-testid":"reset-selected-transforms",onClick:async()=>{await s.clearSelectedTransforms(),null==t||t()},disabled:!l,children:"Clear selected transforms"}),e.jsx(i.VertexMenuItem,{"data-testid":"reset-all-transforms",onClick:async()=>{await s.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const a=useTransformActions(),s=n.useRecoilValue(Ge),l=n.useSetRecoilState(et);return e.jsx(i.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:s,onValueChanged:async()=>{s?(a.disableTransformWidget(),null==t||t(!1)):(l("world"),await a.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:t}){return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Enable manipulator"})]})})}function VertexTransformPanelSection({onClearTransforms:t,onClearAllTransforms:n,onToggleTransformsManipulator:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e.jsx(VertexTransformClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexTransformControls,{onToggleTransformsManipulator:a})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const en="Appearance",tn="Settings",nn="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,a=getHeading(n.useRecoilValue(Qt));return e.jsx("div",{className:"flex flex-col w-full items-center z-overlay pointer-events-none md:pointer-events-auto py-3 px-4 border-b border-neutral-300",children:e.jsx("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:a})})};function getHeading(e){switch(e){case"appearance":return en;case"settings":return tn;case"transforms":return nn;default:return"None"}}function VertexViewerRightOpenedPanel(){const t=n.useRecoilValue(Qt),a=s.useMemo((()=>["appearance","settings","transforms"]),[]);return e.jsx(e.Fragment,{children:null!=t&&a.includes(t)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{}),placement:"right",children:["appearance"===t&&e.jsx(DefaultAppearancePanel,{}),"transforms"===t&&e.jsx(DefaultTransformsPanel,{}),"settings"===t&&e.jsx(DefaultSettingsPanel,{})]})})}function Sidebar({children:t}){return e.jsx("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:t,iconName:n,active:a,responsive:l,disabled:r,content:c,tooltipPlacement:u,children:d,onSelect:m,onDeselect:p}){return e.jsx("div",{className:o({"text-[var(--vertex-ui-blue-700)]":a===t&&!r,"text-neutral-700 hover:text-neutral-800":a!==t&&!r,"cursor-pointer hover:bg-neutral-200":!r,"text-neutral-400":r,"rounded-full md:p-3":l,"p-3":!l&&null==d,"px-3 py-1":null!=d}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{r||(a===t?p():m())},children:e.jsxs(i.VertexTooltip,{placement:null!=u?u:void 0,content:s.isValidElement(c)?void 0:c,children:[e.jsx("div",{slot:"content",children:c}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(i.VertexIcon,{name:n}),d]})]})})}function VertexViewerRightSidebar(){const t=usePanelActions(),a=n.useRecoilValue(Qt);return e.jsx("div",{className:"flex flex-col flex-shrink-0 items-center relative border-neutral-300 border-l bg-white h-full top-0 min-w-12 w-12",children:e.jsxs(Sidebar,{children:[e.jsx(SidebarIcon,{name:"appearance",active:a,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{t.openPrimary("appearance","right")},onDeselect:()=>t.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:a,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:()=>{t.openPrimary("transforms","right")},onDeselect:()=>t.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:a,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{t.openPrimary("settings","right")},onDeselect:()=>t.closePrimary("right")})]})})}const VertexPopupButton=t=>{var{open:n,children:a}=t,s=__rest(t,["open","children"]);const l=a.find((e=>e.type===Anchor)),r=a.filter((e=>e.type!==Anchor));return null==l?e.jsx(e.Fragment,{}):e.jsxs(i.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},s,{children:[l,e.jsx("div",{className:o("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:r})]}))},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(i.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(K),s=n.useRecoilValue(L),getBaseIcon=()=>`align-to-${null==s?void 0:s.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:t.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==s?void 0:s.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==s?void 0:s.hitPending)},[null==s?void 0:s.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(i.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:a?t.closeAlignmentTools:t.openAlignmentTools,children:e.jsx(i.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(c.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(i.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("global"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-global",iconName:"align-to-global",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Global"})}),e.jsx(i.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("surface"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-surface",iconName:"align-to-surface",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue($),l=n.useRecoilValue(O),o=n.useRecoilValueLoadable(F),r=s.useMemo((()=>{const e=l.length>0&&"hasValue"===o.state?axis(l[0],xAxis(o.contents),yAxis(o.contents),zAxis(o.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[o.state,o.contents,l]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(i.VertexIconButton,{onClick:a?t.closeAxisTools:t.openAxisTools,iconName:r,"data-testid":"align-plane-icon",iconColor:"secondary",children:e.jsx(i.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(c.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(i.VertexIconButton,{"data-testid":"align-plane-x-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(i.VertexIconButton,{className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",variant:"plain",iconColor:"secondary",iconName:"axis-y","data-testid":"align-plane-y-axis-button",onClick:()=>t.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(i.VertexIconButton,{"data-testid":"align-plane-z-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e.jsx("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:t,onOffsetChange:a}){const l=n.useRecoilValue(Rt),o=n.useRecoilValue(It),[r,c]=s.useState(convertTo(t,l));s.useEffect((()=>{c(convertTo(t,l))}),[l,t]);const u=createDistanceFormatter(l,parseInt(o,10)),handleIncrementalUpdate=e=>{const t=convertFrom(r+e,l);a(t)},handleSubmit=e=>{e.preventDefault(),a(convertFrom(r,l))},handleBlur=()=>{a(convertFrom(r,l))};return e.jsx(i.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(i.VertexTextfield,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:u(parseFloat(t.toFixed(3))),onInputInput:e=>{c(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>handleIncrementalUpdate(-1),children:e.jsx(i.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>handleIncrementalUpdate(1),children:e.jsx(i.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const an=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(G),l=n.useRecoilValueLoadable(U),o=n.useRecoilValueLoadable(W),r=s.useRef(),u=s.useMemo((()=>"hasValue"===l.state?l.contents:R),[l.state,l.contents]),d=s.useMemo((()=>"hasValue"===o.state?o.contents:0),[o.state,o.contents]),handleCrossSectionValueChange=e=>{clearTimeout(r.current),r.current=window.setTimeout((()=>{t.endInteraction()}),an),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAdditionalTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e.jsx("div",{className:"-ml-px py-1.5",children:e.jsx(i.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(c.VertexViewerToolbarGroup,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexViewerCrossSectionAlignmentPopoverMenu,{}),e.jsx(i.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(i.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary"})}),e.jsx(i.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(i.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary"})}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:d,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==l.state),min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===o.state?o.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),a=n.useRecoilValue(I);return e.jsxs(e.Fragment,{children:[e.jsx(i.VertexTooltip,{content:a?"Hide Section":"Show Section",children:e.jsx(i.VertexIconButton,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:a?"primary":"secondary",onClick:()=>a?t.disable():t.enable()})}),e.jsx(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=n.useRecoilValue(g);return e.jsx(i.VertexTooltip,{content:"Fit All",children:e.jsx(i.VertexIconButton,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(null==t?void 0:t.scene());await(null==e?void 0:e.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(v),[l,o]=n.useRecoilState(S),[r,c]=n.useRecoilState(b);return s.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(i.VertexTooltip,{content:"Pan",children:e.jsx(i.VertexIconButton,{iconName:"pan",iconColor:"pan"===l?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(o("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(v),[l,o]=n.useRecoilState(S),[r,c]=n.useRecoilState(b);return s.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(i.VertexTooltip,{content:"Rotate",children:e.jsx(i.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===l?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(o("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(v),[l,o]=n.useRecoilState(S),[r,c]=n.useRecoilState(b);return s.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(i.VertexTooltip,{content:"Zoom",children:e.jsx(i.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===l?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(o("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(c.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(c.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexRotateButton,{}),e.jsx(VertexPanButton,{}),e.jsx(VertexZoomButton,{}),e.jsx(VertexFitAllButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexBoxSelectionButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexPointToPointMeasurementTool,{}),e.jsx(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=null!=t&&!1!==t;return e.jsx(c.VertexViewerToolbar,{placement:"bottom-center",children:n?e.jsx(c.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:l,onRotationChange:i}){const o=useTransformActions(),r=n.useRecoilValue(Xe),u=n.useRecoilValue(Ge),d=n.useRecoilValue(Ke),m=n.useRecoilValue(Ye),p=n.useRecoilValueLoadable(qe),h=n.useRecoilValue(Rt),g=n.useRecoilValue(It),f=s.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=s.useMemo((()=>{const e=undefined;return u&&(null!=f||r)}),[u,f,r]);return e.jsx(e.Fragment,{children:v&&e.jsx(c.VertexViewerTransformWidget,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?f:void 0,decimalPlaces:parseInt(g,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:null==a||a,onInteractionStarted:()=>{o.disableSelectionSync(),o.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{o.invalidateTransforms(),o.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await o.setTransformWidgetPosition(e.detail),null==l||l(e.detail)},onRotationChanged:e=>{o.setTransformWidgetOrientation(e.detail),null==i||i(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),s=useTransformActions(),l=useViewerSceneActions(),handleReset=async()=>{await n.disable(),await a.resetSelectionState(),s.clearTransformWidgetPosition(),null==t||t(),await l.reset()};return e.jsx(i.VertexTooltip,{content:"Reset View",children:e.jsx(i.VertexIconButton,{iconName:"reset",className:"flex bg-white opacity-70 hover:opacity-100 text-neutral-900 hover:text-neutral-700 hover:bg-neutral-200 rounded p-1 cursor-pointer","data-testid":"viewer-reset-tool-button",onClick:handleReset,variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const s=await n.getPromise(He);t(V,a.detail.scene),t(He,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(Fe,s);const l=undefined;await n.getPromise(Ge)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:a}=useCallbackRef(),s=useBoxSelectionActions(),l=useTransformActions(),i=n.useRecoilValue(xe);return m.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===i&&(l.clearTransformWidgetOrientation(),l.clearTransformWidgetPosition(),l.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,i]),useApplyKeyBinding({keyBind:"Shift",fn:m.useCallback((()=>s.setOperationType("select")),[]),off:m.useCallback((()=>s.setOperationType("clearAndSelect")),[])}),e.jsx(c.VertexViewerBoxQueryTool,{ref:a,"data-testid":"viewer-box-query-tool",operationType:i})};function VertexViewerCameraTypeMenu({open:t,onOpen:a,onDismiss:s,onCameraTypeChange:l}){const r=useViewerCameraActions(),c=n.useRecoilValue(k);return e.jsxs(i.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:s,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:o("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!t,"opacity-100 text-neutral-700 bg-neutral-200":t}),children:e.jsx(i.VertexTooltip,{content:"Change View",children:e.jsx(i.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===c?"cube-orthographic":"cube-perspective",children:e.jsx(i.VertexIcon,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),e.jsxs("div",{className:"w-36",children:[e.jsx("div",{className:"pt-1"}),e.jsxs(i.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{r.updateCameraType("perspective"),null==l||l("perspective")},children:[e.jsx(i.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:o({"text-[var(--vertex-ui-blue-700)]":"perspective"===c})}),e.jsx("div",{className:o("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===c}),children:"Perspective"})]}),e.jsxs(i.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{r.updateCameraType("orthographic"),null==l||l("orthographic")},children:[e.jsx(i.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:o({"text-[var(--vertex-ui-blue-700)]":"orthographic"===c})}),e.jsx("div",{className:o("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===c}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:a}=t,l=__rest(t,["placement","children"]);const i=Array.isArray(a)?a:[a],o=i.filter((e=>!s.isValidElement(e)||e.type!==c.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),r=i.find((e=>s.isValidElement(e)&&e.type===c.VertexViewerViewCube)),[u,d]=s.useState(!1);return e.jsxs(c.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=r?r:e.jsx(c.VertexViewerViewCube,Object.assign({className:"m-7"},l)),0===o.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:u,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e.jsx("div",{className:"mt-3",children:o})]})},VertexViewer=t=>{var{id:a,className:l,disableSelection:i,onTap:r,onLongpress:u,onFrameDrawn:d,onSceneReady:m,viewerRefCallback:p,children:h}=t,b=__rest(t,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const S=n.useRecoilValue(Ot),C=useRecoilRef({state:g}),V=useViewerCameraActions(),w=useHitActions(),j=useSelectionActions(),A=useViewerFrameActions(),[T,P]=n.useRecoilState(v),E=n.useRecoilValue(k),R=n.useRecoilValue(L),I=n.useRecoilValue(pe),[N,M]=n.useRecoilState(f);s.useEffect((()=>{null!=a&&M(a)}),[a]);const O=n.useRecoilValue(At),B=s.useMemo((()=>({opacity:O/100})),[O]),D=n.useRecoilValue(le),_=n.useRecoilValue(ie),F=s.useMemo((()=>({color:D,width:_})),[D,_]),H=n.useRecoilValue(ht),U=n.useRecoilValue(yt),W=n.useRecoilValue(bt),G=n.useRecoilValue(St),K=s.useMemo((()=>({color:U,opacity:W/100,lineWidth:G})),[U,W,G]),$=n.useRecoilValue(ye),q=null!=h&&!1!==h;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(c.VertexViewer,Object.assign({id:N,"data-testid":"vertex-viewer",ref:null!=p?p:C,className:o("flex w-full h-full",l,{"cursor-crosshair":R.hitPending}),style:{"--viewer-background":H},config:S,cameraType:T?E:void 0,onCameraTypeChanged:e=>{T&&V.updateCameraType(e.detail)},phantom:B,featureLines:F,selectionHighlighting:K,featureMaps:$?"final":void 0,onTap:e=>{const t=[...i?[]:[j.selectCurrentHit]];w.tap(e,...t),null==r||r(e)},onLongpress:e=>{w.longPress(e),null==u||u(e)},onFrameDrawn:e=>{A.frameDrawn(e),null==d||d(e)},onSceneReady:e=>{T||P(!0),null==m||m(e)}},b,{children:[I&&e.jsx(VertexBoxSelectionTool,{}),q?h:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerViewCube,{}),e.jsx(VertexToolbar,{}),e.jsx(VertexViewerContextMenu,{})]})]}))};function toSdkConfig(e){return isOnlyNetworkConfig(e)?{network:e}:e}function isOnlyNetworkConfig(e){const t=undefined;return null!=e.renderingHost}const VertexViewerToolkitEventListener=({onHitStateChange:t,onSelectionStateChange:a})=>{const l=n.useRecoilValue(tt),i=n.useRecoilValue(at);return s.useEffect((()=>{null==t||t(l)}),[l,t]),s.useEffect((()=>{null==a||a(i)}),[i,a]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:a,autoDefineCustomElements:l,children:i,config:o}=t,r=__rest(t,["override","autoDefineCustomElements","children","config"]);return s.useEffect((()=>{(null==l||l)&&(d.defineCustomElements(),u.defineCustomElements())}),[l]),e.jsx(n.RecoilRoot,{override:a,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},r)),e.jsx(VertexViewerToolkitRootConfig,{config:o,children:i})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const l=n.useSetRecoilState(Ot);return s.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;l(e)}),[t,l]),e.jsx(e.Fragment,{children:a})};var sn=Object.freeze({__proto__:null,get AssemblyFontFace(){return Zt}});exports.CrossSection=ne,exports.Hits=nt,exports.SceneTree=sn,exports.Selection=st,exports.VertexApplicationMessages=VertexApplicationMessages,exports.VertexBoxSelectionButton=VertexBoxSelectionButton,exports.VertexContextMenu=VertexContextMenu,exports.VertexCrossSectionAppearanceColorPicker=VertexCrossSectionAppearanceColorPicker,exports.VertexCrossSectionAppearanceControls=VertexCrossSectionAppearanceControls,exports.VertexCrossSectionAppearanceLineThicknessSlider=VertexCrossSectionAppearanceLineThicknessSlider,exports.VertexCrossSectionAppearancePanelSection=VertexCrossSectionAppearancePanelSection,exports.VertexCrossSectionAppearanceReset=VertexCrossSectionAppearanceReset,exports.VertexDecimalPlaceSelector=VertexDecimalPlaceSelector,exports.VertexFeatureEdgesColorPicker=VertexFeatureEdgesColorPicker,exports.VertexFeatureEdgesControls=VertexFeatureEdgesControls,exports.VertexFeatureEdgesPanelSection=VertexFeatureEdgesPanelSection,exports.VertexFeatureEdgesReset=VertexFeatureEdgesReset,exports.VertexFeatureEdgesThicknessSlider=VertexFeatureEdgesThicknessSlider,exports.VertexFitAllButton=VertexFitAllButton,exports.VertexFitSelectedMenuItem=VertexFitSelectedMenuItem,exports.VertexFlyToMenuItem=VertexFlyToMenuItem,exports.VertexGhostingControls=VertexGhostingControls,exports.VertexGhostingPanelSection=VertexGhostingPanelSection,exports.VertexHideAllMenuItem=VertexHideAllMenuItem,exports.VertexHidePartMenuItem=VertexHidePartMenuItem,exports.VertexHideSelectedMenuItem=VertexHideSelectedMenuItem,exports.VertexLengthUnitSelector=VertexLengthUnitSelector,exports.VertexMaterialControls=VertexMaterialControls,exports.VertexMaterialPanelSection=VertexMaterialPanelSection,exports.VertexMeasurementContextMenu=VertexMeasurementContextMenu,exports.VertexMeasurementDetails=VertexMeasurementDetails,exports.VertexPanButton=VertexPanButton,exports.VertexPointToPointMeasurement=VertexPointToPointMeasurement,exports.VertexPointToPointMeasurementTool=VertexPointToPointMeasurementTool,exports.VertexPreciseMeasurement=VertexPreciseMeasurement,exports.VertexPreciseMeasurementTool=VertexPreciseMeasurementTool,exports.VertexResizableContent=VertexResizableContent,exports.VertexRotateButton=VertexRotateButton,exports.VertexSceneItemGhostingClear=VertexSceneItemGhostingClear,exports.VertexSceneItemGhostingOpacitySlider=VertexSceneItemGhostingOpacitySlider,exports.VertexSceneItemGhostingToggle=VertexSceneItemGhostingToggle,exports.VertexSceneItemMaterialClear=VertexSceneItemMaterialClear,exports.VertexSceneItemMaterialColorPicker=VertexSceneItemMaterialColorPicker,exports.VertexSceneItemMaterialOpacitySlider=VertexSceneItemMaterialOpacitySlider,exports.VertexSceneTree=VertexSceneTree,exports.VertexSceneTreeColumnPopover=VertexSceneTreeColumnPopover,exports.VertexSceneTreeContextMenu=VertexSceneTreeContextMenu,exports.VertexSceneTreeHeader=VertexSceneTreeHeader,exports.VertexSceneTreeSearchBar=VertexSceneTreeSearchBar,exports.VertexSceneTreeSearchInformationForToolbar=VertexSceneTreeSearchInformationForToolbar,exports.VertexSceneTreeSearchOptionsPopover=VertexSceneTreeSearchOptionsPopover,exports.VertexSceneTreeTableLayout=VertexSceneTreeTableLayout,exports.VertexSelectionHighlightingColorPicker=VertexSelectionHighlightingColorPicker,exports.VertexSelectionHighlightingControls=VertexSelectionHighlightingControls,exports.VertexSelectionHighlightingLineThicknessSlider=VertexSelectionHighlightingLineThicknessSlider,exports.VertexSelectionHighlightingOpacitySlider=VertexSelectionHighlightingOpacitySlider,exports.VertexSelectionHighlightingPanelSection=VertexSelectionHighlightingPanelSection,exports.VertexSelectionHighlightingReset=VertexSelectionHighlightingReset,exports.VertexShowAllMenuItem=VertexShowAllMenuItem,exports.VertexShowOnlyMenuItem=VertexShowOnlyMenuItem,exports.VertexShowOnlySelectedMenuItem=VertexShowOnlySelectedMenuItem,exports.VertexToolbar=VertexToolbar,exports.VertexToolbarDivider=VertexToolbarDivider,exports.VertexTransformClear=VertexTransformClear,exports.VertexTransformControls=VertexTransformControls,exports.VertexTransformManipulatorToggle=VertexTransformManipulatorToggle,exports.VertexTransformPanelSection=VertexTransformPanelSection,exports.VertexTransformWidget=VertexTransformWidget,exports.VertexUnitsControls=VertexUnitsControls,exports.VertexUnitsPanelSection=VertexUnitsPanelSection,exports.VertexViewer=VertexViewer,exports.VertexViewerBackgroundColorPicker=VertexViewerBackgroundColorPicker,exports.VertexViewerBackgroundControls=VertexViewerBackgroundControls,exports.VertexViewerBackgroundPanelSection=VertexViewerBackgroundPanelSection,exports.VertexViewerBackgroundReset=VertexViewerBackgroundReset,exports.VertexViewerContextMenu=VertexViewerContextMenu,exports.VertexViewerCrossSectionButton=VertexViewerCrossSectionButton,exports.VertexViewerRightOpenedPanel=VertexViewerRightOpenedPanel,exports.VertexViewerRightSidebar=VertexViewerRightSidebar,exports.VertexViewerSceneReset=VertexViewerSceneReset,exports.VertexViewerToolkitRoot=VertexViewerToolkitRoot,exports.VertexViewerViewCube=VertexViewerViewCube,exports.VertexZoomButton=VertexZoomButton;
|
|
2
2
|
//# sourceMappingURL=bundle.cjs.js.map
|