@vertexvis/viewer-toolkit-react 0.0.6-canary.12 → 0.0.6-canary.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("quick-format-unescaped"),n=require("recoil"),a=require("@vertexvis/geometry"),o=require("react"),s=require("@vertexvis/
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("quick-format-unescaped"),n=require("recoil"),a=require("@vertexvis/geometry"),o=require("react"),s=require("@vertexvis/viewer"),i=require("@vertexvis/ui-react"),r=require("@vertexvis/viewer-react"),l=require("prop-types"),c=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 u=_interopNamespaceDefault(o),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 __)}var __assign=function(){return __assign=Object.assign||function __assign(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)};function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),o,s=[],i;try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)s.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var m=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,p=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,h=/^(#|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=h.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=m.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=p.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):h.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},f=Object.freeze({__proto__:null,create:create$2,fromNumber:fromNumber,fromHexString:fromHexString,fromCss:fromCss,fromArray:fromArray,isInvisible:isInvisible,isOpaque:isOpaque,toHexString:toHexString});!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 g=function equal(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,a,o;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(a=n;0!=a--;)if(!equal(e[a],t[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,o[a]))return!1;for(a=n;0!=a--;){var s=o[a];if(!equal(e[s],t[s]))return!1}return!0}return e!=e&&t!=t};
|
|
2
2
|
/*!
|
|
3
3
|
* isobject <https://github.com/jonschlinkert/isobject>
|
|
4
4
|
*
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
12
12
|
* Released under the MIT License.
|
|
13
|
-
*/function isObjectObject(e){return!0===isObject(e)&&"[object Object]"===Object.prototype.toString.call(e)}function isPlainObject$1(e){var t,n;return!1!==isObjectObject(e)&&("function"==typeof(t=e.constructor)&&(!1!==isObjectObject(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))}function defaults(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=__read(e),a=n[0],o=n.slice(1),s=__assign({},a);if(0===o.length)return s;if(1===o.length){var i=o[0];for(var r in i)null==s[r]?s[r]=i[r]:isPlainObject(s[r])&&(s[r]=defaults(s[r],i[r]));return s}return o.reduce((function(e,t){return defaults(e,t)}),a)}function isPlainObject(e){return isPlainObject$1(e)}function isEqual$1(e,t){return g(e,t)}function toPairs(e){return null!=e?Object.keys(e).map((function(t){return[t,e[t]]})):[]}function fromPairs(e){return Array.isArray(e)?e.reduce((function(e,t){var n;return null!=t?__assign(__assign({},e),((n={})[t[0]]=t[1],n)):e}),{}):{}}var v=Object.freeze({__proto__:null,defaults:defaults,isPlainObject:isPlainObject,isEqual:isEqual$1,toPairs:toPairs,fromPairs:fromPairs}),b,w=new Uint8Array(16);function rng(){if(!b&&!(b="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 b(w)}var C=/^(?:[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&&C.test(e)}for(var S=[],V=0;V<256;++V)S.push((V+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+"-"+S[e[t+4]]+S[e[t+5]]+"-"+S[e[t+6]]+S[e[t+7]]+"-"+S[e[t+8]]+S[e[t+9]]+"-"+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[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,o=digits(n>>BigInt(32),BigInt(8)),s=digits(n>>BigInt(16),BigInt(4)),i=digits(n,BigInt(4)),r=digits(a>>BigInt(48),BigInt(4)),l=digits(a,BigInt(12));return"".concat(o,"-").concat(s,"-").concat(i,"-").concat(r,"-").concat(l)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],o=t[2],s=t[3],i=t[4];if(null==n||null==a||null==o||null==s||null==i)throw new Error("Invalid UUID string ".concat(e));var r=BigInt.asIntN(64,BigInt("0x".concat(n+a+o))),l=BigInt.asIntN(64,BigInt("0x".concat(s+i)));return{msb:r.toString(),lsb:l.toString()}}var j=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb}),k={exports:{}};const T=t;k.exports=pino;const A=pfGlobalThisOrFallback().console||{},P={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 I=Symbol("pino.logFuncs"),M=Symbol("pino.hierarchy"),E={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[M]};t[M]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:A[e]||A[E[e]||"log"]||noop})),e[I]=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||A;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},o=shouldSerialize(e.browser.serialize,a);let s=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const i=Object.keys(e.customLevels||{}),r=["error","fatal","warn","info","debug","trace"].concat(i);"function"==typeof n&&r.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const l=e.level||"info",c=Object.create(n);c.log||(c.log=noop),setupBaseLogFunctions(c,r,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const d={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:r,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,d,c,"error"),set(this,d,c,"fatal"),set(this,d,c,"warn"),set(this,d,c,"info"),set(this,d,c,"debug"),set(this,d,c,"trace"),i.forEach((e=>{set(this,d,c,e)}))}function child(n,s,i){if(!s)throw new Error("missing bindings for child Pino");i=i||{},o&&s.serializers&&(i.serializers=s.serializers);const r=i.serializers;if(o&&r){var l=Object.assign({},a,r),c=!0===e.browser.serialize?Object.keys(l):o;delete s.serializers,applySerializers([s],c,l,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=s,l&&(this.serializers=l,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,s)))}Child.prototype=this;const d=new Child(this);return appendChildLogger(this,d),d.child=function(...e){return child.call(this,n,...e)},d.level=i.level||this.level,n.onChild(d),d}return c.levels=getLevels(e),c.level=l,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=o,c._stdErrSerialize=s,c.child=function(...e){return child.call(this,d,...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[M];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[I][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const o=undefined,s=levelToValue(t.transmit.level||e.level,n),i=undefined;if(levelToValue(a,n)<s)return}e[a]=createWrap(e,t,n,a);const o=getBindingChain(e);0!==o.length&&(e[a]=prependBindingsInArguments(o,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return o=e[I][a],function LOG(){const s=t.timestamp(),i=new Array(arguments.length),r=Object.getPrototypeOf&&Object.getPrototypeOf(this)===A?A:this;for(var l=0;l<i.length;l++)i[l]=arguments[l];var c=!1;if(t.serialize&&(applySerializers(i,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?o.call(r,...asObject(this,a,i,s,t)):o.apply(r,i),t.transmit){const o=void 0,r=levelToValue(t.transmit.level||e._level,n),l=levelToValue(a,n);if(l<r)return;transmit(this,{ts:s,methodLevel:a,methodValue:l,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},i,c)}};var o}function asObject(e,t,n,a,o){const{level:s,log:i=e=>e}=o.formatters||{},r=n.slice();let l=r[0];const c={};let d=1+(0|e._childLevel);if(d<1&&(d=1),a&&(c.time=a),s){const n=s(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(null!==l&&"object"==typeof l)for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());const e=undefined;return[i(c),...r]}{if(null!==l&&"object"==typeof l){for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());l=r.length?T(r.shift(),r):void 0}else"string"==typeof l&&(l=T(r.shift(),r));void 0!==l&&(c[o.messageKey]=l);const e=undefined;return[i(c)]}}function applySerializers(e,t,n,a){for(const o in e)if(a&&e[o]instanceof Error)e[o]=pino.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const a in e[o])t.indexOf(a)>-1&&a in n&&(e[o][a]=n[a](e[o][a]))}function transmit(e,t,n,a=!1){const o=t.send,s=t.ts,i=t.methodLevel,r=t.methodValue,l=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=s,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=i,e._logEvent.level.value=r,o(i,e._logEvent,l),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 R;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=P,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),k.exports.default=pino,k.exports.pino=pino;const N=(0,k.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?N.error(t,e):N.error(e)},logger_info=(e,t)=>{null!=t?N.info(t,e):N.info(e)},logger_warn=(e,t)=>{null!=t?N.warn(t,e):N.warn(e)},logger_debug=(e,t)=>{null!=t?N.debug(t,e):N.debug(e)};class O{}function useActionCallback(e,t=[]){const a=t instanceof O?void 0:t;return n.useRecoilCallback((t=>e({...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({snapshot:t,...n})=>async(...a)=>{const o=t.retain();try{const o=undefined;return await e({...n,snapshot:t})(...a)}finally{o()}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const a=await e.getPromise(t);if(null==a)throw 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 L=3e3,_=5e3,B=8e3,D=n.atom({key:"applicationMessageToast",default:void 0}),F=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(F,null!=t?{...t,id:j.create()}:void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(D,null!=t?{...t,id:j.create()}:void 0)}))});var H=Object.freeze({__proto__:null,LOW_SEVERITY_BANNER_MESSAGE_DURATION_MS:_,LOW_SEVERITY_TOAST_MESSAGE_DURATION_MS:L,MEDIUM_SEVERITY_TOAST_MESSAGE_DURATION_MS:B,applicationMessageBanner:F,applicationMessageToast:D,useApplicationMessageActions:useApplicationMessageActions});const U=500;function useViewerCameraActions(){const e=useApplicationMessageActions();return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(G),o=await(a?.scene());await(o?.camera().flyTo({itemId:t}).render({animation:{milliseconds:n??U}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(G),o=await(a?.scene());await(o?.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:n??U}}))})),updateCameraType:useActionCallback((({set:t,snapshot:n})=>async(o,s)=>{const i=await n.getPromise(J),r=undefined;null!=i&&a.BoundingBox.isValid(i)||!s?t(W,o):e.setToastMessage({type:"error",message:"Cannot change the camera type when no geometry is visible.",duration:B})}))}}const W=n.atom({key:"viewerCameraType",default:"perspective"}),G=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),K=n.atom({key:"viewerElementId",default:"vertex-viewer"}),$=n.atom({key:"viewerInitialSceneReady",default:!1}),q=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),Y=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),X=n.atom({key:"viewerSceneViewId",default:void 0});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const o=await e.getPromise(G),s=await(o?.scene());a.length>0&&await(s?.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=o.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=o.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),a=o.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=j.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:a,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),a=await(n?.scene()),o=await e.getPromiseRequired(W);a?.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:o})}))}}const Z=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),J=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>e(Z)?.boundingBox});var Q=Object.freeze({__proto__:null,DEFAULT_CAMERA_ANIMATION_DURATION:U,useViewerCameraActions:useViewerCameraActions,useViewerSceneActions:useViewerSceneActions,viewerBaseInteractionHandlerProvider:q,viewerCameraType:W,viewerElement:G,viewerElementId:K,viewerFrameScene:Z,viewerInitialSceneReady:$,viewerPrimaryInteractionType:Y,viewerSceneViewId:X,viewerSceneVisibleBoundingBox:J});class ee{api;interactionStarted=!1;initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){this.interactionStarted||(await(this.api?.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){await(this.api?.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(a.Vector3.left(),-e),y=e=>create(a.Vector3.down(),-e),z=e=>create(a.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},te={x:a.Vector3.left(),y:a.Vector3.down(),z:a.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||a.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||a.Vector3.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,o)=>e&&e.normal&&[["x",t],["y",n],["z",o]].filter((t=>0===a.Vector3.magnitude(a.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>a.Vector3.dot(a.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return a.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>({...e,normal:a.Vector3.multiply(e.normal,a.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=a.Vector3.normalize(e.normal),o=a.Vector3.dot(n,e.position);return towardsCamera(t,create(n,o))},toAxis=(e,t,n,o,s)=>{const i=n.viewAll(),r=getAxis(e,t),l=null!=o&&null!=r?create(r,a.Vector3.dot(r,s||a.BoundingBox.center(o))):forAxis(e,i.lookAt[e]);return towardsCamera(n,l)};function corners(e){return[a.Vector3.create(e.min.x,e.min.y,e.min.z),a.Vector3.create(e.min.x,e.min.y,e.max.z),a.Vector3.create(e.min.x,e.max.y,e.min.z),a.Vector3.create(e.min.x,e.max.y,e.max.z),a.Vector3.create(e.max.x,e.max.y,e.max.z),a.Vector3.create(e.max.x,e.max.y,e.min.z),a.Vector3.create(e.max.x,e.min.y,e.max.z),a.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}var ne;!function(e){e.PART="PART",e.SINGLE="SINGLE"}(ne||(ne={}));const ae="#616161",oe=1,se="#BDBDBD",ie={default:5,min:0,max:10},re=n.atom({key:"crossSectioningEnabled",default:!1}),le=n.atom({key:"crossSectioningHighlightColor",default:ae}),ce=n.atom({key:"crossSectioningBorderWidth",default:1}),de=n.atom({key:"endCapEnabledDefault",default:!1}),ue=n.atom({key:"endCapEnabled",default:!1}),me=n.atom({key:"endCapColorType",default:ne.PART}),pe=n.atom({key:"endCapCustomColor",default:se}),he=n.atom({key:"crossSectioningPlanes",default:[]}),xe=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),fe=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(J)}}),ge=n.atom({key:"crossSectioningIsInteractive",default:!1}),ye=n.atom({key:"crossSectioningActiveAxis",default:"x"}),ve=n.atom({key:"crossSectioningAvailableAxes",default:te}),be=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(he);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),we=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(he),n=e(fe),o=null!=n?corners(n):[];if(t.length>0){const e=o.map((e=>a.Vector3.dot(e,isNegativeNormal(t[0])?a.Vector3.multiply(t[0].normal,a.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return ie}}),Ce=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(he),n=e(be),a=e(we);return t.length>0?t[0].offset*n:a.default}}),Se=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),Ve=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),je=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),ke=n.atom({key:"crossSectioningInteractionHandler",default:new ee,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const a=n.useRecoilValue(ke);o.useEffect((()=>{t&&e?.registerInteractionHandler(a)}),[e,t,a])}const Te=n.atom({key:"hitResultsTapDetails",default:void 0}),Ae=n.atom({key:"hitResultsLongPressDetails",default:void 0}),Pe=n.atom({key:"previousHitResult",default:void 0}),Ie=n.atom({key:"currentHitResult",default:void 0}),Me=n.selector({key:"hitResult",get:async({get:e})=>{const t=e(Te),n=e(Ae),o=t??n,s=e(G),i=await(s?.scene()),r=i?.sceneViewId,l=i?.raycaster();if(null!=o&&null!=l&&null!=r){const e=await l.hitItems(o.position),t=(e?.hits||[])[0];if(null!=t)return{id:t.itemId?.hex,normal:a.Vector3.create(t?.hitNormal?.x||0,t?.hitNormal?.y||0,t?.hitNormal?.z||0),position:a.Vector3.create(t?.hitPoint?.x||0,t?.hitPoint?.y||0,t?.hitPoint?.z||0),meta:o.metaKey||o.ctrlKey||!1,metadata:[],ancestors:t?.ancestors?.filter((e=>null!=e.itemId?.hex)).map((e=>e.itemId?.hex))||[],annotationId:t?.annotationId?.hex}}}}),Ee=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=a.Vector3.dot(a.Vector3.normalize(e.up),t),o=Math.abs(n)>.98?a.Vector3.normalize(a.Vector3.scale(-n,e.viewVector)):e.up,s=a.Vector3.add(a.Vector3.scale(a.Vector3.distance(e.position,e.lookAt),a.Vector3.multiply(t,a.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:o,position:s})}{const o=a.Vector3.angleTo(a.Vector3.normalize(e.viewVector),t),s=null!=n?a.BoundingBox.center(n):e.lookAt,i=a.Vector3.normalize(a.Vector3.cross(a.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(o,s,i)}};function isParallelTo(e,t){const n=a.Angle.toDegrees(a.Vector3.angleTo(e,t));return 0===n||180===n}const Re=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ce),n=await e.getPromise(le),a=await e.getPromise(he),o=await e.getPromise(G),s=await(o?.scene());await(s?.crossSectioning().update({sectionPlanes:a,highlightColor:n?f.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const o=await a.getPromise(G),s=await(o?.scene());if(null!=s){const a=s.camera().viewAll();n(ve),t(he,[towardsCamera(s.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(Me).then((e=>e.value)),o=await t.getPromise(G),s=await(o?.scene());if(null!=a&&null!=s){const t=fromHit(a,s.camera());n(he,null!=t?[t]:[]),n(ve,null!=t?{x:t.normal}:te),await e()}}))),o=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(he),o=undefined;await n.getPromise(re)||(e(re,!0),0===a.length&&await t())})),s=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(re)&&(t(re),t(Se),t(Ve),t(je),t(he),t(xe),t(ye),await e())}));return{enable:o,disable:s,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(re)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(re)||await o(),e(Se,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(Se)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(je),e(Ve,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(Ve)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(Ve),e(je,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(je)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ke);e(ge,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(ke);e(ge),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const o=await n.getPromise(he);if(o.length>0){const s=await n.getPromise(be),i=await n.getPromise(we),r=s<0?-1*i.max:i.min,l=s<0?-1*i.min:i.max,c=o.map((e=>({...e,offset:Math.min(Math.max(a*s,r),l)})));t(he,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(he);t(he,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(he),n=await e.getPromise(G),a=await(n?.scene());t.length>0&&null!=a&&await alignToNormal(a.camera(),t[0].normal,a.boundingBox()).render({animation:{milliseconds:Re}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:o})=>async s=>{const i=await o.getPromise(he),r=await o.getPromise(ve),l=await o.getPromise(fe),c=await o.getPromise(xe),d=await o.getPromise(G),u=await(d?.scene()),m=r[s],p=null!=m&&i.length>0&&isParallelTo(i[0].normal,m)&&!isNaN(a.Vector3.angleTo(i[0].normal,m));if(null!=u&&!p){const e=await o.tryGetPromise(Me).then((e=>e.value));t(ye,s),t(he,[toAxis(s,r,u.camera(),l,"global"!==c.mode?e?.position:void 0)])}n(je),await e()}))),updateAlignment:useActionCallback((({set:e,reset:a})=>async(s,i)=>{a(Ve),e(xe,{mode:s,hitPending:"global"!==s&&null==i}),"global"===s?(a(ye),a(ve),await t()):"surface"===s&&null!=i&&(await o(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(xe);a.hitPending&&(e(xe,{...a,hitPending:!1}),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(xe);n.hitPending&&e(xe,{...n,hitPending:!1})}))}}var Ne=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Re,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:ae,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_END_CAPPING_COLOR:se,DEFAULT_SLIDER_RANGE:ie,get EndCapColorType(){return ne},crossSectioningActiveAxis:ye,crossSectioningAdditionalToolsOpen:Se,crossSectioningAlignment:xe,crossSectioningAlignmentToolsOpen:Ve,crossSectioningAvailableAxes:ve,crossSectioningAxisToolsOpen:je,crossSectioningBorderWidth:ce,crossSectioningEnabled:re,crossSectioningHighlightColor:le,crossSectioningInteractionHandler:ke,crossSectioningIsInteractive:ge,crossSectioningOffsetScalar:be,crossSectioningPlaneDisplayOffset:Ce,crossSectioningPlanes:he,crossSectioningSliderRange:we,crossSectioningTargetBoundingBox:fe,endCapColorType:me,endCapCustomColor:pe,endCapEnabled:ue,endCapEnabledDefault:de,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=o.useState();return o.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),o.useCallback((o=>{const handler=()=>{e(o)};null!=n&&clearTimeout(n),a(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=({onInput:t,...n})=>{const a=useDebouncedCallback((e=>{t?.(e)}),500),i=o.useCallback((e=>{const t=e.target;a(t.value)}),[a]);return e.jsx(s.VertexColorPicker,{onInput:i,...n})},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const a=useCrossSectioningActions(),[o,s]=n.useRecoilState(le);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:o,onValueChanged:e=>{t?.(e.detail)},onInput:async e=>{s(e),await a.reapply()}})};var Oe={exports:{}},Le;
|
|
13
|
+
*/function isObjectObject(e){return!0===isObject(e)&&"[object Object]"===Object.prototype.toString.call(e)}function isPlainObject$1(e){var t,n;return!1!==isObjectObject(e)&&("function"==typeof(t=e.constructor)&&(!1!==isObjectObject(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))}function defaults(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=__read(e),a=n[0],o=n.slice(1),s=__assign({},a);if(0===o.length)return s;if(1===o.length){var i=o[0];for(var r in i)null==s[r]?s[r]=i[r]:isPlainObject(s[r])&&(s[r]=defaults(s[r],i[r]));return s}return o.reduce((function(e,t){return defaults(e,t)}),a)}function isPlainObject(e){return isPlainObject$1(e)}function isEqual$1(e,t){return g(e,t)}function toPairs(e){return null!=e?Object.keys(e).map((function(t){return[t,e[t]]})):[]}function fromPairs(e){return Array.isArray(e)?e.reduce((function(e,t){var n;return null!=t?__assign(__assign({},e),((n={})[t[0]]=t[1],n)):e}),{}):{}}var v=Object.freeze({__proto__:null,defaults:defaults,isPlainObject:isPlainObject,isEqual:isEqual$1,toPairs:toPairs,fromPairs:fromPairs}),b,w=new Uint8Array(16);function rng(){if(!b&&!(b="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 b(w)}var C=/^(?:[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&&C.test(e)}for(var S=[],V=0;V<256;++V)S.push((V+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+"-"+S[e[t+4]]+S[e[t+5]]+"-"+S[e[t+6]]+S[e[t+7]]+"-"+S[e[t+8]]+S[e[t+9]]+"-"+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[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,o=digits(n>>BigInt(32),BigInt(8)),s=digits(n>>BigInt(16),BigInt(4)),i=digits(n,BigInt(4)),r=digits(a>>BigInt(48),BigInt(4)),l=digits(a,BigInt(12));return"".concat(o,"-").concat(s,"-").concat(i,"-").concat(r,"-").concat(l)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],o=t[2],s=t[3],i=t[4];if(null==n||null==a||null==o||null==s||null==i)throw new Error("Invalid UUID string ".concat(e));var r=BigInt.asIntN(64,BigInt("0x".concat(n+a+o))),l=BigInt.asIntN(64,BigInt("0x".concat(s+i)));return{msb:r.toString(),lsb:l.toString()}}var j=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb}),k={exports:{}};const T=t;k.exports=pino;const A=pfGlobalThisOrFallback().console||{},P={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 I=Symbol("pino.logFuncs"),M=Symbol("pino.hierarchy"),E={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[M]};t[M]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:A[e]||A[E[e]||"log"]||noop})),e[I]=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||A;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},o=shouldSerialize(e.browser.serialize,a);let s=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const i=Object.keys(e.customLevels||{}),r=["error","fatal","warn","info","debug","trace"].concat(i);"function"==typeof n&&r.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const l=e.level||"info",c=Object.create(n);c.log||(c.log=noop),setupBaseLogFunctions(c,r,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const d={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:r,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,d,c,"error"),set(this,d,c,"fatal"),set(this,d,c,"warn"),set(this,d,c,"info"),set(this,d,c,"debug"),set(this,d,c,"trace"),i.forEach((e=>{set(this,d,c,e)}))}function child(n,s,i){if(!s)throw new Error("missing bindings for child Pino");i=i||{},o&&s.serializers&&(i.serializers=s.serializers);const r=i.serializers;if(o&&r){var l=Object.assign({},a,r),c=!0===e.browser.serialize?Object.keys(l):o;delete s.serializers,applySerializers([s],c,l,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=s,l&&(this.serializers=l,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,s)))}Child.prototype=this;const d=new Child(this);return appendChildLogger(this,d),d.child=function(...e){return child.call(this,n,...e)},d.level=i.level||this.level,n.onChild(d),d}return c.levels=getLevels(e),c.level=l,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=o,c._stdErrSerialize=s,c.child=function(...e){return child.call(this,d,...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[M];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[I][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const o=undefined,s=levelToValue(t.transmit.level||e.level,n),i=undefined;if(levelToValue(a,n)<s)return}e[a]=createWrap(e,t,n,a);const o=getBindingChain(e);0!==o.length&&(e[a]=prependBindingsInArguments(o,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return o=e[I][a],function LOG(){const s=t.timestamp(),i=new Array(arguments.length),r=Object.getPrototypeOf&&Object.getPrototypeOf(this)===A?A:this;for(var l=0;l<i.length;l++)i[l]=arguments[l];var c=!1;if(t.serialize&&(applySerializers(i,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?o.call(r,...asObject(this,a,i,s,t)):o.apply(r,i),t.transmit){const o=void 0,r=levelToValue(t.transmit.level||e._level,n),l=levelToValue(a,n);if(l<r)return;transmit(this,{ts:s,methodLevel:a,methodValue:l,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},i,c)}};var o}function asObject(e,t,n,a,o){const{level:s,log:i=e=>e}=o.formatters||{},r=n.slice();let l=r[0];const c={};let d=1+(0|e._childLevel);if(d<1&&(d=1),a&&(c.time=a),s){const n=s(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(null!==l&&"object"==typeof l)for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());const e=undefined;return[i(c),...r]}{if(null!==l&&"object"==typeof l){for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());l=r.length?T(r.shift(),r):void 0}else"string"==typeof l&&(l=T(r.shift(),r));void 0!==l&&(c[o.messageKey]=l);const e=undefined;return[i(c)]}}function applySerializers(e,t,n,a){for(const o in e)if(a&&e[o]instanceof Error)e[o]=pino.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const a in e[o])t.indexOf(a)>-1&&a in n&&(e[o][a]=n[a](e[o][a]))}function transmit(e,t,n,a=!1){const o=t.send,s=t.ts,i=t.methodLevel,r=t.methodValue,l=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=s,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=i,e._logEvent.level.value=r,o(i,e._logEvent,l),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 R;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=P,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),k.exports.default=pino,k.exports.pino=pino;const N=(0,k.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?N.error(t,e):N.error(e)},logger_info=(e,t)=>{null!=t?N.info(t,e):N.info(e)},logger_warn=(e,t)=>{null!=t?N.warn(t,e):N.warn(e)},logger_debug=(e,t)=>{null!=t?N.debug(t,e):N.debug(e)};class O{}function useActionCallback(e,t=[]){const a=t instanceof O?void 0:t;return n.useRecoilCallback((t=>e({...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({snapshot:t,...n})=>async(...a)=>{const o=t.retain();try{const o=undefined;return await e({...n,snapshot:t})(...a)}finally{o()}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const a=await e.getPromise(t);if(null==a)throw 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 L=3e3,_=5e3,B=8e3,D=n.atom({key:"applicationMessageToast",default:void 0}),F=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(F,null!=t?{...t,id:j.create()}:void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(D,null!=t?{...t,id:j.create()}:void 0)}))});var H=Object.freeze({__proto__:null,LOW_SEVERITY_BANNER_MESSAGE_DURATION_MS:_,LOW_SEVERITY_TOAST_MESSAGE_DURATION_MS:L,MEDIUM_SEVERITY_TOAST_MESSAGE_DURATION_MS:B,applicationMessageBanner:F,applicationMessageToast:D,useApplicationMessageActions:useApplicationMessageActions});const W=500;function useViewerCameraActions(){const e=useApplicationMessageActions();return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(G),o=await(a?.scene());await(o?.camera().flyTo({itemId:t}).render({animation:{milliseconds:n??W}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(G),o=await(a?.scene());await(o?.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:n??W}}))})),updateCameraType:useActionCallback((({set:t,snapshot:n})=>async(o,s)=>{const i=await n.getPromise(J),r=undefined;null!=i&&a.BoundingBox.isValid(i)||!s?t(U,o):e.setToastMessage({type:"error",message:"Cannot change the camera type when no geometry is visible.",duration:B})}))}}const U=n.atom({key:"viewerCameraType",default:"perspective"}),G=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),K=n.atom({key:"viewerElementId",default:"vertex-viewer"}),$=n.atom({key:"viewerInitialSceneReady",default:!1}),q=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),Y=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),X=n.atom({key:"viewerSceneViewId",default:void 0});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const o=await e.getPromise(G),s=await(o?.scene());a.length>0&&await(s?.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=o.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=o.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),a=o.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=j.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:a,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),a=await(n?.scene()),o=await e.getPromiseRequired(U);a?.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:o})}))}}const Z=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),J=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>e(Z)?.boundingBox});var Q=Object.freeze({__proto__:null,DEFAULT_CAMERA_ANIMATION_DURATION:W,useViewerCameraActions:useViewerCameraActions,useViewerSceneActions:useViewerSceneActions,viewerBaseInteractionHandlerProvider:q,viewerCameraType:U,viewerElement:G,viewerElementId:K,viewerFrameScene:Z,viewerInitialSceneReady:$,viewerPrimaryInteractionType:Y,viewerSceneViewId:X,viewerSceneVisibleBoundingBox:J});class ee{api;interactionStarted=!1;initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){this.interactionStarted||(await(this.api?.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){await(this.api?.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(a.Vector3.left(),-e),y=e=>create(a.Vector3.down(),-e),z=e=>create(a.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},te={x:a.Vector3.left(),y:a.Vector3.down(),z:a.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||a.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||a.Vector3.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,o)=>e&&e.normal&&[["x",t],["y",n],["z",o]].filter((t=>0===a.Vector3.magnitude(a.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>a.Vector3.dot(a.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return a.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>({...e,normal:a.Vector3.multiply(e.normal,a.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=a.Vector3.normalize(e.normal),o=a.Vector3.dot(n,e.position);return towardsCamera(t,create(n,o))},toAxis=(e,t,n,o,s)=>{const i=n.viewAll(),r=getAxis(e,t),l=null!=o&&null!=r?create(r,a.Vector3.dot(r,s||a.BoundingBox.center(o))):forAxis(e,i.lookAt[e]);return towardsCamera(n,l)};function corners(e){return[a.Vector3.create(e.min.x,e.min.y,e.min.z),a.Vector3.create(e.min.x,e.min.y,e.max.z),a.Vector3.create(e.min.x,e.max.y,e.min.z),a.Vector3.create(e.min.x,e.max.y,e.max.z),a.Vector3.create(e.max.x,e.max.y,e.max.z),a.Vector3.create(e.max.x,e.max.y,e.min.z),a.Vector3.create(e.max.x,e.min.y,e.max.z),a.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}var ne;!function(e){e.PART="PART",e.SINGLE="SINGLE"}(ne||(ne={}));const ae="#616161",oe=1,se="#BDBDBD",ie={default:5,min:0,max:10},re=n.atom({key:"crossSectioningEnabled",default:!1}),le=n.atom({key:"crossSectioningHighlightColor",default:ae}),ce=n.atom({key:"crossSectioningBorderWidth",default:1}),de=n.atom({key:"endCapEnabledDefault",default:!0}),ue=n.atom({key:"endCapEnabled",default:!0}),me=n.atom({key:"endCapColorType",default:ne.PART}),pe=n.atom({key:"endCapCustomColor",default:se}),he=n.atom({key:"crossSectioningPlanes",default:[]}),xe=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),fe=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(J)}}),ge=n.atom({key:"crossSectioningIsInteractive",default:!1}),ye=n.atom({key:"crossSectioningActiveAxis",default:"x"}),ve=n.atom({key:"crossSectioningAvailableAxes",default:te}),be=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(he);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),we=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(he),n=e(fe),o=null!=n?corners(n):[];if(t.length>0){const e=o.map((e=>a.Vector3.dot(e,isNegativeNormal(t[0])?a.Vector3.multiply(t[0].normal,a.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return ie}}),Ce=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(he),n=e(be),a=e(we);return t.length>0?t[0].offset*n:a.default}}),Se=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),Ve=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),je=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),ke=n.atom({key:"crossSectioningInteractionHandler",default:new ee,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const a=n.useRecoilValue(ke);o.useEffect((()=>{t&&e?.registerInteractionHandler(a)}),[e,t,a])}const Te=n.atom({key:"hitResultsTapDetails",default:void 0}),Ae=n.atom({key:"hitResultsLongPressDetails",default:void 0}),Pe=n.atom({key:"previousHitResult",default:void 0}),Ie=n.atom({key:"currentHitResult",default:void 0}),Me=n.selector({key:"hitResult",get:async({get:e})=>{const t=e(Te),n=e(Ae),o=t??n,s=e(G),i=await(s?.scene()),r=i?.sceneViewId,l=i?.raycaster();if(null!=o&&null!=l&&null!=r){const e=await l.hitItems(o.position),t=(e?.hits||[])[0];if(null!=t)return{id:t.itemId?.hex,normal:a.Vector3.create(t?.hitNormal?.x||0,t?.hitNormal?.y||0,t?.hitNormal?.z||0),position:a.Vector3.create(t?.hitPoint?.x||0,t?.hitPoint?.y||0,t?.hitPoint?.z||0),meta:o.metaKey||o.ctrlKey||!1,metadata:[],ancestors:t?.ancestors?.filter((e=>null!=e.itemId?.hex)).map((e=>e.itemId?.hex))||[],annotationId:t?.annotationId?.hex}}}}),Ee=n.atom({key:"hitResultsSkipNextTap",default:!1}),Re="Scene Alteration Performance";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={}));var Oe=Object.freeze({__proto__:null,SCENE_ALTERATION_PERFORMANCE:Re,get SceneAlterationPerformanceType(){return Ne}});const Le=n.atomFamily({key:"selectionSelectedItems",default:void 0}),_e=n.atom({key:"selectionSelectedItemIds",default:[]}),Be=n.atom({key:"selectionLastSelected",default:void 0}),De=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),ze=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),Fe=n.selector({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(Be),n=undefined;return e(_e).filter((e=>e!==t?.id&&!t?.ancestors?.includes(e))).length>0}}),He=n.atom({key:"selectionIsAncestorSelection",default:!1}),We=n.atom({key:"selectionFirstSelectedItemInTreeId",default:void 0}),Ue=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{const t=e(Be),n=e(_e);return t?.ancestors?.find((e=>n.includes(e)))??t?.id}}),Ge=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),Ke=n.atom({key:"selectionVisibleSummary",default:void 0}),$e=n.selector({key:"selectionVisibleCount",get:({get:e})=>e(Ke)?.count??0}),qe=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(Ke);return null!=t?.boundingBox?a.BoundingBox.center(t.boundingBox):a.Vector3.origin()}}),Ye=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(_e),n=undefined;return e($e)>0||t.length>0}}),Xe=n.selector({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(_e),n=undefined;return null!=e(X)?t.map((t=>e(an(t)))):[]}}),Ze=n.atom({key:"selectionModelViewsSelected",default:void 0});function contextMenuItemIsRow(e){return null!=e&&null!=e?.node?.id}function contextMenuItemIsElement(e){return null!=e&&e instanceof HTMLElement}const Je=n.atom({key:"contextMenuActive",default:void 0}),Qe=n.atom({key:"contextMenuPosition",default:void 0}),et=n.atom({key:"contextMenuTarget",default:void 0}),tt=n.atom({key:"contextMenuItem",default:void 0}),nt=n.atom({key:"contextMenuActions",default:[]}),at=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(Je)?e(Qe):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,o=t?.clientY;e(Qe,a.Point.create(n,o)),e(et,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,o,s,i)=>{const r=await e.getPromise(Qe),l=await e.getPromise(Je);if(null!=r&&null==l){const e=n.clientX,l=n?.clientY,c=a.Point.create(e,l),d=null!=r?a.Point.distance(r,c):0,u=null==s||s(n);d<2&&u&&(i?.(n,r??c),t(Je,o))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,o,s)=>{if(null==o||o(t)){const o=a.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(Qe,o),e(et,t.target),e(Je,n),s?.(t,o)}})),setContextMenuItem:useActionCallback((({snapshot:e,set:t,reset:n})=>async a=>{const o=await e.getPromise(nt);t(tt,a),o.forEach((e=>e(a))),n(nt)})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Ee,!!n),e(Je),e(nt),e(Qe)})),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)}var ot=Object.freeze({__proto__:null,contextMenuActions:nt,contextMenuActive:Je,contextMenuActivePosition:at,contextMenuItem:tt,contextMenuItemIsElement:contextMenuItemIsElement,contextMenuItemIsRow:contextMenuItemIsRow,contextMenuPosition:Qe,contextMenuTarget:et,targetShouldSkipNextHit:targetShouldSkipNextHit,targetWithinMenu:targetWithinMenu,useContextMenuActions:useContextMenuActions});const st=n.atom({key:"boxSelectionEnabled",default:!1}),it=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(st,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(st),e(it)})),setOperationType:useActionCallback((({set:e})=>t=>{e(it,t)}))});var rt=Object.freeze({__proto__:null,boxSelectionEnabled:st,boxSelectionOperationType:it,useBoxSelectionActions:useBoxSelectionActions});async function whenComponentReady(e,t,n=customElements,a=requestAnimationFrame,o=setTimeout){return null!=e&&null!=e.nodeName&&await n.whenDefined(e.nodeName.toLowerCase()),"function"==typeof e?.componentOnReady?(await(e?.componentOnReady()),t()):(await new Promise((e=>"function"==typeof a?a(e):o(e))),t())}const lt=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),ct=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),dt=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(ct);o.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=e?.measurementModel.onOutcomeChanged(t)})),()=>n?.dispose()}),[e,t])}const ut=2,mt=n.atom({key:"isEditingPreciseMeasurement",default:!1}),pt=n.atom({key:"preciseMeasurementOutcome",default:void 0}),ht=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),xt=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),ft=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),gt=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(ft).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,a){const s=n.useSetRecoilState(ft),i=n.useSetRecoilState(pt),r=n.useSetRecoilState(ht),l=n.useSetRecoilState(xt),c=n.useRecoilValue(ht);o.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=e?.measurementModel.onEntitiesChanged((e=>{s(e),t?.(e)}))})),()=>n?.dispose()}),[e,s]),o.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=e?.measurementModel.onOutcomeChanged((e=>{i(e),a?.(e)}))})),()=>t?.dispose()}),[e,i]),o.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=e?.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];c?.setEntities(new Set([t]))}}))})),()=>t?.dispose()}),[e,c]),o.useEffect((()=>{whenComponentReady(e,(()=>{r(e?.measurementController)}))}),[e,r]),o.useEffect((()=>{whenComponentReady(e,(()=>{l(e?.measurementOverlays)}))}),[e,l])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),o=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ht);t?.clearEntities()})),s=useActionCallback((()=>async(e={})=>{await o(),n(e),a()})),i=useActionCallback((({set:e,reset:n})=>async a=>{await s(),"point-to-point"===a?t():(n(pt),n(ft),e(mt,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await s(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await i(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(mt),a=await e.getPromise(lt);n?await o():a&&(t(ct),t(dt))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(dt)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(dt,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(lt)?await s():await i("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(mt)?await s():await i("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(lt,!0),n.keepExistingMeasurement||e(ct)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(lt),t.keepExistingMeasurement||(e(dt),e(ct))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(mt),e(pt),e(ft)}))}const yt=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(lt)||e(mt)}),vt=n.selector({key:"measurementPanelModel",get:({get:e})=>e(ct)||e(pt)}),bt=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(xt)}),wt=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(mt)?e(gt):void 0}}),Ct=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(yt)&&null!=e(vt)});var St=Object.freeze({__proto__:null,editedPointToPointMeasurement:dt,isEditingMeasurement:yt,isEditingPointToPointMeasurement:lt,isEditingPreciseMeasurement:mt,measurementPanelIsResettable:Ct,measurementPanelMessage:wt,measurementPanelOutcome:vt,measurementPanelOverlays:bt,pointToPointMeasurementOutcome:ct,preciseMeasurementController:ht,preciseMeasurementEntities:ft,preciseMeasurementMessage:gt,preciseMeasurementOutcome:pt,preciseMeasurementOverlays:xt,useDisablePointToPointMeasurement:useDisablePointToPointMeasurement,useDisablePreciseMeasurement:useDisablePreciseMeasurement,useEnablePointToPointMeasurement:useEnablePointToPointMeasurement,useMeasurementActions:useMeasurementActions,usePointToPointMeasurement:usePointToPointMeasurement,usePreciseMeasurementModel:usePreciseMeasurementModel});const useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Me).then((e=>e.value)),a=await e.getPromise(dt);null==n&&null!=a?.start&&null!=a.end&&await t.resetMeasurement()}))),o=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Me).then((e=>e.value));await n.orientToHitResult(t)}))),s=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Me).then((e=>e.value));e(tt,n)}))),i=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Ie,await e.tryGetPromise(Me).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:r},...l)=>{const c=await t.getPromise(yt),d=await t.getPromise(xe),u=2!==r?.buttons&&!r?.altKey;r.altKey||r.ctrlKey||r.metaKey||r.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(Me).then((e=>e.value));n(Pe,p),n(Te,r),await a(),m&&(l.forEach((e=>e())),await o()),await s(),await e.sectionCurrentHit(),await i()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Te),t(Ae,a.detail),await e.tryGetPromise(Me),await s(),await i()})))}},Vt=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,o=undefined,s=undefined;return{tapDetails:e(Te),longPressDetails:e(Ae),previousHitResult:e(Pe),currentHitResult:e(Ie)}}});var jt=Object.freeze({__proto__:null,currentHitResult:Ie,hitResult:Me,hitResultsLongPressDetails:Ae,hitResultsSkipNextTap:Ee,hitResultsTapDetails:Te,hitState:Vt,previousHitResult:Pe,useHitActions:useHitActions});function useSceneAnnotationsOperations(){const e=o.useCallback((async(e,t,n)=>{const a=await(t?.scene());null==n?await(a?.elements((t=>e(t.annotations.where((e=>e.all()))))).execute()):n.length>0&&await(a?.elements((t=>e(t.annotations.where((e=>e.withAnnotationIds(n)))))).execute())}),[]),t=o.useCallback((async(e,t)=>{const n=await(e?.scene());n?.elements((e=>[e.annotations.where((e=>e.all())).deselect(),e.annotations.where((e=>e.withAnnotationIds([t]))).select()])).execute()}),[]),n=o.useCallback((async e=>{const t=await(e?.scene());t?.elements((e=>[e.annotations.where((e=>e.all())).deselect()])).execute()}),[]);return{sceneAnnotationsOperation:e,selectOnlyAnnotation:t,clearAnnotationSelection:n}}function usePmiAnnotationActions(){const e=useSceneAnnotationsOperations(),t=useActionCallback((({snapshot:e,set:t})=>async n=>{const a=await e.getPromise(fn(n));if(null!=a){t(cn(n),(e=>[...e,a])),t(dn(n),(e=>[...e,...a.annotations]));const e=a?.paging?.next;t(rn(n),null!=e?()=>e:()=>{})}})),n=useActionCallback((({snapshot:e})=>async a=>{const o=document.getElementById(`annotation-entry-${a}`);if(null!=o)o.scrollIntoView();else{const o=await e.getPromise(mn),s=o?.modelView.id;if(null==s)return;const i=undefined;await e.getPromise(yn(s))&&(await t(s),await n(a))}}));return{fetchInitialPmiAnnotations:useActionCallback((({snapshot:e})=>async n=>{const a=undefined;0===(await e.getPromise(gn(n))).length&&await t(n)})),fetchNextPmiAnnotations:useActionCallback((()=>async e=>{await t(e)})),selectPmiAnnotation:useActionCallback((({set:t,snapshot:a})=>async(o,s)=>{t(vn,o);const i=await a.getPromise(G);null!=i&&await(e?.selectOnlyAnnotation(i,o)),s&&await n(o)})),clearPmiAnnotationSelection:useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=await n.getPromise(vn),o=await n.getPromise(G);null!=a&&null!=o&&(t(vn),await(e?.clearAnnotationSelection(o)))})),scrollToSelectedPmiAnnotation:n}}const kt=n.atom({key:"sceneTreeLoaderVisible",default:!1}),Tt=n.atom({key:"sceneTreeElement",default:void 0}),At=n.atom({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0}),Pt=n.atom({key:"sceneTreeOpenPopover",default:void 0}),It=n.selectorFamily({key:"sceneTreePopoverIsOpen",get:e=>({get:t})=>t(Pt)===e});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,o)=>{if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await o.deselectItem(a):a.selected?await o.selectItem(a,{recurseParent:!0}):a.selected||await o.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const o=await t.getPromise(Be);e.syncSelection({id:a.id?.hex,ancestors:o?.ancestors??[]},{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=>{const a=await e.getPromise(Tt),o=await(a?.getRowAtClientY(n));null!=o?.node.id?.hex&&await t.flyToById(o.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Tt),n=await e.getPromise(We);null!=n&&t?.scrollToItem(n)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Tt),o=await(a?.getRowAtClientY(n));e(tt,o)})),openSceneTreePopover:useActionCallback((({set:e})=>t=>{e(Pt,t)})),closeSceneTreePopover:useActionCallback((({set:e})=>()=>{e(Pt,void 0)}))}}var Mt=Object.freeze({__proto__:null,sceneTreeController:At,sceneTreeElement:Tt,sceneTreeLoaderVisible:kt,sceneTreeOpenPopover:Pt,sceneTreePopoverIsOpen:It,useSceneTreeActions:useSceneTreeActions});function useSelectionActions(){const e=usePmiAnnotationActions(),t=useSceneViewItemActions(),n=useTransformActions(),a=useViewerSceneActions(),o=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(_e)).forEach((e=>t(Le(e))))})),s=useActionCallback((({snapshot:e,reset:t,set:n})=>async(o,s)=>{const i=await e.getPromise(Le(o.id)),r=await e.getPromise(_e),l=[...o.ancestors??[]]?.reverse().find((e=>!r.includes(e)));null!=i&&null!=l?(n(Le(l),{id:l}),n(_e,(e=>[...e,l])),n(He,!0),await a.execute(Ne.SELECTING_ANCESTOR,a.selectItemsTransform(l)),await m({id:l})):s?.clear?(n(Le(o.id),o),n(_e,[o.id]),await a.execute(Ne.SELECTING_ONLY_ITEM,a.clearSelectionTransform,a.selectItemsTransform(o.id)),await m(o)):(n(Le(o.id),o),n(_e,(e=>[...e,o.id])),await a.execute(Ne.SELECTING_ITEMS,a.selectItemsTransform(o.id)),await m(o)),n(Be,o),n(De,!0),t(ze);try{const t=await e.getPromise(Tt);await(t?.scrollToItem(o.id))}catch(e){logger_debug(`The scene item was not found in the tree. [itemId={${o.id}}]`)}})),i=useActionCallback((({reset:e,set:t})=>async n=>{e(Le(n)),e(ze),e(He),t(_e,(e=>e.filter((e=>e!==n)))),await a.execute(Ne.DESELECTING_ITEMS,a.deselectItemsTransform(n))})),r=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Le(t.id));null!=n?await i(n.id):await s(t)})),l=useActionCallback((({snapshot:a,reset:o,set:i})=>async(r,l={})=>{const c=await a.getPromise(Le(r.id)),d=await a.getPromise(_e);if(d.filter((e=>e!==r.id&&!r.ancestors?.includes(e))).forEach((e=>o(Le(e)))),o(ze),o(He),c)if(l.ignoreAncestorSelection)o(_e),o(Le(c.id));else{const e=d.filter((e=>e===r.id||r.ancestors?.includes(e)));i(_e,e)}else o(_e);t.invalidateCachedItems(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection(),await s(r,{clear:!0})})),c=useActionCallback((({reset:t})=>async()=>{await o(),t(_e),t(Be),t(De),t(ze),t(He),n.clearTransformWidgetPosition(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection()})),d=useActionCallback((()=>async()=>{await c(),await a.execute(Ne.CLEAR_SELECTION,a.clearSelectionTransform)})),u=useActionCallback((({set:e})=>async t=>{e(ze,t)})),m=useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Ze);a?.id!==n?.id&&e(Ze,n)}));return{select:s,toggleSelection:r,clearAndSelect:l,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:t})=>async()=>{const n=await t.tryGetPromise(Me).then((e=>e.value)),a=await t.getPromise(Te),o=a?.metaKey||a?.ctrlKey||a?.shiftKey;null!=n?.annotationId?await e.selectPmiAnnotation(n.annotationId,!0):null==n||o?null!=n&&o?await r(n):await d():await l(n)}))),syncSelection:useActionCallback((({set:e,snapshot:t,reset:n})=>async(a,s)=>{if(s.selected){const n=await t.getPromise(Le(a.id)),i=await t.getPromise(At);if(null!=n&&null!=i){const n=undefined,o=(await(i?.fetchNodeAncestors(a.id))).map((e=>e.id?.hex)).filter((e=>null!=e)),r=await t.getPromise(_e),l=[...o??[]]?.findLastIndex((e=>r.includes(e)));if(o.length>0&&l<o.length-1){const t=o[l+1];return e(He,!0),e(Be,{id:t}),e(Le(t),{id:t}),e(_e,(e=>[...e.filter((e=>e!==t)),t])),e(De,!1),e(ze,!!s.multiSelect),void await m({id:t})}}await o(),e(Le(a.id),a),s.multiSelect?e(_e,(e=>[...e.filter((e=>e!==a.id)),a.id])):e(_e,[a.id]),await m(a),e(Be,a),e(De,!1),e(ze,!!s.multiSelect)}else n(Le(a.id)),n(ze),e(_e,(e=>e.filter((e=>e!==a.id))))})),deselect:i,clearSelection:d,resetSelectionState:c,toggleLastSelectWasMultiSelect:u,selectForModelViewsPanel:m}}const Et=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,o=undefined;return{selectedItemIds:e(_e),lastSelected:e(Be),highestSelectedAncestorId:e(Ue)}}});var Rt=Object.freeze({__proto__:null,fetchedAndSelectedItems:Xe,selectionBoundingBoxCenter:qe,selectionFirstSelectedItemInTreeId:We,selectionHasMultipleSelected:Fe,selectionHighestSelectedAncestor:Ue,selectionIsActive:Ye,selectionIsAncestorSelection:He,selectionLastSelectWasMultiSelect:ze,selectionLastSelected:Be,selectionLastSelectionFromViewer:De,selectionModelViewsSelected:Ze,selectionPreviousVisibleSummary:Ge,selectionSelectedItemIds:_e,selectionSelectedItems:Le,selectionState:Et,selectionVisibleCount:$e,selectionVisibleSummary:Ke,useSelectionActions:useSelectionActions});const Nt=n.atom({key:"lengthUnit",default:"cm"}),Ot=n.atom({key:"decimalPlace",default:"2"});var Lt=Object.freeze({__proto__:null,decimalPlace:Ot,lengthUnit:Nt}),_t,Bt;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(_t||(_t={})),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"}(Bt||(Bt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Bt[t]},convertTo=(e,t)=>{const n=undefined;return e*Bt[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 pickLocalOrWorldTransform(e,t){return"local"===t?e.local:e.world}function mapItemTransforms(e,t){return{local:t(e.local),world:t(e.world)}}function makeItemTransforms(e,t,n){return"local"===n?{local:e,world:s.toWorldTransform(e,t)}:{world:e,local:s.toLocalTransform(e,t)}}function convertTransformToUnits(e,t){const{position:n,rotation:o,scale:s}=e;return{position:a.Vector3.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:o,scale:s}}function convertTransformFromUnits(e,t){const{position:n,rotation:o,scale:s}=e;return{position:a.Vector3.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:o,scale:s}}function toValidTransform(e){const{position:t,rotation:n,scale:a}=e;return{position:{x:t.x||0,y:t.y||0,z:t.z||0},rotation:{x:n.x||0,y:n.y||0,z:n.z||0},scale:a||1}}function scale(e){const t=parseFloat(Math.sqrt(e[0]**2+e[4]**2+e[8]**2).toFixed(2)),n=parseFloat(Math.sqrt(e[1]**2+e[5]**2+e[9]**2).toFixed(2)),a=parseFloat(Math.sqrt(e[2]**2+e[6]**2+e[10]**2).toFixed(2));return t===n&&n===a?t:NaN}function translation(e){return{x:e[12],y:e[13],z:e[14]}}function rotation(e){const t=e.map((t=>t*(1/scale(e))));return t[8]<1?t[8]>-1?{x:Math.atan2(-t[9],t[10])*(180/Math.PI),y:Math.asin(t[8])*(180/Math.PI),z:Math.atan2(-t[4],t[0])*(180/Math.PI)}:{x:-Math.atan2(-t[1],t[5])*(180/Math.PI),y:-90,z:0}:{x:Math.atan2(t[1],t[5])*(180/Math.PI),y:90,z:0}}function toTransformFromApiMatrix(e){return null!=e?{position:translation(e),rotation:rotation(e),scale:scale(e)}:void 0}const Dt={position:a.Vector3.create(0,0,0),rotation:a.Vector3.create(0,0,0),scale:1},zt=n.atom({key:"transformWidgetEnabled",default:!1}),Ft=n.atom({key:"transformWidgetPosition",default:void 0}),Ht=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),Wt=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Ht),n=e(Be);if(null!=t)return t;if(null!=n){const t=e(Jt(n.id));return a.Euler.fromDegrees({x:t?.world.rotation.x,y:t?.world.rotation.y,z:t?.world.rotation.z})}}}),Ut=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),Gt=n.atom({key:"transformWidgetSyncToSelection",default:!1}),Kt=n.atom({key:"transformWidgetIsInteracting",default:!1}),$t=n.atomFamily({key:"appliedItemTransform",default:void 0}),qt=n.atom({key:"appliedItemTransformIds",default:[]}),Yt=n.atom({key:"selectedCoordinateSpace",default:"world"}),Xt=n.atomFamily({key:"editedItemTransform",default:void 0}),Zt=n.selectorFamily({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(Yt),a=t(Nt),o=t(Jt(e)),s=t(Xt(e));if(null!=s)return s.transform;if(null!=o)return pickLocalOrWorldTransform(mapItemTransforms(o,(e=>convertTransformToUnits(e,a))),n)}},set:e=>({get:t,set:a},o)=>{if(null!=e){const s=t(Yt),i=t(en(e)),r=t(Jt(e)),l=t(Nt);if(null!=r&&!(o instanceof n.DefaultValue)&&null!=o&&null!=i){a(Xt(e),{coordinateSpace:s,units:l,transform:o});const n=makeItemTransforms(convertTransformFromUnits(toValidTransform(o),l),i,s),r=t(qt);a($t(e),n),a(qt,[...r,e])}}}}),Jt=n.selectorFamily({key:"fetchedItemTransforms",get:e=>({get:t})=>{const n=t(an(e));if(null!=n){const e=n.override?.transform?toTransformFromApiMatrix(n.override?.transform):void 0,t=n.worldTransform?toTransformFromApiMatrix(n.worldTransform):void 0;return{local:e??Dt,world:t??Dt}}}}),Qt=n.atom({key:"transformInvalidator",default:0}),en=n.selectorFamily({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(X);if(null!=e&&null!=n){const n=t(an(e));if(null!=n?.parentId){const e=t(Jt(n.parentId)),a=t($t(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return null!=a?s.toMatrix(s.toRadiansTransform(a.world)):s.toMatrix(s.toRadiansTransform(e.world))}}return logger_debug(`Unable to find the world matrix for the parent of ${e}. Returning the identity matrix.`),a.Matrix4.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=n.useRecoilValue(Nt),a=n.useRecoilValue(Yt),s=n.useRecoilValue($t(e??"")),[i,r]=n.useRecoilState(Xt(e??""));o.useEffect((()=>{if(null!=s&&(i?.coordinateSpace!==a||i?.units!==t)){const e=undefined,n=convertTransformToUnits(pickLocalOrWorldTransform(s,a),t);r({units:t,coordinateSpace:a,transform:n})}}),[t,a])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const a=n.useRecoilValueLoadable(en(e)),[o,s]=n.useRecoilStateLoadable(Zt(e));return{transform:"hasValue"===o.state?o.contents:void 0,loading:"loading"===o.state||"loading"===a.state,error:"hasError"===o.state?o.contents:void 0,async update(n){t.enableSelectionSync(),s(n),null!=e&&await t.applyTransformToItem(e)}}}const useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(qe);e(Ft,n)})),o=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Ft),o=await t.getPromise(ze),s=await t.getPromise(_e),i=await t.getPromise($e);null==a&&(s.length>0||o||i>0)&&await n(),e(Gt,!0)})),i=useActionCallback((({set:e})=>async t=>{e(Ft,t??void 0)})),r=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(Wt),o=undefined;(await e.getPromise(qt)).forEach((e=>{n($t(e)),n(Xt(e))})),n(qt),null!=a&&t(Ut,a),t(Qt,(e=>e+1))}))),l=useActionCallback((({set:e,reset:t})=>n=>{t(Ut),e(Ht,n)})),c=useActionCallback((({set:e})=>()=>{e(Ft,void 0),e(zt,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(a,s)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:L}),t(zt,!0),s?await n():null==a?await o():await i(a)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(zt),e(Ht)})),setTransformWidgetOrientation:l,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Ut),e(Ht)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ft))),invalidateTransforms:r,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(Kt,t)})),setDefaultWidgetPosition:o,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Gt,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Gt))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ge),n=await e.getPromise(Ke),o=undefined;if(await e.getPromise(Gt)){const e=n?.boundingBox,o=null!=e&&null!=t?.boundingBox&&equals(e,t.boundingBox);null==e||o||await i(a.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Gt),null==t?.annotationId&&(null!=t?await i(t?.position):(e(Ft),l(void 0)))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(Ne.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await r(),c()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(Ne.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await r(),c()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),o=await(n?.scene()),i=await e.getPromise($t(t));if(null==i)return void logger_warn(`There is no transform to apply to item ${t}.`);const r=a.Matrix4.transpose(s.toMatrix(s.toRadiansTransform(i?.local)));return o?.items((e=>e.where((e=>e.withItemId(t))).transform(r))).execute()}))}};var tn=Object.freeze({__proto__:null,appliedItemTransformIds:qt,appliedItemTransforms:$t,convertTransformFromUnits:convertTransformFromUnits,convertTransformToUnits:convertTransformToUnits,displayedItemTransform:Zt,editedItemTransform:Xt,fetchedItemTransforms:Jt,identityTransform:Dt,makeItemTransforms:makeItemTransforms,mapItemTransforms:mapItemTransforms,parentItemWorldMatrix:en,pickLocalOrWorldTransform:pickLocalOrWorldTransform,selectedCoordinateSpace:Yt,toValidTransform:toValidTransform,transformInvalidator:Qt,transformWidgetCachedOrientation:Ut,transformWidgetEnabled:zt,transformWidgetIsInteracting:Kt,transformWidgetOrientation:Wt,transformWidgetOrientationOverride:Ht,transformWidgetPosition:Ft,transformWidgetSyncToSelection:Gt,useEditItemTransform:useEditItemTransform,useTransformActions:useTransformActions});const nn=n.atom({key:"fetchedItemInvalidator",default:0}),an=n.selectorFamily({key:"fetchedItems",get:e=>async({get:t})=>{const n=t(G),a=t(X);if(t(nn),t(Qt),null!=a)try{return await(n?.sceneItems?.getSceneViewItem(e,a,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(nn,(e=>e+1))}))}}var on=Object.freeze({__proto__:null,fetchedItem:an,fetchedItemInvalidator:nn,useSceneViewItemActions:useSceneViewItemActions});const sn=n.atomFamily({key:"modelViewsCursor",default:void 0}),rn=n.atomFamily({key:"pmiAnnotationsCursor",default:void 0}),ln=n.atomFamily({key:"loadedModelViews",default:[]}),cn=n.atomFamily({key:"loadedPmiAnnotations",default:[]}),dn=n.atomFamily({key:"visiblePmiAnnotations",default:[]}),un=n.selector({key:"modelViewsSceneItemName",get:async({get:e})=>{const t=e(Ze);if(null!=t){const n=e(an(t.id));return n?.name??void 0}}}),mn=n.atom({key:"loadedItemModelView",default:void 0}),pn=n.selectorFamily({key:"nextModelViews",get:e=>async({get:t})=>{const n=t(G),a=t(sn(e));return await(n?.modelViews?.listByItem(e,{cursor:a,size:100,hasAnnotations:!0}))}}),hn=n.selectorFamily({key:"modelViews",get:e=>({get:t})=>{const n=t(ln(e)),a=t(pn(e));return n.flatMap((e=>e.modelViews)).concat(a?.modelViews??[])}}),xn=n.selectorFamily({key:"hasMoreModelViews",get:e=>({get:t})=>{const n=t(pn(e));return null!=n?.paging.next}}),fn=n.selectorFamily({key:"nextPmiAnnotations",get:e=>async({get:t})=>{const n=t(G),a=t(rn(e));return n?.pmi?.listAnnotations({modelViewId:e,cursor:a,size:100})}}),gn=n.selectorFamily({key:"pmiAnnotations",get:e=>({get:t})=>{const n=undefined;return t(cn(e)).flatMap((e=>e.annotations))}}),yn=n.selectorFamily({key:"hasMorePmiAnnotations",get:e=>({get:t})=>{const n=undefined;return null!=t(rn(e))}}),vn=n.atom({key:"selectedPmiAnnotationId",default:void 0}),bn=1e3;function useModelViewActions(){const e=useCrossSectioningActions(),t=usePmiAnnotationActions(),n=useSelectionActions(),a=useActionCallback((({snapshot:e})=>async()=>{const a=undefined;if(null!=await e.getPromise(mn)){const a=await e.getPromiseRequired(G),o=await e.getPromiseRequired(_e);await t.clearPmiAnnotationSelection(),0!==o.length&&await n.clearSelection(),await(a?.modelViews?.unload())}}));return{fetchNextModelViews:useActionCallback((({snapshot:e,set:t})=>async n=>{const a=await e.getPromise(pn(n));if(null!=a){const e=a?.paging?.next;null!=e&&(t(ln(n),(e=>[...e,a])),t(sn(n),(()=>e)))}})),loadModelView:useActionCallback((({set:n,snapshot:o})=>async(s,i)=>{const r=await o.getPromiseRequired(G);try{const o=await r.scene();await e.setHighlightColorAndLineWidth(),await e.disable(),await a(),null!=o&&await(o?.camera().flyTo({camera:i.camera}).render({animation:{milliseconds:bn}})),await(r?.modelViews?.load(s,i.id)),n(mn,{itemId:s,modelView:i}),await t.fetchInitialPmiAnnotations(i.id)}catch(e){logger_error("Failed to load model view",e)}})),clearModelView:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=undefined;if(null!=await t.getPromise(mn))try{await a(),e(mn)}catch(e){logger_error("Failed to remove model view",e)}}))}}var wn=Object.freeze({__proto__:null,MODEL_VIEW_ANIMATION_DURATION:bn,hasMoreModelViews:xn,hasMorePmiAnnotations:yn,loadedItemModelView:mn,loadedModelViews:ln,loadedPmiAnnotations:cn,modelViews:hn,modelViewsCursor:sn,modelViewsSceneItemName:un,nextModelViews:pn,nextPmiAnnotations:fn,pmiAnnotations:gn,pmiAnnotationsCursor:rn,selectedPmiAnnotationId:vn,useModelViewActions:useModelViewActions,visiblePmiAnnotations:dn});const alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=a.Vector3.dot(a.Vector3.normalize(e.up),t),o=Math.abs(n)>.98?a.Vector3.normalize(a.Vector3.scale(-n,e.viewVector)):e.up,s=a.Vector3.add(a.Vector3.scale(a.Vector3.distance(e.position,e.lookAt),a.Vector3.multiply(t,a.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:o,position:s})}{const o=a.Vector3.angleTo(a.Vector3.normalize(e.viewVector),t),s=null!=n?a.BoundingBox.center(n):e.lookAt,i=a.Vector3.normalize(a.Vector3.cross(a.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(o,s,i)}};function isParallelTo(e,t){const n=a.Angle.toDegrees(a.Vector3.angleTo(e,t));return 0===n||180===n}const Cn=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ce),n=await e.getPromise(le),a=await e.getPromise(he),o=await e.getPromise(G),s=await(o?.scene());await(s?.crossSectioning().update({sectionPlanes:a,highlightColor:n?f.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(le),n=await e.getPromise(ce),a=await e.getPromise(G),o=await(a?.scene()),s=o?.crossSectioning().current();await(o?.crossSectioning().update({sectionPlanes:s?.sectionPlanes??[],highlightColor:t?f.fromHexString(t):void 0,lineWidth:n}))})),n=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const o=await a.getPromise(G),s=await(o?.scene());if(null!=s){const a=s.camera().viewAll();n(ve),t(he,[towardsCamera(s.camera(),x(a.lookAt.x))]),await e()}})),o=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(Me).then((e=>e.value)),o=await t.getPromise(G),s=await(o?.scene());if(null!=a&&null!=s){const t=fromHit(a,s.camera());n(he,null!=t?[t]:[]),n(ve,null!=t?{x:t.normal}:te),await e()}}))),s=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(he),o=undefined;await t.getPromise(re)||(e(re,!0),0===a.length&&await n())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(re)&&(t(re),t(Se),t(Ve),t(je),t(he),t(xe),t(ye),await e())}));return{enable:s,disable:i,reapply:useActionCallback((({snapshot:n})=>async()=>{const a=await n.getPromise(re),o=undefined,s=null!=await n.getPromise(mn);a?await e():s&&await t()})),setHighlightColorAndLineWidth:t,openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(re)||await s(),e(Se,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(Se)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(je),e(Ve,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(Ve)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(Ve),e(je,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(je)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ke);e(ge,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(ke);e(ge),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const o=await n.getPromise(he);if(o.length>0){const s=await n.getPromise(be),i=await n.getPromise(we),r=s<0?-1*i.max:i.min,l=s<0?-1*i.min:i.max,c=o.map((e=>({...e,offset:Math.min(Math.max(a*s,r),l)})));t(he,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(he);t(he,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(he),n=await e.getPromise(G),a=await(n?.scene());t.length>0&&null!=a&&await alignToNormal(a.camera(),t[0].normal,a.boundingBox()).render({animation:{milliseconds:Cn}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:o})=>async s=>{const i=await o.getPromise(he),r=await o.getPromise(ve),l=await o.getPromise(fe),c=await o.getPromise(xe),d=await o.getPromise(G),u=await(d?.scene()),m=r[s],p=null!=m&&i.length>0&&isParallelTo(i[0].normal,m)&&!isNaN(a.Vector3.angleTo(i[0].normal,m));if(null!=u&&!p){const e=await o.tryGetPromise(Me).then((e=>e.value));t(ye,s),t(he,[toAxis(s,r,u.camera(),l,"global"!==c.mode?e?.position:void 0)])}n(je),await e()}))),updateAlignment:useActionCallback((({set:e,reset:t})=>async(a,i)=>{t(Ve),e(xe,{mode:a,hitPending:"global"!==a&&null==i}),"global"===a?(t(ye),t(ve),await n()):"surface"===a&&null!=i&&(await s(),await o())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(xe);n.hitPending&&(e(xe,{...n,hitPending:!1}),"surface"===n.mode&&await o())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(xe);n.hitPending&&e(xe,{...n,hitPending:!1})}))}}var Sn=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Cn,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:ae,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_END_CAPPING_COLOR:se,DEFAULT_SLIDER_RANGE:ie,get EndCapColorType(){return ne},crossSectioningActiveAxis:ye,crossSectioningAdditionalToolsOpen:Se,crossSectioningAlignment:xe,crossSectioningAlignmentToolsOpen:Ve,crossSectioningAvailableAxes:ve,crossSectioningAxisToolsOpen:je,crossSectioningBorderWidth:ce,crossSectioningEnabled:re,crossSectioningHighlightColor:le,crossSectioningInteractionHandler:ke,crossSectioningIsInteractive:ge,crossSectioningOffsetScalar:be,crossSectioningPlaneDisplayOffset:Ce,crossSectioningPlanes:he,crossSectioningSliderRange:we,crossSectioningTargetBoundingBox:fe,endCapColorType:me,endCapCustomColor:pe,endCapEnabled:ue,endCapEnabledDefault:de,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=o.useState();return o.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),o.useCallback((o=>{const handler=()=>{e(o)};null!=n&&clearTimeout(n),a(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=({onInput:t,...n})=>{const a=useDebouncedCallback((e=>{t?.(e)}),500),s=o.useCallback((e=>{const t=e.target;a(t.value)}),[a]);return e.jsx(i.VertexColorPicker,{onInput:s,...n})},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const a=useCrossSectioningActions(),[o,s]=n.useRecoilState(le);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:o,onValueChanged:e=>{t?.(e.detail)},onInput:async e=>{s(e),await a.reapply()}})};var Vn={exports:{}},jn;
|
|
14
14
|
/*!
|
|
15
15
|
Copyright (c) 2018 Jed Watson.
|
|
16
16
|
Licensed under the MIT License (MIT), see
|
|
17
17
|
http://jedwatson.github.io/classnames
|
|
18
|
-
*/Le=Oe,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}Le.exports?(classNames.default=classNames,Le.exports=classNames):window.classNames=classNames}();var _e=Oe.exports;const VertexSlider=({value:t,defaultValue:n,leftLabel:a,rightLabel:i,onChange:r,onValueChange:l,onValueInput:c,...d})=>{const[u,m]=o.useState(n);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[a&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:a}),e.jsx(s.VertexSlider,{className:_e("w-full",{"mt-0.5":null!=a||null!=i}),value:t??u,onValueChange:e=>{m(e.detail.value),r?.(e.detail.value),l?.(e)},onValueInput:e=>{m(e.detail.value),r?.(e.detail.value),c?.(e)},...d}),i&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:i})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const a=useCrossSectioningActions(),[o,s]=n.useRecoilState(ce);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:o,valueLabelDisplay:"auto",onValueInput:async e=>{s(e.detail.value),await a.reapply()},onValueChange:e=>{t?.(e.detail.value)}})},VertexEndCapColorOptions=({onUpdateColorType:t})=>{const[a,o]=n.useRecoilState(me);return e.jsx("div",{className:"pl-2 text-sm text-neutral-700",children:e.jsxs(s.VertexRadioGroup,{value:a,"data-testid":"end-capping-color-type-radio-group",name:"end-capping-color-type",onValueChanged:e=>{o(e.detail.toUpperCase()===ne.PART?ne.PART:ne.SINGLE),t?.(e.detail)},children:[e.jsx(s.VertexRadio,{"data-testid":"end-capping-color-part-color",label:"Part Color",value:ne.PART}),e.jsx(s.VertexRadio,{"data-testid":"end-capping-color-single-color",label:"Single Color",value:ne.SINGLE})]})})},VertexEndCapColorPicker=({onUpdateCustomColor:t})=>{const[a,o]=n.useRecoilState(pe);return e.jsx(VertexColorPicker,{"data-testid":"end-capping-color-picker",value:a,onValueChanged:e=>{t?.(e.detail)},onInput:e=>o(e)})},VertexEndCapToggle=({onEnabledChange:t})=>{const[a,o]=n.useRecoilState(ue);return e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"end-capping-enabled-toggle",variant:"switch",checked:a,onValueChanged:async e=>{o(e.detail),t?.(e.detail)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:a,onEndCapEnabledChange:o,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:i}){const r=n.useRecoilValue(me);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center pt-2 pb-2",children:[e.jsx(VertexEndCapToggle,{onEnabledChange:o}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Show End Cap"})]}),e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Line 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:a}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Cap Color"}),e.jsx(VertexEndCapColorOptions,{onUpdateColorType:s}),r===ne.SINGLE&&e.jsx("div",{className:"mt-2",children:e.jsx(VertexEndCapColorPicker,{onUpdateCustomColor:i})})]})]})}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(),[o,i]=n.useRecoilState(le),[r,l]=n.useRecoilState(ce),c=n.useRecoilValue(de),[d,u]=n.useRecoilState(ue),[m,p]=n.useRecoilState(me),[h,f]=n.useRecoilState(pe),g=o!==ae||1!==r||d!==c||m!==ne.PART||h!==se;return e.jsx("div",{className:"ml-auto",children:e.jsx(s.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(s.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(ae),l(1),u(c),p(ne.PART),f(se),t?.(),await a.reapply()},disabled:!g})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a,onEndCapEnabledChange:o,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:i}){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,onEndCapEnabledChange:o,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:i})})}const Be=.5,De="#444444",ze=n.atom({key:"featureEdgesSelectedColor",default:De}),Fe=n.atom({key:"featureEdgesLineThickness",default:Be}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(ze);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:a,onValueChanged:e=>{t?.(e.detail)},onInput:e=>o(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Fe);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=>{o(e.detail.value)},onValueChange:e=>{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,o]=n.useRecoilState(ze),[i,r]=n.useRecoilState(Fe),l=i!==Be||a!==De;return e.jsx("div",{className:"ml-auto",children:e.jsx(s.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(s.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(De),r(Be),t?.()},disabled:!l})})})};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){return null!=e&&null!=e?.node?.id}function contextMenuItemIsElement(e){return null!=e&&e instanceof HTMLElement}const He=n.atom({key:"contextMenuActive",default:void 0}),Ue=n.atom({key:"contextMenuPosition",default:void 0}),We=n.atom({key:"contextMenuTarget",default:void 0}),Ge=n.atom({key:"contextMenuItem",default:void 0}),Ke=n.atom({key:"contextMenuActions",default:[]}),$e=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(He)?e(Ue):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,o=t?.clientY;e(Ue,a.Point.create(n,o)),e(We,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,o,s,i)=>{const r=await e.getPromise(Ue),l=await e.getPromise(He);if(null!=r&&null==l){const e=n.clientX,l=n?.clientY,c=a.Point.create(e,l),d=null!=r?a.Point.distance(r,c):0,u=null==s||s(n);d<2&&u&&(i?.(n,r??c),t(He,o))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,o,s)=>{if(null==o||o(t)){const o=a.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(Ue,o),e(We,t.target),e(He,n),s?.(t,o)}})),setContextMenuItem:useActionCallback((({snapshot:e,set:t,reset:n})=>async a=>{const o=await e.getPromise(Ke);t(Ge,a),o.forEach((e=>e(a))),n(Ke)})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Ee,!!n),e(He),e(Ke),e(Ue)})),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)}var qe=Object.freeze({__proto__:null,contextMenuActions:Ke,contextMenuActive:He,contextMenuActivePosition:$e,contextMenuItem:Ge,contextMenuItemIsElement:contextMenuItemIsElement,contextMenuItemIsRow:contextMenuItemIsRow,contextMenuPosition:Ue,contextMenuTarget:We,targetShouldSkipNextHit:targetShouldSkipNextHit,targetWithinMenu:targetWithinMenu,useContextMenuActions:useContextMenuActions});const Ye=n.atom({key:"boxSelectionEnabled",default:!1}),Xe=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(Ye,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(Ye),e(Xe)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Xe,t)}))});var Ze=Object.freeze({__proto__:null,boxSelectionEnabled:Ye,boxSelectionOperationType:Xe,useBoxSelectionActions:useBoxSelectionActions});async function whenComponentReady(e,t,n=customElements,a=requestAnimationFrame,o=setTimeout){return null!=e&&null!=e.nodeName&&await n.whenDefined(e.nodeName.toLowerCase()),"function"==typeof e?.componentOnReady?(await(e?.componentOnReady()),t()):(await new Promise((e=>"function"==typeof a?a(e):o(e))),t())}const Je=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),Qe=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),et=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(Qe);o.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=e?.measurementModel.onOutcomeChanged(t)})),()=>n?.dispose()}),[e,t])}const tt=2,nt=n.atom({key:"isEditingPreciseMeasurement",default:!1}),at=n.atom({key:"preciseMeasurementOutcome",default:void 0}),ot=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),st=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),it=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),rt=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(it).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,a){const s=n.useSetRecoilState(it),i=n.useSetRecoilState(at),r=n.useSetRecoilState(ot),l=n.useSetRecoilState(st),c=n.useRecoilValue(ot);o.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=e?.measurementModel.onEntitiesChanged((e=>{s(e),t?.(e)}))})),()=>n?.dispose()}),[e,s]),o.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=e?.measurementModel.onOutcomeChanged((e=>{i(e),a?.(e)}))})),()=>t?.dispose()}),[e,i]),o.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=e?.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];c?.setEntities(new Set([t]))}}))})),()=>t?.dispose()}),[e,c]),o.useEffect((()=>{whenComponentReady(e,(()=>{r(e?.measurementController)}))}),[e,r]),o.useEffect((()=>{whenComponentReady(e,(()=>{l(e?.measurementOverlays)}))}),[e,l])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),o=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ot);t?.clearEntities()})),s=useActionCallback((()=>async(e={})=>{await o(),n(e),a()})),i=useActionCallback((({set:e,reset:n})=>async a=>{await s(),"point-to-point"===a?t():(n(at),n(it),e(nt,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await s(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await i(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(nt),a=await e.getPromise(Je);n?await o():a&&(t(Qe),t(et))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(et)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(et,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Je)?await s():await i("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(nt)?await s():await i("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Je,!0),n.keepExistingMeasurement||e(Qe)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Je),t.keepExistingMeasurement||(e(et),e(Qe))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(nt),e(at),e(it)}))}const lt=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(Je)||e(nt)}),ct=n.selector({key:"measurementPanelModel",get:({get:e})=>e(Qe)||e(at)}),dt=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(st)}),ut=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(nt)?e(rt):void 0}}),mt=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(lt)&&null!=e(ct)});var pt=Object.freeze({__proto__:null,editedPointToPointMeasurement:et,isEditingMeasurement:lt,isEditingPointToPointMeasurement:Je,isEditingPreciseMeasurement:nt,measurementPanelIsResettable:mt,measurementPanelMessage:ut,measurementPanelOutcome:ct,measurementPanelOverlays:dt,pointToPointMeasurementOutcome:Qe,preciseMeasurementController:ot,preciseMeasurementEntities:it,preciseMeasurementMessage:rt,preciseMeasurementOutcome:at,preciseMeasurementOverlays:st,useDisablePointToPointMeasurement:useDisablePointToPointMeasurement,useDisablePreciseMeasurement:useDisablePreciseMeasurement,useEnablePointToPointMeasurement:useEnablePointToPointMeasurement,useMeasurementActions:useMeasurementActions,usePointToPointMeasurement:usePointToPointMeasurement,usePreciseMeasurementModel:usePreciseMeasurementModel});const ht="Scene Alteration Performance";var xt;!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"}(xt||(xt={}));var ft=Object.freeze({__proto__:null,SCENE_ALTERATION_PERFORMANCE:ht,get SceneAlterationPerformanceType(){return xt}});const gt=n.atom({key:"fetchedItemInvalidator",default:0}),yt=n.selectorFamily({key:"fetchedItems",get:e=>async({get:t})=>{const n=t(G),a=t(X);if(t(gt),t(tn),null!=a)try{return await(n?.sceneItems?.getSceneViewItem(e,a,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}}),vt=n.atomFamily({key:"selectionSelectedItems",default:void 0}),bt=n.atom({key:"selectionSelectedItemIds",default:[]}),wt=n.atom({key:"selectionLastSelected",default:void 0}),Ct=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),St=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),Vt=n.selector({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(wt),n=undefined;return e(bt).filter((e=>e!==t?.id&&!t?.ancestors?.includes(e))).length>0}}),jt=n.atom({key:"selectionIsAncestorSelection",default:!1}),kt=n.atom({key:"selectionFirstSelectedItemInTreeId",default:void 0}),Tt=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{const t=e(wt),n=e(bt);return t?.ancestors?.find((e=>n.includes(e)))??t?.id}}),At=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),Pt=n.atom({key:"selectionVisibleSummary",default:void 0}),It=n.selector({key:"selectionVisibleCount",get:({get:e})=>e(Pt)?.count??0}),Mt=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(Pt);return null!=t?.boundingBox?a.BoundingBox.center(t.boundingBox):a.Vector3.origin()}}),Et=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(bt),n=undefined;return e(It)>0||t.length>0}}),Rt=n.selector({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(bt),n=undefined;return null!=e(X)?t.map((t=>e(yt(t)))):[]}}),Nt=n.atom({key:"selectionModelViewsSelected",default:void 0});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(gt,(e=>e+1))}))}}var Ot=Object.freeze({__proto__:null,fetchedItem:yt,fetchedItemInvalidator:gt,useSceneViewItemActions:useSceneViewItemActions});const Lt=n.atom({key:"lengthUnit",default:"cm"}),_t=n.atom({key:"decimalPlace",default:"2"});var Bt=Object.freeze({__proto__:null,decimalPlace:_t,lengthUnit:Lt}),Dt,zt;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Dt||(Dt={})),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"}(zt||(zt={}));const convertFrom=(e,t)=>{const n=undefined;return e/zt[t]},convertTo=(e,t)=>{const n=undefined;return e*zt[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 pickLocalOrWorldTransform(e,t){return"local"===t?e.local:e.world}function mapItemTransforms(e,t){return{local:t(e.local),world:t(e.world)}}function makeItemTransforms(e,t,n){return"local"===n?{local:e,world:i.toWorldTransform(e,t)}:{world:e,local:i.toLocalTransform(e,t)}}function convertTransformToUnits(e,t){const{position:n,rotation:o,scale:s}=e;return{position:a.Vector3.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:o,scale:s}}function convertTransformFromUnits(e,t){const{position:n,rotation:o,scale:s}=e;return{position:a.Vector3.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:o,scale:s}}function toValidTransform(e){const{position:t,rotation:n,scale:a}=e;return{position:{x:t.x||0,y:t.y||0,z:t.z||0},rotation:{x:n.x||0,y:n.y||0,z:n.z||0},scale:a||1}}function scale(e){const t=parseFloat(Math.sqrt(e[0]**2+e[4]**2+e[8]**2).toFixed(2)),n=parseFloat(Math.sqrt(e[1]**2+e[5]**2+e[9]**2).toFixed(2)),a=parseFloat(Math.sqrt(e[2]**2+e[6]**2+e[10]**2).toFixed(2));return t===n&&n===a?t:NaN}function translation(e){return{x:e[12],y:e[13],z:e[14]}}function rotation(e){const t=e.map((t=>t*(1/scale(e))));return t[8]<1?t[8]>-1?{x:Math.atan2(-t[9],t[10])*(180/Math.PI),y:Math.asin(t[8])*(180/Math.PI),z:Math.atan2(-t[4],t[0])*(180/Math.PI)}:{x:-Math.atan2(-t[1],t[5])*(180/Math.PI),y:-90,z:0}:{x:Math.atan2(t[1],t[5])*(180/Math.PI),y:90,z:0}}function toTransformFromApiMatrix(e){return null!=e?{position:translation(e),rotation:rotation(e),scale:scale(e)}:void 0}const Ft={position:a.Vector3.create(0,0,0),rotation:a.Vector3.create(0,0,0),scale:1},Ht=n.atom({key:"transformWidgetEnabled",default:!1}),Ut=n.atom({key:"transformWidgetPosition",default:void 0}),Wt=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),Gt=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Wt),n=e(wt);if(null!=t)return t;if(null!=n){const t=e(en(n.id));return a.Euler.fromDegrees({x:t?.world.rotation.x,y:t?.world.rotation.y,z:t?.world.rotation.z})}}}),Kt=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),$t=n.atom({key:"transformWidgetSyncToSelection",default:!1}),qt=n.atom({key:"transformWidgetIsInteracting",default:!1}),Yt=n.atomFamily({key:"appliedItemTransform",default:void 0}),Xt=n.atom({key:"appliedItemTransformIds",default:[]}),Zt=n.atom({key:"selectedCoordinateSpace",default:"world"}),Jt=n.atomFamily({key:"editedItemTransform",default:void 0}),Qt=n.selectorFamily({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(Zt),a=t(Lt),o=t(en(e)),s=t(Jt(e));if(null!=s)return s.transform;if(null!=o)return pickLocalOrWorldTransform(mapItemTransforms(o,(e=>convertTransformToUnits(e,a))),n)}},set:e=>({get:t,set:a},o)=>{if(null!=e){const s=t(Zt),i=t(nn(e)),r=t(en(e)),l=t(Lt);if(null!=r&&!(o instanceof n.DefaultValue)&&null!=o&&null!=i){a(Jt(e),{coordinateSpace:s,units:l,transform:o});const n=makeItemTransforms(convertTransformFromUnits(toValidTransform(o),l),i,s),r=t(Xt);a(Yt(e),n),a(Xt,[...r,e])}}}}),en=n.selectorFamily({key:"fetchedItemTransforms",get:e=>({get:t})=>{const n=t(yt(e));if(null!=n){const e=n.override?.transform?toTransformFromApiMatrix(n.override?.transform):void 0,t=n.worldTransform?toTransformFromApiMatrix(n.worldTransform):void 0;return{local:e??Ft,world:t??Ft}}}}),tn=n.atom({key:"transformInvalidator",default:0}),nn=n.selectorFamily({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(X);if(null!=e&&null!=n){const n=t(yt(e));if(null!=n?.parentId){const e=t(en(n.parentId)),a=t(Yt(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return null!=a?i.toMatrix(i.toRadiansTransform(a.world)):i.toMatrix(i.toRadiansTransform(e.world))}}return logger_debug(`Unable to find the world matrix for the parent of ${e}. Returning the identity matrix.`),a.Matrix4.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=n.useRecoilValue(Lt),a=n.useRecoilValue(Zt),s=n.useRecoilValue(Yt(e??"")),[i,r]=n.useRecoilState(Jt(e??""));o.useEffect((()=>{if(null!=s&&(i?.coordinateSpace!==a||i?.units!==t)){const e=undefined,n=convertTransformToUnits(pickLocalOrWorldTransform(s,a),t);r({units:t,coordinateSpace:a,transform:n})}}),[t,a])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const a=n.useRecoilValueLoadable(nn(e)),[o,s]=n.useRecoilStateLoadable(Qt(e));return{transform:"hasValue"===o.state?o.contents:void 0,loading:"loading"===o.state||"loading"===a.state,error:"hasError"===o.state?o.contents:void 0,async update(n){t.enableSelectionSync(),s(n),null!=e&&await t.applyTransformToItem(e)}}}const useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Mt);e(Ut,n)})),o=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Ut),o=await t.getPromise(St),s=await t.getPromise(bt),i=await t.getPromise(It);null==a&&(s.length>0||o||i>0)&&await n(),e($t,!0)})),s=useActionCallback((({set:e})=>async t=>{e(Ut,t??void 0)})),r=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(Gt),o=undefined;(await e.getPromise(Xt)).forEach((e=>{n(Yt(e)),n(Jt(e))})),n(Xt),null!=a&&t(Kt,a),t(tn,(e=>e+1))}))),l=useActionCallback((({set:e,reset:t})=>n=>{t(Kt),e(Wt,n)})),c=useActionCallback((({set:e})=>()=>{e(Ut,void 0),e(Ht,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(a,i)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:L}),t(Ht,!0),i?await n():null==a?await o():await s(a)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Ht),e(Wt)})),setTransformWidgetOrientation:l,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Kt),e(Wt)})),setTransformWidgetPosition:s,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ut))),invalidateTransforms:r,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(qt,t)})),setDefaultWidgetPosition:o,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e($t,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e($t))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(At),n=await e.getPromise(Pt),o=undefined;if(await e.getPromise($t)){const e=n?.boundingBox,o=null!=e&&null!=t?.boundingBox&&equals(e,t.boundingBox);null==e||o||await s(a.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e($t),null==t?.annotationId&&(null!=t?await s(t?.position):(e(Ut),l(void 0)))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(xt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await r(),c()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(xt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await r(),c()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),o=await(n?.scene()),s=await e.getPromise(Yt(t));if(null==s)return void logger_warn(`There is no transform to apply to item ${t}.`);const r=a.Matrix4.transpose(i.toMatrix(i.toRadiansTransform(s?.local)));return o?.items((e=>e.where((e=>e.withItemId(t))).transform(r))).execute()}))}};var an=Object.freeze({__proto__:null,appliedItemTransformIds:Xt,appliedItemTransforms:Yt,convertTransformFromUnits:convertTransformFromUnits,convertTransformToUnits:convertTransformToUnits,displayedItemTransform:Qt,editedItemTransform:Jt,fetchedItemTransforms:en,identityTransform:Ft,makeItemTransforms:makeItemTransforms,mapItemTransforms:mapItemTransforms,parentItemWorldMatrix:nn,pickLocalOrWorldTransform:pickLocalOrWorldTransform,selectedCoordinateSpace:Zt,toValidTransform:toValidTransform,transformInvalidator:tn,transformWidgetCachedOrientation:Kt,transformWidgetEnabled:Ht,transformWidgetIsInteracting:qt,transformWidgetOrientation:Gt,transformWidgetOrientationOverride:Wt,transformWidgetPosition:Ut,transformWidgetSyncToSelection:$t,useEditItemTransform:useEditItemTransform,useTransformActions:useTransformActions});const useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Me).then((e=>e.value)),a=await e.getPromise(et);null==n&&null!=a?.start&&null!=a.end&&await t.resetMeasurement()}))),o=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Me).then((e=>e.value));await n.orientToHitResult(t)}))),s=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Me).then((e=>e.value));e(Ge,n)}))),i=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Ie,await e.tryGetPromise(Me).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:r},...l)=>{const c=await t.getPromise(lt),d=await t.getPromise(xe),u=2!==r?.buttons&&!r?.altKey;r.altKey||r.ctrlKey||r.metaKey||r.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(Me).then((e=>e.value));n(Pe,p),n(Te,r),await a(),m&&(l.forEach((e=>e())),await o()),await s(),await e.sectionCurrentHit(),await i()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Te),t(Ae,a.detail),await e.tryGetPromise(Me),await s(),await i()})))}},on=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,o=undefined,s=undefined;return{tapDetails:e(Te),longPressDetails:e(Ae),previousHitResult:e(Pe),currentHitResult:e(Ie)}}});var sn=Object.freeze({__proto__:null,currentHitResult:Ie,hitResult:Me,hitResultsLongPressDetails:Ae,hitResultsSkipNextTap:Ee,hitResultsTapDetails:Te,hitState:on,previousHitResult:Pe,useHitActions:useHitActions});const rn=n.atomFamily({key:"modelViewsCursor",default:void 0}),ln=n.atomFamily({key:"pmiAnnotationsCursor",default:void 0}),cn=n.atomFamily({key:"loadedModelViews",default:[]}),dn=n.atomFamily({key:"loadedPmiAnnotations",default:[]}),un=n.atomFamily({key:"visiblePmiAnnotations",default:[]}),mn=n.selector({key:"modelViewsSceneItemName",get:async({get:e})=>{const t=e(Nt);if(null!=t){const n=e(yt(t.id));return n?.name??void 0}}}),pn=n.atom({key:"loadedItemModelView",default:void 0}),hn=n.selectorFamily({key:"nextModelViews",get:e=>async({get:t})=>{const n=t(G),a=t(rn(e));return await(n?.modelViews?.listByItem(e,{cursor:a,size:100,hasAnnotations:!0}))}}),xn=n.selectorFamily({key:"modelViews",get:e=>({get:t})=>{const n=t(cn(e)),a=t(hn(e));return n.flatMap((e=>e.modelViews)).concat(a?.modelViews??[])}}),fn=n.selectorFamily({key:"hasMoreModelViews",get:e=>({get:t})=>{const n=t(hn(e));return null!=n?.paging.next}}),gn=n.selectorFamily({key:"nextPmiAnnotations",get:e=>async({get:t})=>{const n=t(G),a=t(ln(e));return n?.pmi?.listAnnotations({modelViewId:e,cursor:a,size:100})}}),yn=n.selectorFamily({key:"pmiAnnotations",get:e=>({get:t})=>{const n=undefined;return t(dn(e)).flatMap((e=>e.annotations))}}),vn=n.selectorFamily({key:"hasMorePmiAnnotations",get:e=>({get:t})=>{const n=undefined;return null!=t(ln(e))}}),bn=n.atom({key:"selectedPmiAnnotationId",default:void 0});function useSceneAnnotationsOperations(){const e=o.useCallback((async(e,t,n)=>{const a=await(t?.scene());null==n?await(a?.elements((t=>e(t.annotations.where((e=>e.all()))))).execute()):n.length>0&&await(a?.elements((t=>e(t.annotations.where((e=>e.withAnnotationIds(n)))))).execute())}),[]),t=o.useCallback((async(e,t)=>{const n=await(e?.scene());n?.elements((e=>[e.annotations.where((e=>e.all())).deselect(),e.annotations.where((e=>e.withAnnotationIds([t]))).select()])).execute()}),[]),n=o.useCallback((async e=>{const t=await(e?.scene());t?.elements((e=>[e.annotations.where((e=>e.all())).deselect()])).execute()}),[]);return{sceneAnnotationsOperation:e,selectOnlyAnnotation:t,clearAnnotationSelection:n}}function usePmiAnnotationActions(){const e=useSceneAnnotationsOperations(),t=useActionCallback((({snapshot:e,set:t})=>async n=>{const a=await e.getPromise(gn(n));if(null!=a){t(dn(n),(e=>[...e,a])),t(un(n),(e=>[...e,...a.annotations]));const e=a?.paging?.next;t(ln(n),null!=e?()=>e:()=>{})}})),n=useActionCallback((({snapshot:e})=>async a=>{const o=document.getElementById(`annotation-entry-${a}`);if(null!=o)o.scrollIntoView();else{const o=await e.getPromise(pn),s=o?.modelView.id;if(null==s)return;const i=undefined;await e.getPromise(vn(s))&&(await t(s),await n(a))}}));return{fetchInitialPmiAnnotations:useActionCallback((({snapshot:e})=>async n=>{const a=undefined;0===(await e.getPromise(yn(n))).length&&await t(n)})),fetchNextPmiAnnotations:useActionCallback((()=>async e=>{await t(e)})),selectPmiAnnotation:useActionCallback((({set:t,snapshot:a})=>async(o,s)=>{t(bn,o);const i=await a.getPromise(G);null!=i&&await(e?.selectOnlyAnnotation(i,o)),s&&await n(o)})),clearPmiAnnotationSelection:useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=await n.getPromise(bn),o=await n.getPromise(G);null!=a&&null!=o&&(t(bn),await(e?.clearAnnotationSelection(o)))})),scrollToSelectedPmiAnnotation:n}}const wn=n.atom({key:"sceneTreeLoaderVisible",default:!1}),Cn=n.atom({key:"sceneTreeElement",default:void 0}),Sn=n.atom({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0}),Vn=n.atom({key:"sceneTreeOpenPopover",default:void 0}),jn=n.selectorFamily({key:"sceneTreePopoverIsOpen",get:e=>({get:t})=>t(Vn)===e});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,o)=>{if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await o.deselectItem(a):a.selected?await o.selectItem(a,{recurseParent:!0}):a.selected||await o.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const o=await t.getPromise(wt);e.syncSelection({id:a.id?.hex,ancestors:o?.ancestors??[]},{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=>{const a=await e.getPromise(Cn),o=await(a?.getRowAtClientY(n));null!=o?.node.id?.hex&&await t.flyToById(o.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Cn),n=await e.getPromise(kt);null!=n&&t?.scrollToItem(n)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Cn),o=await(a?.getRowAtClientY(n));e(Ge,o)})),openSceneTreePopover:useActionCallback((({set:e})=>t=>{e(Vn,t)})),closeSceneTreePopover:useActionCallback((({set:e})=>()=>{e(Vn,void 0)}))}}var kn=Object.freeze({__proto__:null,sceneTreeController:Sn,sceneTreeElement:Cn,sceneTreeLoaderVisible:wn,sceneTreeOpenPopover:Vn,sceneTreePopoverIsOpen:jn,useSceneTreeActions:useSceneTreeActions});function useSelectionActions(){const e=usePmiAnnotationActions(),t=useSceneViewItemActions(),n=useTransformActions(),a=useViewerSceneActions(),o=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(bt)).forEach((e=>t(vt(e))))})),s=useActionCallback((({snapshot:e,reset:t,set:n})=>async(o,s)=>{const i=await e.getPromise(vt(o.id)),r=await e.getPromise(bt),l=[...o.ancestors??[]]?.reverse().find((e=>!r.includes(e)));null!=i&&null!=l?(n(vt(l),{id:l}),n(bt,(e=>[...e,l])),n(jt,!0),await a.execute(xt.SELECTING_ANCESTOR,a.selectItemsTransform(l)),await m({id:l})):s?.clear?(n(vt(o.id),o),n(bt,[o.id]),await a.execute(xt.SELECTING_ONLY_ITEM,a.clearSelectionTransform,a.selectItemsTransform(o.id)),await m(o)):(n(vt(o.id),o),n(bt,(e=>[...e,o.id])),await a.execute(xt.SELECTING_ITEMS,a.selectItemsTransform(o.id)),await m(o)),n(wt,o),n(Ct,!0),t(St);try{const t=await e.getPromise(Cn);await(t?.scrollToItem(o.id))}catch(e){logger_debug(`The scene item was not found in the tree. [itemId={${o.id}}]`)}})),i=useActionCallback((({reset:e,set:t})=>async n=>{e(vt(n)),e(St),e(jt),t(bt,(e=>e.filter((e=>e!==n)))),await a.execute(xt.DESELECTING_ITEMS,a.deselectItemsTransform(n))})),r=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(vt(t.id));null!=n?await i(n.id):await s(t)})),l=useActionCallback((({snapshot:a,reset:o,set:i})=>async(r,l={})=>{const c=await a.getPromise(vt(r.id)),d=await a.getPromise(bt);if(d.filter((e=>e!==r.id&&!r.ancestors?.includes(e))).forEach((e=>o(vt(e)))),o(St),o(jt),c)if(l.ignoreAncestorSelection)o(bt),o(vt(c.id));else{const e=d.filter((e=>e===r.id||r.ancestors?.includes(e)));i(bt,e)}else o(bt);t.invalidateCachedItems(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection(),await s(r,{clear:!0})})),c=useActionCallback((({reset:t})=>async()=>{await o(),t(bt),t(wt),t(Ct),t(St),t(jt),n.clearTransformWidgetPosition(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection()})),d=useActionCallback((()=>async()=>{await c(),await a.execute(xt.CLEAR_SELECTION,a.clearSelectionTransform)})),u=useActionCallback((({set:e})=>async t=>{e(St,t)})),m=useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Nt);a?.id!==n?.id&&e(Nt,n)}));return{select:s,toggleSelection:r,clearAndSelect:l,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:t})=>async()=>{const n=await t.tryGetPromise(Me).then((e=>e.value)),a=await t.getPromise(Te),o=a?.metaKey||a?.ctrlKey||a?.shiftKey;null!=n?.annotationId?await e.selectPmiAnnotation(n.annotationId,!0):null==n||o?null!=n&&o?await r(n):await d():await l(n)}))),syncSelection:useActionCallback((({set:e,snapshot:t,reset:n})=>async(a,s)=>{if(s.selected){const n=await t.getPromise(vt(a.id)),i=await t.getPromise(Sn);if(null!=n&&null!=i){const n=undefined,o=(await(i?.fetchNodeAncestors(a.id))).map((e=>e.id?.hex)).filter((e=>null!=e)),r=await t.getPromise(bt),l=[...o??[]]?.findLastIndex((e=>r.includes(e)));if(o.length>0&&l<o.length-1){const t=o[l+1];return e(jt,!0),e(wt,{id:t}),e(vt(t),{id:t}),e(bt,(e=>[...e.filter((e=>e!==t)),t])),e(Ct,!1),e(St,!!s.multiSelect),void await m({id:t})}}await o(),e(vt(a.id),a),s.multiSelect?e(bt,(e=>[...e.filter((e=>e!==a.id)),a.id])):e(bt,[a.id]),await m(a),e(wt,a),e(Ct,!1),e(St,!!s.multiSelect)}else n(vt(a.id)),n(St),e(bt,(e=>e.filter((e=>e!==a.id))))})),deselect:i,clearSelection:d,resetSelectionState:c,toggleLastSelectWasMultiSelect:u,selectForModelViewsPanel:m}}const Tn=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,o=undefined;return{selectedItemIds:e(bt),lastSelected:e(wt),highestSelectedAncestorId:e(Tt)}}});var An=Object.freeze({__proto__:null,fetchedAndSelectedItems:Rt,selectionBoundingBoxCenter:Mt,selectionFirstSelectedItemInTreeId:kt,selectionHasMultipleSelected:Vt,selectionHighestSelectedAncestor:Tt,selectionIsActive:Et,selectionIsAncestorSelection:jt,selectionLastSelectWasMultiSelect:St,selectionLastSelected:wt,selectionLastSelectionFromViewer:Ct,selectionModelViewsSelected:Nt,selectionPreviousVisibleSummary:At,selectionSelectedItemIds:bt,selectionSelectedItems:vt,selectionState:Tn,selectionVisibleCount:It,selectionVisibleSummary:Pt,useSelectionActions:useSelectionActions});function createColorMaterialWithId(e,t=j.create()){return{id:t,...i.ColorMaterial.fromHex(e)}}const Pn=255,In=18,Mn=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),En=n.atom({key:"sceneItemAdjustmentsRecentColors",default:[]}),Rn=n.atom({key:"sceneItemAdjustmentsCustomColors",default:[createColorMaterialWithId("#ffffff"),createColorMaterialWithId("#616161")]}),Nn=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),On=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),Ln=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),_n=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(wt);if(null!=t)return e(On(t.id))}}),Bn=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),Dn=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),zn=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Ln);t(Mn),n.forEach((e=>t(On(e)))),t(Ln)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(Mn,t)})),saveRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(En),o=[n,...a.filter((e=>e!==n))],s=o.length>In?o.slice(0,-(o.length-In)):o;e(Mn,n),e(En,s)})),removeRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=(await t.getPromise(En)).filter((e=>e.id!==n));e(En,o)})),setCustomColors:useActionCallback((({set:e})=>async t=>{e(Rn,t)})),saveCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=[...await t.getPromise(Rn),n],s=o.length>In?o.slice(o.length-In):o;e(Mn,n),e(Rn,s)})),removeCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=(await t.getPromise(Rn)).filter((e=>e.id!==n));e(Rn,o)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(Mn)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(Nn)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const o=await t.getPromise(bt);a(Mn),o.forEach((e=>a(On(e)))),n(Ln,(e=>e.filter((e=>!o.includes(e))))),await e.execute(xt.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(xt.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(Nn,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(Mn),o=await t.getPromise(Nn),s=await t.getPromise(bt),i=await t.getPromise(_n),r=a??i,l=o??i?.opacity;if(null!=r){const t={...r,opacity:l??r.opacity};await e.execute(xt.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),s.forEach((e=>n(On(e),t))),n(Ln,(e=>[...e,...s]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(zn,!0),e(Bn,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(zn),e(Bn)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(Mn),o=await t.getPromise(Nn);if(null!=a){const s=await t.getPromise(Ln),i={...a,opacity:o??a.opacity};await e.execute(xt.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(i))),s.forEach((e=>n(On(e))));const r=await t.getPromise(Bn);r?.(i),n(zn),n(Bn)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Dn,!1)}))}},Fn="#ffff00",Hn=35,Un=1,Wn=n.atom({key:"selectionHighlightingSelectedColor",default:Fn}),Gn=n.atom({key:"selectionHighlightingSelectedOpacity",default:Hn}),Kn=n.atom({key:"selectionHighlightingSelectedLineThickness",default:1});function elementIsColorSwatch(e){return e instanceof Element&&"VERTEX-COLOR-SWATCH"===e.nodeName}function elementHasColorAttribute(e){return"true"===e.getAttribute("data-custom-color")||"true"===e.getAttribute("data-recent-color")}const $n="#FFFFFF",qn=n.atom({key:"viewerBackgroundSelectedColor",default:$n});var Yn=Object.freeze({__proto__:null,DEFAULT_FEATURE_EDGE_COLOR:De,DEFAULT_FEATURE_EDGE_THICKNESS_VALUE:Be,DEFAULT_SELECTION_HIGHLIGHTING_COLOR:Fn,DEFAULT_SELECTION_HIGHLIGHTING_LINE_THICKNESS:1,DEFAULT_SELECTION_HIGHLIGHTING_OPACITY:Hn,DEFAULT_VIEWER_BACKGROUND_COLOR:$n,MAXIMUM_MATERIAL_OVERRIDE_OPACITY:Pn,MAX_STORED_COLOR_ARRAY_LENGTH:In,appliedItemMaterialOverride:On,appliedItemMaterialOverrideIds:Ln,applyMaterialToAllUserAction:Bn,confirmApplyMaterialToAllDialogOpen:zn,elementHasColorAttribute:elementHasColorAttribute,elementIsColorSwatch:elementIsColorSwatch,featureEdgesLineThickness:Fe,featureEdgesSelectedColor:ze,sceneItemAdjustmentsCustomColors:Rn,sceneItemAdjustmentsLastSelectedOverride:_n,sceneItemAdjustmentsRecentColors:En,sceneItemAdjustmentsSelectedColor:Mn,sceneItemAdjustmentsSelectedOpacity:Nn,selectionHighlightingSelectedColor:Wn,selectionHighlightingSelectedLineThickness:Kn,selectionHighlightingSelectedOpacity:Gn,showConfirmDialogWhenApplyingMaterialToAll:Dn,useSceneItemMaterialActions:useSceneItemMaterialActions,viewerBackgroundSelectedColor:qn});const VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValueLoadable(_n),i=n.useRecoilValue(Mn),r=n.useRecoilValue(Dn),l=u.useMemo((()=>"hasValue"===o.state?i??o.contents:i),[o,i]);return e.jsx(s.VertexTooltip,{content:"Apply to All",children:e.jsx(s.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==l,onClick:async()=>{r?a.confirmApplyAll(t):(await a.applyAll(),t?.(l))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),a=n.useRecoilValue(zn),[i,r]=o.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),r(!1)};return a?e.jsxs(s.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(s.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:i,onValueChanged:e=>{r(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(s.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(s.VertexButton,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await t.applyAll(),i&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValueLoadable(_n),s=n.useRecoilValue(Mn),i=u.useMemo((()=>"hasValue"===o.state?s??o.contents:s),[o,s]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=i?f.toHexString(i.diffuse):void 0,onValueChanged:async()=>{null!=i&&(await a.apply(),t?.(i),await a.saveRecentColor(createColorMaterialWithId(f.toHexString(i.diffuse))))},onInput:async e=>{a.updateColor(createColorMaterialWithId(e)),await a.apply()}})},ColorSwatch=({color:t,hideTooltip:n,onClick:a,...o})=>{const i="string"==typeof t?t:f.toHexString(t.diffuse);return e.jsx(s.VertexTooltip,{className:"flex-grow-0",content:i,disabled:!!n,children:e.jsx("button",{onClick:()=>a?.(t),children:e.jsx(s.VertexColorSwatch,{"data-testid":`color-swatch-${i}`,variant:"square",color:i,...o})})})},VertexSceneItemMaterialColorSwatches=({onAddCustomColor:t,onApplyCustomColor:a,onApplyRecentColor:o})=>{const i=useSceneItemMaterialActions(),r=n.useRecoilValue(Rn),l=n.useRecoilValue(En),c=r.length===In;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"appearance-custom-colors",className:"flex flex-wrap gap-2 mt-1 mb-4",children:[r.map((t=>e.jsx(ColorSwatch,{color:t,onClick:async()=>{i.updateColor(t),await i.apply(),a?.(t)},"data-custom-color":!0,"data-color-id":t.id},t.id))),!c&&e.jsx(s.VertexColorPicker,{"data-testid":"appearance-custom-colors-add",variant:"swatch",size:"md",onValueChanged:async e=>{const n=createColorMaterialWithId(e.detail);await i.saveCustomColor(n),await i.apply(),t?.(n)},children:e.jsx("div",{slot:"overlay",className:"flex items-center justify-center w-full h-full",children:e.jsx(s.VertexIcon,{className:"bg-white p-2",name:"plus",size:"sm"})})})]}),!!l.length&&e.jsx("div",{"data-testid":"appearance-recent-colors",className:"flex flex-wrap gap-2",children:l.map((t=>e.jsx(ColorSwatch,{color:t,onClick:async()=>{i.updateColor(t),await i.apply(),o?.(t)},"data-recent-color":!0,"data-color-id":t.id},t.id)))})]})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValue(Nn),i=n.useRecoilValueLoadable(_n),r=u.useMemo((()=>"hasValue"===i.state?o??i.contents?.opacity??Pn:o??Pn),[o,i]),l=useDebouncedCallback((()=>{a.apply()}),500),c=u.useCallback((e=>{a.updateOpacity(e.detail.value),l(e.detail.value)}),[l,a]),d=u.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e.jsx(s.VertexTooltip,{className:"flex w-full",content:d?"Select a part and apply a color to enable opacity":`${Math.floor(r/Pn*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:d,value:r??Pn,step:5,min:0,max:Pn,onValueChange:e=>{a.updateOpacity(e.detail.value),a.apply(),t?.(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({customColors:t,onApplyMaterial:a,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:r,onApplyRecentColor:l,onApplyOpacity:c}){const d=useSceneItemMaterialActions(),u=n.useRecoilValue(wt);return o.useEffect((()=>{d.clearCurrentColor(),d.clearCurrentOpacity()}),[u?.id]),o.useEffect((()=>{if(null!=t){const e=t.map((e=>({...e,id:j.create()})));d.setCustomColors(e)}}),[t]),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:a}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:s})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Color Swatches"}),e.jsx(VertexSceneItemMaterialColorSwatches,{onAddCustomColor:i,onApplyCustomColor:r,onApplyRecentColor:l}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSceneItemMaterialOpacitySlider,{onApply:c}),e.jsx(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:t,tooltip:n,children:a})=>{const[i,r]=o.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(s.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(s.VertexTooltip,{content:n,disabled:i,placement:"bottom",children:e.jsxs(s.VertexButton,{className:_e("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":i}),"data-testid":`reset-button-${t}`,variant:"plaintext",children:[e.jsx(s.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(s.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:a})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:a})=>{const o=useSceneItemMaterialActions(),i=n.useRecoilValue(Et);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(s.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{o.clear(),t?.()},disabled:!i,children:"Clear selected materials"}),e.jsx(s.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{o.clearAll(),a?.()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({customColors:t,onClearMaterial:n,onClearAllMaterials:a,onApplyMaterial:o,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:r,onApplyRecentColor:l,onApplyOpacity:c}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Material",e.jsx(VertexSceneItemMaterialClear,{onClear:n,onClearAll:a})]}),children:e.jsx(VertexMaterialControls,{customColors:t,onApplyMaterial:o,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:r,onApplyRecentColor:l,onApplyOpacity:c})})}const VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Wn);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:a,onValueChanged:e=>{t?.(e.detail)},onInput:e=>o(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Kn);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=>{o(e.detail.value)},onValueChange:e=>{t?.(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Gn);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=>{o(e.detail.value)},onValueChange:e=>{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,o]=n.useRecoilState(Wn),[i,r]=n.useRecoilState(Gn),[l,c]=n.useRecoilState(Kn),d=a!==Fn||i!==Hn||1!==l;return e.jsx("div",{className:"ml-auto",children:e.jsx(s.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(s.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(Fn),r(Hn),c(1),t?.()},disabled:!d})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:o}){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:o})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(qn);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:a,onValueChanged:e=>{t?.(e.detail)},onInput:e=>o(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,o]=n.useRecoilState(qn),i=a!==$n;return e.jsx("div",{className:"ml-auto",children:e.jsx(s.VertexTooltip,{content:"Reset Background Color",children:e.jsx(s.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o($n),t?.()},disabled:!i})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:t,onUpdateViewerBackgroundColor:n}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Viewer Background",e.jsx(VertexViewerBackgroundReset,{onReset:t})]}),children:e.jsx(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:n})})}const isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,a=e instanceof HTMLElement&&"true"===e.contentEditable,o=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,s=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,i=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,r=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||o||s||i||r},useRecoilReducer=({reducer:e,atom:t})=>{const a=undefined,o=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},Xn=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){switch(t.type){case"push-key-binding":const n=e.bindings[t.binding.keyBind]?.find((e=>e.id===t.binding.id));return null!=n?e:{...e,bindings:{...e.bindings,[t.binding.keyBind]:[...e.bindings[t.binding.keyBind]??[],t.binding]}};case"remove-key-binding":const a=e.bindings[t.binding.keyBind]?.find((e=>e.id===t.binding.id));return null==a?e:{...e,bindings:{...e.bindings,[t.binding.keyBind]:(e.bindings[t.binding.keyBind]??[]).filter((e=>e.id!==t.binding.id))}};case"add-apply-key-binding":return{...e,applyBindings:[...e.applyBindings,t.binding]};case"remove-apply-key-binding":return{...e,applyBindings:e.applyBindings.filter((e=>e.id!==t.id))};case"set-key-pressed":return{...e,applyBindings:e.applyBindings.map((t=>({...t,active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:{...e.pressed,[t.key]:t.pressed},lastPressed:t.pressed?t.key:void 0}}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Xn}),useKeyBindingReadonlyState=()=>n.useRecoilValue(Xn);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=>null!=e.keyBind&&null!=n&&e.keyBind?.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();o.useEffect((()=>{const a=j.create();return n({type:"add-apply-key-binding",binding:{...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();o.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(),s=o.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,{...n.pressed,[e]:!0}))).forEach((e=>{const t=n.bindings[e],o=t.length>0?t[t.length-1]:void 0;null!=o&&(o.fn(),a({type:"remove-key-binding",binding:o}))}))}),[n]);o.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),s(e.key);const t={...n.pressed,[e.key]:!0},o=matchingSingleFnBindings(n.applyBindings,t,e.key),i=matchingOffBindings(n.applyBindings,t,e.key);(o.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)}}),[s,n.applyBindings,n.pressed]),o.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]),o.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(Ye);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>a,cancelPredicate:()=>!a},[a]),e.jsx(s.VertexTooltip,{content:"Box Selection",children:e.jsx(s.VertexIconButton,{iconName:"box-cursor",iconColor:a?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:a?t.disable:t.enable})})},Zn=1,VertexResizableContent=({className:t,style:n,displayShadow:a,heading:o,id:i,initialScale:r,placement:l="left",children:c,onResize:d,...u})=>{const m="left"===l||"right"===l,p="top"===l;function getHorizontalResizeDirection(){switch(l){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===l?"top":"none"}const h=null!=r?r:1;return e.jsx(s.VertexResizable,{id:i,"data-testid":`resizable-content-position-${l}`,className:_e(t,"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"===l,"sidebar-shadow-right":"left"===l&&a,"border-l min-w-75 max-w-half":"right"===l,"sidebar-shadow-left":"right"===l&&a,"border-t bottom-0 fixed":"top"===l,"min-h-12 sheet":p}),style:{maxHeight:"top"===l?window.innerHeight:void 0,...n},initialHorizontalScale:m?r:void 0,initialVerticalScale:p?h:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===l||"top"===l?"absolute":"relative",onResizeEnd:()=>d?.(),...u,children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===l&&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:_e("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===l}),children:c})]})})};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(G),n=await(t?.scene()),a={milliseconds:500};await(n?.camera().viewAll().render({animation:a}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:o}){const[s,i]=u.useState(),[r,l]=u.useState();u.useEffect((()=>{const handleTouchStart=e=>{const o=e;null!=o.touches&&1===o.touches.length&&(null!=s&&clearTimeout(s),l(a.Point.create(o.touches[0].clientX,o.touches[0].clientY)),i(setTimeout((()=>t?.(o)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=s&&null!=r&&a.Point.distance(r,a.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(s),o?.())},handleTouchEnd=()=>{null!=s&&clearTimeout(s)};return e?.addEventListener("touchstart",handleTouchStart),e?.addEventListener("touchmove",handleTouchMove),e?.addEventListener("touchend",handleTouchEnd),()=>{e?.removeEventListener("touchstart",handleTouchStart),e?.removeEventListener("touchmove",handleTouchMove),e?.removeEventListener("touchend",handleTouchEnd)}}),[e,s,r])}var Jn=Object.freeze({__proto__:null,isInputElement:isInputElement,keyBindings:Xn,reducer:reducer,useApplyKeyBinding:useApplyKeyBinding,useDefaultKeybindings:useDefaultKeybindings,useKeyBindingReadonlyState:useKeyBindingReadonlyState,useKeyBindings:useKeyBindings,useLongPress:useLongPress,useStackKeyBinding:useStackKeyBinding});function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:a,disableBackdrop:i,openPredicate:r,onOpen:l,onClose:c,children:d})=>{const u=useContextMenuActions(),m=n.useRecoilValue(He),p=n.useRecoilValue($e),h=o.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=m===a;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:u.clearActiveContextMenu,addPredicate:()=>null!=m&&m===a,cancelPredicate:()=>null==m},[m]);const g=o.useMemo((()=>null!=t?t:null!=r?window:void 0),[t,r]);return useLongPress({target:g,callback:e=>u.longPress(e,a,r,l),onMovement:()=>u.clearActiveContextMenu()}),o.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&m===a){const t=targetShouldSkipNextHit(e);u.clearActiveContextMenu(t)}};if(i)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[i,a,m]),o.useEffect((()=>{const handlePointerDown=e=>{u.pointerDown(e)},handlePointerUp=e=>{u.pointerUp(e,a,r,l)},handleContextMenu=e=>u.contextMenu(e,r);return g?.addEventListener("pointerdown",handlePointerDown),g?.addEventListener("pointerup",handlePointerUp),g?.addEventListener("contextmenu",handleContextMenu),()=>{g?.removeEventListener("pointerdown",handlePointerDown),g?.removeEventListener("pointerup",handlePointerUp),g?.removeEventListener("contextmenu",handleContextMenu)}}),[t,a,r]),e.jsx("div",{className:_e({hidden:!f}),children:e.jsx(s.VertexMenu,{"data-testid":`${a}-context-menu`,open:asBooleanAttribute(f),position:p,fallbackPlacements:h,backdrop:!i,onMenuClosed:()=>{u.clearActiveContextMenu(),c?.()},children:e.jsx("div",{className:"pt-1",children:d})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),a=n.useRecoilValue(Pt),o=useViewerCameraActions();return e.jsx(s.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:async()=>{null!=a?.boundingBox&&await o.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),"Fit Selected"]})})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),a=n.useRecoilValue(Ge);return e.jsx(s.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:async()=>{const e=undefined,n=contextMenuItemIsRow(a)?a?.node.id?.hex:a?.id;null!=n&&await t.flyToById(n)},disabled:asBooleanAttribute(null==a),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),"Fly To"]})})};function useSceneItemsOperations(){const e=n.useRecoilValue(G),t=undefined,a=undefined,s=undefined,i=undefined,r=undefined,l=undefined;return{sceneItemsOperation:o.useCallback((async(t,n)=>{const a=await(e?.scene());null==n?await(a?.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(a?.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:o.useCallback((async()=>{const t=await(e?.scene());t?.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withSelected())).show()])).execute()}),[e]),hideSelected:o.useCallback((async()=>{const t=await(e?.scene());t?.items((e=>[e.where((e=>e.withSelected())).hide()])).execute()}),[e]),showOnlyItem:o.useCallback((async t=>{const n=await(e?.scene());n?.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withItemIds([t]))).show()])).execute()}),[e]),ghostSelected:o.useCallback((async()=>{const t=await(e?.scene());t?.items((e=>[e.where((e=>e.withSelected())).setPhantom(!0)])).execute()}),[e]),unGhostSelected:o.useCallback((async()=>{const t=await(e?.scene());t?.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"hide-all-menu-option",onClick:async()=>{await t.sceneItemsOperation((e=>e.hide()))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide All Parts"]})})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(Ge),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:async()=>{const e=undefined,n=contextMenuItemIsRow(t)?t?.node.id?.hex:t.id;null!=n&&await a.sceneItemsOperation((e=>e.hide()),[n])},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Part"]})})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Selected"]})})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"show-all-menu-option",onClick:async()=>{await t.sceneItemsOperation((e=>e.show()))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show All Parts"]})})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(Ge),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:async()=>{const e=undefined,n=contextMenuItemIsRow(t)?t?.node.id?.hex:t?.id;null!=n&&await a.showOnlyItem(n)},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Part"]})})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(bt),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Selected"]})})},Qn=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),ea=n.atom({key:"openedPanelActivePrimaryRight",default:void 0}),ta=n.atom({key:"openedPanelActiveSceneTreeSecondary",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Qn:ea,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Qn:ea,void 0)})),openSecondary:useActionCallback((({set:e})=>t=>e(ta,t))),closeSecondary:useActionCallback((({reset:e})=>()=>e(ta)))}}var na=Object.freeze({__proto__:null,openedPanelActivePrimaryLeft:Qn,openedPanelActivePrimaryRight:ea,openedPanelActiveSceneTreeSecondary:ta,usePanelActions:usePanelActions});const VertexShowPropertiesMenuItem=()=>{const t=usePanelActions(),a=useSelectionActions(),o=n.useRecoilValue(Ge);return e.jsx(s.VertexMenuItem,{"data-testid":"show-properties-menu-option",disabled:asBooleanAttribute(null==o),onClick:()=>{const e=undefined,n=contextMenuItemIsRow(o)?o?.node.id?.hex:o?.id;null!=n&&(a.clearAndSelect({id:n}),t.openSecondary("Properties"))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"info",size:"sm"}),"Show Properties"]})})};function fromApiProperty(e){return{key:e.key?.name??"",value:apiMetadataPropertyDisplayValue(e.value)}}function apiMetadataPropertyDisplayValue(e){let t="";switch(e?.type){case"string":t=e.value??t;break;case"long":case"double":t=e.value.toString()??t;break;case"timestamp":t=e.value.seconds.toLocaleString()??t}return t}const aa=n.atom({key:"showMetadataSceneItemProperties",default:!0}),oa=n.selectorFamily({key:"nextMetadataSceneItemProperties",get:e=>async({get:t})=>{const n=t(G),a=t(ia(e));try{const t=await(n?.sceneItems?.listSceneItemMetadata(e,{cursor:a,size:20})),o=t?.entries?.map((e=>fromApiProperty(e))),s=undefined;return{metadata:null!=o?[...o]?.sort(((e,t)=>e.key>t.key?1:-1)):void 0,cursor:t?.paging.next}}catch(t){return void logger_debug(`Error encountered get metadata for scene item. [itemId={${e}}]`,t)}}}),sa=n.atomFamily({key:"loadedMetadataSceneItemProperties",default:[]}),ia=n.atomFamily({key:"metadataSceneItemPropertiesCursor",default:void 0}),ra=n.selectorFamily({key:"hasMoreMetadataSceneItemProperties",get:e=>({get:t})=>{const n=undefined;return null!=t(ia(e))}}),la=n.atomFamily({key:"isFetchingMetadataSceneItemProperties",default:!1}),ca=n.selector({key:"metadataSceneItemName",get:async({get:e})=>{const t=e(wt);if(null!=t){const n=e(yt(t.id));return n?.name??void 0}}});var da=Object.freeze({__proto__:null,apiMetadataPropertyDisplayValue:apiMetadataPropertyDisplayValue,fromApiProperty:fromApiProperty,hasMoreMetadataSceneItemProperties:ra,isFetchingMetadataSceneItemProperties:la,loadedMetadataSceneItemProperties:sa,metadataSceneItemName:ca,metadataSceneItemPropertiesCursor:ia,nextMetadataSceneItemProperties:oa,showMetadataSceneItemProperties:aa});const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),"Ghost Selected"]})})};function BetaLabel({children:t,label:n="Beta",placement:a="end",borderColor:o="border-purple-400",textColor:s="text-purple-500"}){return e.jsxs("div",{className:"flex items-center",children:[t,e.jsx("div",{className:_e(`flex border ${o} rounded-md px-1.5 text-xs ${s} uppercase items-center justify-center ml-2 select-none max-h-5`,{"ml-auto":"end"===a}),style:{height:"fit-content"},children:n})]})}const VertexShowModelViewsMenuItem=()=>{const t=usePanelActions(),a=useSelectionActions(),o=n.useRecoilValue(Ge);return e.jsx(s.VertexMenuItem,{"data-testid":"viewer-show-model-views",disabled:asBooleanAttribute(null==o),onClick:async()=>{const e=undefined,n=contextMenuItemIsRow(o)?o?.node.id?.hex:o?.id;null!=n&&(t.openPrimary("model-views","right"),a.selectForModelViewsPanel({id:n}))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"views",size:"sm"}),e.jsxs("div",{className:"flex gap-2",children:["Show Model Views ",e.jsx(BetaLabel,{})]})]})})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Unghost Selected"]})})},DefaultSceneTreeContextMenu=()=>{const t=n.useRecoilValue(aa);return 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(s.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{}),e.jsx(s.VertexMenuDivider,{}),t&&e.jsx(VertexShowPropertiesMenuItem,{}),e.jsx(VertexShowModelViewsMenuItem,{})]})},VertexSceneTreeContextMenu=({children:t})=>{const a=useSceneTreeActions(),o=n.useRecoilValue(Cn),s=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:o,onOpen:async(e,t)=>{const n=e;await a.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:s?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>{const t=n.useRecoilValue(aa);return 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(s.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{}),e.jsx(s.VertexMenuDivider,{}),t&&e.jsx(VertexShowPropertiesMenuItem,{}),e.jsx(VertexShowModelViewsMenuItem,{})]})},VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=o.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,{})})},ua=35,ma=n.atom({key:"sceneItemGhostingSelectedOpacity",default:ua}),pa=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),ha=n.atom({key:"appliedItemPhantomStateIds",default:[]}),xa=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{const t=e(wt);return null!=t&&(e(pa(t.id))??!1)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[a,o]=n.useRecoilState(ma);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=>{o(e.detail.value)},onValueChange:e=>{t?.(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(ha)).forEach((e=>t(pa(e)))),t(ha)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const o=await t.getPromise(bt);o.forEach((e=>n(pa(e),a))),n(ha,(e=>[...e,...o])),await e.execute(xt.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(a)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const o=await t.getPromise(bt);o.forEach((e=>a(pa(e)))),n(ha,(e=>e.filter((e=>!o.includes(e))))),await e.execute(xt.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(xt.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}};var fa=Object.freeze({__proto__:null,DEFAULT_GHOSTING_OPACITY:ua,appliedItemPhantomState:pa,appliedItemPhantomStateIds:ha,sceneItemGhostingLastSelectedPhantom:xa,sceneItemGhostingSelectedOpacity:ma,useSceneItemPhantomActions:useSceneItemPhantomActions});const VertexSceneItemGhostingToggle=({onApply:t})=>{const a=useSceneItemPhantomActions(),o=n.useRecoilValue(Et),i=n.useRecoilValueLoadable(xa);return e.jsx(s.VertexTooltip,{content:"Select a part to display as ghost",disabled:o,children:e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!o,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await a.setPhantomState(e.detail),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 o=useSceneItemPhantomActions(),i=n.useRecoilValue(xa);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(s.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await o.clearPhantomState(),t?.()},disabled:!i,children:"Clear ghosting for selected"}),e.jsx(s.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await o.clearAllPhantomState(),a?.()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:a,onApplyOpacity:o}){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:o})})}function VertexMeasurementContextMenu({onDelete:t}){const a=n.useRecoilValue(We);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(s.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=a&&t(a.id),children:[e.jsx(s.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}function useDockedPlacement(e,t){const[n,o]=u.useState(a.Point.create(0,0));return u.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),s=a.Point.create(n.left,n.bottom),i=a.Point.create(n.right,n.bottom);o("left"===t?s:i)}}),[e,t]),n}function VertexMeasurementDetails({placement:t,size:a}){const o=useMeasurementActions(),i=n.useRecoilValue(G),l=n.useRecoilValue(K),c=useDockedPlacement(i??null,t),d=n.useRecoilValue(ct),u=n.useRecoilValue(dt),m=n.useRecoilValue(ut),p=n.useRecoilValue(mt),h=n.useRecoilValue(Lt),f=n.useRecoilValue(_t);return e.jsx(s.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${l}`,position:c,children:e.jsxs("div",{className:_e("flex flex-col min-w-40",{"text-xs leading-2":"sm"===a,"text-sm leading-4":"md"===a,"text-base leading-5":"lg"===a,"text-lg leading-5":"xl"===a}),children:[e.jsxs("div",{className:"pb-2 flex justify-between items-center",children:[e.jsx("div",{className:_e("w-full",{"text-sm leading-5":"sm"===a,"text-base leading-5":"md"===a,"text-lg leading-6":"lg"===a,"text-xl leading-7 mr-6":"xl"===a}),children:"Measurement"}),e.jsx("div",{className:_e("mr-0.5",{hidden:!p}),children:e.jsx(s.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(s.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:o.resetMeasurement})})})]}),e.jsx(r.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:_e("gap-y-1.5",{hidden:null==d}),measurementOutcome:d,measurementOverlays:u,distanceUnits:toUnitType(h),fractionalDigits:parseInt(f,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:_e({hidden:null==m}),children:m})]})})}function useCallbackRef(e){const[t,n]=o.useState(e?.override??null),a=undefined;return{element:t,callback:o.useCallback((t=>n(e?.override??t)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,detailsSize:a,onPointToPointMeasurementChange:s}){const i=useMeasurementActions(),l=n.useRecoilValue(G),c=n.useRecoilValue(Je),d=n.useRecoilValue(et),u=n.useRecoilValue(Lt),m=n.useRecoilValue(_t),{callback:p,element:h}=useCallbackRef();usePointToPointMeasurement(h);const f=o.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};i.setEditedPointToPointMeasurement(t),s?.(t)}),[i]);return c?e.jsxs(e.Fragment,{children:[e.jsx(r.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:p,viewer:l??void 0,mode:"replace",start:d?.start,end:d?.end,invalid:d?.invalid,units:toUnitType(u),fractionalDigits:parseInt(m,10),showAxisReferenceLines:!0,onEditEnd:f}),e.jsx(VertexMeasurementDetails,{placement:t,size:a}),e.jsx(VertexMeasurementContextMenu,{onDelete:i.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(Je);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>a,cancelPredicate:()=>!a},[a,t]),e.jsx(s.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(s.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const ga=n.atom({key:"viewerToolkitSdkConfig",default:void 0});var ya=Object.freeze({__proto__:null,sdkConfig:ga});const VertexPreciseMeasurement=({detailsPlacement:t,detailsSize:a,onEntitiesChanged:o,onOutcomeChanged:s})=>{const i=n.useRecoilValue(G),l=n.useRecoilValue(ga),c=n.useRecoilValue(nt),{callback:d,element:u}=useCallbackRef();return usePreciseMeasurementModel(u,o,s),c?e.jsxs(e.Fragment,{children:[e.jsx(r.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:d,viewer:i??void 0,config:JSON.stringify({network:{apiHost:l?.network?.apiHost,renderingHost:l?.network?.renderingHost,sceneTreeHost:l?.network?.sceneTreeHost,sceneViewHost:l?.network?.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t,size:a})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(nt);return e.jsx(s.VertexTooltip,{content:"Precise Measurement",children:e.jsx(s.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(F),a=n.useRecoilValue(D);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(s.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=a&&e.jsx(s.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id)]})}const va={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 ba=n.atom({key:"sceneTreeColumnsRefreshTrigger",default:0}),wa=n.atom({key:"sceneTreeColumnsWhitelistedColumns",default:[]}),Ca=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(Sn);return e(ba),null!=t?await t.fetchMetadataKeys():[]}}),Sa=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Ca).filter((e=>e!==va.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),Va=n.atom({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),ja=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(Va),n=e(Cn),a=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{...e,[a.label]:a}}),{Name:{...va,initialWidth:e,minWidth:n}})}return{Name:va}}}),ka=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(ja))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e})=>async t=>{e(Va,t)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(ba,(e=>e+1))}))}}const Ta=16,Aa=-8;var Pa;function useOpenPositionedPopover({open:e,buttonElement:t,horizontalOffset:n,verticalOffset:a}){const[o,s]=u.useState(),[i,r]=u.useState(),l=undefined;return{position:o,direction:i,handleOpen:u.useCallback((()=>{if(!e){const e=t?.getBoundingClientRect();if(null!=e){const t=n??Ta,o=a??Aa,i=e.x>window.innerWidth/2?Pa.LEFT:Pa.RIGHT;s({x:i===Pa.LEFT?e.left-t:e.right+t,y:e.top+o}),r(i)}}}),[e,t])}}!function(e){e.LEFT="left",e.RIGHT="right"}(Pa||(Pa={}));var Ia=Object.freeze({__proto__:null,DEFAULT_HORIZONTAL_POSITION_OFFSET:Ta,DEFAULT_NAME_COLUMN:va,DEFAULT_VERTICAL_POSITION_OFFSET:Aa,get PlacementDirection(){return Pa},mapToColumn:mapToColumn,sceneTreeColumnsActiveColumnNames:ka,sceneTreeColumnsActiveColumns:ja,sceneTreeColumnsAvailableColumns:Ca,sceneTreeColumnsAvailableSortedColumns:Sa,sceneTreeColumnsRefreshTrigger:ba,sceneTreeColumnsVisibleMetadataColumnNames:Va,sceneTreeColumnsWhitelistedColumns:wa,useOpenPositionedPopover:useOpenPositionedPopover,useSceneTreeColumnActions:useSceneTreeColumnActions});const Ma=n.atom({key:"sceneTreeSearchActive",default:!1}),Ea=n.atom({key:"sceneTreeColumnsPartial",default:!1}),Ra=n.atom({key:"sceneTreeSearchValue",default:void 0}),Na=n.atom({key:"sceneTreeSearchExactMatch",default:!1}),Oa=n.atom({key:"sceneTreeSearchRemoveHiddenItems",default:!1}),La=n.atom({key:"sceneTreeSearchResultCount",default:0}),_a=n.atom({key:"sceneTreeSearchActiveColumns",default:[]}),Ba=n.selector({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(_a);return 0===t.length||t.includes(va.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),a=n.useRecoilValue(Ma),s=n.useSetRecoilState(La),i=n.useSetRecoilState(kt);o.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=e?.controller?.stateChanged((e=>{void 0!==e?.totalFilteredRows&&s(e?.totalFilteredRows)}))})),()=>{t?.dispose()}}),[e]),o.useEffect((()=>{if(null!=e){let n;return whenComponentReady(e,(()=>{n=e?.controller?.stateChanged((e=>{if(null!=e?.filterTerm){const t=e?.rows.find((e=>e?.node?.selected));i(t?.node.id?.hex)}else a&&t.flyToFirstSelectedItem()}))})),()=>{n?.dispose()}}}),[e,e?.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=n.useSetRecoilState(Ea);o.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=e?.controller?.stateChanged((e=>{t(!!e?.isPartialKeysResponse)}))})),()=>{n?.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(_a,t)})),t=useActionCallback((({snapshot:t})=>async(n,a,o,s)=>{const i=await t.getPromise(Cn),r=await t.getPromise(Na),l=await t.getPromise(Oa),c=await t.getPromise(_a),d=c.length>0?a?[...c,n]:c.filter((e=>e!==n)):[...o,va.metadataKeyName].filter((e=>e!==n));e(d),s&&i?.filterItems(s,{columns:d,exactMatch:r,removeHiddenItems:l})})),n=useActionCallback((({snapshot:e,set:t})=>async(n,a,o)=>{const s=await e.getPromise(Cn),i=await e.getPromise(Na),r=await e.getPromise(Oa),l=await e.getPromise(_a),c=n.filter((e=>!a.includes(e))),d=a.filter((e=>!n.includes(e))),u=l.length>0?[...l.filter((e=>!c.includes(e))),...d]:[...a,va.metadataKeyName],m=u.length>0?u:[...a,va.metadataKeyName];t(_a,m),o&&s?.filterItems(o,{columns:m,exactMatch:i,removeHiddenItems:r})})),a=useActionCallback((({set:e})=>t=>{e(Na,t)})),o=useActionCallback((({set:e})=>t=>{e(Oa,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:a,setMetadataSearchRemoveHiddenItems:o}};var Da=Object.freeze({__proto__:null,sceneTreeColumnsPartial:Ea,sceneTreeSearchActive:Ma,sceneTreeSearchActiveColumns:_a,sceneTreeSearchExactMatch:Na,sceneTreeSearchNameColumnActive:Ba,sceneTreeSearchRemoveHiddenItems:Oa,sceneTreeSearchResultCount:La,sceneTreeSearchValue:Ra,useSceneTreePartialResults:useSceneTreePartialResults,useSceneTreeSearch:useSceneTreeSearch,useSceneTreeSearchActions:useSceneTreeSearchActions});const 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 za;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=e?.depthColors,n=null!=t?Object.keys(t).reduce(((e,n)=>({...e,[`--scene-tree-row-background-color-depth-${n}`]:t[parseInt(n)]})),{}):{};return null!=e?{...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===za.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(za||(za={}));const Fa=n.atom({key:"sceneTreeAdditionalMetadataKeys",default:[]}),Ha=n.selector({key:"sceneTreeActiveMetadataKeys",get:({get:e})=>{const t=e(Fa),n=e(Va),a=e(wa),o=new Set([...t,...n]),s=new Set(a);return 0===a.length?Array.from(o):Array.from(o.intersection(s))}});var Ua=Object.freeze({__proto__:null,sceneTreeActiveMetadataKeys:Ha,sceneTreeAdditionalMetadataKeys:Fa});function childrenAsArray(e){return Array.isArray(e)?e:[e]}function filterChildElements(e,t){return childrenAsArray(e).filter((e=>o.isValidElement(e)&&e.type===t))}function findChildElement(e,t){return filterChildElements(e,t)[0]}function cloneChildNodeOrFunction(e,t){return"object"==typeof e?o.cloneElement(e,t):e(t)}function useStateSyncedValue(e,t,{transform:a}={}){const[s,i]=n.useRecoilState(e);return o.useEffect((()=>{null!=t&&i(null!=a?a(t):t)}),[t]),s}const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const a=n.useSetRecoilState(Ma);return e.jsx(s.VertexTooltip,{className:"flex ml-auto",content:"Scene Tree Search",children:e.jsx(s.VertexIconButton,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{a(!0),t?.()}})})},VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:a,children:o})=>{const i="string"==typeof o?o.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(s.VertexToggle,{"data-testid":`scene-tree-metadata-check-${i}`,variant:"check",checked:t,disabled:n,onValueChanged:e=>a?.(e.detail)}),e.jsx("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${i}`,onClick:()=>{n||a?.(!t)},children:o})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:t,onSearchForExactMatchChange:a})=>{const o=useSceneTreeActions(),i=useSceneTreeSearchActions(),r=n.useRecoilValue(Cn),l=n.useRecoilValue(Ba),c=n.useRecoilValue(_a),d=n.useRecoilValue(Ra),m=n.useRecoilValue(Na),p=n.useRecoilValue(Oa),h=n.useRecoilValue(Va),{element:f,callback:g}=useCallbackRef(),v="scene-tree-search",b=n.useRecoilValue(jn(v)),{position:w,direction:C,handleOpen:S}=useOpenPositionedPopover({open:b,buttonElement:f,horizontalOffset:20}),V=u.useCallback((()=>{o.closeSceneTreePopover()}),[]),j=C===Pa.LEFT?"left-end":"right-start",updateSearch=async(e,t)=>{if(d){const n=c.length>0?c:[...h,va.metadataKeyName];await(r?.filterItems(d,{columns:n,exactMatch:e,removeHiddenItems:t}))}};return e.jsxs(e.Fragment,{children:[e.jsx(s.VertexTooltip,{content:"Search Options",placement:"top",children:e.jsx(s.VertexIconButton,{"data-testid":"scene-tree-search-options-popover-button",className:"text-neutral-700",ref:g,iconName:"gear",iconSize:"sm",onClick:()=>{b?V():(S(),o.openSceneTreePopover(v))}})}),b&&e.jsx(s.VertexPopover,{"data-testid":"scene-tree-search-options-popover",open:b,backdrop:!1,position:w,resizeBehavior:"fixed",placement:j,className:"z-popover",children:e.jsxs("div",{className:_e("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 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(s.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:l,disabled:0===c.length||c.every((e=>e===va.metadataKeyName)),onChange:async e=>{await i.updateMetadataSearchAfterSearchKeysChange(va.metadataKeyName,e,h,d),t?.()},children:va.label},va.metadataKeyName),h.map((n=>e.jsx(VertexSceneTreeMetadataCheck,{checked:c.includes(n),disabled:c.length>0&&c.every((e=>e===n)),onChange:async e=>{await i.updateMetadataSearchAfterSearchKeysChange(n,e,h,d),t?.()},children:n},n)))]}),e.jsxs("div",{className:"flex p-3 border-t border-neutral-300",children:[e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:m,onValueChanged:async e=>{i.setMetadataSearchExactMatch(e.detail),a?.(),await updateSearch(e.detail,p)}}),e.jsx("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]}),e.jsxs("div",{className:"flex px-3 pb-3",children:[e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"filter-remove-hidden-items-toggle",variant:"switch",checked:p,onValueChanged:async e=>{i.setMetadataSearchRemoveHiddenItems(e.detail),await updateSearch(m,e.detail)}}),e.jsx("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Search only visible items"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:t,onClearSearch:a,onExitSearchMode:o,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:l,sceneTreeSearchElement:c,children:d})=>{const m=useSceneTreeActions(),p=n.useRecoilValue(Cn),[h,f]=n.useRecoilState(Ma),[g,v]=n.useRecoilState(Ra),b=n.useRecoilValue(jn("scene-tree-search"));useSceneTreeSearch({sceneTreeElement:p??null});const{element:w,callback:C}=useCallbackRef({override:c}),S=null==g||""===g;return u.useEffect((()=>{h&&w?.setFocus()}),[w,h]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(s.VertexTooltip,{className:"self-center mr-1",content:"Exit Search",children:e.jsx(s.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"caret-left",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{f(!1),v(void 0),await(w?.clear()),await(p?.filterItems("")),b&&m.closeSceneTreePopover(),await m.flyToFirstSelectedItem(),o?.()}})}),e.jsxs(r.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:C,controller:p?.controller,onBlur:()=>{S&&(f(!1),o?.(),b&&m.closeSceneTreePopover())},onSearch:()=>{v(w?.value),t?.(w?.value)},children:[d,e.jsx(s.VertexIcon,{slot:"clear-icon",name:"close-circle-fill",size:"sm",onPointerDown:async()=>{await m.flyToFirstSelectedItem(),a?.()}})]}),e.jsx("div",{className:"self-center pl-1",onPointerDown:e=>{e.preventDefault()},children:e.jsx(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:l})})]})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:a,onSearch:o,onClearSearch:s,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:l,children:c})=>{const d=n.useRecoilValue(Ma);return e.jsxs(r.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[d&&e.jsx(VertexSceneTreeSearchBar,{onSearch:o,onClearSearch:s,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:l,children:c}),!d&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})};function useCacheableLoadable(e,t){const a=o.useRef(),[s,i]=o.useState(0),r=n.useRecoilValueLoadable(e);o.useEffect((()=>{"hasValue"===r.state&&(a.current=r.contents)}),[t,r]);const[l,c]=o.useMemo((()=>"hasValue"!==r.state&&null!=a.current?[a.current,!0]:"hasValue"===r.state?[r.contents,!1]:[void 0,!1]),[r.state,r.contents,s]),d=o.useCallback((()=>{a.current=void 0,i(s+1)}),[s]),u=undefined;return o.useMemo((()=>({data:l,state:r.state,cached:c,invalidate:d})),[d,l,c,r.state])}const VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const a=useSceneTreeActions(),o=useSceneTreeColumnActions(),i=useSceneTreeSearchActions(),l=undefined;useSceneTreePartialResults({sceneTreeElement:n.useRecoilValue(Cn)??null});const c=n.useRecoilValue(Ra),d=n.useRecoilValue(wa),m=useCacheableLoadable(Sa),p=d.length>0?d:m.data,h=n.useRecoilValue(Va),f=n.useRecoilValue(Ea),[g,v]=u.useState(h),[b,w]=u.useState(""),{element:C,callback:S}=useCallbackRef(),V="scene-tree-columns",j=n.useRecoilValue(jn(V)),{position:k,direction:T,handleOpen:A}=useOpenPositionedPopover({open:j,buttonElement:C}),P=u.useCallback((()=>{a.closeSceneTreePopover()}),[]),I=T===Pa.LEFT?"left-end":"right-start",M=u.useMemo((()=>{if(null!=p){const e=p.filter((e=>g.indexOf(e)<0)),t=undefined;return[...[...g].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[g,p]),E=u.useMemo((()=>M),[j,p]);return e.jsxs(e.Fragment,{children:[e.jsx(s.VertexTooltip,{content:"Configure Columns",placement:"top",children:e.jsx(s.VertexIconButton,{"data-testid":"scene-tree-column-popover-button",ref:S,iconName:"columns-add",iconSize:"sm",onClick:()=>{j?P():(A(),a.openSceneTreePopover(V))}})}),j&&e.jsx(s.VertexPopover,{"data-testid":"scene-tree-column-popover",open:j,backdrop:!1,position:k,resizeBehavior:"fixed",placement:I,className:"z-popover",children:e.jsxs("div",{className:_e("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!j}),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(s.VertexIconButton,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{w(""),P()}})]}),e.jsx(s.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&&w(t.toLowerCase())}}),f&&e.jsx(r.VertexSceneTreeNotificationBanner,{"data-testid":"partial-key-list-notification-banner",message:"loading"===m.state?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>o.refreshKeyList()}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:va.label}),E.filter((e=>""===b||e.toLowerCase().includes(b))).map((t=>e.jsx(VertexSceneTreeMetadataCheck,{checked:g.includes(t),disabled:g.length>=6&&!g.includes(t),onChange:e=>{v(e?[...g,t]:g.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:()=>v([]),children:"Clear selection"}),e.jsx("div",{className:"flex-grow"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(s.VertexButton,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{w(""),P()},children:"Cancel"}),e.jsx(s.VertexButton,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await i.updateMetadataSearchAfterColumnVisibilityChange(h,g,c),await o.setActive(g),t?.(g),w(""),P()},children:"Apply"})]})]})]})})]})};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(Cn),o=n.useRecoilValue(Ra),i=n.useRecoilValue(La),r=undefined,l=`${i} ${1===i?"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:`${l}`}),e.jsx(s.VertexTooltip,{className:"w-auto",content:"Select Results",placement:"top",children:e.jsx(s.VertexButton,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=a&&null!=o&&(await a.selectFilteredItems(o),t.toggleLastSelectWasMultiSelect(!0))},children:e.jsxs("div",{className:"flex h-6 items-center gap-1",children:[e.jsx(s.VertexIcon,{size:"sm",name:"check-circle"}),e.jsx("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(Cn);return e.jsx(s.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(s.VertexIcon,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{t?.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=n.useRecoilValue(Cn);return e.jsx(s.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(s.VertexIcon,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{t?.expandAll()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:t})=>{const a=n.useRecoilValue(Ra),o=null==a||""===a;return e.jsx(r.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,{}),!o&&e.jsx(VertexSceneTreeSearchInformationForToolbar,{}),e.jsx("div",{className:"ml-auto",children:e.jsx(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:t})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:o,onVisibleSceneTreeColumnsChange:s,children:i})=>{const r=null!=i&&!1!==i;return e.jsx("div",{slot:"header",className:"flex flex-col",children:r?i:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:o,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:s})]})})};function useMetadataActions(){const e=useActionCallback((({snapshot:e,set:t})=>async n=>{const a=undefined;if(await e.getPromise(la(n)))return;t(la(n),!0);const o=await e.getPromise(oa(n));if(null!=o?.metadata){const e=[...o.metadata];t(sa(n),(t=>[...t,...e]))}const s=o?.cursor;t(ia(n),s),t(la(n),!1)}));return{fetchInitialMetadata:useActionCallback((({snapshot:t})=>async n=>{const a=undefined;0===(await t.getPromise(sa(n))).length&&await e(n)})),fetchNextMetadata:useActionCallback((()=>async t=>{await e(t)}))}}var Wa={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),a=o,s=_interopRequireDefault(a),i,r=_interopRequireDefault(l);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){function InfiniteScroll(e){_classCallCheck(this,InfiniteScroll);var t=_possibleConstructorReturn(this,(InfiniteScroll.__proto__||Object.getPrototypeOf(InfiniteScroll)).call(this,e));return t.scrollListener=t.scrollListener.bind(t),t.eventListenerOptions=t.eventListenerOptions.bind(t),t.mousewheelListener=t.mousewheelListener.bind(t),t}return _inherits(InfiniteScroll,e),n(InfiniteScroll,[{key:"componentDidMount",value:function componentDidMount(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function componentDidUpdate(){if(this.props.isReverse&&this.loadMore){var e=this.getParentElement(this.scrollComponent);e.scrollTop=e.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function isPassiveSupported(){var e=!1,t={get passive(){e=!0}};try{document.addEventListener("test",null,t),document.removeEventListener("test",null,t)}catch(e){}return e}},{key:"eventListenerOptions",value:function eventListenerOptions(){var e=this.props.useCapture;return e=this.isPassiveSupported()?{useCapture:this.props.useCapture,passive:!0}:{passive:!1}}},{key:"setDefaultLoader",value:function setDefaultLoader(e){this.defaultLoader=e}},{key:"detachMousewheelListener",value:function detachMousewheelListener(){var e=window;!1===this.props.useWindow&&(e=this.scrollComponent.parentNode),e.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function detachScrollListener(){var e=window;!1===this.props.useWindow&&(e=this.getParentElement(this.scrollComponent)),e.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),e.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function getParentElement(e){var t=this.props.getScrollParent&&this.props.getScrollParent();return null!=t?t:e&&e.parentNode}},{key:"filterProps",value:function filterProps(e){return e}},{key:"attachScrollListener",value:function attachScrollListener(){var e=this.getParentElement(this.scrollComponent);if(this.props.hasMore&&e){var t=window;!1===this.props.useWindow&&(t=e),t.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),t.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),t.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}}},{key:"mousewheelListener",value:function mousewheelListener(e){1!==e.deltaY||this.isPassiveSupported()||e.preventDefault()}},{key:"scrollListener",value:function scrollListener(){var e=this.scrollComponent,t=window,n=this.getParentElement(e),a=void 0;if(this.props.useWindow){var o=document.documentElement||document.body.parentNode||document.body,s=void 0!==t.pageYOffset?t.pageYOffset:o.scrollTop;a=this.props.isReverse?s:this.calculateOffset(e,s)}else a=this.props.isReverse?n.scrollTop:e.scrollHeight-n.scrollTop-n.clientHeight;a<Number(this.props.threshold)&&e&&null!==e.offsetParent&&(this.detachScrollListener(),this.beforeScrollHeight=n.scrollHeight,this.beforeScrollTop=n.scrollTop,"function"==typeof this.props.loadMore&&(this.props.loadMore(this.pageLoaded+=1),this.loadMore=!0))}},{key:"calculateOffset",value:function calculateOffset(e,t){return e?this.calculateTopPosition(e)+(e.offsetHeight-t-window.innerHeight):0}},{key:"calculateTopPosition",value:function calculateTopPosition(e){return e?e.offsetTop+this.calculateTopPosition(e.offsetParent):0}},{key:"render",value:function render(){var e=this,t=this.filterProps(this.props),n=t.children,a=t.element,o=t.hasMore;t.initialLoad;var i=t.isReverse,r=t.loader;t.loadMore,t.pageStart;var l=t.ref;t.threshold,t.useCapture,t.useWindow,t.getScrollParent;var c=_objectWithoutProperties(t,["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","ref","threshold","useCapture","useWindow","getScrollParent"]);c.ref=function(t){e.scrollComponent=t,l&&l(t)};var d=[n];return o&&(r?i?d.unshift(r):d.push(r):this.defaultLoader&&(i?d.unshift(this.defaultLoader):d.push(this.defaultLoader))),s.default.createElement(a,c,d)}}]),InfiniteScroll}(a.Component);c.propTypes={children:r.default.node.isRequired,element:r.default.node,hasMore:r.default.bool,initialLoad:r.default.bool,isReverse:r.default.bool,loader:r.default.node,loadMore:r.default.func.isRequired,pageStart:r.default.number,ref:r.default.func,getScrollParent:r.default.func,threshold:r.default.number,useCapture:r.default.bool,useWindow:r.default.bool},c.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,ref:null,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null,getScrollParent:null},t.default=c,e.exports=t.default}(Wa,Wa.exports);var Ga=Wa.exports;const CopyButton=({id:t,textToCopy:n,iconSize:a,disableTooltip:i,onCopyValue:r})=>{const[l,c]=o.useState(!1),d=undefined,u=useDebouncedCallback((()=>{c(!1)}),2e3);return e.jsx(s.VertexTooltip,{className:"h-fit self-center z-[16000]",content:l?"Copied to Clipboard":"Copy",placement:"bottom",disabled:i,children:e.jsx("div",{className:_e({"text-green-700":l}),children:e.jsx(s.VertexIconButton,{className:"ml-auto","data-testid":`${t}-copy-button`,iconName:l?"check":"copy",iconSize:a??"xs",onClick:e=>{e.stopPropagation(),e.preventDefault(),null!=n&&(navigator.clipboard.writeText(n),r?.(n)),c(!0),u(!0)},style:{"--hover-box-shadow":"none"}})})})};function MetadataPropertyValue({value:t,onCopyMetadataValue:n}){const[a,i]=o.useState(!1),r=""!==t.replace(/^\s*$/,"").trim();return r?e.jsxs("div",{className:"flex w-full border-b border-neutral-300 pl-1 pr-3","data-testid":`${t}-metadata-property`,onMouseEnter:()=>{i(!0)},onMouseLeave:()=>i(!1),children:[e.jsx(s.VertexTooltip,{className:"w-full shrink truncate pr-2 py-1.5",content:t,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t})}),a&&e.jsx(CopyButton,{id:t,textToCopy:t,onCopyValue:n})]}):e.jsx("div",{className:_e("overflow-visible border-b border-neutral-300 pl-1 pr-4 py-1.5",{"text-neutral-500":!r}),children:"--"})}const MetadataPanelContents=({sceneItemId:t,onCopyMetadataValue:a})=>{const i=useMetadataActions(),r=n.useRecoilValueLoadable(ca),l=n.useRecoilValue(sa(t)),c=n.useRecoilValue(ra(t)),d=n.useRecoilValue(la(t)),u=l?.length>0;function getMessage(){if(!d&&0===l?.length&&"hasValue"===r.state)return"This part does not contain properties"}return o.useEffect((()=>{null!=t&&i.fetchInitialMetadata(t)}),[t]),e.jsxs(e.Fragment,{children:[e.jsx(Ga,{initialLoad:!1,hasMore:c,loadMore:async()=>{c&&await i.fetchNextMetadata(t)},useWindow:!1,children:e.jsxs("div",{className:"flex w-full text-xs leading-5 grow-0",children:[e.jsx(s.VertexResizable,{className:"w-1/2 min-w-24 max-w-full shrink-0",horizontalDirection:"right",verticalDirection:"none",initialHorizontalScale:.5,parentSelector:"#metadata-panel-wrapper",horizontalSiblingSelector:"#metadata-value-column",children:e.jsx("div",{className:"flex flex-col w-full overflow-hidden whitespace-nowrap",children:l.map(((t,n)=>e.jsx(s.VertexTooltip,{className:"border-b border-neutral-300 pl-4 pr-1 py-1.5",content:t.key,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t.key})},n)))})}),e.jsx("div",{id:"metadata-value-column",className:"flex flex-col w-full min-w-24",children:l.map(((t,n)=>e.jsx(MetadataPropertyValue,{value:t.value,onCopyMetadataValue:a},n)))})]})}),!u&&e.jsx("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:getMessage()})]})},MetadataPanel=({onCopyMetadataValue:t})=>{const a=usePanelActions(),o=n.useRecoilValue(wt),i=n.useRecoilValueLoadable(ca);return e.jsxs("div",{id:"metadata-panel-wrapper","data-testid":"metadata-panel-wrapper",className:"w-full h-full flex flex-col mt-auto text-neutral-800",children:[e.jsxs("div",{className:"flex h-10 border-b border-neutral-300 p-3 pl-4 text-[0.875rem] items-center",children:["hasValue"===i.state&&e.jsx("span",{className:"flex flex-col w-full",children:e.jsx(s.VertexTooltip,{content:i.contents,children:e.jsx("div",{className:"truncate",children:i.contents||""})})}),"loading"===i.state&&e.jsx("div",{className:"flex items-center w-full h-full",children:e.jsx("div",{className:"w-1/2 h-1/2 bg-neutral-300 animate-pulse rounded"})}),e.jsx(s.VertexIcon,{className:"ml-auto cursor-pointer",onClick:a.closeSecondary,name:"close",size:"sm"})]}),e.jsxs("div",{className:"w-full h-full overflow-y-auto overflow-x-hidden",children:[null!=o&&e.jsx(MetadataPanelContents,{sceneItemId:o.id,onCopyMetadataValue:t}),null==o&&e.jsx("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:"Please select a single part or assembly to view its metadata"})]})]})},SceneTreeSecondaryPanel=({panelId:t,onCopyMetadataValue:n})=>e.jsx(s.VertexResizable,{"data-testid":"scene-tree-secondary-panel",className:"min-h-20 max-h-full flex-shrink-0 border-t border-neutral-300",horizontalDirection:"none",verticalDirection:"top",initializeWithOffset:!0,initialVerticalScale:.6,parentSelector:`#${t}`,verticalSiblingSelector:"#scene-tree-container",children:e.jsx(MetadataPanel,{onCopyMetadataValue:n})}),VertexSceneTreeCustomColumn=({label:t,rowDataBinding:a,expandToggle:s,visibilityToggle:i,isolateButton:l,modelViewsButton:c,initialWidth:d,minWidth:u})=>{const m=n.useRecoilValue(Cn);return o.useEffect((()=>{m?.invalidateRows()}),[a]),e.jsxs(r.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${t}`,initialWidth:d,minWidth:u,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${_e("truncate",{"pl-2":s,"pr-2":i})}">\n ${t}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${a}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${s?"expand-toggle":""}\n ${i?"visibility-toggle":""}\n ${l?"isolate-button":""}\n >\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=a?a:"--"}" \n placement="${i?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${a}</div>\n </div>\n </vertex-tooltip>\n\n ${c?'<div attr:style={{row.data.modelViewIndicatorStyle}}> \n <vertex-tooltip class="block w-full truncate" content="Listing Model Views" placement="bottom">\n <vertex-icon-button\n class="ml-auto mr-0.5 text-neutral-800"\n event:pointerup="{{row.data.handleShowModelViews}}"\n icon-name="views"\n icon-size="sm"\n variant="plain"\n >\n </vertex-icon-button>\n </vertex-tooltip>\n </div>':""}\n </div>\n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},t)},VertexSceneTreeMetadataColumns=({children:t})=>{const a=n.useRecoilValue(ja),o=n.useRecoilValue(ka),s=[],i=o.filter((e=>e!==va.label)).map((e=>a[e]));return null!=t?e.jsx(e.Fragment,{children:t({columns:i.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))})}):e.jsx(e.Fragment,{children:i.map(((t,n)=>{const a=s[n]??t.initialWidth;return e.jsx(VertexSceneTreeCustomColumn,{label:t.label,visibilityToggle:n===i.length-1,isolateButton:n===i.length-1,rowDataBinding:t.binding,initialWidth:a,minWidth:t.minWidth},t.label)}))})},VertexSceneTreeTableLayout=t=>{const{children:a,...s}=t,i=n.useRecoilValue(ja),l=n.useRecoilValue(ka),c=o.useMemo((()=>findChildElement(a,NameColumn)),[a]),d=o.useMemo((()=>findChildElement(a,MetadataColumns)),[a]),u=i[va.label]??va,m=l.filter((e=>e!==va.label)).map((e=>i[e]));return e.jsxs(r.VertexSceneTreeTableLayout,{"data-testid":"scene-tree-table-layout",...s,children:[c?cloneChildNodeOrFunction(c.props.children,{columnCount:l.length,initialWidth:u.initialWidth,minWidth:u.minWidth}):e.jsx(VertexSceneTreeCustomColumn,{expandToggle:!0,visibilityToggle:1===l.length,isolateButton:1===l.length,rowDataBinding:u.binding,label:u.label,initialWidth:u.initialWidth,minWidth:u.minWidth}),null!=d?cloneChildNodeOrFunction(d.props.children,{columns:m.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))}):e.jsx(VertexSceneTreeMetadataColumns,{})]})},NameColumn=({children:t})=>e.jsx(e.Fragment,{children:t}),MetadataColumns=({children:t})=>e.jsx(e.Fragment,{children:t});VertexSceneTreeTableLayout.NameColumn=NameColumn,VertexSceneTreeTableLayout.MetadataColumns=MetadataColumns;const VertexSceneTree=({id:t,font:a,backgroundColors:s,additionalLoadedMetadataProperties:i,whitelistedMetadataProperties:l,allowViewingMetadataPropertiesPanel:c,children:d,style:u,onPointerDown:m,onClick:p,onToggleSelection:h,onToggleExpansion:f,onToggleVisibility:g,onCopyMetadataValue:v,className:b,rowData:w,...C})=>{const S=usePanelActions(),V=useSceneTreeActions(),j=useSelectionActions(),k=n.useRecoilValue(ga),T=n.useRecoilValue(G),A=n.useRecoilValue(ta),P=n.useRecoilValue(Ha),I=n.useRecoilValue(_a),M=n.useRecoilValue(Na),E=n.useRecoilValue(Oa),R=n.useRecoilValue(Ra),N=null==R||""===R,O=useRecoilRef({state:Cn}),L=o.useMemo((()=>findChildElement(d,Header)),[d]),_=o.useMemo((()=>findChildElement(d,TableLayout)),[d]),B=o.useMemo((()=>findChildElement(d,ContextMenu)),[d]),wrappedExpansionHandler=(e,t,n)=>{V.toggleExpansion(e,t,n),f?.(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{V.toggleSelection(e,t,n),h?.(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{V.toggleVisibility(e,t,n),g?.(e,t,n)},handleClick=async e=>{e.altKey&&await V.flyToRow(e.clientY),p?.(e)},handlePointerDown=async e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&await j.clearSelection(),m?.(e)},D=n.useSetRecoilState(Sn),handleFirstRowRendered=e=>{D(e.target.controller),C?.onFirstRowRendered?.(e)},F=o.useMemo((()=>({metadataSearchKeys:I,exactMatch:M,removeHiddenItems:E})),[I,M,E]);useStateSyncedValue(wa,l,{transform:e=>e.sort(((e,t)=>e.localeCompare(t)))}),useStateSyncedValue(aa,c),useStateSyncedValue(Fa,i);const H=n.useRecoilValue(Nt),U=o.useCallback((e=>{e.preventDefault(),e.stopPropagation(),S.openPrimary("model-views","right")}),[S]);return e.jsxs("div",{id:"scene-tree-panel",className:"flex flex-col w-full h-full grow-0",children:[e.jsx("div",{id:"scene-tree-container",className:"flex group h-full min-h-32 overflow-auto",children:e.jsxs(r.VertexSceneTree,{id:t??"vertex-scene-tree","data-testid":"vertex-scene-tree",config:k,ref:O,className:_e("flex-1",{filtered:!N}),style:{...styleFromOptionalFont(a),...styleFromOptionalBackgroundColors(s),...u},onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:T,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{const t=w?.(e)??{};return{handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler,handleShowModelViews:U,modelViewIndicatorStyle:e?.node.id?.hex===H?.id?"display: flex;":"display: none;",...t}},searchOptions:F,metadataKeys:P,...C,onFirstRowRendered:handleFirstRowRendered,children:[L??e.jsx(VertexSceneTreeHeader,{}),_??e.jsx(VertexSceneTreeTableLayout,{}),B??e.jsx(VertexSceneTreeContextMenu,{})]})}),void 0!==A&&e.jsx(SceneTreeSecondaryPanel,{panelId:"scene-tree-panel",onCopyMetadataValue:v})]})},Header=({children:t})=>e.jsx(e.Fragment,{children:t}),TableLayout=({children:t})=>e.jsx(e.Fragment,{children:t}),ContextMenu=({children:t})=>e.jsx(e.Fragment,{children:t});VertexSceneTree.Header=Header,VertexSceneTree.TableLayout=TableLayout,VertexSceneTree.ContextMenu=ContextMenu;const VertexDecimalPlaceSelector=({onApply:t})=>{const[a,o]=n.useRecoilState(_t);return e.jsxs(s.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{o(e.detail),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,o]=n.useRecoilState(Lt);return e.jsxs(s.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{o(e.detail),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})})}function useModelViewActions(){const e=usePmiAnnotationActions(),t=useSelectionActions();return{fetchNextModelViews:useActionCallback((({snapshot:e,set:t})=>async n=>{const a=await e.getPromise(hn(n));if(null!=a){const e=a?.paging?.next;null!=e&&(t(cn(n),(e=>[...e,a])),t(rn(n),(()=>e)))}})),loadModelView:useActionCallback((({set:n,snapshot:a})=>async(o,s)=>{const i=await a.getPromiseRequired(G),r=await a.getPromiseRequired(bt);try{await(i?.modelViews?.load(o,s.id)),n(pn,{itemId:o,modelView:s}),await e.clearPmiAnnotationSelection(),0!==r.length&&await t.clearSelection(),await e.fetchInitialPmiAnnotations(s.id)}catch(e){logger_error("Failed to load model view",e)}})),clearModelView:useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;if(null!=await n.getPromise(pn)){const a=await n.getPromiseRequired(G);try{await(a?.modelViews?.unload()),t(pn),await e.clearPmiAnnotationSelection()}catch(e){logger_error("Failed to remove model view",e)}}}))}}var Ka=Object.freeze({__proto__:null,hasMoreModelViews:fn,hasMorePmiAnnotations:vn,loadedItemModelView:pn,loadedModelViews:cn,loadedPmiAnnotations:dn,modelViews:xn,modelViewsCursor:rn,modelViewsSceneItemName:mn,nextModelViews:hn,nextPmiAnnotations:gn,pmiAnnotations:yn,pmiAnnotationsCursor:ln,selectedPmiAnnotationId:bn,useModelViewActions:useModelViewActions,visiblePmiAnnotations:un});function FileWithMagnifyingGlassImage(){return e.jsx("div",{children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"160",height:"160",viewBox:"0 0 220 220",children:[e.jsx("path",{fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":".75",d:"M38.84 186.31h143.29m-155.07 5.14h176.49M1 196.58h218m-205.11 5.14h185.22m-162.74 5.13h141.84"}),e.jsx("path",{fill:"#f7fcfd",d:"m150.94 50.25 20.43 19.51a3.42 3.42 0 0 1 1 2.46v121.2a5.23 5.23 0 0 1-5.23 5.23H52.78a5.23 5.23 0 0 1-5.23-5.23V54.56a5.24 5.24 0 0 1 5.23-5.24h95.81a3.44 3.44 0 0 1 2.35.93"}),e.jsx("path",{fill:"none",stroke:"#006bad","stroke-dasharray":"3 3","stroke-linecap":"round","stroke-linejoin":"round",d:"m150.94 50.25 20.43 19.51a3.42 3.42 0 0 1 1 2.46v121.2a5.23 5.23 0 0 1-5.23 5.23H52.78a5.23 5.23 0 0 1-5.23-5.23V54.56a5.24 5.24 0 0 1 5.23-5.24h95.81a3.44 3.44 0 0 1 2.35.93"}),e.jsx("path",{d:"M79.12 123.99H110v30.88H79.12z",fill:"#e0f3f9"}),e.jsx("path",{d:"M110 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M105.4 154.87H82.17",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M80.62 154.87h-1.5v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M79.12 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M79.12 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M83.72 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M108.5 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 123.99h30.88v30.88H110z",fill:"#e0f3f9"}),e.jsx("path",{d:"M140.88 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M136.28 154.87h-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M111.5 154.87H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M114.6 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M139.38 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M140.88 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 93.11h30.88v30.88H110z",fill:"#e0f3f9"}),e.jsx("path",{d:"M140.88 122.49v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M136.28 123.99h-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M111.5 123.99H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 119.39V96.15",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 94.61v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M114.6 93.11h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M139.38 93.11h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M140.88 97.7v23.24",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M150.91 50.28a3.6 3.6 0 0 1 .86 1.22",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"none",stroke:"#006bad","stroke-dasharray":"2.87 2.87","stroke-linecap":"round","stroke-linejoin":"round",d:"M152.05 54.34v9.14a5.24 5.24 0 0 0 5.24 5.23h9.94"}),e.jsx("path",{d:"M168.67 68.71h.2a3.5 3.5 0 0 1 1.27.23M19.8 78.25l1.93 14.68-14.67 1.93",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M21.73 92.93S-2.15 82.45 4.05 54.82",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"none",stroke:"#b43296","stroke-linecap":"round","stroke-linejoin":"round",d:"M14.89 132.63h5.88v5.88h-5.88z"}),e.jsx("path",{fill:"none",stroke:"#f90","stroke-linecap":"round","stroke-linejoin":"round",d:"M174.49 36v5.88m-2.94-2.94h5.88"}),e.jsx("circle",{cx:"199.1",cy:"164.76",r:"2.45",fill:"none",stroke:"#0c0","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M109.68 25.74V11.9M87.12 29.74l-6.02-9.4m53.21 9.4 6.01-9.4",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"#eff9fc",stroke:"#006bad","stroke-linejoin":"round",d:"m140.43 139.69 7.22 5.8-8.28 10.31-7.22-5.8"}),e.jsx("circle",{cx:"110.2",cy:"124.35",r:"27.74",fill:"#e0f3f9",opacity:".7"}),e.jsx("path",{fill:"#fff",stroke:"#006bad","stroke-linejoin":"round",d:"M131.2 98.19a33.55 33.55 0 1 0 5.16 47.16 33.56 33.56 0 0 0-5.16-47.16Zm.63 43.52a27.73 27.73 0 1 1-4.26-39 27.73 27.73 0 0 1 4.26 39ZM187 173.84a29.8 29.8 0 0 1-4.19 7.52 29.3 29.3 0 0 1-7.24 6.71l-37.77-30.31a29.3 29.3 0 0 1 5-8.56 29.6 29.6 0 0 1 6.4-5.67Z"}),e.jsx("path",{fill:"none",stroke:"#fff","stroke-linecap":"round","stroke-miterlimit":"10",d:"m118.82 138.09 12.51-15.58m-38.56-3.68 6.94-8.65m-5.32 1.9 6.95-8.66m16.23 42.44 12.5-15.58"}),e.jsx("path",{fill:"#fff",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round",d:"M139.92 153.31a28.4 28.4 0 0 0-2.12 4.45m7.07-.49a38 38 0 0 0-2.35 4.28m7.3-.32c-.93 1.34-1.79 2.72-2.58 4.11m7.53-.15q-1.47 2-2.81 3.94m7.75.01-3 3.78m7.95.18c-1.07 1.24-2.16 2.45-3.26 3.61m8.21.35a54 54 0 0 1-3.49 3.44m8.44.5a37 37 0 0 1-3.72 3.26m8.67.74a29 29 0 0 1-3.95 3.09"}),e.jsx("path",{d:"m196.69 115.8-2.18 14.64 14.64 2.18",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M194.51 130.44s23.76-12 21.9-35.66",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"})]})})}function ModelViewsEmptyState({itemSelected:t}){const n=t?"There are no model views associated with this part.":"Select a part to access model views.";return e.jsxs("div",{"data-testid":"pmi-views-empty-state",className:"h-full w-full px-4 flex flex-col gap-2 justify-center items-center overflow-y-auto",children:[e.jsx(FileWithMagnifyingGlassImage,{}),e.jsx("div",{className:"text-base text-neutral-700 text-center px-3 pt-2.5 pb-1.5",children:"No Model Views"}),e.jsx("div",{className:"text-[0.8125rem] text-neutral-600 text-center px-3 pb-2.5",children:n})]})}const VertexModelViewsViewRow=({view:t,currentlyViewing:n,itemId:a,onLoadModelView:o,onClearModelView:i})=>{const r=useModelViewActions();return e.jsx("div",{"data-testid":`model-view-${t.id}`,onClick:async()=>{n?(await r.clearModelView(),i?.()):(await r.loadModelView(a,t),o?.(a,t.id))},className:_e("flex flex-col w-full h-8 p-1 pl-4 cursor-pointer text-neutral-700 text-[0.8125rem] hover:text-[var(--vertex-ui-blue-600)]",{"bg-[var(--vertex-ui-blue-200)]":n,"hover:bg-[var(--vertex-ui-blue-100)]":!n}),children:e.jsxs("div",{className:_e("flex w-full h-full items-center",{"text-neutral-900 font-extrabold":n}),children:[e.jsxs(s.VertexTooltip,{className:"flex w-20 grow","data-testid":`model-view-${t.id}-tooltip`,placement:"bottom-start",content:t.displayName,children:[e.jsx(s.VertexIcon,{name:"views",size:"sm"}),e.jsx("div",{className:"truncate mx-2",children:t.displayName}),e.jsx("span",{className:"font-normal text-neutral-700 ml-auto pr-1",children:n&&"(Viewing)"})]}),n&&e.jsx("div",{className:"ml-auto pr-1",children:e.jsx(s.VertexIconButton,{"data-testid":"model-views-clear-selection",iconSize:"sm",iconName:"close",onClick:async()=>await r.clearModelView()})})]})},t.id)};function VertexModelViewsList({itemId:t,onLoadModelView:a,onClearModelView:o}){const i=useModelViewActions(),r=n.useRecoilValue(pn),l=n.useRecoilValue(xn(t)),c=n.useRecoilValue(fn(t)),d=n.useRecoilValueLoadable(mn),u=0===l.length;return e.jsxs("div",{className:"w-full h-full flex flex-col",children:[("hasValue"!==d.state||null!=d.contents)&&e.jsxs("div",{className:"flex flex-row h-11 w-full border-b border-neutral-300 p-3 pl-4 mr-2 text-sm items-center",children:["hasValue"===d.state&&e.jsx("div",{className:"truncate items-center",children:e.jsx(s.VertexTooltip,{content:d.contents,children:e.jsx("div",{className:"truncate",children:d.contents||""})})}),"loading"===d.state&&e.jsx("div",{className:"flex items-center h-11 w-full",children:e.jsx("div",{className:"w-3/4 h-3 bg-neutral-300 animate-pulse rounded"})})]}),u&&e.jsx(ModelViewsEmptyState,{itemSelected:!0}),!u&&e.jsx("div",{className:"h-full overflow-y-auto",children:e.jsx(Ga,{hasMore:c,loadMore:()=>{i.fetchNextModelViews(t)},useWindow:!1,children:l.map((n=>{const s=r?.modelView?.id.toString(),i=s===n?.id;return e.jsx(VertexModelViewsViewRow,{view:n,currentlyViewing:i,itemId:t,onLoadModelView:a,onClearModelView:o},n.id)}))})})]})}const VertexPMIAnnotationRow=({annotation:t,checked:n,onCheckedChange:a,selected:o,onSelectedChange:i})=>e.jsxs("div",{id:`annotation-entry-${t.id}`,"data-testid":`annotation-entry-${t.displayName}`,className:_e("flex items-center w-full h-7 gap-2.5 pl-4 pr-2 cursor-default hover:text-[var(--vertex-ui-blue-600)]",{"bg-[var(--vertex-ui-blue-200)]":o,"hover:bg-[var(--vertex-ui-blue-100)]":!o}),onClick:()=>i(!o),children:[e.jsx(s.VertexToggle,{"data-testid":`annotation-entry-${t.displayName}-check`,variant:"check",checked:n,onClick:e=>e.stopPropagation(),onValueChanged:e=>{a(e.detail)}}),e.jsx("div",{className:"w-1/2 flex-grow",children:e.jsx(s.VertexTooltip,{content:t.displayName,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t.displayName})})})]}),VertexPMIAnnotationsSecondaryPanel=({modelViewId:t,parentPanelId:a,verticalSiblingId:o,sceneAnnotationOperations:i,onToggleSelectionOfPMIAnnotation:r,onToggleVisibilityOfPMIAnnotation:l})=>{const c=usePmiAnnotationActions(),d=n.useRecoilValue(G),m=n.useRecoilValue(yn(t)),p=n.useRecoilValue(vn(t)),h=n.useRecoilValue(bn),[f,g]=n.useRecoilState(un(t)),[v,b]=u.useState("");u.useEffect((()=>{t!==v&&(g(m),b(t))}),[m,v,t,g,b]);const toggleVisibilityOfAllAnnotations=e=>{e?(g(m),i?.sceneAnnotationsOperation((e=>e.show()),d)):(g([]),i?.sceneAnnotationsOperation((e=>e.hide()),d))};return e.jsx(s.VertexResizable,{"data-testid":"pmi-annotation-secondary-panel",className:"min-h-28 max-h-3/4 flex-shrink-0 border-t text-sm text-neutral-700",horizontalDirection:"none",verticalDirection:"top",initializeWithOffset:!0,initialVerticalScale:.6,parentSelector:`#${a}`,verticalSiblingSelector:`#${o}`,children:e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx("div",{className:"flex items-center w-full h-9 border-b border-[var(--vertex-ui-neutral-300)] px-4 shrink-0",children:"3D PMI"}),e.jsxs("div",{"data-testid":"display-all-annotations",className:"flex items-center w-full h-8 gap-2.5 px-4 py-1.5 cursor-default border-b border-[var(--vertex-ui-neutral-300)]",onClick:()=>{const e=m.length!==f.length;toggleVisibilityOfAllAnnotations(e)},children:[e.jsx(s.VertexToggle,{"data-testid":"display-all-annotations-check",variant:"check",checked:m.length===f.length,onClick:e=>e.stopPropagation(),onValueChanged:e=>{toggleVisibilityOfAllAnnotations(e.detail)}}),"Display All"]}),e.jsx("div",{className:"h-full overflow-y-auto text-[0.8125rem] py-1",children:e.jsx(Ga,{hasMore:p,loadMore:async()=>{p&&await c.fetchNextPmiAnnotations(t)},useWindow:!1,children:m.map(((n,a)=>e.jsx(VertexPMIAnnotationRow,{annotation:n,checked:f.includes(n),onCheckedChange:e=>{e?(g([...f,n]),i?.sceneAnnotationsOperation((e=>e.show()),d,[n.id])):(g(f.filter((e=>e!==n))),i?.sceneAnnotationsOperation((e=>e.hide()),d,[n.id])),l?.(t,n.id,e)},selected:n.id===h,onSelectedChange:async e=>{e?await c.selectPmiAnnotation(n.id,!1):await c.clearPmiAnnotationSelection(),r?.(t,n.id,e)}},a)))})})]})})},VertexModelViewsPanelSection=({onLoadModelView:t,onClearModelView:a,onToggleSelectionOfPMIAnnotation:o,onToggleVisibilityOfPMIAnnotation:s})=>{const i=useSceneAnnotationsOperations(),r=n.useRecoilValue(Nt),l=null!=r?.id,c=n.useRecoilValue(pn),d=c?.itemId===r?.id;return e.jsxs("div",{id:"model-views-panel-wrapper",className:"w-full h-full flex flex-col text-neutral-800",children:[e.jsxs("div",{"data-testid":"model-views-container",className:"group h-full flex overflow-auto min-h-29 relative",children:[l&&e.jsx(u.Suspense,{fallback:e.jsx(ModelViewsItemListLoading,{}),children:e.jsx(VertexModelViewsList,{itemId:r.id,onLoadModelView:t,onClearModelView:a})}),!l&&e.jsx(ModelViewsEmptyState,{itemSelected:!1})]}),null!=c&&d&&e.jsx(u.Suspense,{fallback:e.jsx(ModelViewsItemListLoading,{}),children:e.jsx(VertexPMIAnnotationsSecondaryPanel,{modelViewId:c.modelView.id,parentPanelId:"model-views-panel-wrapper",verticalSiblingId:"model-views-container",sceneAnnotationOperations:i,onToggleSelectionOfPMIAnnotation:o,onToggleVisibilityOfPMIAnnotation:s})})]})};function ModelViewsItemListLoading(){return e.jsxs("div",{className:"flex flex-col w-full h-full items-center justify-center text-[0.8125rem] overflow-y-auto",children:[e.jsx(s.VertexSpinner,{"data-testid":"model-views-panel-spinner",size:"lg",color:"grey"}),e.jsx("div",{className:"pt-3 px-10 text-center",children:"Loading model views for the selected part..."})]})}function VertexModelViewsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexModelViewsPanelSection,{})})}function ColorSwatchContextMenu({onRemoveCustomColor:t}){const a=useContextMenuActions(),o=useSceneItemMaterialActions(),i=n.useRecoilValue(Ge);return e.jsx(VertexContextMenu,{menuType:"color-swatch",onOpen:e=>{elementIsColorSwatch(e.target)&&a.setContextMenuItem(e.target)},openPredicate:e=>elementIsColorSwatch(e.target)&&elementHasColorAttribute(e.target),disableBackdrop:!0,children:e.jsx(s.VertexMenuItem,{"data-testid":"color-swatch-delete",onClick:async()=>{if(contextMenuItemIsElement(i)&&elementIsColorSwatch(i)){const e=i?.getAttribute("data-color-id");null!=e&&"true"===i.getAttribute("data-custom-color")?(await o.removeCustomColor(e),t?.(e)):null!=e&&"true"===i.getAttribute("data-recent-color")&&await o.removeRecentColor(e)}},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),"Delete"]})})})}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,{}),e.jsx(ColorSwatchContextMenu,{})]})}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 i=useTransformActions(),r=useCacheableLoadable(Rt),l=n.useRecoilValue(Tt),c=useCacheableLoadable(Yt(l??"")),d=o.useMemo((()=>{const e=r.data?.some((e=>null!=e?.override?.transform)),t=null!=c.data;return e||t}),[r,c]);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(s.VertexMenuItem,{"data-testid":"clear-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),t?.()},disabled:!d,children:"Clear selected transforms"}),e.jsx(s.VertexMenuItem,{"data-testid":"clear-all-transforms",onClick:async()=>{await i.clearAllTransforms(),a?.()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:t,value:a,step:s,min:i,max:r,disabled:l,testId:c,onBlur:d,onInput:u,onChange:m})=>{const p=o.useRef(null),h=n.useRecoilValue(_t),[f,g]=o.useState(!0);o.useEffect((()=>{const e=null!=p.current&&Number.isNaN(p.current.valueAsNumber),t=f||e;null!=p.current&&t?p.current.value=a?.toFixed(Number(h))??"":g(!0)}),[a]);const v=o.useCallback((e=>{g(!1),m?.(e)}),[g,m]),b=o.useCallback((e=>{g(!0),d?.(e),null!=p.current&&null!=a&&(p.current.value=a.toFixed(Number(h)))}),[d,a,g]);return e.jsxs("div",{children:[e.jsx("div",{className:"truncate rounded-md w-full",children:e.jsx("input",{ref:p,className:"w-full truncate border border-neutral-400 rounded-md px-2 py-1.5 hover:border-neutral-500 focus:border-neutral-500 focus:outline-none",type:"number",step:s,min:i,max:r,"data-testid":c,disabled:l,defaultValue:Number.isNaN(a)?"":a?.toFixed(Number(h)),onBlur:b,onInput:u,onChange:v})}),null!=t&&e.jsx("div",{className:"flex justify-center items-center pointer-events-none text-neutral-500",children:e.jsx("span",{children:t})})]})},VertexTransformInputs=({onUpdateTransform:t})=>{const a=n.useRecoilValue(Lt),o=n.useRecoilValue(Vt),s=n.useRecoilValue(St),i=o||s,r=n.useRecoilValue(Tt),{transform:l,error:c,update:d}=useEditItemTransform(r),u=i?void 0:l,m=useDebouncedCallback((async e=>{await d(e),t?.(e)}),50);function updateTransform(e){return t=>{if(null!=u){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||m?.({...u,...e(n,u)})}}}function updatePosition(e){return updateTransform(((t,n)=>({position:{...n.position,...e(t)}})))}function updateRotation(e){return updateTransform(((t,n)=>({rotation:{...n.rotation,...e(t)}})))}function updateScale(){return updateTransform((e=>e>0?{scale:e}:{}))}function updateToDefaultValueIfInvalid(e,t){return n=>{const a=parseFloat(n.currentTarget.value),o=undefined;(isNaN(a)||!!t?.(a))&&null!=u&&m(v.defaults(e,u))}}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Position"}),e.jsxs("div",{className:"flex flex-wrap w-full gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"X"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-x",value:null!=u?u.position.x:void 0,bottomLabel:a,disabled:null==u,onChange:updatePosition((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({position:{x:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Y"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-y",value:u?.position.y,bottomLabel:a,disabled:null==u,onChange:updatePosition((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({position:{y:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Z"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-z",value:u?.position.z,bottomLabel:a,disabled:null==u,onChange:updatePosition((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({position:{z:0}})})})]})]})]}),e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Rotation"}),e.jsxs("div",{className:"flex flex-wrap w-full gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"X"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-x",value:u?.rotation.x,bottomLabel:"deg",disabled:null==u,onChange:updateRotation((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{x:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Y"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-y",value:u?.rotation.y,bottomLabel:"deg",disabled:null==u,onChange:updateRotation((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{y:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Z"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-z",value:u?.rotation.z,bottomLabel:"deg",disabled:null==u,onChange:updateRotation((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{z:0}})})})]})]})]}),e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Scale"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"scale",value:u?.scale,step:.1,min:.1,disabled:null==u,onChange:updateScale(),onBlur:updateToDefaultValueIfInvalid({scale:1},(e=>e<=0))})}),i&&e.jsx("div",{className:"bg-orange-100 rounded px-3 py-2 mt-6 mb-2",children:"Input based part transformation is not yet supported for multiple parts."}),null!=c&&e.jsx("div",{className:"bg-red-100 rounded px-3 py-2 mt-6 mb-2",children:"There was a problem retrieving data. Try selecting a different part."})]})]})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const a=useTransformActions(),o=n.useRecoilValue(Ht),i=n.useSetRecoilState(Zt);return e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:o,onValueChanged:async()=>{o?(a.disableTransformWidget(),t?.(!1)):(i("world"),await a.enableTransformWidget(),t?.(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:t,onUpdateTransform:n}){return e.jsxs(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-[0.8125rem] text-neutral-700",children:"Enable manipulator"})]}),e.jsx(VertexTransformInputs,{onUpdateTransform:n})]})}function VertexTransformPanelSection({onClearTransforms:t,onClearAllTransforms:n,onToggleTransformsManipulator:a,onUpdateTransform:o}){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,onUpdateTransform:o})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const $a="Appearance",qa="Model Views",Ya="Settings",Xa="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:t})=>{const a=n.useRecoilValue(ea),o=getHeading(a,t),s="model-views"===a;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.jsxs("div",{className:"flex items-center w-full leading-6 text-md align-center font-medium text-neutral-800 gap-2",children:[o,s&&e.jsx(BetaLabel,{})]})})};function getHeading(e,t={}){switch(e){case"appearance":return $a;case"model-views":return qa;case"settings":return Ya;case"transforms":return Xa;default:const n=undefined;return(null!=e?t[e]:void 0)??"None"}}function VertexViewerRightOpenedPanel({children:t}){const a=n.useRecoilValue(ea),s=o.useMemo((()=>filterChildElements(t,CustomPanelContent)),[t]),i=o.useMemo((()=>s.reduce(((e,t)=>({...e,[t.props.panelName]:t.props.panelTitle})),{})),[s]),r=o.useMemo((()=>["appearance","model-views","settings","transforms",...s.map((e=>e.props.panelName))]),[s]);return e.jsx(e.Fragment,{children:null!=a&&r.includes(a)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{additionalHeaderMap:i}),placement:"right",children:["appearance"===a&&e.jsx(DefaultAppearancePanel,{}),"transforms"===a&&e.jsx(DefaultTransformsPanel,{}),"settings"===a&&e.jsx(DefaultSettingsPanel,{}),"model-views"===a&&e.jsx(VertexModelViewsPanel,{}),t]})})}function CustomPanelContent({panelName:t,children:a}){const o=n.useRecoilValue(ea);return e.jsx(e.Fragment,{children:o===t&&a})}function Sidebar({children:t}){return e.jsx("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:t,iconName:n,active:a,responsive:i,disabled:r,content:l,tooltipPlacement:c,children:d,onSelect:u,onDeselect:m}){return e.jsx("div",{className:_e({"text-[var(--vertex-ui-blue-700)]":a===t&&!r,"text-neutral-700 hover:text-neutral-800":a!==t&&!r,"cursor-pointer hover:bg-neutral-200":!r,"text-neutral-400":r,"rounded-full md:p-3":i,"p-3":!i&&null==d,"px-3 py-1":null!=d}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{r||(a===t?m():u())},children:e.jsxs(s.VertexTooltip,{placement:c??void 0,content:o.isValidElement(l)?void 0:l,children:[e.jsx("div",{slot:"content",children:l}),e.jsx("div",{className:"flex flex-col",children:d??e.jsx(s.VertexIcon,{name:n})})]})})}function VertexViewerRightSidebar({children:t}){const a=usePanelActions(),o=useTransformActions(),s=n.useRecoilValue(ea);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:[t,e.jsx(SidebarIcon,{name:"appearance",active:s,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{a.openPrimary("appearance","right")},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:s,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{a.openPrimary("transforms","right"),await o.enableTransformWidget(void 0,!0)},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"model-views",active:s,iconName:"views",tooltipPlacement:"right",content:"Model Views",onSelect:async()=>{a.openPrimary("model-views","right")},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:s,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{a.openPrimary("settings","right")},onDeselect:()=>a.closePrimary("right")})]})})}function CustomPanelIcon(t){const a=usePanelActions(),o=n.useRecoilValue(ea),{panelName:s,tooltipContent:i,iconName:r,...l}=t;if(null==r&&null==l.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e.jsx(SidebarIcon,{...l,name:s,iconName:r??"help",active:o,content:i,onSelect:()=>{a.openPrimary(t.panelName,"right")},onDeselect:()=>{a.closePrimary("right")}})}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=({open:t,children:n,...a})=>{const o=n.find((e=>e.type===Anchor)),i=n.filter((e=>e.type!==Anchor));return null==o?e.jsx(e.Fragment,{}):e.jsxs(s.VertexPopover,{className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(t),...a,children:[o,e.jsx("div",{className:_e("flex mb-1.5",{hidden:!t}),"data-testid":"align-plane-popover-menu",children:i})]})},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(s.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu({disabled:t}){const a=useCrossSectioningActions(),o=n.useRecoilValue(Ve),i=n.useRecoilValue(xe),getBaseIcon=()=>`align-to-${i?.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:a.cancelCurrentHit,addPredicate:()=>i?.hitPending??!1,cancelPredicate:()=>!i?.hitPending},[i?.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(o),onDismissed:a.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(s.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:o?a.closeAlignmentTools:a.openAlignmentTools,disabled:t,children:e.jsx(s.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(r.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(s.VertexIconButton,{iconColor:"secondary",onClick:()=>a.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(s.VertexIconButton,{iconColor:"secondary",onClick:()=>a.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({disabled:t}){const a=useCrossSectioningActions(),i=n.useRecoilValue(je),l=n.useRecoilValue(he),c=n.useRecoilValueLoadable(ve),d=o.useMemo((()=>{const e=l.length>0&&"hasValue"===c.state?axis(l[0],xAxis(c.contents),yAxis(c.contents),zAxis(c.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[c.state,c.contents,l]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:a.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(s.VertexIconButton,{onClick:i?a.closeAxisTools:a.openAxisTools,iconName:d,"data-testid":"align-plane-icon",iconColor:"secondary",disabled:t,children:e.jsx(s.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(r.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(s.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:()=>a.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(s.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:()=>a.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(s.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:()=>a.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,disabled:a,onOffsetChange:i}){const r=n.useRecoilValue(Lt),l=n.useRecoilValue(_t),[c,d]=o.useState(convertTo(t,r));o.useEffect((()=>{d(convertTo(t,r))}),[r,t]);const u=createDistanceFormatter(r,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(c+e,r);i(t)},handleSubmit=e=>{e.preventDefault(),i(convertFrom(c,r))},handleBlur=()=>{i(convertFrom(c,r))};return e.jsx(s.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(s.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=>{d(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,disabled:a,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>{a||handleIncrementalUpdate(-1)},children:e.jsx(s.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>{a||handleIncrementalUpdate(1)},children:e.jsx(s.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Za=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(Se),i=n.useRecoilValueLoadable(we),l=n.useRecoilValueLoadable(Ce),c=o.useRef(),d=o.useMemo((()=>"hasValue"===i.state&&Number.isFinite(i.contents.max)&&Number.isFinite(i.contents.min)),[i.state,i.contents]),u=o.useMemo((()=>"hasValue"===i.state?i.contents:ie),[i.state,i.contents]),m=o.useMemo((()=>"hasValue"===l.state&&Number.isFinite(l.contents)?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(c.current),c.current=window.setTimeout((()=>{t.endInteraction()}),Za),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(s.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(r.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,{disabled:!d}),e.jsx(s.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(s.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary",disabled:!d})}),e.jsx(s.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(s.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary",disabled:!d})}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{disabled:!d}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:m,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==i.state)||!d,min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state&&d?l.contents:0,disabled:!d,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),a=n.useRecoilValue(re);return e.jsxs(e.Fragment,{children:[e.jsx(s.VertexTooltip,{content:a?"Hide Section":"Show Section",children:e.jsx(s.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(s.VertexTooltip,{content:"Fit All",children:e.jsx(s.VertexIconButton,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(t?.scene());await(e?.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[i,r]=n.useRecoilState(Y),[l,c]=n.useRecoilState(q);return o.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(s.VertexTooltip,{content:"Pan",children:e.jsx(s.VertexIconButton,{iconName:"pan",iconColor:"pan"===i?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(r("pan"),null!=l){const e=await l;e?.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[i,r]=n.useRecoilState(Y),[l,c]=n.useRecoilState(q);return o.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(s.VertexTooltip,{content:"Rotate",children:e.jsx(s.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===i?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(r("rotate"),null!=l){const e=await l;e?.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[i,r]=n.useRecoilState(Y),[l,c]=n.useRecoilState(q);return o.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(s.VertexTooltip,{content:"Zoom",children:e.jsx(s.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===i?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(r("zoom"),null!=l){const e=await l;e?.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(r.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(r.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=({endCapEnabledByDefault:t,children:a})=>{const s=n.useSetRecoilState(ue),i=n.useSetRecoilState(de);o.useEffect((()=>{null!=t&&(s(t),i(t))}),[t]);const l=null!=a&&!1!==a;return e.jsx(r.VertexViewerToolbar,{placement:"bottom-center",children:l?e.jsx(r.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:a}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:s,onRotationChange:i}){const l=useTransformActions(),c=n.useRecoilValue($t),d=n.useRecoilValue(Ht),u=n.useRecoilValue(Ut),m=n.useRecoilValue(Kt),p=n.useRecoilValueLoadable(Gt),h=n.useRecoilValue(Lt),f=n.useRecoilValue(_t),g=o.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=o.useMemo((()=>{const e=undefined;return d&&(null!=g||c)}),[d,g,c]);return e.jsx(e.Fragment,{children:v&&e.jsx(r.VertexViewerTransformWidget,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:u,rotation:null!=u?g:void 0,decimalPlaces:parseInt(f,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:a??!0,onInteractionStarted:()=>{l.disableSelectionSync(),l.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{l.invalidateTransforms(),l.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await l.setTransformWidgetPosition(e.detail),s?.(e.detail)},onRotationChanged:e=>{l.setTransformWidgetOrientation(e.detail),i?.(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const a=useCrossSectioningActions(),o=useModelViewActions(),i=useSelectionActions(),r=useTransformActions(),l=useViewerSceneActions(),c=n.useSetRecoilState(Nt),handleReset=async()=>{await a.disable(),await i.resetSelectionState(),r.clearTransformWidgetPosition(),await r.invalidateTransforms(),c(void 0),await o.clearModelView(),t?.(),await l.reset()};return e.jsx(s.VertexTooltip,{content:"Reset View",children:e.jsx(s.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 o=await n.getPromise(Pt);t(Z,a.detail.scene),t(Pt,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(At,o);const s=undefined;await n.getPromise(Ht)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:a}=useCallbackRef(),o=useBoxSelectionActions(),s=useTransformActions(),i=n.useRecoilValue(Xe);return u.useEffect((()=>{const e=whenComponentReady(t,(()=>[t?.model?.onDragComplete((()=>{"clearAndSelect"===i&&(s.clearTransformWidgetOrientation(),s.clearTransformWidgetPosition(),s.enableSelectionSync())}))]));return()=>{e?.then((e=>{e?.forEach((e=>e?.dispose()))}))}}),[t,i]),useApplyKeyBinding({keyBind:"Shift",fn:u.useCallback((()=>o.setOperationType("select")),[]),off:u.useCallback((()=>o.setOperationType("clearAndSelect")),[])}),e.jsx(r.VertexViewerBoxQueryTool,{ref:a,"data-testid":"viewer-box-query-tool",operationType:i})};function VertexViewerCameraTypeMenu({open:t,onOpen:a,onDismiss:o,onCameraTypeChange:i}){const r=useViewerCameraActions(),l=n.useRecoilValue(W);return e.jsxs(s.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:o,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:_e("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(s.VertexTooltip,{content:"Change View",children:e.jsx(s.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===l?"cube-orthographic":"cube-perspective",children:e.jsx(s.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(s.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{r.updateCameraType("perspective",!0),i?.("perspective")},children:[e.jsx(s.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:_e({"text-[var(--vertex-ui-blue-700)]":"perspective"===l})}),e.jsx("div",{className:_e("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===l}),children:"Perspective"})]}),e.jsxs(s.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{r.updateCameraType("orthographic",!0),i?.("orthographic")},children:[e.jsx(s.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:_e({"text-[var(--vertex-ui-blue-700)]":"orthographic"===l})}),e.jsx("div",{className:_e("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===l}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=({placement:t,children:n,...a})=>{const s=Array.isArray(n)?n:[n],i=s.filter((e=>!o.isValidElement(e)||e.type!==r.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),l=s.find((e=>o.isValidElement(e)&&e.type===r.VertexViewerViewCube)),[c,d]=o.useState(!1);return e.jsxs(r.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:t??"top-right",children:[l??e.jsx(r.VertexViewerViewCube,{className:"m-7",...a}),0===i.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:c,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e.jsx("div",{className:"mt-3",children:i})]})},VertexViewer=({id:t,src:a,className:s,disableSelection:i,onTap:l,onLongpress:c,onFrameDrawn:d,onSceneReady:u,viewerRefCallback:m,children:p,...h})=>{const f=n.useRecoilValue(ga),g=useRecoilRef({state:G}),v=useViewerCameraActions(),b=useCrossSectioningActions(),w=useHitActions(),C=useSelectionActions(),S=useViewerFrameActions(),V=n.useRecoilValue(W),j=n.useRecoilValue(xe),k=n.useRecoilValue(Ye),T=n.useSetRecoilState(X),[A,P]=n.useRecoilState($);o.useEffect((()=>{A&&(P(!1),b.disable())}),[a]);const[I,M]=n.useRecoilState(K);o.useEffect((()=>{null!=t&&M(t)}),[t]);const E=n.useRecoilValue(ma),R=o.useMemo((()=>({opacity:E/100})),[E]),N=n.useRecoilValue(ze),O=n.useRecoilValue(Fe),L=o.useMemo((()=>({color:N,width:O})),[N,O]),_=n.useRecoilValue(ue),B=n.useRecoilValue(me),D=n.useRecoilValue(pe),F=o.useMemo((()=>({endCapEnabled:_,endCapUsePartColor:B===ne.PART,..._&&B===ne.SINGLE&&{endCapColor:D}})),[_,B,D]),H=n.useRecoilValue(qn),U=n.useRecoilValue(Wn),q=n.useRecoilValue(Gn),Y=n.useRecoilValue(Kn),Z=o.useMemo((()=>({color:U,opacity:q/100,lineWidth:Y})),[U,q,Y]),J=n.useRecoilValue(nt),Q=null!=p&&!1!==p;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(r.VertexViewer,{id:I,"data-testid":"vertex-viewer",src:a,ref:e=>{m?.(e),g(e)},className:_e("flex w-full h-full",s,{"cursor-crosshair":j.hitPending}),style:{"--viewer-background":H},config:f,cameraType:A?V:void 0,onCameraTypeChanged:e=>{A&&v.updateCameraType(e.detail,!1)},phantom:R,featureLines:L,selectionHighlighting:Z,crossSectioning:F,featureMaps:J?"final":void 0,onTap:e=>{const t=[...i?[]:[C.selectCurrentHit]];w.tap(e,...t),l?.(e)},onLongpress:e=>{w.longPress(e),c?.(e)},onFrameDrawn:e=>{S.frameDrawn(e),d?.(e)},onSceneReady:async e=>{if(!A){P(!0);const t=await(e?.target?.scene());T(t?.sceneViewId)}u?.(e)},...h,children:[k&&e.jsx(VertexBoxSelectionTool,{}),Q?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:a})=>{const s=n.useRecoilValue(on),i=n.useRecoilValue(Tn);return o.useEffect((()=>{t?.(s)}),[s,t]),o.useEffect((()=>{a?.(i)}),[i,a]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=({override:t,autoDefineCustomElements:a,children:s,config:i,...r})=>(o.useEffect((()=>{(null==a||a)&&(d.defineCustomElements(),c.defineCustomElements())}),[a]),e.jsx(n.RecoilRoot,{override:t,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,{...r}),e.jsx(VertexViewerToolkitRootConfig,{config:i,children:s})]})})),VertexViewerToolkitRootConfig=({config:t,children:a})=>{const s=n.useSetRecoilState(ga);return o.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;s(e)}),[t,s]),e.jsx(e.Fragment,{children:a})};var Ja=Object.freeze({__proto__:null,get AssemblyFontFace(){return za},Columns:Ia,Core:kn,Metadata:Ua,Search:Da});exports.Appearance=Yn,exports.BoxSelection=Ze,exports.Config=ya,exports.ContextMenu=qe,exports.CrossSection=Ne,exports.Ghosting=fa,exports.Hits=sn,exports.Keybinding=Jn,exports.Measurement=pt,exports.Messages=H,exports.Metadata=da,exports.ModelViews=Ka,exports.Panel=na,exports.Performance=ft,exports.SceneTree=Ja,exports.SceneViewItem=Ot,exports.Selection=An,exports.Settings=Bt,exports.Transforms=an,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.VertexModelViewsPanel=VertexModelViewsPanel,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.VertexSceneItemMaterialColorSwatches=VertexSceneItemMaterialColorSwatches,exports.VertexSceneItemMaterialOpacitySlider=VertexSceneItemMaterialOpacitySlider,exports.VertexSceneTree=VertexSceneTree,exports.VertexSceneTreeColumnPopover=VertexSceneTreeColumnPopover,exports.VertexSceneTreeContextMenu=VertexSceneTreeContextMenu,exports.VertexSceneTreeCustomColumn=VertexSceneTreeCustomColumn,exports.VertexSceneTreeHeader=VertexSceneTreeHeader,exports.VertexSceneTreeMetadataColumns=VertexSceneTreeMetadataColumns,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.VertexShowPropertiesMenuItem=VertexShowPropertiesMenuItem,exports.VertexToolbar=VertexToolbar,exports.VertexToolbarDivider=VertexToolbarDivider,exports.VertexTransformClear=VertexTransformClear,exports.VertexTransformControls=VertexTransformControls,exports.VertexTransformInputs=VertexTransformInputs,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,exports.Viewer=Q;
|
|
18
|
+
*/jn=Vn,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}jn.exports?(classNames.default=classNames,jn.exports=classNames):window.classNames=classNames}();var kn=Vn.exports;const VertexSlider=({value:t,defaultValue:n,leftLabel:a,rightLabel:s,onChange:r,onValueChange:l,onValueInput:c,...d})=>{const[u,m]=o.useState(n);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[a&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:a}),e.jsx(i.VertexSlider,{className:kn("w-full",{"mt-0.5":null!=a||null!=s}),value:t??u,onValueChange:e=>{m(e.detail.value),r?.(e.detail.value),l?.(e)},onValueInput:e=>{m(e.detail.value),r?.(e.detail.value),c?.(e)},...d}),s&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:s})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const a=useCrossSectioningActions(),[o,s]=n.useRecoilState(ce);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:o,valueLabelDisplay:"auto",onValueInput:async e=>{s(e.detail.value),await a.reapply()},onValueChange:e=>{t?.(e.detail.value)}})},VertexEndCapColorOptions=({onUpdateColorType:t})=>{const[a,o]=n.useRecoilState(me);return e.jsx("div",{className:"pl-2 text-sm text-neutral-700",children:e.jsxs(i.VertexRadioGroup,{value:a,"data-testid":"end-capping-color-type-radio-group",name:"end-capping-color-type",onValueChanged:e=>{o(e.detail.toUpperCase()===ne.PART?ne.PART:ne.SINGLE),t?.(e.detail)},children:[e.jsx(i.VertexRadio,{"data-testid":"end-capping-color-part-color",label:"Part Color",value:ne.PART}),e.jsx(i.VertexRadio,{"data-testid":"end-capping-color-single-color",label:"Single Color",value:ne.SINGLE})]})})},VertexEndCapColorPicker=({onUpdateCustomColor:t})=>{const[a,o]=n.useRecoilState(pe);return e.jsx(VertexColorPicker,{"data-testid":"end-capping-color-picker",value:a,onValueChanged:e=>{t?.(e.detail)},onInput:e=>o(e)})},VertexEndCapToggle=({onEnabledChange:t})=>{const[a,o]=n.useRecoilState(ue);return e.jsx(i.VertexToggle,{className:"flex items-center","data-testid":"end-capping-enabled-toggle",variant:"switch",checked:a,onValueChanged:async e=>{o(e.detail),t?.(e.detail)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:a,onEndCapEnabledChange:o,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:i}){const r=n.useRecoilValue(me);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center pt-2 pb-2",children:[e.jsx(VertexEndCapToggle,{onEnabledChange:o}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Show End Cap"})]}),e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Line 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:a}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Cap Color"}),e.jsx(VertexEndCapColorOptions,{onUpdateColorType:s}),r===ne.SINGLE&&e.jsx("div",{className:"mt-2",children:e.jsx(VertexEndCapColorPicker,{onUpdateCustomColor:i})})]})]})}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(),[o,s]=n.useRecoilState(le),[r,l]=n.useRecoilState(ce),c=n.useRecoilValue(de),[d,u]=n.useRecoilState(ue),[m,p]=n.useRecoilState(me),[h,f]=n.useRecoilState(pe),g=o!==ae||1!==r||d!==c||m!==ne.PART||h!==se;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()=>{s(ae),l(1),u(c),p(ne.PART),f(se),t?.(),await a.reapply()},disabled:!g})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a,onEndCapEnabledChange:o,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:i}){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,onEndCapEnabledChange:o,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:i})})}const Tn=.5,An="#444444",Pn=n.atom({key:"featureEdgesSelectedColor",default:An}),In=n.atom({key:"featureEdgesLineThickness",default:Tn}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Pn);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:a,onValueChanged:e=>{t?.(e.detail)},onInput:e=>o(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState(In);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=>{o(e.detail.value)},onValueChange:e=>{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,o]=n.useRecoilState(Pn),[s,r]=n.useRecoilState(In),l=s!==Tn||a!==An;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:()=>{o(An),r(Tn),t?.()},disabled:!l})})})};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 createColorMaterialWithId(e,t=j.create()){return{id:t,...s.ColorMaterial.fromHex(e)}}const Mn=255,En=18,Rn=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),Nn=n.atom({key:"sceneItemAdjustmentsRecentColors",default:[]}),On=n.atom({key:"sceneItemAdjustmentsCustomColors",default:[createColorMaterialWithId("#ffffff"),createColorMaterialWithId("#616161")]}),Ln=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),_n=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),Bn=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),Dn=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Be);if(null!=t)return e(_n(t.id))}}),zn=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),Fn=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),Hn=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Bn);t(Rn),n.forEach((e=>t(_n(e)))),t(Bn)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(Rn,t)})),saveRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Nn),o=[n,...a.filter((e=>e!==n))],s=o.length>En?o.slice(0,-(o.length-En)):o;e(Rn,n),e(Nn,s)})),removeRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=(await t.getPromise(Nn)).filter((e=>e.id!==n));e(Nn,o)})),setCustomColors:useActionCallback((({set:e})=>async t=>{e(On,t)})),saveCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=[...await t.getPromise(On),n],s=o.length>En?o.slice(o.length-En):o;e(Rn,n),e(On,s)})),removeCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=(await t.getPromise(On)).filter((e=>e.id!==n));e(On,o)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(Rn)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(Ln)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const o=await t.getPromise(_e);a(Rn),o.forEach((e=>a(_n(e)))),n(Bn,(e=>e.filter((e=>!o.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(Ln,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(Rn),o=await t.getPromise(Ln),s=await t.getPromise(_e),i=await t.getPromise(Dn),r=a??i,l=o??i?.opacity;if(null!=r){const t={...r,opacity:l??r.opacity};await e.execute(Ne.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),s.forEach((e=>n(_n(e),t))),n(Bn,(e=>[...e,...s]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(Hn,!0),e(zn,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(Hn),e(zn)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(Rn),o=await t.getPromise(Ln);if(null!=a){const s=await t.getPromise(Bn),i={...a,opacity:o??a.opacity};await e.execute(Ne.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(i))),s.forEach((e=>n(_n(e))));const r=await t.getPromise(zn);r?.(i),n(Hn),n(zn)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Fn,!1)}))}},Wn="#ffff00",Un=35,Gn=1,Kn=n.atom({key:"selectionHighlightingSelectedColor",default:Wn}),$n=n.atom({key:"selectionHighlightingSelectedOpacity",default:Un}),qn=n.atom({key:"selectionHighlightingSelectedLineThickness",default:1});function elementIsColorSwatch(e){return e instanceof Element&&"VERTEX-COLOR-SWATCH"===e.nodeName}function elementHasColorAttribute(e){return"true"===e.getAttribute("data-custom-color")||"true"===e.getAttribute("data-recent-color")}const Yn="#FFFFFF",Xn=n.atom({key:"viewerBackgroundSelectedColor",default:Yn});var Zn=Object.freeze({__proto__:null,DEFAULT_FEATURE_EDGE_COLOR:An,DEFAULT_FEATURE_EDGE_THICKNESS_VALUE:Tn,DEFAULT_SELECTION_HIGHLIGHTING_COLOR:Wn,DEFAULT_SELECTION_HIGHLIGHTING_LINE_THICKNESS:1,DEFAULT_SELECTION_HIGHLIGHTING_OPACITY:Un,DEFAULT_VIEWER_BACKGROUND_COLOR:Yn,MAXIMUM_MATERIAL_OVERRIDE_OPACITY:Mn,MAX_STORED_COLOR_ARRAY_LENGTH:En,appliedItemMaterialOverride:_n,appliedItemMaterialOverrideIds:Bn,applyMaterialToAllUserAction:zn,confirmApplyMaterialToAllDialogOpen:Hn,elementHasColorAttribute:elementHasColorAttribute,elementIsColorSwatch:elementIsColorSwatch,featureEdgesLineThickness:In,featureEdgesSelectedColor:Pn,sceneItemAdjustmentsCustomColors:On,sceneItemAdjustmentsLastSelectedOverride:Dn,sceneItemAdjustmentsRecentColors:Nn,sceneItemAdjustmentsSelectedColor:Rn,sceneItemAdjustmentsSelectedOpacity:Ln,selectionHighlightingSelectedColor:Kn,selectionHighlightingSelectedLineThickness:qn,selectionHighlightingSelectedOpacity:$n,showConfirmDialogWhenApplyingMaterialToAll:Fn,useSceneItemMaterialActions:useSceneItemMaterialActions,viewerBackgroundSelectedColor:Xn});const VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValueLoadable(Dn),s=n.useRecoilValue(Rn),r=n.useRecoilValue(Fn),l=u.useMemo((()=>"hasValue"===o.state?s??o.contents:s),[o,s]);return e.jsx(i.VertexTooltip,{content:"Apply to All",children:e.jsx(i.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==l,onClick:async()=>{r?a.confirmApplyAll(t):(await a.applyAll(),t?.(l))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),a=n.useRecoilValue(Hn),[s,r]=o.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),r(!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:s,onValueChanged:e=>{r(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(),s&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValueLoadable(Dn),s=n.useRecoilValue(Rn),i=u.useMemo((()=>"hasValue"===o.state?s??o.contents:s),[o,s]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=i?f.toHexString(i.diffuse):void 0,onValueChanged:async()=>{null!=i&&(await a.apply(),t?.(i),await a.saveRecentColor(createColorMaterialWithId(f.toHexString(i.diffuse))))},onInput:async e=>{a.updateColor(createColorMaterialWithId(e)),await a.apply()}})},ColorSwatch=({color:t,hideTooltip:n,onClick:a,...o})=>{const s="string"==typeof t?t:f.toHexString(t.diffuse);return e.jsx(i.VertexTooltip,{className:"flex-grow-0",content:s,disabled:!!n,children:e.jsx("button",{onClick:()=>a?.(t),children:e.jsx(i.VertexColorSwatch,{"data-testid":`color-swatch-${s}`,variant:"square",color:s,...o})})})},VertexSceneItemMaterialColorSwatches=({onAddCustomColor:t,onApplyCustomColor:a,onApplyRecentColor:o})=>{const s=useSceneItemMaterialActions(),r=n.useRecoilValue(On),l=n.useRecoilValue(Nn),c=r.length===En;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"appearance-custom-colors",className:"flex flex-wrap gap-2 mt-1 mb-4",children:[r.map((t=>e.jsx(ColorSwatch,{color:t,onClick:async()=>{s.updateColor(t),await s.apply(),a?.(t)},"data-custom-color":!0,"data-color-id":t.id},t.id))),!c&&e.jsx(i.VertexColorPicker,{"data-testid":"appearance-custom-colors-add",variant:"swatch",size:"md",onValueChanged:async e=>{const n=createColorMaterialWithId(e.detail);await s.saveCustomColor(n),await s.apply(),t?.(n)},children:e.jsx("div",{slot:"overlay",className:"flex items-center justify-center w-full h-full",children:e.jsx(i.VertexIcon,{className:"bg-white p-2",name:"plus",size:"sm"})})})]}),!!l.length&&e.jsx("div",{"data-testid":"appearance-recent-colors",className:"flex flex-wrap gap-2",children:l.map((t=>e.jsx(ColorSwatch,{color:t,onClick:async()=>{s.updateColor(t),await s.apply(),o?.(t)},"data-recent-color":!0,"data-color-id":t.id},t.id)))})]})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValue(Ln),s=n.useRecoilValueLoadable(Dn),r=u.useMemo((()=>"hasValue"===s.state?o??s.contents?.opacity??Mn:o??Mn),[o,s]),l=useDebouncedCallback((()=>{a.apply()}),500),c=u.useCallback((e=>{a.updateOpacity(e.detail.value),l(e.detail.value)}),[l,a]),d=u.useMemo((()=>"hasValue"!==s.state||null==s.contents),[s]);return e.jsx(i.VertexTooltip,{className:"flex w-full",content:d?"Select a part and apply a color to enable opacity":`${Math.floor(r/Mn*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:d,value:r??Mn,step:5,min:0,max:Mn,onValueChange:e=>{a.updateOpacity(e.detail.value),a.apply(),t?.(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({customColors:t,onApplyMaterial:a,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:r,onApplyRecentColor:l,onApplyOpacity:c}){const d=useSceneItemMaterialActions(),u=n.useRecoilValue(Be);return o.useEffect((()=>{d.clearCurrentColor(),d.clearCurrentOpacity()}),[u?.id]),o.useEffect((()=>{if(null!=t){const e=t.map((e=>({...e,id:j.create()})));d.setCustomColors(e)}}),[t]),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:a}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:s})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Color Swatches"}),e.jsx(VertexSceneItemMaterialColorSwatches,{onAddCustomColor:i,onApplyCustomColor:r,onApplyRecentColor:l}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSceneItemMaterialOpacitySlider,{onApply:c}),e.jsx(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:t,tooltip:n,children:a})=>{const[s,r]=o.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:s,placement:"bottom",children:e.jsxs(i.VertexButton,{className:kn("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":s}),"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 o=useSceneItemMaterialActions(),s=n.useRecoilValue(Ye);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:()=>{o.clear(),t?.()},disabled:!s,children:"Clear selected materials"}),e.jsx(i.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{o.clearAll(),a?.()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({customColors:t,onClearMaterial:n,onClearAllMaterials:a,onApplyMaterial:o,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:r,onApplyRecentColor:l,onApplyOpacity:c}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Material",e.jsx(VertexSceneItemMaterialClear,{onClear:n,onClearAll:a})]}),children:e.jsx(VertexMaterialControls,{customColors:t,onApplyMaterial:o,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:r,onApplyRecentColor:l,onApplyOpacity:c})})}const VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Kn);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:a,onValueChanged:e=>{t?.(e.detail)},onInput:e=>o(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState(qn);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=>{o(e.detail.value)},onValueChange:e=>{t?.(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState($n);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=>{o(e.detail.value)},onValueChange:e=>{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,o]=n.useRecoilState(Kn),[s,r]=n.useRecoilState($n),[l,c]=n.useRecoilState(qn),d=a!==Wn||s!==Un||1!==l;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:()=>{o(Wn),r(Un),c(1),t?.()},disabled:!d})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:o}){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:o})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Xn);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:a,onValueChanged:e=>{t?.(e.detail)},onInput:e=>o(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,o]=n.useRecoilState(Xn),s=a!==Yn;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:()=>{o(Yn),t?.()},disabled:!s})})})};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,o=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,s=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,i=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,r=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||o||s||i||r},useRecoilReducer=({reducer:e,atom:t})=>{const a=undefined,o=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},Jn=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){switch(t.type){case"push-key-binding":const n=e.bindings[t.binding.keyBind]?.find((e=>e.id===t.binding.id));return null!=n?e:{...e,bindings:{...e.bindings,[t.binding.keyBind]:[...e.bindings[t.binding.keyBind]??[],t.binding]}};case"remove-key-binding":const a=e.bindings[t.binding.keyBind]?.find((e=>e.id===t.binding.id));return null==a?e:{...e,bindings:{...e.bindings,[t.binding.keyBind]:(e.bindings[t.binding.keyBind]??[]).filter((e=>e.id!==t.binding.id))}};case"add-apply-key-binding":return{...e,applyBindings:[...e.applyBindings,t.binding]};case"remove-apply-key-binding":return{...e,applyBindings:e.applyBindings.filter((e=>e.id!==t.id))};case"set-key-pressed":return{...e,applyBindings:e.applyBindings.map((t=>({...t,active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:{...e.pressed,[t.key]:t.pressed},lastPressed:t.pressed?t.key:void 0}}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Jn}),useKeyBindingReadonlyState=()=>n.useRecoilValue(Jn);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=>null!=e.keyBind&&null!=n&&e.keyBind?.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();o.useEffect((()=>{const a=j.create();return n({type:"add-apply-key-binding",binding:{...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();o.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(),s=o.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,{...n.pressed,[e]:!0}))).forEach((e=>{const t=n.bindings[e],o=t.length>0?t[t.length-1]:void 0;null!=o&&(o.fn(),a({type:"remove-key-binding",binding:o}))}))}),[n]);o.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),s(e.key);const t={...n.pressed,[e.key]:!0},o=matchingSingleFnBindings(n.applyBindings,t,e.key),i=matchingOffBindings(n.applyBindings,t,e.key);(o.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)}}),[s,n.applyBindings,n.pressed]),o.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]),o.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(st);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})})},Qn=1,VertexResizableContent=({className:t,style:n,displayShadow:a,heading:o,id:s,initialScale:r,placement:l="left",children:c,onResize:d,...u})=>{const m="left"===l||"right"===l,p="top"===l;function getHorizontalResizeDirection(){switch(l){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===l?"top":"none"}const h=null!=r?r:1;return e.jsx(i.VertexResizable,{id:s,"data-testid":`resizable-content-position-${l}`,className:kn(t,"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"===l,"sidebar-shadow-right":"left"===l&&a,"border-l min-w-75 max-w-half":"right"===l,"sidebar-shadow-left":"right"===l&&a,"border-t bottom-0 fixed":"top"===l,"min-h-12 sheet":p}),style:{maxHeight:"top"===l?window.innerHeight:void 0,...n},initialHorizontalScale:m?r:void 0,initialVerticalScale:p?h:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===l||"top"===l?"absolute":"relative",onResizeEnd:()=>d?.(),...u,children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===l&&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:kn("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===l}),children:c})]})})};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(G),n=await(t?.scene()),a={milliseconds:500};await(n?.camera().viewAll().render({animation:a}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:o}){const[s,i]=u.useState(),[r,l]=u.useState();u.useEffect((()=>{const handleTouchStart=e=>{const o=e;null!=o.touches&&1===o.touches.length&&(null!=s&&clearTimeout(s),l(a.Point.create(o.touches[0].clientX,o.touches[0].clientY)),i(setTimeout((()=>t?.(o)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=s&&null!=r&&a.Point.distance(r,a.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(s),o?.())},handleTouchEnd=()=>{null!=s&&clearTimeout(s)};return e?.addEventListener("touchstart",handleTouchStart),e?.addEventListener("touchmove",handleTouchMove),e?.addEventListener("touchend",handleTouchEnd),()=>{e?.removeEventListener("touchstart",handleTouchStart),e?.removeEventListener("touchmove",handleTouchMove),e?.removeEventListener("touchend",handleTouchEnd)}}),[e,s,r])}var ea=Object.freeze({__proto__:null,isInputElement:isInputElement,keyBindings:Jn,reducer:reducer,useApplyKeyBinding:useApplyKeyBinding,useDefaultKeybindings:useDefaultKeybindings,useKeyBindingReadonlyState:useKeyBindingReadonlyState,useKeyBindings:useKeyBindings,useLongPress:useLongPress,useStackKeyBinding:useStackKeyBinding});function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:a,disableBackdrop:s,openPredicate:r,onOpen:l,onClose:c,children:d})=>{const u=useContextMenuActions(),m=n.useRecoilValue(Je),p=n.useRecoilValue(at),h=o.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=m===a;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:u.clearActiveContextMenu,addPredicate:()=>null!=m&&m===a,cancelPredicate:()=>null==m},[m]);const g=o.useMemo((()=>null!=t?t:null!=r?window:void 0),[t,r]);return useLongPress({target:g,callback:e=>u.longPress(e,a,r,l),onMovement:()=>u.clearActiveContextMenu()}),o.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&m===a){const t=targetShouldSkipNextHit(e);u.clearActiveContextMenu(t)}};if(s)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[s,a,m]),o.useEffect((()=>{const handlePointerDown=e=>{u.pointerDown(e)},handlePointerUp=e=>{u.pointerUp(e,a,r,l)},handleContextMenu=e=>u.contextMenu(e,r);return g?.addEventListener("pointerdown",handlePointerDown),g?.addEventListener("pointerup",handlePointerUp),g?.addEventListener("contextmenu",handleContextMenu),()=>{g?.removeEventListener("pointerdown",handlePointerDown),g?.removeEventListener("pointerup",handlePointerUp),g?.removeEventListener("contextmenu",handleContextMenu)}}),[t,a,r]),e.jsx("div",{className:kn({hidden:!f}),children:e.jsx(i.VertexMenu,{"data-testid":`${a}-context-menu`,open:asBooleanAttribute(f),position:p,fallbackPlacements:h,backdrop:!s,onMenuClosed:()=>{u.clearActiveContextMenu(),c?.()},children:e.jsx("div",{className:"pt-1",children:d})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(_e),a=n.useRecoilValue(Ke),o=useViewerCameraActions();return e.jsx(i.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:async()=>{null!=a?.boundingBox&&await o.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),"Fit Selected"]})})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),a=n.useRecoilValue(tt);return e.jsx(i.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:async()=>{const e=undefined,n=contextMenuItemIsRow(a)?a?.node.id?.hex:a?.id;null!=n&&await t.flyToById(n)},disabled:asBooleanAttribute(null==a),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),"Fly To"]})})};function useSceneItemsOperations(){const e=n.useRecoilValue(G),t=undefined,a=undefined,s=undefined,i=undefined,r=undefined,l=undefined;return{sceneItemsOperation:o.useCallback((async(t,n)=>{const a=await(e?.scene());null==n?await(a?.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(a?.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:o.useCallback((async()=>{const t=await(e?.scene());t?.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withSelected())).show()])).execute()}),[e]),hideSelected:o.useCallback((async()=>{const t=await(e?.scene());t?.items((e=>[e.where((e=>e.withSelected())).hide()])).execute()}),[e]),showOnlyItem:o.useCallback((async t=>{const n=await(e?.scene());n?.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withItemIds([t]))).show()])).execute()}),[e]),ghostSelected:o.useCallback((async()=>{const t=await(e?.scene());t?.items((e=>[e.where((e=>e.withSelected())).setPhantom(!0)])).execute()}),[e]),unGhostSelected:o.useCallback((async()=>{const t=await(e?.scene());t?.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsx(i.VertexMenuItem,{"data-testid":"hide-all-menu-option",onClick:async()=>{await t.sceneItemsOperation((e=>e.hide()))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide All Parts"]})})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(tt),a=useSceneItemsOperations();return e.jsx(i.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:async()=>{const e=undefined,n=contextMenuItemIsRow(t)?t?.node.id?.hex:t.id;null!=n&&await a.sceneItemsOperation((e=>e.hide()),[n])},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Part"]})})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(_e),a=useSceneItemsOperations();return e.jsx(i.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Selected"]})})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsx(i.VertexMenuItem,{"data-testid":"show-all-menu-option",onClick:async()=>{await t.sceneItemsOperation((e=>e.show()))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show All Parts"]})})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(tt),a=useSceneItemsOperations();return e.jsx(i.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:async()=>{const e=undefined,n=contextMenuItemIsRow(t)?t?.node.id?.hex:t?.id;null!=n&&await a.showOnlyItem(n)},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Part"]})})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(_e),a=useSceneItemsOperations();return e.jsx(i.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Selected"]})})},ta=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),na=n.atom({key:"openedPanelActivePrimaryRight",default:void 0}),aa=n.atom({key:"openedPanelActiveSceneTreeSecondary",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?ta:na,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?ta:na,void 0)})),openSecondary:useActionCallback((({set:e})=>t=>e(aa,t))),closeSecondary:useActionCallback((({reset:e})=>()=>e(aa)))}}var oa=Object.freeze({__proto__:null,openedPanelActivePrimaryLeft:ta,openedPanelActivePrimaryRight:na,openedPanelActiveSceneTreeSecondary:aa,usePanelActions:usePanelActions});const VertexShowPropertiesMenuItem=()=>{const t=usePanelActions(),a=useSelectionActions(),o=n.useRecoilValue(tt);return e.jsx(i.VertexMenuItem,{"data-testid":"show-properties-menu-option",disabled:asBooleanAttribute(null==o),onClick:()=>{const e=undefined,n=contextMenuItemIsRow(o)?o?.node.id?.hex:o?.id;null!=n&&(a.clearAndSelect({id:n}),t.openSecondary("Properties"))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"info",size:"sm"}),"Show Properties"]})})};function fromApiProperty(e){return{key:e.key?.name??"",value:apiMetadataPropertyDisplayValue(e.value)}}function apiMetadataPropertyDisplayValue(e){let t="";switch(e?.type){case"string":t=e.value??t;break;case"long":case"double":t=e.value.toString()??t;break;case"timestamp":t=e.value.seconds.toLocaleString()??t}return t}const sa=n.atom({key:"showMetadataSceneItemProperties",default:!0}),ia=n.selectorFamily({key:"nextMetadataSceneItemProperties",get:e=>async({get:t})=>{const n=t(G),a=t(la(e));try{const t=await(n?.sceneItems?.listSceneItemMetadata(e,{cursor:a,size:20})),o=t?.entries?.map((e=>fromApiProperty(e))),s=undefined;return{metadata:null!=o?[...o]?.sort(((e,t)=>e.key>t.key?1:-1)):void 0,cursor:t?.paging.next}}catch(t){return void logger_debug(`Error encountered get metadata for scene item. [itemId={${e}}]`,t)}}}),ra=n.atomFamily({key:"loadedMetadataSceneItemProperties",default:[]}),la=n.atomFamily({key:"metadataSceneItemPropertiesCursor",default:void 0}),ca=n.selectorFamily({key:"hasMoreMetadataSceneItemProperties",get:e=>({get:t})=>{const n=undefined;return null!=t(la(e))}}),da=n.atomFamily({key:"isFetchingMetadataSceneItemProperties",default:!1}),ua=n.selector({key:"metadataSceneItemName",get:async({get:e})=>{const t=e(Be);if(null!=t){const n=e(an(t.id));return n?.name??void 0}}});var ma=Object.freeze({__proto__:null,apiMetadataPropertyDisplayValue:apiMetadataPropertyDisplayValue,fromApiProperty:fromApiProperty,hasMoreMetadataSceneItemProperties:ca,isFetchingMetadataSceneItemProperties:da,loadedMetadataSceneItemProperties:ra,metadataSceneItemName:ua,metadataSceneItemPropertiesCursor:la,nextMetadataSceneItemProperties:ia,showMetadataSceneItemProperties:sa});const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(_e),a=useSceneItemsOperations();return e.jsx(i.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),"Ghost Selected"]})})};function BetaLabel({children:t,label:n="Beta",placement:a="end",borderColor:o="border-purple-400",textColor:s="text-purple-500"}){return e.jsxs("div",{className:"flex items-center",children:[t,e.jsx("div",{className:kn(`flex border ${o} rounded-md px-1.5 text-xs ${s} uppercase items-center justify-center ml-2 select-none max-h-5`,{"ml-auto":"end"===a}),style:{height:"fit-content"},children:n})]})}const VertexShowModelViewsMenuItem=()=>{const t=usePanelActions(),a=useSelectionActions(),o=n.useRecoilValue(tt);return e.jsx(i.VertexMenuItem,{"data-testid":"viewer-show-model-views",disabled:asBooleanAttribute(null==o),onClick:async()=>{const e=undefined,n=contextMenuItemIsRow(o)?o?.node.id?.hex:o?.id;null!=n&&(t.openPrimary("model-views","right"),a.selectForModelViewsPanel({id:n}))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"views",size:"sm"}),e.jsxs("div",{className:"flex gap-2",children:["Show Model Views ",e.jsx(BetaLabel,{})]})]})})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(_e),a=useSceneItemsOperations();return e.jsx(i.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Unghost Selected"]})})},DefaultSceneTreeContextMenu=()=>{const t=n.useRecoilValue(sa);return 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,{}),e.jsx(i.VertexMenuDivider,{}),t&&e.jsx(VertexShowPropertiesMenuItem,{}),e.jsx(VertexShowModelViewsMenuItem,{})]})},VertexSceneTreeContextMenu=({children:t})=>{const a=useSceneTreeActions(),o=n.useRecoilValue(Tt),s=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:o,onOpen:async(e,t)=>{const n=e;await a.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:s?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>{const t=n.useRecoilValue(sa);return 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,{}),e.jsx(i.VertexMenuDivider,{}),t&&e.jsx(VertexShowPropertiesMenuItem,{}),e.jsx(VertexShowModelViewsMenuItem,{})]})},VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=o.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,{})})},pa=35,ha=n.atom({key:"sceneItemGhostingSelectedOpacity",default:pa}),xa=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),fa=n.atom({key:"appliedItemPhantomStateIds",default:[]}),ga=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{const t=e(Be);return null!=t&&(e(xa(t.id))??!1)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[a,o]=n.useRecoilState(ha);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=>{o(e.detail.value)},onValueChange:e=>{t?.(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(fa)).forEach((e=>t(xa(e)))),t(fa)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const o=await t.getPromise(_e);o.forEach((e=>n(xa(e),a))),n(fa,(e=>[...e,...o])),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 o=await t.getPromise(_e);o.forEach((e=>a(xa(e)))),n(fa,(e=>e.filter((e=>!o.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}};var ya=Object.freeze({__proto__:null,DEFAULT_GHOSTING_OPACITY:pa,appliedItemPhantomState:xa,appliedItemPhantomStateIds:fa,sceneItemGhostingLastSelectedPhantom:ga,sceneItemGhostingSelectedOpacity:ha,useSceneItemPhantomActions:useSceneItemPhantomActions});const VertexSceneItemGhostingToggle=({onApply:t})=>{const a=useSceneItemPhantomActions(),o=n.useRecoilValue(Ye),s=n.useRecoilValueLoadable(ga);return e.jsx(i.VertexTooltip,{content:"Select a part to display as ghost",disabled:o,children:e.jsx(i.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!o,checked:"hasValue"===s.state&&s.contents,onValueChanged:async e=>{await a.setPhantomState(e.detail),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 o=useSceneItemPhantomActions(),s=n.useRecoilValue(ga);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 o.clearPhantomState(),t?.()},disabled:!s,children:"Clear ghosting for selected"}),e.jsx(i.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await o.clearAllPhantomState(),a?.()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:a,onApplyOpacity:o}){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:o})})}function VertexMeasurementContextMenu({onDelete:t}){const a=n.useRecoilValue(et);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"})]})})}function useDockedPlacement(e,t){const[n,o]=u.useState(a.Point.create(0,0));return u.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),s=a.Point.create(n.left,n.bottom),i=a.Point.create(n.right,n.bottom);o("left"===t?s:i)}}),[e,t]),n}function VertexMeasurementDetails({placement:t,size:a}){const o=useMeasurementActions(),s=n.useRecoilValue(G),l=n.useRecoilValue(K),c=useDockedPlacement(s??null,t),d=n.useRecoilValue(vt),u=n.useRecoilValue(bt),m=n.useRecoilValue(wt),p=n.useRecoilValue(Ct),h=n.useRecoilValue(Nt),f=n.useRecoilValue(Ot);return e.jsx(i.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${l}`,position:c,children:e.jsxs("div",{className:kn("flex flex-col min-w-40",{"text-xs leading-2":"sm"===a,"text-sm leading-4":"md"===a,"text-base leading-5":"lg"===a,"text-lg leading-5":"xl"===a}),children:[e.jsxs("div",{className:"pb-2 flex justify-between items-center",children:[e.jsx("div",{className:kn("w-full",{"text-sm leading-5":"sm"===a,"text-base leading-5":"md"===a,"text-lg leading-6":"lg"===a,"text-xl leading-7 mr-6":"xl"===a}),children:"Measurement"}),e.jsx("div",{className:kn("mr-0.5",{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:o.resetMeasurement})})})]}),e.jsx(r.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:kn("gap-y-1.5",{hidden:null==d}),measurementOutcome:d,measurementOverlays:u,distanceUnits:toUnitType(h),fractionalDigits:parseInt(f,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:kn({hidden:null==m}),children:m})]})})}function useCallbackRef(e){const[t,n]=o.useState(e?.override??null),a=undefined;return{element:t,callback:o.useCallback((t=>n(e?.override??t)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,detailsSize:a,onPointToPointMeasurementChange:s}){const i=useMeasurementActions(),l=n.useRecoilValue(G),c=n.useRecoilValue(lt),d=n.useRecoilValue(dt),u=n.useRecoilValue(Nt),m=n.useRecoilValue(Ot),{callback:p,element:h}=useCallbackRef();usePointToPointMeasurement(h);const f=o.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};i.setEditedPointToPointMeasurement(t),s?.(t)}),[i]);return c?e.jsxs(e.Fragment,{children:[e.jsx(r.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:p,viewer:l??void 0,mode:"replace",start:d?.start,end:d?.end,invalid:d?.invalid,units:toUnitType(u),fractionalDigits:parseInt(m,10),showAxisReferenceLines:!0,onEditEnd:f}),e.jsx(VertexMeasurementDetails,{placement:t,size:a}),e.jsx(VertexMeasurementContextMenu,{onDelete:i.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(lt);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 va=n.atom({key:"viewerToolkitSdkConfig",default:void 0});var ba=Object.freeze({__proto__:null,sdkConfig:va});const VertexPreciseMeasurement=({detailsPlacement:t,detailsSize:a,onEntitiesChanged:o,onOutcomeChanged:s})=>{const i=n.useRecoilValue(G),l=n.useRecoilValue(va),c=n.useRecoilValue(mt),{callback:d,element:u}=useCallbackRef();return usePreciseMeasurementModel(u,o,s),c?e.jsxs(e.Fragment,{children:[e.jsx(r.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:d,viewer:i??void 0,config:JSON.stringify({network:{apiHost:l?.network?.apiHost,renderingHost:l?.network?.renderingHost,sceneTreeHost:l?.network?.sceneTreeHost,sceneViewHost:l?.network?.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t,size:a})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(mt);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(F),a=n.useRecoilValue(D);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 wa={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 Ca=n.atom({key:"sceneTreeColumnsRefreshTrigger",default:0}),Sa=n.atom({key:"sceneTreeColumnsWhitelistedColumns",default:[]}),Va=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(At);return e(Ca),null!=t?await t.fetchMetadataKeys():[]}}),ja=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Va).filter((e=>e!==wa.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),ka=n.atom({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),Ta=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(ka),n=e(Tt),a=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{...e,[a.label]:a}}),{Name:{...wa,initialWidth:e,minWidth:n}})}return{Name:wa}}}),Aa=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Ta))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e})=>async t=>{e(ka,t)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(Ca,(e=>e+1))}))}}const Pa=16,Ia=-8;var Ma;function useOpenPositionedPopover({open:e,buttonElement:t,horizontalOffset:n,verticalOffset:a}){const[o,s]=u.useState(),[i,r]=u.useState(),l=undefined;return{position:o,direction:i,handleOpen:u.useCallback((()=>{if(!e){const e=t?.getBoundingClientRect();if(null!=e){const t=n??Pa,o=a??Ia,i=e.x>window.innerWidth/2?Ma.LEFT:Ma.RIGHT;s({x:i===Ma.LEFT?e.left-t:e.right+t,y:e.top+o}),r(i)}}}),[e,t])}}!function(e){e.LEFT="left",e.RIGHT="right"}(Ma||(Ma={}));var Ea=Object.freeze({__proto__:null,DEFAULT_HORIZONTAL_POSITION_OFFSET:Pa,DEFAULT_NAME_COLUMN:wa,DEFAULT_VERTICAL_POSITION_OFFSET:Ia,get PlacementDirection(){return Ma},mapToColumn:mapToColumn,sceneTreeColumnsActiveColumnNames:Aa,sceneTreeColumnsActiveColumns:Ta,sceneTreeColumnsAvailableColumns:Va,sceneTreeColumnsAvailableSortedColumns:ja,sceneTreeColumnsRefreshTrigger:Ca,sceneTreeColumnsVisibleMetadataColumnNames:ka,sceneTreeColumnsWhitelistedColumns:Sa,useOpenPositionedPopover:useOpenPositionedPopover,useSceneTreeColumnActions:useSceneTreeColumnActions});const Ra=n.atom({key:"sceneTreeSearchActive",default:!1}),Na=n.atom({key:"sceneTreeColumnsPartial",default:!1}),Oa=n.atom({key:"sceneTreeSearchValue",default:void 0}),La=n.atom({key:"sceneTreeSearchExactMatch",default:!1}),_a=n.atom({key:"sceneTreeSearchRemoveHiddenItems",default:!1}),Ba=n.atom({key:"sceneTreeSearchResultCount",default:0}),Da=n.atom({key:"sceneTreeSearchActiveColumns",default:[]}),za=n.selector({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(Da);return 0===t.length||t.includes(wa.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),a=n.useRecoilValue(Ra),s=n.useSetRecoilState(Ba),i=n.useSetRecoilState(We);o.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=e?.controller?.stateChanged((e=>{void 0!==e?.totalFilteredRows&&s(e?.totalFilteredRows)}))})),()=>{t?.dispose()}}),[e]),o.useEffect((()=>{if(null!=e){let n;return whenComponentReady(e,(()=>{n=e?.controller?.stateChanged((e=>{if(null!=e?.filterTerm){const t=e?.rows.find((e=>e?.node?.selected));i(t?.node.id?.hex)}else a&&t.flyToFirstSelectedItem()}))})),()=>{n?.dispose()}}}),[e,e?.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=n.useSetRecoilState(Na);o.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=e?.controller?.stateChanged((e=>{t(!!e?.isPartialKeysResponse)}))})),()=>{n?.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(Da,t)})),t=useActionCallback((({snapshot:t})=>async(n,a,o,s)=>{const i=await t.getPromise(Tt),r=await t.getPromise(La),l=await t.getPromise(_a),c=await t.getPromise(Da),d=c.length>0?a?[...c,n]:c.filter((e=>e!==n)):[...o,wa.metadataKeyName].filter((e=>e!==n));e(d),s&&i?.filterItems(s,{columns:d,exactMatch:r,removeHiddenItems:l})})),n=useActionCallback((({snapshot:e,set:t})=>async(n,a,o)=>{const s=await e.getPromise(Tt),i=await e.getPromise(La),r=await e.getPromise(_a),l=await e.getPromise(Da),c=n.filter((e=>!a.includes(e))),d=a.filter((e=>!n.includes(e))),u=l.length>0?[...l.filter((e=>!c.includes(e))),...d]:[...a,wa.metadataKeyName],m=u.length>0?u:[...a,wa.metadataKeyName];t(Da,m),o&&s?.filterItems(o,{columns:m,exactMatch:i,removeHiddenItems:r})})),a=useActionCallback((({set:e})=>t=>{e(La,t)})),o=useActionCallback((({set:e})=>t=>{e(_a,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:a,setMetadataSearchRemoveHiddenItems:o}};var Fa=Object.freeze({__proto__:null,sceneTreeColumnsPartial:Na,sceneTreeSearchActive:Ra,sceneTreeSearchActiveColumns:Da,sceneTreeSearchExactMatch:La,sceneTreeSearchNameColumnActive:za,sceneTreeSearchRemoveHiddenItems:_a,sceneTreeSearchResultCount:Ba,sceneTreeSearchValue:Oa,useSceneTreePartialResults:useSceneTreePartialResults,useSceneTreeSearch:useSceneTreeSearch,useSceneTreeSearchActions:useSceneTreeSearchActions});const 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 Ha;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=e?.depthColors,n=null!=t?Object.keys(t).reduce(((e,n)=>({...e,[`--scene-tree-row-background-color-depth-${n}`]:t[parseInt(n)]})),{}):{};return null!=e?{...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===Ha.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Ha||(Ha={}));const Wa=n.atom({key:"sceneTreeAdditionalMetadataKeys",default:[]}),Ua=n.selector({key:"sceneTreeActiveMetadataKeys",get:({get:e})=>{const t=e(Wa),n=e(ka),a=e(Sa),o=new Set([...t,...n]),s=new Set(a);return 0===a.length?Array.from(o):Array.from(o.intersection(s))}});var Ga=Object.freeze({__proto__:null,sceneTreeActiveMetadataKeys:Ua,sceneTreeAdditionalMetadataKeys:Wa});function childrenAsArray(e){return Array.isArray(e)?e:[e]}function filterChildElements(e,t){return childrenAsArray(e).filter((e=>o.isValidElement(e)&&e.type===t))}function findChildElement(e,t){return filterChildElements(e,t)[0]}function cloneChildNodeOrFunction(e,t){return"object"==typeof e?o.cloneElement(e,t):e(t)}function useStateSyncedValue(e,t,{transform:a}={}){const[s,i]=n.useRecoilState(e);return o.useEffect((()=>{null!=t&&i(null!=a?a(t):t)}),[t]),s}const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const a=n.useSetRecoilState(Ra);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),t?.()}})})},VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:a,children:o})=>{const s="string"==typeof o?o.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(i.VertexToggle,{"data-testid":`scene-tree-metadata-check-${s}`,variant:"check",checked:t,disabled:n,onValueChanged:e=>a?.(e.detail)}),e.jsx("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${s}`,onClick:()=>{n||a?.(!t)},children:o})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:t,onSearchForExactMatchChange:a})=>{const o=useSceneTreeActions(),s=useSceneTreeSearchActions(),r=n.useRecoilValue(Tt),l=n.useRecoilValue(za),c=n.useRecoilValue(Da),d=n.useRecoilValue(Oa),m=n.useRecoilValue(La),p=n.useRecoilValue(_a),h=n.useRecoilValue(ka),{element:f,callback:g}=useCallbackRef(),v="scene-tree-search",b=n.useRecoilValue(It(v)),{position:w,direction:C,handleOpen:S}=useOpenPositionedPopover({open:b,buttonElement:f,horizontalOffset:20}),V=u.useCallback((()=>{o.closeSceneTreePopover()}),[]),j=C===Ma.LEFT?"left-end":"right-start",updateSearch=async(e,t)=>{if(d){const n=c.length>0?c:[...h,wa.metadataKeyName];await(r?.filterItems(d,{columns:n,exactMatch:e,removeHiddenItems:t}))}};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",className:"text-neutral-700",ref:g,iconName:"gear",iconSize:"sm",onClick:()=>{b?V():(S(),o.openSceneTreePopover(v))}})}),b&&e.jsx(i.VertexPopover,{"data-testid":"scene-tree-search-options-popover",open:b,backdrop:!1,position:w,resizeBehavior:"fixed",placement:j,className:"z-popover",children:e.jsxs("div",{className:kn("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 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:l,disabled:0===c.length||c.every((e=>e===wa.metadataKeyName)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(wa.metadataKeyName,e,h,d),t?.()},children:wa.label},wa.metadataKeyName),h.map((n=>e.jsx(VertexSceneTreeMetadataCheck,{checked:c.includes(n),disabled:c.length>0&&c.every((e=>e===n)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(n,e,h,d),t?.()},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:m,onValueChanged:async e=>{s.setMetadataSearchExactMatch(e.detail),a?.(),await updateSearch(e.detail,p)}}),e.jsx("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]}),e.jsxs("div",{className:"flex px-3 pb-3",children:[e.jsx(i.VertexToggle,{className:"flex items-center","data-testid":"filter-remove-hidden-items-toggle",variant:"switch",checked:p,onValueChanged:async e=>{s.setMetadataSearchRemoveHiddenItems(e.detail),await updateSearch(m,e.detail)}}),e.jsx("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Search only visible items"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:t,onClearSearch:a,onExitSearchMode:o,onSearchedSceneTreeColumnsChange:s,onSearchForExactMatchChange:l,sceneTreeSearchElement:c,children:d})=>{const m=useSceneTreeActions(),p=n.useRecoilValue(Tt),[h,f]=n.useRecoilState(Ra),[g,v]=n.useRecoilState(Oa),b=n.useRecoilValue(It("scene-tree-search"));useSceneTreeSearch({sceneTreeElement:p??null});const{element:w,callback:C}=useCallbackRef({override:c}),S=null==g||""===g;return u.useEffect((()=>{h&&w?.setFocus()}),[w,h]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(i.VertexTooltip,{className:"self-center mr-1",content:"Exit Search",children:e.jsx(i.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"caret-left",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{f(!1),v(void 0),await(w?.clear()),await(p?.filterItems("")),b&&m.closeSceneTreePopover(),await m.flyToFirstSelectedItem(),o?.()}})}),e.jsxs(r.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:C,controller:p?.controller,onBlur:()=>{S&&(f(!1),o?.(),b&&m.closeSceneTreePopover())},onSearch:()=>{v(w?.value),t?.(w?.value)},children:[d,e.jsx(i.VertexIcon,{slot:"clear-icon",name:"close-circle-fill",size:"sm",onPointerDown:async()=>{await m.flyToFirstSelectedItem(),a?.()}})]}),e.jsx("div",{className:"self-center pl-1",onPointerDown:e=>{e.preventDefault()},children:e.jsx(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:s,onSearchForExactMatchChange:l})})]})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:a,onSearch:o,onClearSearch:s,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:l,children:c})=>{const d=n.useRecoilValue(Ra);return e.jsxs(r.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[d&&e.jsx(VertexSceneTreeSearchBar,{onSearch:o,onClearSearch:s,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:l,children:c}),!d&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})};function useCacheableLoadable(e,t){const a=o.useRef(),[s,i]=o.useState(0),r=n.useRecoilValueLoadable(e);o.useEffect((()=>{"hasValue"===r.state&&(a.current=r.contents)}),[t,r]);const[l,c]=o.useMemo((()=>"hasValue"!==r.state&&null!=a.current?[a.current,!0]:"hasValue"===r.state?[r.contents,!1]:[void 0,!1]),[r.state,r.contents,s]),d=o.useCallback((()=>{a.current=void 0,i(s+1)}),[s]),u=undefined;return o.useMemo((()=>({data:l,state:r.state,cached:c,invalidate:d})),[d,l,c,r.state])}const VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const a=useSceneTreeActions(),o=useSceneTreeColumnActions(),s=useSceneTreeSearchActions(),l=undefined;useSceneTreePartialResults({sceneTreeElement:n.useRecoilValue(Tt)??null});const c=n.useRecoilValue(Oa),d=n.useRecoilValue(Sa),m=useCacheableLoadable(ja),p=d.length>0?d:m.data,h=n.useRecoilValue(ka),f=n.useRecoilValue(Na),[g,v]=u.useState(h),[b,w]=u.useState(""),{element:C,callback:S}=useCallbackRef(),V="scene-tree-columns",j=n.useRecoilValue(It(V)),{position:k,direction:T,handleOpen:A}=useOpenPositionedPopover({open:j,buttonElement:C}),P=u.useCallback((()=>{a.closeSceneTreePopover()}),[]),I=T===Ma.LEFT?"left-end":"right-start",M=u.useMemo((()=>{if(null!=p){const e=p.filter((e=>g.indexOf(e)<0)),t=undefined;return[...[...g].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[g,p]),E=u.useMemo((()=>M),[j,p]);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:S,iconName:"columns-add",iconSize:"sm",onClick:()=>{j?P():(A(),a.openSceneTreePopover(V))}})}),j&&e.jsx(i.VertexPopover,{"data-testid":"scene-tree-column-popover",open:j,backdrop:!1,position:k,resizeBehavior:"fixed",placement:I,className:"z-popover",children:e.jsxs("div",{className:kn("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!j}),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:()=>{w(""),P()}})]}),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&&w(t.toLowerCase())}}),f&&e.jsx(r.VertexSceneTreeNotificationBanner,{"data-testid":"partial-key-list-notification-banner",message:"loading"===m.state?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>o.refreshKeyList()}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:wa.label}),E.filter((e=>""===b||e.toLowerCase().includes(b))).map((t=>e.jsx(VertexSceneTreeMetadataCheck,{checked:g.includes(t),disabled:g.length>=6&&!g.includes(t),onChange:e=>{v(e?[...g,t]:g.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:()=>v([]),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:()=>{w(""),P()},children:"Cancel"}),e.jsx(i.VertexButton,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await s.updateMetadataSearchAfterColumnVisibilityChange(h,g,c),await o.setActive(g),t?.(g),w(""),P()},children:"Apply"})]})]})]})})]})};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(Tt),o=n.useRecoilValue(Oa),s=n.useRecoilValue(Ba),r=undefined,l=`${s} ${1===s?"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:`${l}`}),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!=o&&(await a.selectFilteredItems(o),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"})]})})})]})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(Tt);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:()=>{t?.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=n.useRecoilValue(Tt);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:()=>{t?.expandAll()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:t})=>{const a=n.useRecoilValue(Oa),o=null==a||""===a;return e.jsx(r.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,{}),!o&&e.jsx(VertexSceneTreeSearchInformationForToolbar,{}),e.jsx("div",{className:"ml-auto",children:e.jsx(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:t})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:o,onVisibleSceneTreeColumnsChange:s,children:i})=>{const r=null!=i&&!1!==i;return e.jsx("div",{slot:"header",className:"flex flex-col",children:r?i:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:o,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:s})]})})};function useMetadataActions(){const e=useActionCallback((({snapshot:e,set:t})=>async n=>{const a=undefined;if(await e.getPromise(da(n)))return;t(da(n),!0);const o=await e.getPromise(ia(n));if(null!=o?.metadata){const e=[...o.metadata];t(ra(n),(t=>[...t,...e]))}const s=o?.cursor;t(la(n),s),t(da(n),!1)}));return{fetchInitialMetadata:useActionCallback((({snapshot:t})=>async n=>{const a=undefined;0===(await t.getPromise(ra(n))).length&&await e(n)})),fetchNextMetadata:useActionCallback((()=>async t=>{await e(t)}))}}var Ka={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),a=o,s=_interopRequireDefault(a),i,r=_interopRequireDefault(l);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){function InfiniteScroll(e){_classCallCheck(this,InfiniteScroll);var t=_possibleConstructorReturn(this,(InfiniteScroll.__proto__||Object.getPrototypeOf(InfiniteScroll)).call(this,e));return t.scrollListener=t.scrollListener.bind(t),t.eventListenerOptions=t.eventListenerOptions.bind(t),t.mousewheelListener=t.mousewheelListener.bind(t),t}return _inherits(InfiniteScroll,e),n(InfiniteScroll,[{key:"componentDidMount",value:function componentDidMount(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function componentDidUpdate(){if(this.props.isReverse&&this.loadMore){var e=this.getParentElement(this.scrollComponent);e.scrollTop=e.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function isPassiveSupported(){var e=!1,t={get passive(){e=!0}};try{document.addEventListener("test",null,t),document.removeEventListener("test",null,t)}catch(e){}return e}},{key:"eventListenerOptions",value:function eventListenerOptions(){var e=this.props.useCapture;return e=this.isPassiveSupported()?{useCapture:this.props.useCapture,passive:!0}:{passive:!1}}},{key:"setDefaultLoader",value:function setDefaultLoader(e){this.defaultLoader=e}},{key:"detachMousewheelListener",value:function detachMousewheelListener(){var e=window;!1===this.props.useWindow&&(e=this.scrollComponent.parentNode),e.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function detachScrollListener(){var e=window;!1===this.props.useWindow&&(e=this.getParentElement(this.scrollComponent)),e.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),e.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function getParentElement(e){var t=this.props.getScrollParent&&this.props.getScrollParent();return null!=t?t:e&&e.parentNode}},{key:"filterProps",value:function filterProps(e){return e}},{key:"attachScrollListener",value:function attachScrollListener(){var e=this.getParentElement(this.scrollComponent);if(this.props.hasMore&&e){var t=window;!1===this.props.useWindow&&(t=e),t.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),t.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),t.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}}},{key:"mousewheelListener",value:function mousewheelListener(e){1!==e.deltaY||this.isPassiveSupported()||e.preventDefault()}},{key:"scrollListener",value:function scrollListener(){var e=this.scrollComponent,t=window,n=this.getParentElement(e),a=void 0;if(this.props.useWindow){var o=document.documentElement||document.body.parentNode||document.body,s=void 0!==t.pageYOffset?t.pageYOffset:o.scrollTop;a=this.props.isReverse?s:this.calculateOffset(e,s)}else a=this.props.isReverse?n.scrollTop:e.scrollHeight-n.scrollTop-n.clientHeight;a<Number(this.props.threshold)&&e&&null!==e.offsetParent&&(this.detachScrollListener(),this.beforeScrollHeight=n.scrollHeight,this.beforeScrollTop=n.scrollTop,"function"==typeof this.props.loadMore&&(this.props.loadMore(this.pageLoaded+=1),this.loadMore=!0))}},{key:"calculateOffset",value:function calculateOffset(e,t){return e?this.calculateTopPosition(e)+(e.offsetHeight-t-window.innerHeight):0}},{key:"calculateTopPosition",value:function calculateTopPosition(e){return e?e.offsetTop+this.calculateTopPosition(e.offsetParent):0}},{key:"render",value:function render(){var e=this,t=this.filterProps(this.props),n=t.children,a=t.element,o=t.hasMore;t.initialLoad;var i=t.isReverse,r=t.loader;t.loadMore,t.pageStart;var l=t.ref;t.threshold,t.useCapture,t.useWindow,t.getScrollParent;var c=_objectWithoutProperties(t,["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","ref","threshold","useCapture","useWindow","getScrollParent"]);c.ref=function(t){e.scrollComponent=t,l&&l(t)};var d=[n];return o&&(r?i?d.unshift(r):d.push(r):this.defaultLoader&&(i?d.unshift(this.defaultLoader):d.push(this.defaultLoader))),s.default.createElement(a,c,d)}}]),InfiniteScroll}(a.Component);c.propTypes={children:r.default.node.isRequired,element:r.default.node,hasMore:r.default.bool,initialLoad:r.default.bool,isReverse:r.default.bool,loader:r.default.node,loadMore:r.default.func.isRequired,pageStart:r.default.number,ref:r.default.func,getScrollParent:r.default.func,threshold:r.default.number,useCapture:r.default.bool,useWindow:r.default.bool},c.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,ref:null,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null,getScrollParent:null},t.default=c,e.exports=t.default}(Ka,Ka.exports);var $a=Ka.exports;const CopyButton=({id:t,textToCopy:n,iconSize:a,disableTooltip:s,onCopyValue:r})=>{const[l,c]=o.useState(!1),d=undefined,u=useDebouncedCallback((()=>{c(!1)}),2e3);return e.jsx(i.VertexTooltip,{className:"h-fit self-center z-[16000]",content:l?"Copied to Clipboard":"Copy",placement:"bottom",disabled:s,children:e.jsx("div",{className:kn({"text-green-700":l}),children:e.jsx(i.VertexIconButton,{className:"ml-auto","data-testid":`${t}-copy-button`,iconName:l?"check":"copy",iconSize:a??"xs",onClick:e=>{e.stopPropagation(),e.preventDefault(),null!=n&&(navigator.clipboard.writeText(n),r?.(n)),c(!0),u(!0)},style:{"--hover-box-shadow":"none"}})})})};function MetadataPropertyValue({value:t,onCopyMetadataValue:n}){const[a,s]=o.useState(!1),r=""!==t.replace(/^\s*$/,"").trim();return r?e.jsxs("div",{className:"flex w-full border-b border-neutral-300 pl-1 pr-3","data-testid":`${t}-metadata-property`,onMouseEnter:()=>{s(!0)},onMouseLeave:()=>s(!1),children:[e.jsx(i.VertexTooltip,{className:"w-full shrink truncate pr-2 py-1.5",content:t,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t})}),a&&e.jsx(CopyButton,{id:t,textToCopy:t,onCopyValue:n})]}):e.jsx("div",{className:kn("overflow-visible border-b border-neutral-300 pl-1 pr-4 py-1.5",{"text-neutral-500":!r}),children:"--"})}const MetadataPanelContents=({sceneItemId:t,onCopyMetadataValue:a})=>{const s=useMetadataActions(),r=n.useRecoilValueLoadable(ua),l=n.useRecoilValue(ra(t)),c=n.useRecoilValue(ca(t)),d=n.useRecoilValue(da(t)),u=l?.length>0;function getMessage(){if(!d&&0===l?.length&&"hasValue"===r.state)return"This part does not contain properties"}return o.useEffect((()=>{null!=t&&s.fetchInitialMetadata(t)}),[t]),e.jsxs(e.Fragment,{children:[e.jsx($a,{initialLoad:!1,hasMore:c,loadMore:async()=>{c&&await s.fetchNextMetadata(t)},useWindow:!1,children:e.jsxs("div",{className:"flex w-full text-xs leading-5 grow-0",children:[e.jsx(i.VertexResizable,{className:"w-1/2 min-w-24 max-w-full shrink-0",horizontalDirection:"right",verticalDirection:"none",initialHorizontalScale:.5,parentSelector:"#metadata-panel-wrapper",horizontalSiblingSelector:"#metadata-value-column",children:e.jsx("div",{className:"flex flex-col w-full overflow-hidden whitespace-nowrap",children:l.map(((t,n)=>e.jsx(i.VertexTooltip,{className:"border-b border-neutral-300 pl-4 pr-1 py-1.5",content:t.key,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t.key})},n)))})}),e.jsx("div",{id:"metadata-value-column",className:"flex flex-col w-full min-w-24",children:l.map(((t,n)=>e.jsx(MetadataPropertyValue,{value:t.value,onCopyMetadataValue:a},n)))})]})}),!u&&e.jsx("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:getMessage()})]})},MetadataPanel=({onCopyMetadataValue:t})=>{const a=usePanelActions(),o=n.useRecoilValue(Be),s=n.useRecoilValueLoadable(ua);return e.jsxs("div",{id:"metadata-panel-wrapper","data-testid":"metadata-panel-wrapper",className:"w-full h-full flex flex-col mt-auto text-neutral-800",children:[e.jsxs("div",{className:"flex h-10 border-b border-neutral-300 p-3 pl-4 text-[0.875rem] items-center",children:["hasValue"===s.state&&e.jsx("span",{className:"flex flex-col w-full",children:e.jsx(i.VertexTooltip,{content:s.contents,children:e.jsx("div",{className:"truncate",children:s.contents||""})})}),"loading"===s.state&&e.jsx("div",{className:"flex items-center w-full h-full",children:e.jsx("div",{className:"w-1/2 h-1/2 bg-neutral-300 animate-pulse rounded"})}),e.jsx(i.VertexIcon,{className:"ml-auto cursor-pointer",onClick:a.closeSecondary,name:"close",size:"sm"})]}),e.jsxs("div",{className:"w-full h-full overflow-y-auto overflow-x-hidden",children:[null!=o&&e.jsx(MetadataPanelContents,{sceneItemId:o.id,onCopyMetadataValue:t}),null==o&&e.jsx("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:"Please select a single part or assembly to view its metadata"})]})]})},SceneTreeSecondaryPanel=({panelId:t,onCopyMetadataValue:n})=>e.jsx(i.VertexResizable,{"data-testid":"scene-tree-secondary-panel",className:"min-h-20 max-h-full flex-shrink-0 border-t border-neutral-300",horizontalDirection:"none",verticalDirection:"top",initializeWithOffset:!0,initialVerticalScale:.6,parentSelector:`#${t}`,verticalSiblingSelector:"#scene-tree-container",children:e.jsx(MetadataPanel,{onCopyMetadataValue:n})}),VertexSceneTreeCustomColumn=({label:t,rowDataBinding:a,expandToggle:s,visibilityToggle:i,isolateButton:l,modelViewsButton:c,initialWidth:d,minWidth:u})=>{const m=n.useRecoilValue(Tt);return o.useEffect((()=>{m?.invalidateRows()}),[a]),e.jsxs(r.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${t}`,initialWidth:d,minWidth:u,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${kn("truncate",{"pl-2":s,"pr-2":i})}">\n ${t}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${a}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${s?"expand-toggle":""}\n ${i?"visibility-toggle":""}\n ${l?"isolate-button":""}\n >\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=a?a:"--"}" \n placement="${i?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${a}</div>\n </div>\n </vertex-tooltip>\n\n ${c?'<div attr:style={{row.data.modelViewIndicatorStyle}}> \n <vertex-tooltip class="block w-full truncate" content="Listing Model Views" placement="bottom">\n <vertex-icon-button\n class="ml-auto mr-0.5 text-neutral-800"\n event:pointerup="{{row.data.handleShowModelViews}}"\n icon-name="views"\n icon-size="sm"\n variant="plain"\n >\n </vertex-icon-button>\n </vertex-tooltip>\n </div>':""}\n </div>\n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},t)},VertexSceneTreeMetadataColumns=({children:t})=>{const a=n.useRecoilValue(Ta),o=n.useRecoilValue(Aa),s=[],i=o.filter((e=>e!==wa.label)).map((e=>a[e]));return null!=t?e.jsx(e.Fragment,{children:t({columns:i.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))})}):e.jsx(e.Fragment,{children:i.map(((t,n)=>{const a=s[n]??t.initialWidth;return e.jsx(VertexSceneTreeCustomColumn,{label:t.label,visibilityToggle:n===i.length-1,isolateButton:n===i.length-1,rowDataBinding:t.binding,initialWidth:a,minWidth:t.minWidth},t.label)}))})},VertexSceneTreeTableLayout=t=>{const{children:a,...s}=t,i=n.useRecoilValue(Ta),l=n.useRecoilValue(Aa),c=o.useMemo((()=>findChildElement(a,NameColumn)),[a]),d=o.useMemo((()=>findChildElement(a,MetadataColumns)),[a]),u=i[wa.label]??wa,m=l.filter((e=>e!==wa.label)).map((e=>i[e]));return e.jsxs(r.VertexSceneTreeTableLayout,{"data-testid":"scene-tree-table-layout",...s,children:[c?cloneChildNodeOrFunction(c.props.children,{columnCount:l.length,initialWidth:u.initialWidth,minWidth:u.minWidth}):e.jsx(VertexSceneTreeCustomColumn,{expandToggle:!0,visibilityToggle:1===l.length,isolateButton:1===l.length,rowDataBinding:u.binding,label:u.label,initialWidth:u.initialWidth,minWidth:u.minWidth}),null!=d?cloneChildNodeOrFunction(d.props.children,{columns:m.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))}):e.jsx(VertexSceneTreeMetadataColumns,{})]})},NameColumn=({children:t})=>e.jsx(e.Fragment,{children:t}),MetadataColumns=({children:t})=>e.jsx(e.Fragment,{children:t});VertexSceneTreeTableLayout.NameColumn=NameColumn,VertexSceneTreeTableLayout.MetadataColumns=MetadataColumns;const VertexSceneTree=({id:t,font:a,backgroundColors:s,additionalLoadedMetadataProperties:i,whitelistedMetadataProperties:l,allowViewingMetadataPropertiesPanel:c,children:d,style:u,onPointerDown:m,onClick:p,onToggleSelection:h,onToggleExpansion:f,onToggleVisibility:g,onCopyMetadataValue:v,className:b,rowData:w,...C})=>{const S=usePanelActions(),V=useSceneTreeActions(),j=useSelectionActions(),k=n.useRecoilValue(va),T=n.useRecoilValue(G),A=n.useRecoilValue(aa),P=n.useRecoilValue(Ua),I=n.useRecoilValue(Da),M=n.useRecoilValue(La),E=n.useRecoilValue(_a),R=n.useRecoilValue(Oa),N=null==R||""===R,O=useRecoilRef({state:Tt}),L=o.useMemo((()=>findChildElement(d,Header)),[d]),_=o.useMemo((()=>findChildElement(d,TableLayout)),[d]),B=o.useMemo((()=>findChildElement(d,ContextMenu)),[d]),wrappedExpansionHandler=(e,t,n)=>{V.toggleExpansion(e,t,n),f?.(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{V.toggleSelection(e,t,n),h?.(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{V.toggleVisibility(e,t,n),g?.(e,t,n)},handleClick=async e=>{e.altKey&&await V.flyToRow(e.clientY),p?.(e)},handlePointerDown=async e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&await j.clearSelection(),m?.(e)},D=n.useSetRecoilState(At),handleFirstRowRendered=e=>{D(e.target.controller),C?.onFirstRowRendered?.(e)},F=o.useMemo((()=>({metadataSearchKeys:I,exactMatch:M,removeHiddenItems:E})),[I,M,E]);useStateSyncedValue(Sa,l,{transform:e=>e.sort(((e,t)=>e.localeCompare(t)))}),useStateSyncedValue(sa,c),useStateSyncedValue(Wa,i);const H=n.useRecoilValue(Ze),W=o.useCallback((e=>{e.preventDefault(),e.stopPropagation(),S.openPrimary("model-views","right")}),[S]);return e.jsxs("div",{id:"scene-tree-panel",className:"flex flex-col w-full h-full grow-0",children:[e.jsx("div",{id:"scene-tree-container",className:"flex group h-full min-h-32 overflow-auto",children:e.jsxs(r.VertexSceneTree,{id:t??"vertex-scene-tree","data-testid":"vertex-scene-tree",config:k,ref:O,className:kn("flex-1",{filtered:!N}),style:{...styleFromOptionalFont(a),...styleFromOptionalBackgroundColors(s),...u},onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:T,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{const t=w?.(e)??{};return{handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler,handleShowModelViews:W,modelViewIndicatorStyle:e?.node.id?.hex===H?.id?"display: flex;":"display: none;",...t}},searchOptions:F,metadataKeys:P,...C,onFirstRowRendered:handleFirstRowRendered,children:[L??e.jsx(VertexSceneTreeHeader,{}),_??e.jsx(VertexSceneTreeTableLayout,{}),B??e.jsx(VertexSceneTreeContextMenu,{})]})}),void 0!==A&&e.jsx(SceneTreeSecondaryPanel,{panelId:"scene-tree-panel",onCopyMetadataValue:v})]})},Header=({children:t})=>e.jsx(e.Fragment,{children:t}),TableLayout=({children:t})=>e.jsx(e.Fragment,{children:t}),ContextMenu=({children:t})=>e.jsx(e.Fragment,{children:t});VertexSceneTree.Header=Header,VertexSceneTree.TableLayout=TableLayout,VertexSceneTree.ContextMenu=ContextMenu;const VertexDecimalPlaceSelector=({onApply:t})=>{const[a,o]=n.useRecoilState(Ot);return e.jsxs(i.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{o(e.detail),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,o]=n.useRecoilState(Nt);return e.jsxs(i.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{o(e.detail),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})})}function FileWithMagnifyingGlassImage(){return e.jsx("div",{children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"160",height:"160",viewBox:"0 0 220 220",children:[e.jsx("path",{fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":".75",d:"M38.84 186.31h143.29m-155.07 5.14h176.49M1 196.58h218m-205.11 5.14h185.22m-162.74 5.13h141.84"}),e.jsx("path",{fill:"#f7fcfd",d:"m150.94 50.25 20.43 19.51a3.42 3.42 0 0 1 1 2.46v121.2a5.23 5.23 0 0 1-5.23 5.23H52.78a5.23 5.23 0 0 1-5.23-5.23V54.56a5.24 5.24 0 0 1 5.23-5.24h95.81a3.44 3.44 0 0 1 2.35.93"}),e.jsx("path",{fill:"none",stroke:"#006bad","stroke-dasharray":"3 3","stroke-linecap":"round","stroke-linejoin":"round",d:"m150.94 50.25 20.43 19.51a3.42 3.42 0 0 1 1 2.46v121.2a5.23 5.23 0 0 1-5.23 5.23H52.78a5.23 5.23 0 0 1-5.23-5.23V54.56a5.24 5.24 0 0 1 5.23-5.24h95.81a3.44 3.44 0 0 1 2.35.93"}),e.jsx("path",{d:"M79.12 123.99H110v30.88H79.12z",fill:"#e0f3f9"}),e.jsx("path",{d:"M110 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M105.4 154.87H82.17",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M80.62 154.87h-1.5v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M79.12 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M79.12 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M83.72 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M108.5 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 123.99h30.88v30.88H110z",fill:"#e0f3f9"}),e.jsx("path",{d:"M140.88 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M136.28 154.87h-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M111.5 154.87H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M114.6 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M139.38 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M140.88 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 93.11h30.88v30.88H110z",fill:"#e0f3f9"}),e.jsx("path",{d:"M140.88 122.49v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M136.28 123.99h-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M111.5 123.99H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 119.39V96.15",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 94.61v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M114.6 93.11h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M139.38 93.11h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M140.88 97.7v23.24",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M150.91 50.28a3.6 3.6 0 0 1 .86 1.22",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"none",stroke:"#006bad","stroke-dasharray":"2.87 2.87","stroke-linecap":"round","stroke-linejoin":"round",d:"M152.05 54.34v9.14a5.24 5.24 0 0 0 5.24 5.23h9.94"}),e.jsx("path",{d:"M168.67 68.71h.2a3.5 3.5 0 0 1 1.27.23M19.8 78.25l1.93 14.68-14.67 1.93",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M21.73 92.93S-2.15 82.45 4.05 54.82",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"none",stroke:"#b43296","stroke-linecap":"round","stroke-linejoin":"round",d:"M14.89 132.63h5.88v5.88h-5.88z"}),e.jsx("path",{fill:"none",stroke:"#f90","stroke-linecap":"round","stroke-linejoin":"round",d:"M174.49 36v5.88m-2.94-2.94h5.88"}),e.jsx("circle",{cx:"199.1",cy:"164.76",r:"2.45",fill:"none",stroke:"#0c0","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M109.68 25.74V11.9M87.12 29.74l-6.02-9.4m53.21 9.4 6.01-9.4",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"#eff9fc",stroke:"#006bad","stroke-linejoin":"round",d:"m140.43 139.69 7.22 5.8-8.28 10.31-7.22-5.8"}),e.jsx("circle",{cx:"110.2",cy:"124.35",r:"27.74",fill:"#e0f3f9",opacity:".7"}),e.jsx("path",{fill:"#fff",stroke:"#006bad","stroke-linejoin":"round",d:"M131.2 98.19a33.55 33.55 0 1 0 5.16 47.16 33.56 33.56 0 0 0-5.16-47.16Zm.63 43.52a27.73 27.73 0 1 1-4.26-39 27.73 27.73 0 0 1 4.26 39ZM187 173.84a29.8 29.8 0 0 1-4.19 7.52 29.3 29.3 0 0 1-7.24 6.71l-37.77-30.31a29.3 29.3 0 0 1 5-8.56 29.6 29.6 0 0 1 6.4-5.67Z"}),e.jsx("path",{fill:"none",stroke:"#fff","stroke-linecap":"round","stroke-miterlimit":"10",d:"m118.82 138.09 12.51-15.58m-38.56-3.68 6.94-8.65m-5.32 1.9 6.95-8.66m16.23 42.44 12.5-15.58"}),e.jsx("path",{fill:"#fff",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round",d:"M139.92 153.31a28.4 28.4 0 0 0-2.12 4.45m7.07-.49a38 38 0 0 0-2.35 4.28m7.3-.32c-.93 1.34-1.79 2.72-2.58 4.11m7.53-.15q-1.47 2-2.81 3.94m7.75.01-3 3.78m7.95.18c-1.07 1.24-2.16 2.45-3.26 3.61m8.21.35a54 54 0 0 1-3.49 3.44m8.44.5a37 37 0 0 1-3.72 3.26m8.67.74a29 29 0 0 1-3.95 3.09"}),e.jsx("path",{d:"m196.69 115.8-2.18 14.64 14.64 2.18",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M194.51 130.44s23.76-12 21.9-35.66",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"})]})})}function ModelViewsEmptyState({itemSelected:t}){const n=t?"There are no model views associated with this part.":"Select a part to access model views.";return e.jsxs("div",{"data-testid":"pmi-views-empty-state",className:"h-full w-full px-4 flex flex-col gap-2 justify-center items-center overflow-y-auto",children:[e.jsx(FileWithMagnifyingGlassImage,{}),e.jsx("div",{className:"text-base text-neutral-700 text-center px-3 pt-2.5 pb-1.5",children:"No Model Views"}),e.jsx("div",{className:"text-[0.8125rem] text-neutral-600 text-center px-3 pb-2.5",children:n})]})}const VertexModelViewsViewRow=({view:t,currentlyViewing:n,itemId:a,onLoadModelView:o,onClearModelView:s})=>{const r=useModelViewActions();return e.jsx("div",{"data-testid":`model-view-${t.id}`,onClick:async()=>{n?(await r.clearModelView(),s?.()):(await r.loadModelView(a,t),o?.(a,t.id))},className:kn("flex flex-col w-full h-8 p-1 pl-4 cursor-pointer text-neutral-700 text-[0.8125rem] hover:text-[var(--vertex-ui-blue-600)]",{"bg-[var(--vertex-ui-blue-200)]":n,"hover:bg-[var(--vertex-ui-blue-100)]":!n}),children:e.jsxs("div",{className:kn("flex w-full h-full items-center",{"text-neutral-900 font-extrabold":n}),children:[e.jsxs(i.VertexTooltip,{className:"flex w-20 grow","data-testid":`model-view-${t.id}-tooltip`,placement:"bottom-start",content:t.displayName,children:[e.jsx(i.VertexIcon,{name:"views",size:"sm"}),e.jsx("div",{className:"truncate mx-2",children:t.displayName}),e.jsx("span",{className:"font-normal text-neutral-700 ml-auto pr-1",children:n&&"(Viewing)"})]}),n&&e.jsx("div",{className:"ml-auto pr-1",children:e.jsx(i.VertexIconButton,{"data-testid":"model-views-clear-selection",iconSize:"sm",iconName:"close",onClick:async()=>await r.clearModelView()})})]})},t.id)};function VertexModelViewsList({itemId:t,onLoadModelView:a,onClearModelView:o}){const s=useModelViewActions(),r=n.useRecoilValue(mn),l=n.useRecoilValue(hn(t)),c=n.useRecoilValue(xn(t)),d=n.useRecoilValueLoadable(un),u=0===l.length;return e.jsxs("div",{className:"w-full h-full flex flex-col",children:[("hasValue"!==d.state||null!=d.contents)&&e.jsxs("div",{className:"flex flex-row h-11 w-full border-b border-neutral-300 p-3 pl-4 mr-2 text-sm items-center",children:["hasValue"===d.state&&e.jsx("div",{className:"truncate items-center",children:e.jsx(i.VertexTooltip,{content:d.contents,children:e.jsx("div",{className:"truncate",children:d.contents||""})})}),"loading"===d.state&&e.jsx("div",{className:"flex items-center h-11 w-full",children:e.jsx("div",{className:"w-3/4 h-3 bg-neutral-300 animate-pulse rounded"})})]}),u&&e.jsx(ModelViewsEmptyState,{itemSelected:!0}),!u&&e.jsx("div",{className:"h-full overflow-y-auto",children:e.jsx($a,{hasMore:c,loadMore:()=>{s.fetchNextModelViews(t)},useWindow:!1,children:l.map((n=>{const s=r?.modelView?.id.toString(),i=s===n?.id;return e.jsx(VertexModelViewsViewRow,{view:n,currentlyViewing:i,itemId:t,onLoadModelView:a,onClearModelView:o},n.id)}))})})]})}const VertexPMIAnnotationRow=({annotation:t,checked:n,onCheckedChange:a,selected:o,onSelectedChange:s})=>e.jsxs("div",{id:`annotation-entry-${t.id}`,"data-testid":`annotation-entry-${t.displayName}`,className:kn("flex items-center w-full h-7 gap-2.5 pl-4 pr-2 cursor-default hover:text-[var(--vertex-ui-blue-600)]",{"bg-[var(--vertex-ui-blue-200)]":o,"hover:bg-[var(--vertex-ui-blue-100)]":!o}),onClick:()=>s(!o),children:[e.jsx(i.VertexToggle,{"data-testid":`annotation-entry-${t.displayName}-check`,variant:"check",checked:n,onClick:e=>e.stopPropagation(),onValueChanged:e=>{a(e.detail)}}),e.jsx("div",{className:"w-1/2 flex-grow",children:e.jsx(i.VertexTooltip,{content:t.displayName,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t.displayName})})})]}),VertexPMIAnnotationsSecondaryPanel=({modelViewId:t,parentPanelId:a,verticalSiblingId:o,sceneAnnotationOperations:s,onToggleSelectionOfPMIAnnotation:r,onToggleVisibilityOfPMIAnnotation:l})=>{const c=usePmiAnnotationActions(),d=n.useRecoilValue(G),m=n.useRecoilValue(gn(t)),p=n.useRecoilValue(yn(t)),h=n.useRecoilValue(vn),[f,g]=n.useRecoilState(dn(t)),[v,b]=u.useState("");u.useEffect((()=>{t!==v&&(g(m),b(t))}),[m,v,t,g,b]);const toggleVisibilityOfAllAnnotations=e=>{e?(g(m),s?.sceneAnnotationsOperation((e=>e.show()),d)):(g([]),s?.sceneAnnotationsOperation((e=>e.hide()),d))};return e.jsx(i.VertexResizable,{"data-testid":"pmi-annotation-secondary-panel",className:"min-h-28 max-h-3/4 flex-shrink-0 border-t text-sm text-neutral-700",horizontalDirection:"none",verticalDirection:"top",initializeWithOffset:!0,initialVerticalScale:.6,parentSelector:`#${a}`,verticalSiblingSelector:`#${o}`,children:e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx("div",{className:"flex items-center w-full h-9 border-b border-[var(--vertex-ui-neutral-300)] px-4 shrink-0",children:"3D PMI"}),e.jsxs("div",{"data-testid":"display-all-annotations",className:"flex items-center w-full h-8 gap-2.5 px-4 py-1.5 cursor-default border-b border-[var(--vertex-ui-neutral-300)]",onClick:()=>{const e=m.length!==f.length;toggleVisibilityOfAllAnnotations(e)},children:[e.jsx(i.VertexToggle,{"data-testid":"display-all-annotations-check",variant:"check",checked:m.length===f.length,onClick:e=>e.stopPropagation(),onValueChanged:e=>{toggleVisibilityOfAllAnnotations(e.detail)}}),"Display All"]}),e.jsx("div",{className:"h-full overflow-y-auto text-[0.8125rem] py-1",children:e.jsx($a,{hasMore:p,loadMore:async()=>{p&&await c.fetchNextPmiAnnotations(t)},useWindow:!1,children:m.map(((n,a)=>e.jsx(VertexPMIAnnotationRow,{annotation:n,checked:f.includes(n),onCheckedChange:e=>{e?(g([...f,n]),s?.sceneAnnotationsOperation((e=>e.show()),d,[n.id])):(g(f.filter((e=>e!==n))),s?.sceneAnnotationsOperation((e=>e.hide()),d,[n.id])),l?.(t,n.id,e)},selected:n.id===h,onSelectedChange:async e=>{e?await c.selectPmiAnnotation(n.id,!1):await c.clearPmiAnnotationSelection(),r?.(t,n.id,e)}},a)))})})]})})},VertexModelViewsPanelSection=({onLoadModelView:t,onClearModelView:a,onToggleSelectionOfPMIAnnotation:o,onToggleVisibilityOfPMIAnnotation:s})=>{const i=useSceneAnnotationsOperations(),r=n.useRecoilValue(Ze),l=null!=r?.id,c=n.useRecoilValue(mn),d=c?.itemId===r?.id;return e.jsxs("div",{id:"model-views-panel-wrapper",className:"w-full h-full flex flex-col text-neutral-800",children:[e.jsxs("div",{"data-testid":"model-views-container",className:"group h-full flex overflow-auto min-h-29 relative",children:[l&&e.jsx(u.Suspense,{fallback:e.jsx(ModelViewsItemListLoading,{}),children:e.jsx(VertexModelViewsList,{itemId:r.id,onLoadModelView:t,onClearModelView:a})}),!l&&e.jsx(ModelViewsEmptyState,{itemSelected:!1})]}),null!=c&&d&&e.jsx(u.Suspense,{fallback:e.jsx(ModelViewsItemListLoading,{}),children:e.jsx(VertexPMIAnnotationsSecondaryPanel,{modelViewId:c.modelView.id,parentPanelId:"model-views-panel-wrapper",verticalSiblingId:"model-views-container",sceneAnnotationOperations:i,onToggleSelectionOfPMIAnnotation:o,onToggleVisibilityOfPMIAnnotation:s})})]})};function ModelViewsItemListLoading(){return e.jsxs("div",{className:"flex flex-col w-full h-full items-center justify-center text-[0.8125rem] overflow-y-auto",children:[e.jsx(i.VertexSpinner,{"data-testid":"model-views-panel-spinner",size:"lg",color:"grey"}),e.jsx("div",{className:"pt-3 px-10 text-center",children:"Loading model views for the selected part..."})]})}function VertexModelViewsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexModelViewsPanelSection,{})})}function ColorSwatchContextMenu({onRemoveCustomColor:t}){const a=useContextMenuActions(),o=useSceneItemMaterialActions(),s=n.useRecoilValue(tt);return e.jsx(VertexContextMenu,{menuType:"color-swatch",onOpen:e=>{elementIsColorSwatch(e.target)&&a.setContextMenuItem(e.target)},openPredicate:e=>elementIsColorSwatch(e.target)&&elementHasColorAttribute(e.target),disableBackdrop:!0,children:e.jsx(i.VertexMenuItem,{"data-testid":"color-swatch-delete",onClick:async()=>{if(contextMenuItemIsElement(s)&&elementIsColorSwatch(s)){const e=s?.getAttribute("data-color-id");null!=e&&"true"===s.getAttribute("data-custom-color")?(await o.removeCustomColor(e),t?.(e)):null!=e&&"true"===s.getAttribute("data-recent-color")&&await o.removeRecentColor(e)}},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(i.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),"Delete"]})})})}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,{}),e.jsx(ColorSwatchContextMenu,{})]})}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(),r=useCacheableLoadable(Xe),l=n.useRecoilValue(Ue),c=useCacheableLoadable($t(l??"")),d=o.useMemo((()=>{const e=r.data?.some((e=>null!=e?.override?.transform)),t=null!=c.data;return e||t}),[r,c]);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":"clear-selected-transforms",onClick:async()=>{await s.clearSelectedTransforms(),t?.()},disabled:!d,children:"Clear selected transforms"}),e.jsx(i.VertexMenuItem,{"data-testid":"clear-all-transforms",onClick:async()=>{await s.clearAllTransforms(),a?.()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:t,value:a,step:s,min:i,max:r,disabled:l,testId:c,onBlur:d,onInput:u,onChange:m})=>{const p=o.useRef(null),h=n.useRecoilValue(Ot),[f,g]=o.useState(!0);o.useEffect((()=>{const e=null!=p.current&&Number.isNaN(p.current.valueAsNumber),t=f||e;null!=p.current&&t?p.current.value=a?.toFixed(Number(h))??"":g(!0)}),[a]);const v=o.useCallback((e=>{g(!1),m?.(e)}),[g,m]),b=o.useCallback((e=>{g(!0),d?.(e),null!=p.current&&null!=a&&(p.current.value=a.toFixed(Number(h)))}),[d,a,g]);return e.jsxs("div",{children:[e.jsx("div",{className:"truncate rounded-md w-full",children:e.jsx("input",{ref:p,className:"w-full truncate border border-neutral-400 rounded-md px-2 py-1.5 hover:border-neutral-500 focus:border-neutral-500 focus:outline-none",type:"number",step:s,min:i,max:r,"data-testid":c,disabled:l,defaultValue:Number.isNaN(a)?"":a?.toFixed(Number(h)),onBlur:b,onInput:u,onChange:v})}),null!=t&&e.jsx("div",{className:"flex justify-center items-center pointer-events-none text-neutral-500",children:e.jsx("span",{children:t})})]})},VertexTransformInputs=({onUpdateTransform:t})=>{const a=n.useRecoilValue(Nt),o=n.useRecoilValue(Fe),s=n.useRecoilValue(ze),i=o||s,r=n.useRecoilValue(Ue),{transform:l,error:c,update:d}=useEditItemTransform(r),u=i?void 0:l,m=useDebouncedCallback((async e=>{await d(e),t?.(e)}),50);function updateTransform(e){return t=>{if(null!=u){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||m?.({...u,...e(n,u)})}}}function updatePosition(e){return updateTransform(((t,n)=>({position:{...n.position,...e(t)}})))}function updateRotation(e){return updateTransform(((t,n)=>({rotation:{...n.rotation,...e(t)}})))}function updateScale(){return updateTransform((e=>e>0?{scale:e}:{}))}function updateToDefaultValueIfInvalid(e,t){return n=>{const a=parseFloat(n.currentTarget.value),o=undefined;(isNaN(a)||!!t?.(a))&&null!=u&&m(v.defaults(e,u))}}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Position"}),e.jsxs("div",{className:"flex flex-wrap w-full gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"X"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-x",value:null!=u?u.position.x:void 0,bottomLabel:a,disabled:null==u,onChange:updatePosition((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({position:{x:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Y"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-y",value:u?.position.y,bottomLabel:a,disabled:null==u,onChange:updatePosition((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({position:{y:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Z"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-z",value:u?.position.z,bottomLabel:a,disabled:null==u,onChange:updatePosition((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({position:{z:0}})})})]})]})]}),e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Rotation"}),e.jsxs("div",{className:"flex flex-wrap w-full gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"X"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-x",value:u?.rotation.x,bottomLabel:"deg",disabled:null==u,onChange:updateRotation((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{x:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Y"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-y",value:u?.rotation.y,bottomLabel:"deg",disabled:null==u,onChange:updateRotation((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{y:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Z"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-z",value:u?.rotation.z,bottomLabel:"deg",disabled:null==u,onChange:updateRotation((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{z:0}})})})]})]})]}),e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Scale"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"scale",value:u?.scale,step:.1,min:.1,disabled:null==u,onChange:updateScale(),onBlur:updateToDefaultValueIfInvalid({scale:1},(e=>e<=0))})}),i&&e.jsx("div",{className:"bg-orange-100 rounded px-3 py-2 mt-6 mb-2",children:"Input based part transformation is not yet supported for multiple parts."}),null!=c&&e.jsx("div",{className:"bg-red-100 rounded px-3 py-2 mt-6 mb-2",children:"There was a problem retrieving data. Try selecting a different part."})]})]})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const a=useTransformActions(),o=n.useRecoilValue(zt),s=n.useSetRecoilState(Yt);return e.jsx(i.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:o,onValueChanged:async()=>{o?(a.disableTransformWidget(),t?.(!1)):(s("world"),await a.enableTransformWidget(),t?.(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:t,onUpdateTransform:n}){return e.jsxs(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-[0.8125rem] text-neutral-700",children:"Enable manipulator"})]}),e.jsx(VertexTransformInputs,{onUpdateTransform:n})]})}function VertexTransformPanelSection({onClearTransforms:t,onClearAllTransforms:n,onToggleTransformsManipulator:a,onUpdateTransform:o}){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,onUpdateTransform:o})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const qa="Appearance",Ya="Model Views",Xa="Settings",Za="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:t})=>{const a=n.useRecoilValue(na),o=getHeading(a,t),s="model-views"===a;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.jsxs("div",{className:"flex items-center w-full leading-6 text-md align-center font-medium text-neutral-800 gap-2",children:[o,s&&e.jsx(BetaLabel,{})]})})};function getHeading(e,t={}){switch(e){case"appearance":return qa;case"model-views":return Ya;case"settings":return Xa;case"transforms":return Za;default:const n=undefined;return(null!=e?t[e]:void 0)??"None"}}function VertexViewerRightOpenedPanel({children:t}){const a=n.useRecoilValue(na),s=o.useMemo((()=>filterChildElements(t,CustomPanelContent)),[t]),i=o.useMemo((()=>s.reduce(((e,t)=>({...e,[t.props.panelName]:t.props.panelTitle})),{})),[s]),r=o.useMemo((()=>["appearance","model-views","settings","transforms",...s.map((e=>e.props.panelName))]),[s]);return e.jsx(e.Fragment,{children:null!=a&&r.includes(a)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{additionalHeaderMap:i}),placement:"right",children:["appearance"===a&&e.jsx(DefaultAppearancePanel,{}),"transforms"===a&&e.jsx(DefaultTransformsPanel,{}),"settings"===a&&e.jsx(DefaultSettingsPanel,{}),"model-views"===a&&e.jsx(VertexModelViewsPanel,{}),t]})})}function CustomPanelContent({panelName:t,children:a}){const o=n.useRecoilValue(na);return e.jsx(e.Fragment,{children:o===t&&a})}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:s,disabled:r,content:l,tooltipPlacement:c,children:d,onSelect:u,onDeselect:m}){return e.jsx("div",{className:kn({"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":s,"p-3":!s&&null==d,"px-3 py-1":null!=d}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{r||(a===t?m():u())},children:e.jsxs(i.VertexTooltip,{placement:c??void 0,content:o.isValidElement(l)?void 0:l,children:[e.jsx("div",{slot:"content",children:l}),e.jsx("div",{className:"flex flex-col",children:d??e.jsx(i.VertexIcon,{name:n})})]})})}function VertexViewerRightSidebar({children:t}){const a=usePanelActions(),o=useTransformActions(),s=n.useRecoilValue(na);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:[t,e.jsx(SidebarIcon,{name:"appearance",active:s,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{a.openPrimary("appearance","right")},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:s,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{a.openPrimary("transforms","right"),await o.enableTransformWidget(void 0,!0)},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"model-views",active:s,iconName:"views",tooltipPlacement:"right",content:"Model Views",onSelect:async()=>{a.openPrimary("model-views","right")},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:s,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{a.openPrimary("settings","right")},onDeselect:()=>a.closePrimary("right")})]})})}function CustomPanelIcon(t){const a=usePanelActions(),o=n.useRecoilValue(na),{panelName:s,tooltipContent:i,iconName:r,...l}=t;if(null==r&&null==l.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e.jsx(SidebarIcon,{...l,name:s,iconName:r??"help",active:o,content:i,onSelect:()=>{a.openPrimary(t.panelName,"right")},onDeselect:()=>{a.closePrimary("right")}})}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=({open:t,children:n,...a})=>{const o=n.find((e=>e.type===Anchor)),s=n.filter((e=>e.type!==Anchor));return null==o?e.jsx(e.Fragment,{}):e.jsxs(i.VertexPopover,{className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(t),...a,children:[o,e.jsx("div",{className:kn("flex mb-1.5",{hidden:!t}),"data-testid":"align-plane-popover-menu",children:s})]})},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(i.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu({disabled:t}){const a=useCrossSectioningActions(),o=n.useRecoilValue(Ve),s=n.useRecoilValue(xe),getBaseIcon=()=>`align-to-${s?.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:a.cancelCurrentHit,addPredicate:()=>s?.hitPending??!1,cancelPredicate:()=>!s?.hitPending},[s?.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(o),onDismissed:a.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:o?a.closeAlignmentTools:a.openAlignmentTools,disabled:t,children:e.jsx(i.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(r.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:()=>a.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:()=>a.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({disabled:t}){const a=useCrossSectioningActions(),s=n.useRecoilValue(je),l=n.useRecoilValue(he),c=n.useRecoilValueLoadable(ve),d=o.useMemo((()=>{const e=l.length>0&&"hasValue"===c.state?axis(l[0],xAxis(c.contents),yAxis(c.contents),zAxis(c.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[c.state,c.contents,l]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(s),onDismissed:a.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(i.VertexIconButton,{onClick:s?a.closeAxisTools:a.openAxisTools,iconName:d,"data-testid":"align-plane-icon",iconColor:"secondary",disabled:t,children:e.jsx(i.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(r.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:()=>a.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:()=>a.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:()=>a.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,disabled:a,onOffsetChange:s}){const r=n.useRecoilValue(Nt),l=n.useRecoilValue(Ot),[c,d]=o.useState(convertTo(t,r));o.useEffect((()=>{d(convertTo(t,r))}),[r,t]);const u=createDistanceFormatter(r,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(c+e,r);s(t)},handleSubmit=e=>{e.preventDefault(),s(convertFrom(c,r))},handleBlur=()=>{s(convertFrom(c,r))};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=>{d(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,disabled:a,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>{a||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:()=>{a||handleIncrementalUpdate(1)},children:e.jsx(i.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Ja=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(Se),s=n.useRecoilValueLoadable(we),l=n.useRecoilValueLoadable(Ce),c=o.useRef(),d=o.useMemo((()=>"hasValue"===s.state&&Number.isFinite(s.contents.max)&&Number.isFinite(s.contents.min)),[s.state,s.contents]),u=o.useMemo((()=>"hasValue"===s.state?s.contents:ie),[s.state,s.contents]),m=o.useMemo((()=>"hasValue"===l.state&&Number.isFinite(l.contents)?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(c.current),c.current=window.setTimeout((()=>{t.endInteraction()}),Ja),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(r.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,{disabled:!d}),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",disabled:!d})}),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",disabled:!d})}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{disabled:!d}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:m,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==s.state)||!d,min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state&&d?l.contents:0,disabled:!d,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),a=n.useRecoilValue(re);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(t?.scene());await(e?.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[s,r]=n.useRecoilState(Y),[l,c]=n.useRecoilState(q);return o.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"===s?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(r("pan"),null!=l){const e=await l;e?.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[s,r]=n.useRecoilState(Y),[l,c]=n.useRecoilState(q);return o.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"===s?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(r("rotate"),null!=l){const e=await l;e?.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[s,r]=n.useRecoilState(Y),[l,c]=n.useRecoilState(q);return o.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"===s?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(r("zoom"),null!=l){const e=await l;e?.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(r.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(r.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=({endCapEnabledByDefault:t,children:a})=>{const s=n.useSetRecoilState(ue),i=n.useSetRecoilState(de);o.useEffect((()=>{null!=t&&(s(t),i(t))}),[t]);const l=null!=a&&!1!==a;return e.jsx(r.VertexViewerToolbar,{placement:"bottom-center",children:l?e.jsx(r.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:a}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:s,onRotationChange:i}){const l=useTransformActions(),c=n.useRecoilValue(Gt),d=n.useRecoilValue(zt),u=n.useRecoilValue(Ft),m=n.useRecoilValue(Ut),p=n.useRecoilValueLoadable(Wt),h=n.useRecoilValue(Nt),f=n.useRecoilValue(Ot),g=o.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=o.useMemo((()=>{const e=undefined;return d&&(null!=g||c)}),[d,g,c]);return e.jsx(e.Fragment,{children:v&&e.jsx(r.VertexViewerTransformWidget,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:u,rotation:null!=u?g:void 0,decimalPlaces:parseInt(f,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:a??!0,onInteractionStarted:()=>{l.disableSelectionSync(),l.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{l.invalidateTransforms(),l.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await l.setTransformWidgetPosition(e.detail),s?.(e.detail)},onRotationChanged:e=>{l.setTransformWidgetOrientation(e.detail),i?.(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const a=useCrossSectioningActions(),o=useModelViewActions(),s=useSelectionActions(),r=useTransformActions(),l=useViewerSceneActions(),c=n.useSetRecoilState(Ze),handleReset=async()=>{await a.disable(),await s.resetSelectionState(),r.clearTransformWidgetPosition(),await r.invalidateTransforms(),c(void 0),await o.clearModelView(),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 o=await n.getPromise(Ke);t(Z,a.detail.scene),t(Ke,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(Ge,o);const s=undefined;await n.getPromise(zt)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:a}=useCallbackRef(),o=useBoxSelectionActions(),s=useTransformActions(),i=n.useRecoilValue(it);return u.useEffect((()=>{const e=whenComponentReady(t,(()=>[t?.model?.onDragComplete((()=>{"clearAndSelect"===i&&(s.clearTransformWidgetOrientation(),s.clearTransformWidgetPosition(),s.enableSelectionSync())}))]));return()=>{e?.then((e=>{e?.forEach((e=>e?.dispose()))}))}}),[t,i]),useApplyKeyBinding({keyBind:"Shift",fn:u.useCallback((()=>o.setOperationType("select")),[]),off:u.useCallback((()=>o.setOperationType("clearAndSelect")),[])}),e.jsx(r.VertexViewerBoxQueryTool,{ref:a,"data-testid":"viewer-box-query-tool",operationType:i})};function VertexViewerCameraTypeMenu({open:t,onOpen:a,onDismiss:o,onCameraTypeChange:s}){const r=useViewerCameraActions(),l=n.useRecoilValue(U);return e.jsxs(i.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:o,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:kn("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"===l?"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",!0),s?.("perspective")},children:[e.jsx(i.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:kn({"text-[var(--vertex-ui-blue-700)]":"perspective"===l})}),e.jsx("div",{className:kn("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===l}),children:"Perspective"})]}),e.jsxs(i.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{r.updateCameraType("orthographic",!0),s?.("orthographic")},children:[e.jsx(i.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:kn({"text-[var(--vertex-ui-blue-700)]":"orthographic"===l})}),e.jsx("div",{className:kn("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===l}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=({placement:t,children:n,...a})=>{const s=Array.isArray(n)?n:[n],i=s.filter((e=>!o.isValidElement(e)||e.type!==r.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),l=s.find((e=>o.isValidElement(e)&&e.type===r.VertexViewerViewCube)),[c,d]=o.useState(!1);return e.jsxs(r.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:t??"top-right",children:[l??e.jsx(r.VertexViewerViewCube,{className:"m-7",...a}),0===i.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:c,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e.jsx("div",{className:"mt-3",children:i})]})},VertexViewer=({id:t,src:a,className:s,disableSelection:i,onTap:l,onLongpress:c,onFrameDrawn:d,onSceneReady:u,viewerRefCallback:m,children:p,...h})=>{const f=n.useRecoilValue(va),g=useRecoilRef({state:G}),v=useViewerCameraActions(),b=useCrossSectioningActions(),w=useHitActions(),C=useSelectionActions(),S=useViewerFrameActions(),V=n.useRecoilValue(U),j=n.useRecoilValue(xe),k=n.useRecoilValue(st),T=n.useSetRecoilState(X),[A,P]=n.useRecoilState($);o.useEffect((()=>{A&&(P(!1),b.disable())}),[a]);const[I,M]=n.useRecoilState(K);o.useEffect((()=>{null!=t&&M(t)}),[t]);const E=n.useRecoilValue(ha),R=o.useMemo((()=>({opacity:E/100})),[E]),N=n.useRecoilValue(Pn),O=n.useRecoilValue(In),L=o.useMemo((()=>({color:N,width:O})),[N,O]),_=n.useRecoilValue(ue),B=n.useRecoilValue(me),D=n.useRecoilValue(pe),F=o.useMemo((()=>({endCapEnabled:_,endCapUsePartColor:B===ne.PART,..._&&B===ne.SINGLE&&{endCapColor:D}})),[_,B,D]),H=n.useRecoilValue(Xn),W=n.useRecoilValue(Kn),q=n.useRecoilValue($n),Y=n.useRecoilValue(qn),Z=o.useMemo((()=>({color:W,opacity:q/100,lineWidth:Y})),[W,q,Y]),J=n.useRecoilValue(mt),Q=null!=p&&!1!==p;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(r.VertexViewer,{id:I,"data-testid":"vertex-viewer",src:a,ref:e=>{m?.(e),g(e)},className:kn("flex w-full h-full",s,{"cursor-crosshair":j.hitPending}),style:{"--viewer-background":H},config:f,cameraType:A?V:void 0,onCameraTypeChanged:e=>{A&&v.updateCameraType(e.detail,!1)},phantom:R,featureLines:L,selectionHighlighting:Z,crossSectioning:F,featureMaps:J?"final":void 0,onTap:e=>{const t=[...i?[]:[C.selectCurrentHit]];w.tap(e,...t),l?.(e)},onLongpress:e=>{w.longPress(e),c?.(e)},onFrameDrawn:e=>{S.frameDrawn(e),d?.(e)},onSceneReady:async e=>{if(!A){P(!0);const t=await(e?.target?.scene());T(t?.sceneViewId)}u?.(e)},...h,children:[k&&e.jsx(VertexBoxSelectionTool,{}),Q?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:a})=>{const s=n.useRecoilValue(Vt),i=n.useRecoilValue(Et);return o.useEffect((()=>{t?.(s)}),[s,t]),o.useEffect((()=>{a?.(i)}),[i,a]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=({override:t,autoDefineCustomElements:a,children:s,config:i,...r})=>(o.useEffect((()=>{(null==a||a)&&(d.defineCustomElements(),c.defineCustomElements())}),[a]),e.jsx(n.RecoilRoot,{override:t,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,{...r}),e.jsx(VertexViewerToolkitRootConfig,{config:i,children:s})]})})),VertexViewerToolkitRootConfig=({config:t,children:a})=>{const s=n.useSetRecoilState(va);return o.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;s(e)}),[t,s]),e.jsx(e.Fragment,{children:a})};var Qa=Object.freeze({__proto__:null,get AssemblyFontFace(){return Ha},Columns:Ea,Core:Mt,Metadata:Ga,Search:Fa});exports.Appearance=Zn,exports.BoxSelection=rt,exports.Config=ba,exports.ContextMenu=ot,exports.CrossSection=Sn,exports.Ghosting=ya,exports.Hits=jt,exports.Keybinding=ea,exports.Measurement=St,exports.Messages=H,exports.Metadata=ma,exports.ModelViews=wn,exports.Panel=oa,exports.Performance=Oe,exports.SceneTree=Qa,exports.SceneViewItem=on,exports.Selection=Rt,exports.Settings=Lt,exports.Transforms=tn,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.VertexModelViewsPanel=VertexModelViewsPanel,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.VertexSceneItemMaterialColorSwatches=VertexSceneItemMaterialColorSwatches,exports.VertexSceneItemMaterialOpacitySlider=VertexSceneItemMaterialOpacitySlider,exports.VertexSceneTree=VertexSceneTree,exports.VertexSceneTreeColumnPopover=VertexSceneTreeColumnPopover,exports.VertexSceneTreeContextMenu=VertexSceneTreeContextMenu,exports.VertexSceneTreeCustomColumn=VertexSceneTreeCustomColumn,exports.VertexSceneTreeHeader=VertexSceneTreeHeader,exports.VertexSceneTreeMetadataColumns=VertexSceneTreeMetadataColumns,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.VertexShowPropertiesMenuItem=VertexShowPropertiesMenuItem,exports.VertexToolbar=VertexToolbar,exports.VertexToolbarDivider=VertexToolbarDivider,exports.VertexTransformClear=VertexTransformClear,exports.VertexTransformControls=VertexTransformControls,exports.VertexTransformInputs=VertexTransformInputs,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,exports.Viewer=Q;
|
|
19
19
|
//# sourceMappingURL=bundle.cjs.js.map
|