@vertexvis/viewer-toolkit-react 0.0.3-testing.0 → 0.0.3

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.
@@ -1,7 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("quick-format-unescaped"),n=require("recoil"),a=require("react"),s=require("@vertexvis/geometry"),i=require("@vertexvis/ui-react"),o=require("@vertexvis/viewer"),l=require("@vertexvis/viewer-react"),r=require("@vertexvis/ui/loader"),c=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 u=_interopNamespaceDefault(a),extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}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 __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),s,i=[],o;try{for(;(void 0===t||t-- >0)&&!(s=a.next()).done;)i.push(s.value)}catch(e){o={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}"function"==typeof SuppressedError&&SuppressedError;var d={exports:{}};const m=t;d.exports=pino;const p=pfGlobalThisOrFallback().console||{},h={mapHttpRequest:mock,mapHttpResponse:mock,wrapRequestSerializer:passthrough,wrapResponseSerializer:passthrough,wrapErrorSerializer:passthrough,req:mock,res:mock,err:asErrValue,errWithCause:asErrValue};function levelToValue(e,t){return"silent"===e?1/0:t.levels.values[e]}const g=Symbol("pino.logFuncs"),f=Symbol("pino.hierarchy"),v={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[f]};t[f]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:p[e]||p[v[e]||"log"]||noop})),e[g]=a}function shouldSerialize(e,t){if(Array.isArray(e)){const t=undefined;return e.filter((function(e){return"!stdSerializers.err"!==e}))}return!0===e&&Object.keys(t)}function pino(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const n=e.browser.write||p;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},s=shouldSerialize(e.browser.serialize,a);let i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);const o=Object.keys(e.customLevels||{}),l=["error","fatal","warn","info","debug","trace"].concat(o);"function"==typeof n&&l.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const r=e.level||"info",c=Object.create(n);c.log||(c.log=noop),setupBaseLogFunctions(c,l,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const u={transmit:t,serialize:s,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:l,timestamp:getTimeFunction(e),messageKey:e.messageKey||"msg",onChild:e.onChild||noop};function getLevelVal(){return levelToValue(this.level,this)}function getLevel(){return this._level}function setLevel(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set(this,u,c,"error"),set(this,u,c,"fatal"),set(this,u,c,"warn"),set(this,u,c,"info"),set(this,u,c,"debug"),set(this,u,c,"trace"),o.forEach((e=>{set(this,u,c,e)}))}function child(n,i,o){if(!i)throw new Error("missing bindings for child Pino");o=o||{},s&&i.serializers&&(o.serializers=i.serializers);const l=o.serializers;if(s&&l){var r=Object.assign({},a,l),c=!0===e.browser.serialize?Object.keys(r):s;delete i.serializers,applySerializers([i],c,r,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=i,r&&(this.serializers=r,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,i)))}Child.prototype=this;const u=new Child(this);return appendChildLogger(this,u),u.child=function(...e){return child.call(this,n,...e)},u.level=o.level||this.level,n.onChild(u),u}return c.levels=getLevels(e),c.level=r,c.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=noop,c.serializers=a,c._serialize=s,c._stdErrSerialize=i,c.child=function(...e){return child.call(this,u,...e)},t&&(c._logEvent=createLogEventShape()),c}function getLevels(e){const t=e.customLevels||{},n=undefined,a=undefined;return{values:Object.assign({},pino.levels.values,t),labels:Object.assign({},pino.levels.labels,invertObject(t))}}function invertObject(e){const t={};return Object.keys(e).forEach((function(n){t[e[n]]=n})),t}function getBindingChain(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[f];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}function set(e,t,n,a){if(Object.defineProperty(e,a,{value:levelToValue(e.level,n)>levelToValue(a,n)?noop:n[g][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const s=undefined,i=levelToValue(t.transmit.level||e.level,n),o=undefined;if(levelToValue(a,n)<i)return}e[a]=createWrap(e,t,n,a);const s=getBindingChain(e);0!==s.length&&(e[a]=prependBindingsInArguments(s,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return s=e[g][a],function LOG(){const i=t.timestamp(),o=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===p?p:this;for(var r=0;r<o.length;r++)o[r]=arguments[r];var c=!1;if(t.serialize&&(applySerializers(o,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?s.call(l,...asObject(this,a,o,i,t)):s.apply(l,o),t.transmit){const s=void 0,l=levelToValue(t.transmit.level||e._level,n),r=levelToValue(a,n);if(r<l)return;transmit(this,{ts:i,methodLevel:a,methodValue:r,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},o,c)}};var s}function asObject(e,t,n,a,s){const{level:i,log:o=e=>e}=s.formatters||{},l=n.slice();let r=l[0];const c={};let u=1+(0|e._childLevel);if(u<1&&(u=1),a&&(c.time=a),i){const n=i(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(s.asObjectBindingsOnly){if(null!==r&&"object"==typeof r)for(;u--&&"object"==typeof l[0];)Object.assign(c,l.shift());const e=undefined;return[o(c),...l]}{if(null!==r&&"object"==typeof r){for(;u--&&"object"==typeof l[0];)Object.assign(c,l.shift());r=l.length?m(l.shift(),l):void 0}else"string"==typeof r&&(r=m(l.shift(),l));void 0!==r&&(c[s.messageKey]=r);const e=undefined;return[o(c)]}}function applySerializers(e,t,n,a){for(const s in e)if(a&&e[s]instanceof Error)e[s]=pino.stdSerializers.err(e[s]);else if("object"==typeof e[s]&&!Array.isArray(e[s])&&t)for(const a in e[s])t.indexOf(a)>-1&&a in n&&(e[s][a]=n[a](e[s][a]))}function transmit(e,t,n,a=!1){const s=t.send,i=t.ts,o=t.methodLevel,l=t.methodValue,r=t.val,c=e._logEvent.bindings;a||applySerializers(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=l,s(o,e._logEvent,r),e._logEvent=createLogEventShape(c)}function createLogEventShape(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function asErrValue(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function getTimeFunction(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?nullTime:epochTime}function mock(){return{}}function passthrough(e){return e}function noop(){}function nullTime(){return!1}function epochTime(){return Date.now()}function unixTime(){return Math.round(Date.now()/1e3)}function isoTime(){return new Date(Date.now()).toISOString()}function pfGlobalThisOrFallback(){function defd(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return defd(self)||defd(window)||defd(this)||{}}}var b;pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},pino.stdSerializers=h,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),d.exports.default=pino,d.exports.pino=pino;const S=(0,d.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?S.error(t,e):S.error(e)},logger_info=(e,t)=>{null!=t?S.info(t,e):S.info(e)},logger_warn=(e,t)=>{null!=t?S.warn(t,e):S.warn(e)},logger_debug=(e,t)=>{null!=t?S.debug(t,e):S.debug(e)};class V{}function useActionCallback(e,t=[]){const a=t instanceof V?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}}}}var C=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,w=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,j=/^(#|0x)?([A-Fa-f0-9]{6})$/,create$2=function(e,t,n,a){return void 0===a&&(a=255),{r:e,g:t,b:n,a:a}},fromNumber=function(e){var t=16777215&e;return create$2(t>>16&255,t>>8&255,255&t)},fromHexString=function(e){var t=j.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=C.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=w.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):j.test(e)?fromHexString(e):void 0},fromArray=function(e){return create$2(e[0],e[1],e[2],e[3])},isInvisible=function(e){return 0===e.a},isOpaque=function(e){return 255===e.a},toHexString=function(e){return"#".concat(componentToHex(e.r)).concat(componentToHex(e.g)).concat(componentToHex(e.b))},componentToHex=function(e){var t=e.toString(16);return 1===t.length?"0"+t:t},k=Object.freeze({__proto__:null,create:create$2,fromNumber:fromNumber,fromHexString:fromHexString,fromCss:fromCss,fromArray:fromArray,isInvisible:isInvisible,isOpaque:isOpaque,toHexString:toHexString}),T;!function(e){function MapperValidationError(t){var n=e.call(this,"Validation error mapping object.")||this;return n.errors=t,Object.setPrototypeOf(n,MapperValidationError.prototype),n}__extends(MapperValidationError,e)}(Error);var A=new Uint8Array(16);function rng(){if(!T&&!(T="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return T(A)}var P=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(e){return"string"==typeof e&&P.test(e)}for(var E=[],R=0;R<256;++R)E.push((R+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(E[e[t+0]]+E[e[t+1]]+E[e[t+2]]+E[e[t+3]]+"-"+E[e[t+4]]+E[e[t+5]]+"-"+E[e[t+6]]+E[e[t+7]]+"-"+E[e[t+8]]+E[e[t+9]]+"-"+E[e[t+10]]+E[e[t+11]]+E[e[t+12]]+E[e[t+13]]+E[e[t+14]]+E[e[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}function v4(e,t,n){var a=(e=e||{}).random||(e.rng||rng)();return a[6]=15&a[6]|64,a[8]=63&a[8]|128,stringify(a)}function create$1(){return v4()}function fromMsbLsb(e,t){function digits(e,t){var n=BigInt(1)<<t*BigInt(4);return(n|e&n-BigInt(1)).toString(16).substring(1)}var n="string"==typeof e?BigInt(e):e,a="string"==typeof t?BigInt(t):t,s=digits(n>>BigInt(32),BigInt(8)),i=digits(n>>BigInt(16),BigInt(4)),o=digits(n,BigInt(4)),l=digits(a>>BigInt(48),BigInt(4)),r=digits(a,BigInt(12));return"".concat(s,"-").concat(i,"-").concat(o,"-").concat(l,"-").concat(r)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],s=t[2],i=t[3],o=t[4];if(null==n||null==a||null==s||null==i||null==o)throw new Error("Invalid UUID string ".concat(e));var l=BigInt.asIntN(64,BigInt("0x".concat(n+a+s))),r=BigInt.asIntN(64,BigInt("0x".concat(i+o)));return{msb:l.toString(),lsb:r.toString()}}var I=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb});const O=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),N=n.atom({key:"viewerElementId",default:"vertex-viewer"}),M=n.atom({key:"viewerInitialSceneReady",default:!1}),L=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),B=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),_=n.selector({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(O))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),D=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),F=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(D))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const s=await e.getPromise(_),i=await s();a.length>0&&await(null==i?void 0:i.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=a.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=a.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),s=a.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=I.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:s,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(_),a=await n(),s=await e.getPromiseRequired(U);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:s})}))}}const H=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(_),s=await a();await(null==s?void 0:s.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:H}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(_),s=await a();await(null==s?void 0:s.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:H}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(U,t)}))}}const U=n.atom({key:"viewerCameraType",default:"perspective"});class W{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(s.Vector3.left(),-e),y=e=>create(s.Vector3.down(),-e),z=e=>create(s.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},G={x:s.Vector3.left(),y:s.Vector3.down(),z:s.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||s.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||s.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===s.Vector3.magnitude(s.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>s.Vector3.dot(s.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return s.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:s.Vector3.multiply(e.normal,s.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=s.Vector3.normalize(e.normal),a=s.Vector3.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,i)=>{const o=n.viewAll(),l=getAxis(e,t),r=null!=a&&null!=l?create(l,s.Vector3.dot(l,i||s.BoundingBox.center(a))):forAxis(e,o.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[s.Vector3.create(e.min.x,e.min.y,e.min.z),s.Vector3.create(e.min.x,e.min.y,e.max.z),s.Vector3.create(e.min.x,e.max.y,e.min.z),s.Vector3.create(e.min.x,e.max.y,e.max.z),s.Vector3.create(e.max.x,e.max.y,e.max.z),s.Vector3.create(e.max.x,e.max.y,e.min.z),s.Vector3.create(e.max.x,e.min.y,e.max.z),s.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 K="#999999",$=1,q={default:5,min:0,max:10},Y=n.atom({key:"crossSectioningEnabled",default:!1}),X=n.atom({key:"crossSectioningHighlightColor",default:K}),Z=n.atom({key:"crossSectioningBorderWidth",default:1}),J=n.atom({key:"crossSectioningPlanes",default:[]}),Q=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),ee=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(F)}}),te=n.atom({key:"crossSectioningIsInteractive",default:!1}),ne=n.atom({key:"crossSectioningActiveAxis",default:"x"}),ae=n.atom({key:"crossSectioningAvailableAxes",default:G}),se=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(J);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),ie=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(J),n=e(ee),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>s.Vector3.dot(e,isNegativeNormal(t[0])?s.Vector3.multiply(t[0].normal,s.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return q}}),oe=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(J),n=e(se),a=e(ie);return t.length>0?t[0].offset*n:a.default}}),le=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),re=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),ce=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),ue=n.atom({key:"crossSectioningInteractionHandler",default:new W,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const s=n.useRecoilValue(ue);a.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(s))}),[e,t,s])}const de=n.atom({key:"hitResultsTapDetails",default:void 0}),me=n.atom({key:"hitResultsLongPressDetails",default:void 0}),pe=n.atom({key:"previousHitResult",default:void 0}),xe=n.atom({key:"currentHitResult",default:void 0}),he=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,a,i,o,l,r,c;const u=e(de),d=e(me),m=null!=u?u:d,p=e(_),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:s.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===(i=null==u?void 0:u.hitNormal)||void 0===i?void 0:i.z)||0),position:s.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})))||[]}}}}),ge=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=s.Vector3.dot(s.Vector3.normalize(e.up),t),a=Math.abs(n)>.98?s.Vector3.normalize(s.Vector3.scale(-n,e.viewVector)):e.up,i=s.Vector3.add(s.Vector3.scale(s.Vector3.distance(e.position,e.lookAt),s.Vector3.multiply(t,s.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:i})}{const a=s.Vector3.angleTo(s.Vector3.normalize(e.viewVector),t),i=null!=n?s.BoundingBox.center(n):e.lookAt,o=s.Vector3.normalize(s.Vector3.cross(s.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,i,o)}};function isParallelTo(e,t){const n=s.Angle.toDegrees(s.Vector3.angleTo(e,t));return 0===n||180===n}const fe=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Z),n=await e.getPromise(X),a=await e.getPromise(J),s=await e.getPromise(_),i=await s();await(null==i?void 0:i.crossSectioning().update({sectionPlanes:a,highlightColor:n?k.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const s=await a.getPromise(_),i=await s();if(null!=i){const a=i.camera().viewAll();n(ae),t(J,[towardsCamera(i.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(he).then((e=>e.value)),s=await t.getPromise(_),i=await s();if(null!=a&&null!=i){const t=fromHit(a,i.camera());n(J,null!=t?[t]:[]),n(ae,null!=t?{x:t.normal}:G),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(J),s=undefined;await n.getPromise(Y)||(e(Y,!0),0===a.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(Y)&&(t(Y),t(le),t(re),t(ce),t(J),t(Q),t(ne),await e())}));return{enable:a,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Y)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Y)||await a(),e(le,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(le)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(ce),e(re,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(re)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(re),e(ce,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(ce)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ue);e(te,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(ue);e(te),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const s=await n.getPromise(J);if(s.length>0){const i=await n.getPromise(se),o=await n.getPromise(ie),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(J,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(J);t(J,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(J),n=await e.getPromise(O),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:fe}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async i=>{const o=await a.getPromise(J),l=await a.getPromise(ae),r=await a.getPromise(ee),c=await a.getPromise(Q),u=await a.getPromise(O),d=await(null==u?void 0:u.scene()),m=l[i],p=null!=m&&o.length>0&&isParallelTo(o[0].normal,m)&&!isNaN(s.Vector3.angleTo(o[0].normal,m));if(null!=d&&!p){const e=await a.tryGetPromise(he).then((e=>e.value));t(ne,i),t(J,[toAxis(i,l,d.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(ce),await e()}))),updateAlignment:useActionCallback((({set:e,reset:s})=>async(i,o)=>{s(re),e(Q,{mode:i,hitPending:"global"!==i&&null==o}),"global"===i?(s(ne),s(ae),await t()):"surface"===i&&null!=o&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Q);a.hitPending&&(e(Q,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Q);n.hitPending&&e(Q,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var ve=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:fe,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:K,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:q,crossSectioningActiveAxis:ne,crossSectioningAdditionalToolsOpen:le,crossSectioningAlignment:Q,crossSectioningAlignmentToolsOpen:re,crossSectioningAvailableAxes:ae,crossSectioningAxisToolsOpen:ce,crossSectioningBorderWidth:Z,crossSectioningEnabled:Y,crossSectioningHighlightColor:X,crossSectioningInteractionHandler:ue,crossSectioningIsInteractive:te,crossSectioningOffsetScalar:se,crossSectioningPlaneDisplayOffset:oe,crossSectioningPlanes:J,crossSectioningSliderRange:ie,crossSectioningTargetBoundingBox:ee,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,s]=a.useState();return a.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),a.useCallback((a=>{const handler=()=>{e(a)};null!=n&&clearTimeout(n),s(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,s=__rest(t,["onInput"]);const o=useDebouncedCallback((e=>{null==n||n(e)}),500),l=a.useCallback((e=>{const t=e.target;o(t.value)}),[o]);return e.jsx(i.VertexColorPicker,Object.assign({onInput:l},s))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const a=useCrossSectioningActions(),[s,i]=n.useRecoilState(X);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()}})};var ye={exports:{}},be;
2
- /*!
3
- Copyright (c) 2018 Jed Watson.
4
- Licensed under the MIT License (MIT), see
5
- http://jedwatson.github.io/classnames
6
- */be=ye,function(){var e={}.hasOwnProperty;function classNames(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=appendClass(e,parseValue(n)))}return e}function parseValue(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return classNames.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var n="";for(var a in t)e.call(t,a)&&t[a]&&(n=appendClass(n,a));return n}function appendClass(e,t){return t?e?e+" "+t:e+t:e}be.exports?(classNames.default=classNames,be.exports=classNames):window.classNames=classNames}();var Se=ye.exports;const VertexSlider=t=>{var{value:n,defaultValue:s,leftLabel:o,rightLabel:l,onChange:r,onValueChange:c,onValueInput:u}=t,d=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[m,p]=a.useState(s);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[o&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:o}),e.jsx(i.VertexSlider,Object.assign({className:Se("w-full",{"mt-0.5":null!=o||null!=l}),value:null!=n?n:m,onValueChange:e=>{p(e.detail.value),null==r||r(e.detail.value),null==c||c(e)},onValueInput:e=>{p(e.detail.value),null==r||r(e.detail.value),null==u||u(e)}},d)),l&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:l})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const a=useCrossSectioningActions(),[s,i]=n.useRecoilState(Z);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,o]=n.useRecoilState(X),[l,r]=n.useRecoilState(Z),c=s!==K||1!==l;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()=>{o(K),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 Ve=.5,Ce="#444444",we=n.atom({key:"featureEdgesSelectedColor",default:Ce}),je=n.atom({key:"featureEdgesLineThickness",default:Ve}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(we);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(je);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(we),[o,l]=n.useRecoilState(je),r=o!==Ve||a!==Ce;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(Ce),l(Ve),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 ke=n.atom({key:"contextMenuActive",default:void 0}),Te=n.atom({key:"contextMenuPosition",default:void 0}),Ae=n.atom({key:"contextMenuTarget",default:void 0}),Pe=n.atom({key:"contextMenuItem",default:void 0}),Ee=n.atom({key:"contextMenuActions",default:[]}),Re=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(ke)?e(Te):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(Te,s.Point.create(n,a)),e(Ae,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,i,o)=>{const l=await e.getPromise(Te),r=await e.getPromise(ke);if(null!=l&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=s.Point.create(e,r),u=null!=l?s.Point.distance(l,c):0,d=null==i||i(n);u<2&&d&&(null==o||o(n,null!=l?l:c),t(ke,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,i)=>{if(null==a||a(t)){const a=s.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(Te,a),e(Ae,t.target),e(ke,n),null==i||i(t,a)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(ge,!!n),e(ke),e(Ee),e(Te)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(ge)))}}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 Ie=n.atom({key:"boxSelectionEnabled",default:!1}),Oe=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(Ie,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(Ie),e(Oe)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Oe,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 Ne=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),Me=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),Le=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(Me);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const Be=2,_e=n.atom({key:"isEditingPreciseMeasurement",default:!1}),De=n.atom({key:"preciseMeasurementOutcome",default:void 0}),ze=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),Fe=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),He=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),Ue=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(He).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,s){const i=n.useSetRecoilState(He),o=n.useSetRecoilState(De),l=n.useSetRecoilState(ze),r=n.useSetRecoilState(Fe),c=n.useRecoilValue(ze);a.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]),a.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{o(e),null==s||s(e)}))})),()=>null==t?void 0:t.dispose()}),[e,o]),a.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]),a.useEffect((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),a.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(ze);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(De),n(He),e(_e,!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(_e),a=await e.getPromise(Ne);n?await s():a&&(t(Me),t(Le))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(Le)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(Le,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Ne)?await i():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(_e)?await i():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Ne,!0),n.keepExistingMeasurement||e(Me)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Ne),t.keepExistingMeasurement||(e(Le),e(Me))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(_e),e(De),e(He)}))}const We=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(Ne)||e(_e)}),Ge=n.selector({key:"measurementPanelModel",get:({get:e})=>e(Me)||e(De)}),Ke=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(Fe)}),$e=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(_e)?e(Ue):void 0}}),qe=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(We)&&null!=e(Ge)}),Ye=3e3,Xe=n.atom({key:"applicationMessageToast",default:void 0}),Ze=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(Ze,null!=t?Object.assign(Object.assign({},t),{id:I.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Xe,null!=t?Object.assign(Object.assign({},t),{id:I.create()}):void 0)}))});var Je;!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"}(Je||(Je={}));const Qe=n.atomFamily({key:"selectionSelectedItems",default:void 0}),et=n.atom({key:"selectionSelectedItemIds",default:[]}),tt=n.atom({key:"selectionLastSelected",default:void 0}),nt=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),at=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),st=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(tt),s=e(et);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}}),it=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),ot=n.atom({key:"selectionVisibleSummary",default:void 0}),lt=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(ot))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),rt=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(ot);return null!=(null==t?void 0:t.boundingBox)?s.BoundingBox.center(t.boundingBox):s.Vector3.origin()}}),ct=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(et),n=undefined;return e(lt)>0||t.length>0}}),ut=n.atom({key:"transformWidgetEnabled",default:!1}),dt=n.atom({key:"transformWidgetPosition",default:void 0}),mt=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),pt=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(mt);if(null!=t)return t}}),xt=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),ht=n.atom({key:"transformWidgetSyncToSelection",default:!1}),gt=n.atom({key:"transformWidgetIsInteracting",default:!1}),ft=n.atomFamily({key:"appliedItemTransform",default:void 0}),vt=n.atom({key:"appliedItemTransformIds",default:[]}),yt=n.atom({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(rt);e(dt,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(dt),s=await t.getPromise(at),i=await t.getPromise(et),o=await t.getPromise(lt);null==a&&(i.length>0||s||o>0)&&await n(),e(ht,!0)})),i=useActionCallback((({set:e})=>async t=>{e(dt,null!=t?t:void 0)})),o=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(pt),s=undefined;(await e.getPromise(vt)).forEach((e=>{n(ft(e))})),null!=a&&t(xt,a)}))),l=useActionCallback((({set:e,reset:t})=>n=>{t(xt),e(mt,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(s,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Ye}),t(ut,!0),o?await n():null==s?await a():await i(s)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(ut),e(mt)})),setTransformWidgetOrientation:l,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(xt),e(mt)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(dt))),invalidateTransforms:o,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(gt,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(ht,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(ht))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(it),n=await e.getPromise(ot),a=undefined;if(await e.getPromise(ht)){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 i(s.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(ht),null!=t?(await i(null==t?void 0:t.position),l(s.Vector3.eulerTo(s.Vector3.up(),t.normal))):(e(dt),l(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Je.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(dt,void 0),e(ut,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Je.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(dt,void 0),e(ut,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(he).then((e=>e.value)),a=await e.getPromise(Le);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(he).then((e=>e.value));await n.orientToHitResult(t)}))),i=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(he).then((e=>e.value));e(Pe,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(xe,await e.tryGetPromise(he).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:l},...r)=>{const c=await t.getPromise(We),u=await t.getPromise(Q),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(he).then((e=>e.value));n(pe,p),n(de,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(de),t(me,a.detail),await e.tryGetPromise(he),await i(),await o()})))}},bt=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,s=undefined,i=undefined;return{tapDetails:e(de),longPressDetails:e(me),previousHitResult:e(pe),currentHitResult:e(xe)}}});var St=Object.freeze({__proto__:null,currentHitResult:xe,hitResult:he,hitResultsLongPressDetails:me,hitResultsSkipNextTap:ge,hitResultsTapDetails:de,hitState:bt,previousHitResult:pe,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(et)).forEach((e=>t(Qe(e))))})),a=useActionCallback((({snapshot:e,reset:n,set:a})=>async(s,i)=>{var o,l;const r=await e.getPromise(Qe(s.id)),c=await e.getPromise(et),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(Qe(d),{id:d}),a(et,(e=>[...e,d])),t.execute(Je.SELECTING_ANCESTOR,t.selectItemsTransform(d))):(null==i?void 0:i.clear)?(a(Qe(s.id),s),a(et,[s.id]),t.execute(Je.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(s.id))):(a(Qe(s.id),s),a(et,(e=>[...e,s.id])),t.execute(Je.SELECTING_ITEMS,t.selectItemsTransform(s.id))),u(s),a(tt,s),a(nt,!0),n(at)})),s=useActionCallback((({reset:e,set:n})=>async a=>{e(Qe(a)),e(at),n(et,(e=>e.filter((e=>e!==a)))),t.execute(Je.DESELECTING_ITEMS,t.deselectItemsTransform(a))})),i=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Qe(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(Qe(i.id)),r=await t.getPromise(et);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(Qe(e)))),n(at),l)if(o.ignoreAncestorSelection)n(et),n(Qe(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(et,e)}else n(et);e.clearTransformWidgetOrientation(),await a(i,{clear:!0})})),l=useActionCallback((({reset:t})=>async()=>{await n(),t(et),t(tt),t(nt),t(at),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),r=useActionCallback((()=>async()=>{await l(),t.execute(Je.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(at,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(he).then((e=>e.value)),n=await e.getPromise(de),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(Qe(a.id),a),s.multiSelect?e(et,(e=>[...e.filter((e=>e!==a.id)),a.id])):e(et,[a.id]),u(a),e(tt,a),e(nt,!1),e(at,!!s.multiSelect)):(t(Qe(a.id)),t(at),e(et,(e=>e.filter((e=>e!==a.id)))))})),deselect:s,clearSelection:r,resetSelectionState:l,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:u}}const Vt=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,s=undefined;return{selectedItemIds:e(et),lastSelected:e(tt),highestSelectedAncestorId:e(st)}}});var Ct=Object.freeze({__proto__:null,selectionBoundingBoxCenter:rt,selectionHighestSelectedAncestor:st,selectionIsActive:ct,selectionLastSelectWasMultiSelect:at,selectionLastSelected:tt,selectionLastSelectionFromViewer:nt,selectionPreviousVisibleSummary:it,selectionSelectedItemIds:et,selectionSelectedItems:Qe,selectionState:Vt,selectionVisibleCount:lt,selectionVisibleSummary:ot,useSelectionActions:useSelectionActions});const wt=255,jt=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),kt=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),Tt=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),At=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),Pt=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(tt);if(null!=t)return e(Tt(t.id))}}),Et=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),Rt=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),It=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(At);t(jt),n.forEach((e=>t(Tt(e)))),t(At)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(jt,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(jt)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(kt)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const s=await t.getPromise(et);a(jt),s.forEach((e=>a(Tt(e)))),n(At,(e=>e.filter((e=>!s.includes(e))))),await e.execute(Je.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(Je.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(kt,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(jt),s=await t.getPromise(kt),i=await t.getPromise(et),o=await t.getPromise(Pt),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(Je.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),i.forEach((e=>n(Tt(e),t))),n(At,(e=>[...e,...i]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(It,!0),e(Et,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(It),e(Et)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(jt),s=await t.getPromise(kt);if(null!=a){const i=await t.getPromise(At),o=Object.assign(Object.assign({},a),{opacity:null!=s?s:a.opacity});await e.execute(Je.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),i.forEach((e=>n(Tt(e))));const l=await t.getPromise(Et);null==l||l(o),n(It),n(Et)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Rt,!1)}))}},Ot="#FFFFFF",Nt=n.atom({key:"viewerBackgroundSelectedColor",default:Ot}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValueLoadable(Pt),o=n.useRecoilValue(jt),l=n.useRecoilValue(Rt),r=u.useMemo((()=>"hasValue"===s.state?null!=o?o:s.contents:o),[s,o]);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()=>{l?a.confirmApplyAll(t):(await a.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),s=n.useRecoilValue(It),[o,l]=a.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),l(!1)};return s?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:o,onValueChanged:e=>{l(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(),o&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}function createColorMaterialWithId(e,t=I.create()){return Object.assign({id:t},o.ColorMaterial.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValueLoadable(Pt),i=n.useRecoilValue(jt),o=u.useMemo((()=>"hasValue"===s.state?null!=i?i:s.contents:i),[s,i]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=o?k.toHexString(o.diffuse):void 0,onValueChanged:()=>{a.apply(),null==t||t(o)},onInput:async e=>{a.updateColor(createColorMaterialWithId(e)),await a.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValue(kt),o=n.useRecoilValueLoadable(Pt),l=u.useMemo((()=>{var e,t;return"hasValue"===o.state?null!==(t=null!=s?s:null===(e=o.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:wt:null!=s?s:wt}),[s,o]),r=useDebouncedCallback((()=>{a.apply()}),500),c=u.useCallback((e=>{a.updateOpacity(e.detail.value),r(e.detail.value)}),[r,a]),d=u.useMemo((()=>"hasValue"!==o.state||null==o.contents),[o]);return e.jsx(i.VertexTooltip,{className:"flex w-full",content:d?"Select a part and apply a color to enable opacity":`${Math.floor(l/wt*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:d,value:null!=l?l:wt,step:5,min:0,max:wt,onValueChange:e=>{a.updateOpacity(e.detail.value),a.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({onApplyMaterial:t,onApplyMaterialToAll:s,onApplyOpacity:i}){const o=useSceneItemMaterialActions(),l=n.useRecoilValue(tt);return a.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:s})]})]}),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:s})=>{const[o,l]=a.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:()=>l(!0),onMenuClosed:()=>l(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(i.VertexTooltip,{content:n,disabled:o,placement:"bottom",children:e.jsxs(i.VertexButton,{className:Se("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":o}),"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:s})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:a})=>{const s=useSceneItemMaterialActions(),o=n.useRecoilValue(ct);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:!o,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: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 Mt="#ffff00",Lt=35,Bt=1,_t=n.atom({key:"selectionHighlightingSelectedColor",default:Mt}),Dt=n.atom({key:"selectionHighlightingSelectedOpacity",default:Lt}),zt=n.atom({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(_t);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(zt);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(Dt);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(_t),[o,l]=n.useRecoilState(Dt),[r,c]=n.useRecoilState(zt),u=a!==Mt||o!==Lt||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(Mt),l(Lt),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(Nt);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(Nt),o=a!==Ot;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(Ot),null==t||t()},disabled:!o})})})};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=n.useRecoilCallback((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[]);return a},Ft=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:Ft});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();a.useEffect((()=>{const a=I.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:a,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:a})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();a.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,s]=useKeyBindingState(),i=a.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],a=t.length>0?t[t.length-1]:void 0;null!=a&&(a.fn(),s({type:"remove-key-binding",binding:a}))}))}),[n]);a.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){s({type:"set-key-pressed",key:e.key,pressed:!0}),i(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),a=matchingSingleFnBindings(n.applyBindings,t,e.key),o=matchingOffBindings(n.applyBindings,t,e.key);(a.length>0||o.length>0)&&e.preventDefault()}},handleKeyUp=e=>{s({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]),a.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]),a.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(Ie);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})})},Ht=1,VertexResizableContent=t=>{var{className:n,style:a,displayShadow:s,heading:o,id:l,initialScale:r,placement:c="left",children:u,onResize:d}=t,m=__rest(t,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const p="left"===c||"right"===c,h="top"===c;function getHorizontalResizeDirection(){switch(c){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===c?"top":"none"}const g=null!=r?r:1;return e.jsx(i.VertexResizable,Object.assign({id:l,"data-testid":`resizable-content-position-${c}`,className:Se(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"===c,"sidebar-shadow-right":"left"===c&&s,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&s,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},a),initialHorizontalScale:p?r:void 0,initialVerticalScale:h?g:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==d?void 0:d()},m,{children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===c&&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"})}),o,e.jsx("div",{className:Se("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:u})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromiseRequired(_),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[i,o]=u.useState(),[l,r]=u.useState();u.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=i&&clearTimeout(i),r(s.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!=i&&null!=l&&s.Point.distance(l,s.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(i),null==a||a())},handleTouchEnd=()=>{null!=i&&clearTimeout(i)};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,i,l])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:s,disableBackdrop:o,openPredicate:l,onOpen:r,onClose:c,children:u})=>{const d=useContextMenuActions(),m=n.useRecoilValue(ke),p=n.useRecoilValue(Re),h=a.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),g=m===s;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:d.clearActiveContextMenu,addPredicate:()=>null!=m&&m===s,cancelPredicate:()=>null==m},[m]);const f=a.useMemo((()=>null!=t?t:null!=l?window:void 0),[t,l]);return useLongPress({target:f,callback:e=>d.longPress(e,s,l,r),onMovement:()=>d.clearActiveContextMenu()}),a.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&m===s){const t=targetShouldSkipNextHit(e);d.clearActiveContextMenu(t)}};if(o)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[o,s,m]),a.useEffect((()=>{const handlePointerDown=e=>{d.pointerDown(e)},handlePointerUp=e=>{d.pointerUp(e,s,l,r)},handleContextMenu=e=>d.contextMenu(e,l);return null==f||f.addEventListener("pointerdown",handlePointerDown),null==f||f.addEventListener("pointerup",handlePointerUp),null==f||f.addEventListener("contextmenu",handleContextMenu),()=>{null==f||f.removeEventListener("pointerdown",handlePointerDown),null==f||f.removeEventListener("pointerup",handlePointerUp),null==f||f.removeEventListener("contextmenu",handleContextMenu)}}),[t,s,l]),e.jsx("div",{className:Se({hidden:!g}),children:e.jsx(i.VertexMenu,{"data-testid":`${s}-context-menu`,open:asBooleanAttribute(g),position:p,fallbackPlacements:h,backdrop:!o,onMenuClosed:()=>{d.clearActiveContextMenu(),null==c||c()},children:e.jsx("div",{className:"pt-1",children:u})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(et),a=n.useRecoilValue(ot),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(Pe);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(O),t=undefined,s=undefined,i=undefined,o=undefined,l=undefined,r=undefined;return{sceneItemsOperation:a.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:a.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:a.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:a.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:a.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:a.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(Pe),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(et),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(Pe),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(et),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 Ut=n.atom({key:"sceneTreeElement",default:void 0}),Wt=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(tt);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(Ut),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(Ut),s=await(null==a?void 0:a.getRowAtClientY(n));e(Pe,s)}))}}const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(et),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(et),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(Ut),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(i.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,s=a.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:s,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},Gt=35,Kt=n.atom({key:"sceneItemGhostingSelectedOpacity",default:Gt}),$t=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),qt=n.atom({key:"appliedItemPhantomStateIds",default:[]}),Yt=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(tt);return null!=n&&(null!==(t=e($t(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[a,s]=n.useRecoilState(Kt);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(qt)).forEach((e=>t($t(e)))),t(qt)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const s=await t.getPromise(et);s.forEach((e=>n($t(e),a))),n(qt,(e=>[...e,...s])),await e.execute(Je.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(et);s.forEach((e=>a($t(e)))),n(qt,(e=>e.filter((e=>!s.includes(e))))),await e.execute(Je.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(Je.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(ct),o=n.useRecoilValueLoadable(Yt);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"===o.state&&o.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(),o=n.useRecoilValue(Yt);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:!o,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(Ae);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 Xt=n.atom({key:"lengthUnit",default:"cm"}),Zt=n.atom({key:"decimalPlace",default:"2"});var Jt,Qt;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Jt||(Jt={})),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"}(Qt||(Qt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Qt[t]},convertTo=(e,t)=>{const n=undefined;return e*Qt[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]=u.useState(s.Point.create(0,0));return u.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),i=s.Point.create(n.left,n.bottom),o=s.Point.create(n.right,n.bottom);a("left"===t?i:o)}}),[e,t]),n}function VertexMeasurementDetails({placement:t}){const a=useMeasurementActions(),s=n.useRecoilValue(O),o=n.useRecoilValue(N),r=useDockedPlacement(null!=s?s:null,t),c=n.useRecoilValue(Ge),u=n.useRecoilValue(Ke),d=n.useRecoilValue($e),m=n.useRecoilValue(qe),p=n.useRecoilValue(Xt),h=n.useRecoilValue(Zt);return e.jsx(i.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${o}`,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:Se("-mt-1 relative",{hidden:!m}),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(l.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:Se("gap-y-1.5 text-xs",{hidden:null==c}),measurementOutcome:c,measurementOverlays:u,distanceUnits:toUnitType(p),fractionalDigits:parseInt(h,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:Se("text-xs",{hidden:null==d}),children:d})]})})}function useCallbackRef(e){var t;const[n,s]=a.useState((t=void 0,null)),i=undefined;return{element:n,callback:a.useCallback((e=>s(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,onPointToPointMeasurementChange:s}){const i=useMeasurementActions(),o=n.useRecoilValue(O),r=n.useRecoilValue(Ne),c=n.useRecoilValue(Le),u=n.useRecoilValue(Xt),d=n.useRecoilValue(Zt),{callback:m,element:p}=useCallbackRef();usePointToPointMeasurement(p);const h=a.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};i.setEditedPointToPointMeasurement(t),null==s||s(t)}),[i]);return r?e.jsxs(e.Fragment,{children:[e.jsx(l.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:m,viewer:null!=o?o:void 0,mode:"replace",start:null==c?void 0:c.start,end:null==c?void 0:c.end,invalid:null==c?void 0:c.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(Ne);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 en=n.atom({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:t,onEntitiesChanged:a,onOutcomeChanged:s})=>{var i,o,r,c;const u=n.useRecoilValue(O),d=n.useRecoilValue(en),m=n.useRecoilValue(_e),{callback:p,element:h}=useCallbackRef();return usePreciseMeasurementModel(h,a,s),m?e.jsxs(e.Fragment,{children:[e.jsx(l.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===(r=null==d?void 0:d.network)||void 0===r?void 0:r.sceneTreeHost,sceneViewHost:null===(c=null==d?void 0:d.network)||void 0===c?void 0:c.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(_e);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(Ze),a=n.useRecoilValue(Xe);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 tn={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 nn=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(Wt);return null!=t?await t.fetchMetadataKeys():[]}}),an=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(nn).filter((e=>e!==tn.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),sn=n.atom({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),on=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(sn),n=e(Ut),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({},tn),{initialWidth:e,minWidth:n})})}return{Name:tn}}}),ln=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(on))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e,snapshot:t})=>async n=>{e(sn,n);const a=await t.getPromise(Wt);null==a||a.setMetadataKeys(n)}))}}const rn=16,cn=-8;var un;function useOpenColumnPopover({buttonElement:e,horizontalOffset:t,verticalOffset:n}){const[a,s]=u.useState(!1),[i,o]=u.useState(),[l,r]=u.useState(),c=u.useCallback((()=>{if(a)s(!1);else{const a=null==e?void 0:e.getBoundingClientRect();if(null!=a){const e=null!=t?t:rn,i=null!=n?n:cn,l=a.x>window.innerWidth/2?un.LEFT:un.RIGHT;o({x:l===un.LEFT?a.left-e:a.right+e,y:a.top+i}),r(l),s(!0)}}}),[a,e]),d=u.useCallback((()=>{s(!1)}),[]);return{open:a,position:i,direction:l,handleOpen:c,handleClose:d}}!function(e){e.LEFT="left",e.RIGHT="right"}(un||(un={}));const dn=n.atom({key:"sceneTreeSearchActive",default:!1}),mn=n.atom({key:"sceneTreeSearchValue",default:void 0}),pn=n.atom({key:"sceneTreeSearchExactMatch",default:!1}),xn=n.atom({key:"sceneTreeSearchResultCount",default:0}),hn=n.atom({key:"sceneTreeSearchActiveColumns",default:[]}),gn=n.selector({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(hn);return 0===t.length||t.includes(tn.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=n.useSetRecoilState(xn);a.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(hn,t)})),t=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Ut),a=await e.getPromise(pn),s=await e.getPromise(hn),i=a?[tn.metadataKeyName]:[],o=s.length>0?s:i;null==n||n.filterItems(t,{columns:o,exactMatch:a})})),n=useActionCallback((({snapshot:t})=>async(n,a)=>{const s=await t.getPromise(hn);if(a)e(0===s.length?[tn.metadataKeyName,n]:[...s,n]);else{const t=s.filter((e=>e!==n));e(t.every((e=>e===tn.metadataKeyName))?[]:t)}})),a=useActionCallback((({set:e})=>t=>{e(pn,t)}));return{setMetadataSearchKeys:e,updateSearchForActiveColumns:t,updateMetadataSearchAfterSearchKeysChange:n,setMetadataSearchExactMatch:a}},VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:a,children:s})=>{const o="string"==typeof s?s.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(i.VertexToggle,{"data-testid":`scene-tree-metadata-check-${o}`,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-${o}`,onClick:()=>{n||null==a||a(!t)},children:s})]})},VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const a=useSceneTreeColumnActions(),s=useSceneTreeSearchActions(),o=n.useRecoilValue(mn),l=n.useRecoilValueLoadable(an),r=n.useRecoilValue(sn),c=n.useRecoilValue(hn),[d,m]=u.useState(r),[p,h]=u.useState(""),{element:g,callback:f}=useCallbackRef(),{open:v,position:b,direction:S,handleOpen:V,handleClose:C}=useOpenColumnPopover({buttonElement:g}),w=S===un.LEFT?"left-end":"right-start",j=u.useMemo((()=>{if("hasValue"===l.state){const e=l.contents.filter((e=>d.indexOf(e)<0)),t=undefined;return[...[...d].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[d,l.state,l.contents]),k=u.useMemo((()=>j),[v]);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:f,iconName:"columns-add",iconSize:"sm",onClick:()=>{V()}})}),v&&e.jsx(i.VertexPopover,{"data-testid":"scene-tree-column-popover",open:v,backdrop:!1,position:b,resizeBehavior:"fixed",placement:w,className:"z-popover",children:e.jsxs("div",{className:Se("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!v}),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:()=>{h(""),C()}})]}),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&&h(t.toLowerCase())}}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:tn.label}),"hasValue"===l.state&&k.filter((e=>""===p||e.toLowerCase().includes(p))).map((t=>e.jsx(VertexSceneTreeMetadataCheck,{checked:d.includes(t),disabled:d.length>=6&&!d.includes(t),onChange:e=>{m(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:()=>m([]),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:()=>{h(""),C()},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),h(""),C();const e=[tn.metadataKeyName,...d],n=c.filter((t=>!e.includes(t)));n.length>0&&(await Promise.all(n.map((e=>s.updateMetadataSearchAfterSearchKeysChange(e,!1)))),null!=o&&await s.updateSearchForActiveColumns(o))},children:"Apply"})]})]})]})})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:t,onSearchForExactMatchChange:a})=>{const s=useSceneTreeSearchActions(),o=n.useRecoilValue(gn),l=n.useRecoilValue(hn),r=n.useRecoilValue(mn),c=n.useRecoilValue(pn),u=n.useRecoilValue(sn),{element:d,callback:m}=useCallbackRef(),{open:p,position:h,direction:g,handleOpen:f,handleClose:v}=useOpenColumnPopover({buttonElement:d,horizontalOffset:40}),b=g===un.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:m,iconName:"gear",iconSize:"sm",onClick:()=>{f()}})}),e.jsx(i.VertexPopover,{"data-testid":"scene-tree-search-options-popover",open:p,backdrop:!1,position:h,resizeBehavior:"fixed",placement:b,className:"z-popover",children:e.jsxs("div",{className:Se("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!p}),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:()=>{v()}})]}),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:o,disabled:0===l.length||l.every((e=>e===tn.metadataKeyName)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(tn.metadataKeyName,e),null==t||t(),null!=r&&await s.updateSearchForActiveColumns(r)},children:tn.label},tn.metadataKeyName),u.map((n=>e.jsx(VertexSceneTreeMetadataCheck,{checked:l.includes(n),disabled:l.length>0&&l.every((e=>e===n)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(n,e),null==t||t(),null!=r&&await s.updateSearchForActiveColumns(r)},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:c,onValueChanged:async e=>{s.setMetadataSearchExactMatch(e.detail),null==a||a(),null!=r&&await s.updateSearchForActiveColumns(r)}}),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:o,onSearchForExactMatchChange:r,children:c})=>{const d=n.useRecoilValue(Ut),[m,p]=n.useRecoilState(dn),[h,g]=n.useRecoilState(mn);useSceneTreeSearch({sceneTreeElement:null!=d?d:null});const{element:f,callback:v}=useCallbackRef(),b=null==h||""===h,S=b?"Exit Search":"Clear Search";return u.useEffect((()=>{m&&(null==f||f.setFocus())}),[f,m]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(l.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:v,controller:null==d?void 0:d.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:c}),e.jsx("div",{className:"self-center px-1",onPointerDown:e=>{e.preventDefault()},children:e.jsx(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:r})}),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(Ut),s=n.useRecoilValue(mn),o=n.useRecoilValue(xn),l=undefined,r=undefined,c=`${o>=1e3?`${o}+`:`${o}`} ${1===o?"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=n.useRecoilCallback((({set:t})=>n=>{t(e,n)}),[]);return t}var fn;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===fn.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(fn||(fn={}));const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const a=n.useSetRecoilState(dn);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:i,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:r,children:c})=>{const u=n.useRecoilValue(dn);return e.jsxs(l.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[u&&e.jsx(VertexSceneTreeSearchBar,{onSearch:s,onClearSearch:i,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:r,children:c}),!u&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(Ut);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(Ut);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(mn),s=null==a||""===a;return e.jsx(l.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: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(on),s=n.useRecoilValue(ln),i=[];return e.jsx(l.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},t,{children:s.map(((t,n)=>{var o;const r=a[t],c=null!==(o=i[n])&&void 0!==o?o:r.initialWidth;return e.jsxs(l.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:c,minWidth:r.minWidth,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${Se("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:s,font:i,backgroundColors:o,children:r,style:c,onPointerDown:u,onClick:d,onToggleSelection:m,onToggleExpansion:p,onToggleVisibility:h,className:g,rowData:f}=t,v=__rest(t,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const b=useSceneTreeActions(),S=useSelectionActions(),V=n.useRecoilValue(en),C=n.useRecoilValue(O),w=n.useRecoilValue(hn),j=n.useRecoilValue(pn),k=n.useRecoilValue(mn),T=null==k||""===k,A=useRecoilRef({state:Ut}),P=null!=r&&!1!==r,wrappedExpansionHandler=(e,t,n)=>{b.toggleExpansion(e,t,n),null==p||p(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{b.toggleSelection(e,t,n),null==m||m(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{b.toggleVisibility(e,t,n),null==h||h(e,t,n)},handleClick=e=>{e.altKey&&b.flyToRow(e.clientY),null==d||d(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&S.clearSelection(),null==u||u(e)},E=n.useSetRecoilState(Wt),handleFirstRowRendered=e=>{var t;E(e.target.controller),null===(t=null==v?void 0:v.onFirstRowRendered)||void 0===t||t.call(v,e)},R=a.useMemo((()=>({metadataSearchKeys:w,exactMatch:j})),[w,j]);return e.jsx("div",{className:Se("flex flex-col w-full h-full",g),children:e.jsx("div",{className:"flex group h-full",children:e.jsx(l.VertexSceneTree,Object.assign({id:null!=s?s:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:V,ref:A,className:Se("flex-1",{filtered:!T}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(i)),styleFromOptionalBackgroundColors(o)),c),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:C,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==f?void 0:f(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)},searchOptions:R},v,{onFirstRowRendered:handleFirstRowRendered,children:P?r:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeHeader,{}),e.jsx(VertexSceneTreeTableLayout,{}),e.jsx(VertexSceneTreeContextMenu,{})]})}))})})},VertexDecimalPlaceSelector=({onApply:t})=>{const[a,s]=n.useRecoilState(Zt);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(Xt);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 vn=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),yn=n.atom({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?vn:yn,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?vn:yn,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(),o=n.useRecoilValue(ct);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:!o,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(ut),o=n.useSetRecoilState(yt);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)):(o("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 bn="Appearance",Sn="Settings",Vn="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,a=getHeading(n.useRecoilValue(yn));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 bn;case"settings":return Sn;case"transforms":return Vn;default:return"None"}}function VertexViewerRightOpenedPanel(){const t=n.useRecoilValue(yn),s=a.useMemo((()=>["appearance","settings","transforms"]),[]);return e.jsx(e.Fragment,{children:null!=t&&s.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:s,responsive:o,disabled:l,content:r,tooltipPlacement:c,children:u,onSelect:d,onDeselect:m}){return e.jsx("div",{className:Se({"text-[var(--vertex-ui-blue-700)]":s===t&&!l,"text-neutral-700 hover:text-neutral-800":s!==t&&!l,"cursor-pointer hover:bg-neutral-200":!l,"text-neutral-400":l,"rounded-full md:p-3":o,"p-3":!o&&null==u,"px-3 py-1":null!=u}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{l||(s===t?m():d())},children:e.jsxs(i.VertexTooltip,{placement:null!=c?c:void 0,content:a.isValidElement(r)?void 0:r,children:[e.jsx("div",{slot:"content",children:r}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(i.VertexIcon,{name:n}),u]})]})})}function VertexViewerRightSidebar(){const t=usePanelActions(),a=n.useRecoilValue(yn);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 o=a.find((e=>e.type===Anchor)),l=a.filter((e=>e.type!==Anchor));return null==o?e.jsx(e.Fragment,{}):e.jsxs(i.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},s,{children:[o,e.jsx("div",{className:Se("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:l})]}))},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(re),s=n.useRecoilValue(Q),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(l.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(),s=n.useRecoilValue(ce),o=n.useRecoilValue(J),r=n.useRecoilValueLoadable(ae),c=a.useMemo((()=>{const e=o.length>0&&"hasValue"===r.state?axis(o[0],xAxis(r.contents),yAxis(r.contents),zAxis(r.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[r.state,r.contents,o]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(s),onDismissed:t.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(i.VertexIconButton,{onClick:s?t.closeAxisTools:t.openAxisTools,iconName:c,"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(l.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:s}){const o=n.useRecoilValue(Xt),l=n.useRecoilValue(Zt),[r,c]=a.useState(convertTo(t,o));a.useEffect((()=>{c(convertTo(t,o))}),[o,t]);const u=createDistanceFormatter(o,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(r+e,o);s(t)},handleSubmit=e=>{e.preventDefault(),s(convertFrom(r,o))},handleBlur=()=>{s(convertFrom(r,o))};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 Cn=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),s=n.useRecoilValue(le),o=n.useRecoilValueLoadable(ie),r=n.useRecoilValueLoadable(oe),c=a.useRef(),u=a.useMemo((()=>"hasValue"===o.state?o.contents:q),[o.state,o.contents]),d=a.useMemo((()=>"hasValue"===r.state?r.contents:0),[r.state,r.contents]),handleCrossSectionValueChange=e=>{clearTimeout(c.current),c.current=window.setTimeout((()=>{t.endInteraction()}),Cn),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(s),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:s?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(l.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"!==o.state),min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===r.state?r.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),a=n.useRecoilValue(Y);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(O);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(O),s=n.useRecoilValue(M),[o,l]=n.useRecoilState(B),[r,c]=n.useRecoilState(L);return a.useEffect((()=>{null!=t&&s&&c(t.getBaseInteractionHandler())}),[t,s,c]),e.jsx(i.VertexTooltip,{content:"Pan",children:e.jsx(i.VertexIconButton,{iconName:"pan",iconColor:"pan"===o?"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(O),s=n.useRecoilValue(M),[o,l]=n.useRecoilState(B),[r,c]=n.useRecoilState(L);return a.useEffect((()=>{null!=t&&s&&c(t.getBaseInteractionHandler())}),[t,s,c]),e.jsx(i.VertexTooltip,{content:"Rotate",children:e.jsx(i.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===o?"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(O),s=n.useRecoilValue(M),[o,l]=n.useRecoilState(B),[r,c]=n.useRecoilState(L);return a.useEffect((()=>{null!=t&&s&&c(t.getBaseInteractionHandler())}),[t,s,c]),e.jsx(i.VertexTooltip,{content:"Zoom",children:e.jsx(i.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===o?"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(l.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(l.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(l.VertexViewerToolbar,{placement:"bottom-center",children:n?e.jsx(l.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:s,onPositionChange:i,onRotationChange:o}){const r=useTransformActions(),c=n.useRecoilValue(ht),u=n.useRecoilValue(ut),d=n.useRecoilValue(dt),m=n.useRecoilValue(xt),p=n.useRecoilValueLoadable(pt),h=n.useRecoilValue(Xt),g=n.useRecoilValue(Zt),f=a.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=a.useMemo((()=>{const e=undefined;return u&&(null!=f||c)}),[u,f,c]);return e.jsx(e.Fragment,{children:v&&e.jsx(l.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==s||s,onInteractionStarted:()=>{r.disableSelectionSync(),r.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{r.invalidateTransforms(),r.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await r.setTransformWidgetPosition(e.detail),null==i||i(e.detail)},onRotationChanged:e=>{r.setTransformWidgetOrientation(e.detail),null==o||o(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),s=useTransformActions(),o=useViewerSceneActions(),handleReset=async()=>{await n.disable(),await a.resetSelectionState(),s.clearTransformWidgetPosition(),null==t||t(),await o.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(ot);t(D,a.detail.scene),t(ot,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(it,s);const i=undefined;await n.getPromise(ut)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:a}=useCallbackRef(),s=useBoxSelectionActions(),i=useTransformActions(),o=n.useRecoilValue(Oe);return u.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:u.useCallback((()=>s.setOperationType("select")),[]),off:u.useCallback((()=>s.setOperationType("clearAndSelect")),[])}),e.jsx(l.VertexViewerBoxQueryTool,{ref:a,"data-testid":"viewer-box-query-tool",operationType:o})};function VertexViewerCameraTypeMenu({open:t,onOpen:a,onDismiss:s,onCameraTypeChange:o}){const l=useViewerCameraActions(),r=n.useRecoilValue(U);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:Se("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"===r?"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:()=>{l.updateCameraType("perspective"),null==o||o("perspective")},children:[e.jsx(i.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:Se({"text-[var(--vertex-ui-blue-700)]":"perspective"===r})}),e.jsx("div",{className:Se("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===r}),children:"Perspective"})]}),e.jsxs(i.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{l.updateCameraType("orthographic"),null==o||o("orthographic")},children:[e.jsx(i.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:Se({"text-[var(--vertex-ui-blue-700)]":"orthographic"===r})}),e.jsx("div",{className:Se("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===r}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:s}=t,i=__rest(t,["placement","children"]);const o=Array.isArray(s)?s:[s],r=o.filter((e=>!a.isValidElement(e)||e.type!==l.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),c=o.find((e=>a.isValidElement(e)&&e.type===l.VertexViewerViewCube)),[u,d]=a.useState(!1);return e.jsxs(l.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=c?c:e.jsx(l.VertexViewerViewCube,Object.assign({className:"m-7"},i)),0===r.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:r})]})},VertexViewer=t=>{var{id:s,className:i,disableSelection:o,onTap:r,onLongpress:c,onFrameDrawn:u,onSceneReady:d,viewerRefCallback:m,children:p}=t,h=__rest(t,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const g=n.useRecoilValue(en),f=useRecoilRef({state:O}),v=useViewerCameraActions(),b=useHitActions(),S=useSelectionActions(),V=useViewerFrameActions(),[C,w]=n.useRecoilState(M),j=n.useRecoilValue(U),k=n.useRecoilValue(Q),T=n.useRecoilValue(Ie),[A,P]=n.useRecoilState(N);a.useEffect((()=>{null!=s&&P(s)}),[s]);const E=n.useRecoilValue(Kt),R=a.useMemo((()=>({opacity:E/100})),[E]),I=n.useRecoilValue(we),L=n.useRecoilValue(je),B=a.useMemo((()=>({color:I,width:L})),[I,L]),_=n.useRecoilValue(Nt),D=n.useRecoilValue(_t),F=n.useRecoilValue(Dt),H=n.useRecoilValue(zt),W=a.useMemo((()=>({color:D,opacity:F/100,lineWidth:H})),[D,F,H]),G=n.useRecoilValue(_e),K=null!=p&&!1!==p;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(l.VertexViewer,Object.assign({id:A,"data-testid":"vertex-viewer",ref:null!=m?m:f,className:Se("flex w-full h-full",i,{"cursor-crosshair":k.hitPending}),style:{"--viewer-background":_},config:g,cameraType:C?j:void 0,onCameraTypeChanged:e=>{C&&v.updateCameraType(e.detail)},phantom:R,featureLines:B,selectionHighlighting:W,featureMaps:G?"final":void 0,onTap:e=>{const t=[...o?[]:[S.selectCurrentHit]];b.tap(e,...t),null==r||r(e)},onLongpress:e=>{b.longPress(e),null==c||c(e)},onFrameDrawn:e=>{V.frameDrawn(e),null==u||u(e)},onSceneReady:e=>{C||w(!0),null==d||d(e)}},h,{children:[T&&e.jsx(VertexBoxSelectionTool,{}),K?p: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:s})=>{const i=n.useRecoilValue(bt),o=n.useRecoilValue(Vt);return a.useEffect((()=>{null==t||t(i)}),[i,t]),a.useEffect((()=>{null==s||s(o)}),[o,s]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:s,autoDefineCustomElements:i,children:o,config:l}=t,u=__rest(t,["override","autoDefineCustomElements","children","config"]);return a.useEffect((()=>{(null==i||i)&&(c.defineCustomElements(),r.defineCustomElements())}),[i]),e.jsx(n.RecoilRoot,{override:s,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},u)),e.jsx(VertexViewerToolkitRootConfig,{config:l,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:s})=>{const i=n.useSetRecoilState(en);return a.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;i(e)}),[t,i]),e.jsx(e.Fragment,{children:s})};var wn=Object.freeze({__proto__:null,get AssemblyFontFace(){return fn}});exports.CrossSection=ve,exports.Hits=St,exports.SceneTree=wn,exports.Selection=Ct,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;
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;
7
2
  //# sourceMappingURL=bundle.cjs.js.map