@vertexvis/viewer-toolkit-react 0.0.6-canary.4 → 0.0.6-canary.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import a from"quick-format-unescaped";import{useRecoilCallback as i,atom as l,selector as o,useRecoilValue as r,useRecoilState as s,useSetRecoilState as c,selectorFamily as d,atomFamily as u,DefaultValue as m,useRecoilValueLoadable as p,useRecoilStateLoadable as h,RecoilRoot as f}from"recoil";import{BoundingBox as g,Vector3 as v,Angle as b,Point as w,Euler as C,Matrix4 as S}from"@vertexvis/geometry";import*as k from"react";import A,{useEffect as T,useCallback as P,useRef as E,useState as M,useMemo as I}from"react";import{VertexColorPicker as N,VertexSlider as O,VertexRadioGroup as V,VertexRadio as _,VertexToggle as L,VertexTooltip as R,VertexIconButton as j,VertexDialog as D,VertexButton as B,VertexColorSwatch as H,VertexIcon as F,VertexDropdownMenu as U,VertexMenuItem as W,VertexResizable as G,VertexMenu as K,VertexMenuDivider as $,VertexDraggablePopover as q,VertexBanner as Y,VertexToast as X,VertexPopover as Z,VertexTextfield as J,VertexSelect as Q,VertexSpinner as ee}from"@vertexvis/ui-react";import{toWorldTransform as te,toLocalTransform as ne,toMatrix as ae,toRadiansTransform as ie,ColorMaterial as le}from"@vertexvis/viewer";import{VertexViewerMeasurementDetails as oe,VertexViewerMeasurementDistance as re,VertexViewerMeasurementPrecise as se,VertexSceneTreeSearch as ce,VertexSceneTreeToolbar as de,VertexSceneTreeNotificationBanner as ue,VertexSceneTreeTableColumn as me,VertexSceneTreeTableLayout as pe,VertexSceneTree as he,VertexViewerToolbarGroup as fe,VertexViewerToolbar as ge,VertexViewerTransformWidget as ve,VertexViewerBoxQueryTool as ye,VertexViewerViewCube as be,VertexViewer as we}from"@vertexvis/viewer-react";import Ce from"prop-types";import{defineCustomElements as Se}from"@vertexvis/ui/loader";import{defineCustomElements as xe}from"@vertexvis/viewer/loader";var 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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __rest(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]]);return n}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),i,l=[],o;try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)l.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return l}"function"==typeof SuppressedError&&SuppressedError;var ke=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,Ae=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,Te=/^(#|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=Te.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=ke.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=Ae.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):Te.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},Pe=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 Ee=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,i;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=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,i[a]))return!1;for(a=n;0!=a--;){var l=i[a];if(!equal(e[l],t[l]))return!1}return!0}return e!=e&&t!=t};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import a from"quick-format-unescaped";import{useRecoilCallback as i,atom as l,selector as o,useRecoilValue as r,useRecoilState as s,useSetRecoilState as c,selectorFamily as d,atomFamily as u,DefaultValue as m,useRecoilValueLoadable as p,useRecoilStateLoadable as h,RecoilRoot as f}from"recoil";import{BoundingBox as v,Vector3 as g,Angle as b,Point as w,Euler as C,Matrix4 as S}from"@vertexvis/geometry";import*as k from"react";import A,{useEffect as T,useCallback as P,useRef as M,useState as E,useMemo as I}from"react";import{VertexColorPicker as N,VertexSlider as O,VertexRadioGroup as V,VertexRadio as _,VertexToggle as L,VertexTooltip as R,VertexIconButton as j,VertexDialog as D,VertexButton as B,VertexColorSwatch as H,VertexIcon as F,VertexDropdownMenu as U,VertexMenuItem as W,VertexResizable as G,VertexMenu as K,VertexMenuDivider as $,VertexDraggablePopover as q,VertexBanner as Y,VertexToast as X,VertexPopover as Z,VertexTextfield as J,VertexSelect as Q,VertexSpinner as ee}from"@vertexvis/ui-react";import{toWorldTransform as te,toLocalTransform as ne,toMatrix as ae,toRadiansTransform as ie,ColorMaterial as le}from"@vertexvis/viewer";import{VertexViewerMeasurementDetails as oe,VertexViewerMeasurementDistance as re,VertexViewerMeasurementPrecise as se,VertexSceneTreeSearch as ce,VertexSceneTreeToolbar as de,VertexSceneTreeNotificationBanner as ue,VertexSceneTreeTableColumn as me,VertexSceneTreeTableLayout as pe,VertexSceneTree as he,VertexViewerToolbarGroup as fe,VertexViewerToolbar as ve,VertexViewerTransformWidget as ge,VertexViewerBoxQueryTool as ye,VertexViewerViewCube as be,VertexViewer as we}from"@vertexvis/viewer-react";import Ce from"prop-types";import{defineCustomElements as Se}from"@vertexvis/ui/loader";import{defineCustomElements as xe}from"@vertexvis/viewer/loader";var 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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __rest(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]]);return n}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),i,l=[],o;try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)l.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return l}"function"==typeof SuppressedError&&SuppressedError;var ke=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,Ae=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,Te=/^(#|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=Te.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=ke.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=Ae.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):Te.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},Pe=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 Me=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,i;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=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,i[a]))return!1;for(a=n;0!=a--;){var l=i[a];if(!equal(e[l],t[l]))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 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import a from"qu
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],i=n.slice(1),l=__assign({},a);if(0===i.length)return l;if(1===i.length){var o=i[0];for(var r in o)null==l[r]?l[r]=o[r]:isPlainObject(l[r])&&(l[r]=defaults(l[r],o[r]));return l}return i.reduce((function(e,t){return defaults(e,t)}),a)}function isPlainObject(e){return isPlainObject$1(e)}function isEqual$1(e,t){return Ee(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 Me=Object.freeze({__proto__:null,defaults:defaults,isPlainObject:isPlainObject,isEqual:isEqual$1,toPairs:toPairs,fromPairs:fromPairs}),Ie,Ne=new Uint8Array(16);function rng(){if(!Ie&&!(Ie="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 Ie(Ne)}var Oe=/^(?:[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&&Oe.test(e)}for(var Ve=[],_e=0;_e<256;++_e)Ve.push((_e+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ve[e[t+0]]+Ve[e[t+1]]+Ve[e[t+2]]+Ve[e[t+3]]+"-"+Ve[e[t+4]]+Ve[e[t+5]]+"-"+Ve[e[t+6]]+Ve[e[t+7]]+"-"+Ve[e[t+8]]+Ve[e[t+9]]+"-"+Ve[e[t+10]]+Ve[e[t+11]]+Ve[e[t+12]]+Ve[e[t+13]]+Ve[e[t+14]]+Ve[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,i=digits(n>>BigInt(32),BigInt(8)),l=digits(n>>BigInt(16),BigInt(4)),o=digits(n,BigInt(4)),r=digits(a>>BigInt(48),BigInt(4)),s=digits(a,BigInt(12));return"".concat(i,"-").concat(l,"-").concat(o,"-").concat(r,"-").concat(s)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],i=t[2],l=t[3],o=t[4];if(null==n||null==a||null==i||null==l||null==o)throw new Error("Invalid UUID string ".concat(e));var r=BigInt.asIntN(64,BigInt("0x".concat(n+a+i))),s=BigInt.asIntN(64,BigInt("0x".concat(l+o)));return{msb:r.toString(),lsb:s.toString()}}var Le=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb}),Re={exports:{}};const je=a;Re.exports=pino;const De=pfGlobalThisOrFallback().console||{},ze={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 Be=Symbol("pino.logFuncs"),He=Symbol("pino.hierarchy"),Fe={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[He]};t[He]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:De[e]||De[Fe[e]||"log"]||noop})),e[Be]=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||De;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},i=shouldSerialize(e.browser.serialize,a);let l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1);const o=Object.keys(e.customLevels||{}),r=["error","fatal","warn","info","debug","trace"].concat(o);"function"==typeof n&&r.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const s=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:i,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"),o.forEach((e=>{set(this,d,c,e)}))}function child(n,l,o){if(!l)throw new Error("missing bindings for child Pino");o=o||{},i&&l.serializers&&(o.serializers=l.serializers);const r=o.serializers;if(i&&r){var s=Object.assign({},a,r),c=!0===e.browser.serialize?Object.keys(s):i;delete l.serializers,applySerializers([l],c,s,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=l,s&&(this.serializers=s,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,l)))}Child.prototype=this;const d=new Child(this);return appendChildLogger(this,d),d.child=function(...e){return child.call(this,n,...e)},d.level=o.level||this.level,n.onChild(d),d}return c.levels=getLevels(e),c.level=s,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=i,c._stdErrSerialize=l,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[He];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[Be][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const i=undefined,l=levelToValue(t.transmit.level||e.level,n),o=undefined;if(levelToValue(a,n)<l)return}e[a]=createWrap(e,t,n,a);const i=getBindingChain(e);0!==i.length&&(e[a]=prependBindingsInArguments(i,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return i=e[Be][a],function LOG(){const l=t.timestamp(),o=new Array(arguments.length),r=Object.getPrototypeOf&&Object.getPrototypeOf(this)===De?De:this;for(var s=0;s<o.length;s++)o[s]=arguments[s];var c=!1;if(t.serialize&&(applySerializers(o,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?i.call(r,...asObject(this,a,o,l,t)):i.apply(r,o),t.transmit){const i=void 0,r=levelToValue(t.transmit.level||e._level,n),s=levelToValue(a,n);if(s<r)return;transmit(this,{ts:l,methodLevel:a,methodValue:s,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},o,c)}};var i}function asObject(e,t,n,a,i){const{level:l,log:o=e=>e}=i.formatters||{},r=n.slice();let s=r[0];const c={};let d=1+(0|e._childLevel);if(d<1&&(d=1),a&&(c.time=a),l){const n=l(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(null!==s&&"object"==typeof s)for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());const e=undefined;return[o(c),...r]}{if(null!==s&&"object"==typeof s){for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());s=r.length?je(r.shift(),r):void 0}else"string"==typeof s&&(s=je(r.shift(),r));void 0!==s&&(c[i.messageKey]=s);const e=undefined;return[o(c)]}}function applySerializers(e,t,n,a){for(const i in e)if(a&&e[i]instanceof Error)e[i]=pino.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(const a in e[i])t.indexOf(a)>-1&&a in n&&(e[i][a]=n[a](e[i][a]))}function transmit(e,t,n,a=!1){const i=t.send,l=t.ts,o=t.methodLevel,r=t.methodValue,s=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=l,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=r,i(o,e._logEvent,s),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 Ue;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=ze,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),Re.exports.default=pino,Re.exports.pino=pino;const We=(0,Re.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?We.error(t,e):We.error(e)},logger_info=(e,t)=>{null!=t?We.info(t,e):We.info(e)},logger_warn=(e,t)=>{null!=t?We.warn(t,e):We.warn(e)},logger_debug=(e,t)=>{null!=t?We.debug(t,e):We.debug(e)};class Ge{}function useActionCallback(e,t=[]){const n=undefined;return i((t=>e(Object.assign(Object.assign({},t),{snapshot:Object.defineProperties(t.snapshot,{getPromiseRequired:{configurable:!0,value:createGetPromiseRequiredWrapper(t.snapshot)},tryGetPromise:{configurable:!0,value:createTryGetPromiseWrapper(t.snapshot)}})}))),t instanceof Ge?void 0:t)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,a=__rest(t,["snapshot"]);return async(...t)=>{const i=n.retain();try{const i=undefined;return await e(Object.assign(Object.assign({},a),{snapshot:n}))(...t)}finally{i()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const a=await e.getPromise(t);if(null==a)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return a}}function createTryGetPromiseWrapper(e){return async t=>{try{return{value:await e.getPromise(t)}}catch(e){return logger_debug(`Error encountered retrieving Recoil value. [key={${t.key}}]`,e),{error:e}}}}const Ke=3e3,$e=5e3,qe=8e3,Ye=l({key:"applicationMessageToast",default:void 0}),Xe=l({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(Xe,null!=t?Object.assign(Object.assign({},t),{id:Le.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Ye,null!=t?Object.assign(Object.assign({},t),{id:Le.create()}):void 0)}))});var Ze=Object.freeze({__proto__:null,LOW_SEVERITY_BANNER_MESSAGE_DURATION_MS:$e,LOW_SEVERITY_TOAST_MESSAGE_DURATION_MS:Ke,MEDIUM_SEVERITY_TOAST_MESSAGE_DURATION_MS:qe,applicationMessageBanner:Xe,applicationMessageToast:Ye,useApplicationMessageActions:useApplicationMessageActions});const Je=500;function useViewerCameraActions(){const e=useApplicationMessageActions();return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(et),i=await(null==a?void 0:a.scene());await(null==i?void 0:i.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:Je}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(et),i=await(null==a?void 0:a.scene());await(null==i?void 0:i.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:Je}}))})),updateCameraType:useActionCallback((({set:t,snapshot:n})=>async(a,i)=>{const l=await n.getPromise(rt),o=undefined;null!=l&&g.isValid(l)||!i?t(Qe,a):e.setToastMessage({type:"error",message:"Cannot change the camera type when no geometry is visible.",duration:qe})}))}}const Qe=l({key:"viewerCameraType",default:"perspective"}),et=l({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),tt=l({key:"viewerElementId",default:"vertex-viewer"}),nt=l({key:"viewerInitialSceneReady",default:!1}),at=l({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),it=l({key:"viewerPrimaryInteractionType",default:"rotate"}),lt=l({key:"viewerSceneViewId",default:void 0});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const i=await e.getPromise(et),l=await(null==i?void 0:i.scene());a.length>0&&await(null==l?void 0:l.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=A.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=A.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),a=A.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=Le.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:a,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(et),a=await(null==n?void 0:n.scene()),i=await e.getPromiseRequired(Qe);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:i})}))}}const ot=l({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),rt=o({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(ot))||void 0===t?void 0:t.boundingBox}});var st=Object.freeze({__proto__:null,DEFAULT_CAMERA_ANIMATION_DURATION:Je,useViewerCameraActions:useViewerCameraActions,useViewerSceneActions:useViewerSceneActions,viewerBaseInteractionHandlerProvider:at,viewerCameraType:Qe,viewerElement:et,viewerElementId:tt,viewerFrameScene:ot,viewerInitialSceneReady:nt,viewerPrimaryInteractionType:it,viewerSceneViewId:lt,viewerSceneVisibleBoundingBox:rt});class ct{constructor(){this.interactionStarted=!1}initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){var e;this.interactionStarted||(await(null===(e=this.api)||void 0===e?void 0:e.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){var e;await(null===(e=this.api)||void 0===e?void 0:e.endInteraction()),this.interactionStarted=!1}}const create=(e,t=0)=>({normal:e,offset:t}),forAxis=(e,t)=>{switch(e){case"x":return x(t);case"y":return y(t);case"z":return z(t)}},x=e=>create(v.left(),-e),y=e=>create(v.down(),-e),z=e=>create(v.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},dt={x:v.left(),y:v.down(),z:v.forward()},xAxis=e=>e.x,yAxis=e=>e.y||v.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||v.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,a)=>e&&e.normal&&[["x",t],["y",n],["z",a]].filter((t=>0===v.magnitude(v.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>v.dot(v.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return v.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:v.multiply(e.normal,v.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=v.normalize(e.normal),a=v.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,i)=>{const l=n.viewAll(),o=getAxis(e,t),r=null!=a&&null!=o?create(o,v.dot(o,i||g.center(a))):forAxis(e,l.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[v.create(e.min.x,e.min.y,e.min.z),v.create(e.min.x,e.min.y,e.max.z),v.create(e.min.x,e.max.y,e.min.z),v.create(e.min.x,e.max.y,e.max.z),v.create(e.max.x,e.max.y,e.max.z),v.create(e.max.x,e.max.y,e.min.z),v.create(e.max.x,e.min.y,e.max.z),v.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 ut;!function(e){e.PART="PART",e.SINGLE="SINGLE"}(ut||(ut={}));const mt="#616161",pt=1,ht="#BDBDBD",ft={default:5,min:0,max:10},gt=l({key:"crossSectioningEnabled",default:!1}),vt=l({key:"crossSectioningHighlightColor",default:mt}),yt=l({key:"crossSectioningBorderWidth",default:1}),bt=l({key:"endCapEnabledDefault",default:!1}),wt=l({key:"endCapEnabled",default:!1}),Ct=l({key:"endCapColorType",default:ut.PART}),St=l({key:"endCapCustomColor",default:ht}),xt=l({key:"crossSectioningPlanes",default:[]}),kt=l({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),At=o({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(rt)}}),Tt=l({key:"crossSectioningIsInteractive",default:!1}),Pt=l({key:"crossSectioningActiveAxis",default:"x"}),Et=l({key:"crossSectioningAvailableAxes",default:dt}),Mt=o({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(xt);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),It=o({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(xt),n=e(At),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>v.dot(e,isNegativeNormal(t[0])?v.multiply(t[0].normal,v.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return ft}}),Nt=o({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(xt),n=e(Mt),a=e(It);return t.length>0?t[0].offset*n:a.default}}),Ot=l({key:"crossSectioningAdditionalToolsOpen",default:!1}),Vt=l({key:"crossSectioningAlignmentToolsOpen",default:!1}),_t=l({key:"crossSectioningAxisToolsOpen",default:!1}),Lt=l({key:"crossSectioningInteractionHandler",default:new ct,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const n=r(Lt);A.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(n))}),[e,t,n])}const Rt=l({key:"hitResultsTapDetails",default:void 0}),jt=l({key:"hitResultsLongPressDetails",default:void 0}),Dt=l({key:"previousHitResult",default:void 0}),zt=l({key:"currentHitResult",default:void 0}),Bt=o({key:"hitResult",get:async({get:e})=>{var t,n,a,i,l,o,r,s,c;const d=e(Rt),u=e(jt),m=null!=d?d:u,p=e(et),h=await(null==p?void 0:p.scene()),f=null==h?void 0:h.sceneViewId,g=null==h?void 0:h.raycaster();if(null!=m&&null!=g&&null!=f){const e=await g.hitItems(m.position),d=((null==e?void 0:e.hits)||[])[0];if(null!=d)return{id:null===(t=d.itemId)||void 0===t?void 0:t.hex,normal:v.create((null===(n=null==d?void 0:d.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==d?void 0:d.hitNormal)||void 0===a?void 0:a.y)||0,(null===(i=null==d?void 0:d.hitNormal)||void 0===i?void 0:i.z)||0),position:v.create((null===(l=null==d?void 0:d.hitPoint)||void 0===l?void 0:l.x)||0,(null===(o=null==d?void 0:d.hitPoint)||void 0===o?void 0:o.y)||0,(null===(r=null==d?void 0:d.hitPoint)||void 0===r?void 0:r.z)||0),meta:m.metaKey||m.ctrlKey||!1,metadata:[],ancestors:(null===(s=null==d?void 0:d.ancestors)||void 0===s?void 0:s.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[],annotationId:null===(c=null==d?void 0:d.annotationId)||void 0===c?void 0:c.hex}}}}),Ht=l({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=v.dot(v.normalize(e.up),t),a=Math.abs(n)>.98?v.normalize(v.scale(-n,e.viewVector)):e.up,i=v.add(v.scale(v.distance(e.position,e.lookAt),v.multiply(t,v.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:i})}{const a=v.angleTo(v.normalize(e.viewVector),t),i=null!=n?g.center(n):e.lookAt,l=v.normalize(v.cross(v.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,i,l)}};function isParallelTo(e,t){const n=b.toDegrees(v.angleTo(e,t));return 0===n||180===n}const Ft=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(yt),n=await e.getPromise(vt),a=await e.getPromise(xt),i=await e.getPromise(et),l=await(null==i?void 0:i.scene());await(null==l?void 0:l.crossSectioning().update({sectionPlanes:a,highlightColor:n?Pe.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const i=await a.getPromise(et),l=await(null==i?void 0:i.scene());if(null!=l){const a=l.camera().viewAll();n(Et),t(xt,[towardsCamera(l.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(Bt).then((e=>e.value)),i=await t.getPromise(et),l=await(null==i?void 0:i.scene());if(null!=a&&null!=l){const t=fromHit(a,l.camera());n(xt,null!=t?[t]:[]),n(Et,null!=t?{x:t.normal}:dt),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(xt),i=undefined;await n.getPromise(gt)||(e(gt,!0),0===a.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(gt)&&(t(gt),t(Ot),t(Vt),t(_t),t(xt),t(kt),t(Pt),await e())}));return{enable:a,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(gt)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(gt)||await a(),e(Ot,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(Ot)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(_t),e(Vt,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(Vt)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(Vt),e(_t,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(_t)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Lt);e(Tt,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(Lt);e(Tt),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(xt);if(i.length>0){const l=await n.getPromise(Mt),o=await n.getPromise(It),r=l<0?-1*o.max:o.min,s=l<0?-1*o.min:o.max,c=i.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*l,r),s)})));t(xt,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(xt);t(xt,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(xt),n=await e.getPromise(et),a=await(null==n?void 0:n.scene());t.length>0&&null!=a&&await alignToNormal(a.camera(),t[0].normal,a.boundingBox()).render({animation:{milliseconds:Ft}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async i=>{const l=await a.getPromise(xt),o=await a.getPromise(Et),r=await a.getPromise(At),s=await a.getPromise(kt),c=await a.getPromise(et),d=await(null==c?void 0:c.scene()),u=o[i],m=null!=u&&l.length>0&&isParallelTo(l[0].normal,u)&&!isNaN(v.angleTo(l[0].normal,u));if(null!=d&&!m){const e=await a.tryGetPromise(Bt).then((e=>e.value));t(Pt,i),t(xt,[toAxis(i,o,d.camera(),r,"global"!==s.mode?null==e?void 0:e.position:void 0)])}n(_t),await e()}))),updateAlignment:useActionCallback((({set:e,reset:i})=>async(l,o)=>{i(Vt),e(kt,{mode:l,hitPending:"global"!==l&&null==o}),"global"===l?(i(Pt),i(Et),await t()):"surface"===l&&null!=o&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(kt);a.hitPending&&(e(kt,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(kt);n.hitPending&&e(kt,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Ut=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Ft,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:mt,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_END_CAPPING_COLOR:ht,DEFAULT_SLIDER_RANGE:ft,get EndCapColorType(){return ut},crossSectioningActiveAxis:Pt,crossSectioningAdditionalToolsOpen:Ot,crossSectioningAlignment:kt,crossSectioningAlignmentToolsOpen:Vt,crossSectioningAvailableAxes:Et,crossSectioningAxisToolsOpen:_t,crossSectioningBorderWidth:yt,crossSectioningEnabled:gt,crossSectioningHighlightColor:vt,crossSectioningInteractionHandler:Lt,crossSectioningIsInteractive:Tt,crossSectioningOffsetScalar:Mt,crossSectioningPlaneDisplayOffset:Nt,crossSectioningPlanes:xt,crossSectioningSliderRange:It,crossSectioningTargetBoundingBox:At,endCapColorType:Ct,endCapCustomColor:St,endCapEnabled:wt,endCapEnabledDefault:bt,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=A.useState();return A.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),A.useCallback((i=>{const handler=()=>{e(i)};null!=n&&clearTimeout(n),a(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,a=__rest(t,["onInput"]);const i=useDebouncedCallback((e=>{null==n||n(e)}),500),l=A.useCallback((e=>{const t=e.target;i(t.value)}),[i]);return e(N,Object.assign({onInput:l},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=s(vt);return e(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{i(e),await n.reapply()}})};var Wt={exports:{}},Gt;
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],i=n.slice(1),l=__assign({},a);if(0===i.length)return l;if(1===i.length){var o=i[0];for(var r in o)null==l[r]?l[r]=o[r]:isPlainObject(l[r])&&(l[r]=defaults(l[r],o[r]));return l}return i.reduce((function(e,t){return defaults(e,t)}),a)}function isPlainObject(e){return isPlainObject$1(e)}function isEqual$1(e,t){return Me(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 Ee=Object.freeze({__proto__:null,defaults:defaults,isPlainObject:isPlainObject,isEqual:isEqual$1,toPairs:toPairs,fromPairs:fromPairs}),Ie,Ne=new Uint8Array(16);function rng(){if(!Ie&&!(Ie="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 Ie(Ne)}var Oe=/^(?:[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&&Oe.test(e)}for(var Ve=[],_e=0;_e<256;++_e)Ve.push((_e+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ve[e[t+0]]+Ve[e[t+1]]+Ve[e[t+2]]+Ve[e[t+3]]+"-"+Ve[e[t+4]]+Ve[e[t+5]]+"-"+Ve[e[t+6]]+Ve[e[t+7]]+"-"+Ve[e[t+8]]+Ve[e[t+9]]+"-"+Ve[e[t+10]]+Ve[e[t+11]]+Ve[e[t+12]]+Ve[e[t+13]]+Ve[e[t+14]]+Ve[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,i=digits(n>>BigInt(32),BigInt(8)),l=digits(n>>BigInt(16),BigInt(4)),o=digits(n,BigInt(4)),r=digits(a>>BigInt(48),BigInt(4)),s=digits(a,BigInt(12));return"".concat(i,"-").concat(l,"-").concat(o,"-").concat(r,"-").concat(s)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],i=t[2],l=t[3],o=t[4];if(null==n||null==a||null==i||null==l||null==o)throw new Error("Invalid UUID string ".concat(e));var r=BigInt.asIntN(64,BigInt("0x".concat(n+a+i))),s=BigInt.asIntN(64,BigInt("0x".concat(l+o)));return{msb:r.toString(),lsb:s.toString()}}var Le=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb}),Re={exports:{}};const je=a;Re.exports=pino;const De=pfGlobalThisOrFallback().console||{},ze={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 Be=Symbol("pino.logFuncs"),He=Symbol("pino.hierarchy"),Fe={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[He]};t[He]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:De[e]||De[Fe[e]||"log"]||noop})),e[Be]=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||De;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},i=shouldSerialize(e.browser.serialize,a);let l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1);const o=Object.keys(e.customLevels||{}),r=["error","fatal","warn","info","debug","trace"].concat(o);"function"==typeof n&&r.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const s=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:i,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"),o.forEach((e=>{set(this,d,c,e)}))}function child(n,l,o){if(!l)throw new Error("missing bindings for child Pino");o=o||{},i&&l.serializers&&(o.serializers=l.serializers);const r=o.serializers;if(i&&r){var s=Object.assign({},a,r),c=!0===e.browser.serialize?Object.keys(s):i;delete l.serializers,applySerializers([l],c,s,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=l,s&&(this.serializers=s,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,l)))}Child.prototype=this;const d=new Child(this);return appendChildLogger(this,d),d.child=function(...e){return child.call(this,n,...e)},d.level=o.level||this.level,n.onChild(d),d}return c.levels=getLevels(e),c.level=s,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=i,c._stdErrSerialize=l,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[He];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[Be][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const i=undefined,l=levelToValue(t.transmit.level||e.level,n),o=undefined;if(levelToValue(a,n)<l)return}e[a]=createWrap(e,t,n,a);const i=getBindingChain(e);0!==i.length&&(e[a]=prependBindingsInArguments(i,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return i=e[Be][a],function LOG(){const l=t.timestamp(),o=new Array(arguments.length),r=Object.getPrototypeOf&&Object.getPrototypeOf(this)===De?De:this;for(var s=0;s<o.length;s++)o[s]=arguments[s];var c=!1;if(t.serialize&&(applySerializers(o,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?i.call(r,...asObject(this,a,o,l,t)):i.apply(r,o),t.transmit){const i=void 0,r=levelToValue(t.transmit.level||e._level,n),s=levelToValue(a,n);if(s<r)return;transmit(this,{ts:l,methodLevel:a,methodValue:s,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},o,c)}};var i}function asObject(e,t,n,a,i){const{level:l,log:o=e=>e}=i.formatters||{},r=n.slice();let s=r[0];const c={};let d=1+(0|e._childLevel);if(d<1&&(d=1),a&&(c.time=a),l){const n=l(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(null!==s&&"object"==typeof s)for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());const e=undefined;return[o(c),...r]}{if(null!==s&&"object"==typeof s){for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());s=r.length?je(r.shift(),r):void 0}else"string"==typeof s&&(s=je(r.shift(),r));void 0!==s&&(c[i.messageKey]=s);const e=undefined;return[o(c)]}}function applySerializers(e,t,n,a){for(const i in e)if(a&&e[i]instanceof Error)e[i]=pino.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(const a in e[i])t.indexOf(a)>-1&&a in n&&(e[i][a]=n[a](e[i][a]))}function transmit(e,t,n,a=!1){const i=t.send,l=t.ts,o=t.methodLevel,r=t.methodValue,s=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=l,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=r,i(o,e._logEvent,s),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 Ue;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=ze,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),Re.exports.default=pino,Re.exports.pino=pino;const We=(0,Re.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?We.error(t,e):We.error(e)},logger_info=(e,t)=>{null!=t?We.info(t,e):We.info(e)},logger_warn=(e,t)=>{null!=t?We.warn(t,e):We.warn(e)},logger_debug=(e,t)=>{null!=t?We.debug(t,e):We.debug(e)};class Ge{}function useActionCallback(e,t=[]){const n=undefined;return i((t=>e(Object.assign(Object.assign({},t),{snapshot:Object.defineProperties(t.snapshot,{getPromiseRequired:{configurable:!0,value:createGetPromiseRequiredWrapper(t.snapshot)},tryGetPromise:{configurable:!0,value:createTryGetPromiseWrapper(t.snapshot)}})}))),t instanceof Ge?void 0:t)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,a=__rest(t,["snapshot"]);return async(...t)=>{const i=n.retain();try{const i=undefined;return await e(Object.assign(Object.assign({},a),{snapshot:n}))(...t)}finally{i()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const a=await e.getPromise(t);if(null==a)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return a}}function createTryGetPromiseWrapper(e){return async t=>{try{return{value:await e.getPromise(t)}}catch(e){return logger_debug(`Error encountered retrieving Recoil value. [key={${t.key}}]`,e),{error:e}}}}const Ke=3e3,$e=5e3,qe=8e3,Ye=l({key:"applicationMessageToast",default:void 0}),Xe=l({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(Xe,null!=t?Object.assign(Object.assign({},t),{id:Le.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Ye,null!=t?Object.assign(Object.assign({},t),{id:Le.create()}):void 0)}))});var Ze=Object.freeze({__proto__:null,LOW_SEVERITY_BANNER_MESSAGE_DURATION_MS:$e,LOW_SEVERITY_TOAST_MESSAGE_DURATION_MS:Ke,MEDIUM_SEVERITY_TOAST_MESSAGE_DURATION_MS:qe,applicationMessageBanner:Xe,applicationMessageToast:Ye,useApplicationMessageActions:useApplicationMessageActions});const Je=500;function useViewerCameraActions(){const e=useApplicationMessageActions();return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(et),i=await(null==a?void 0:a.scene());await(null==i?void 0:i.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:Je}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(et),i=await(null==a?void 0:a.scene());await(null==i?void 0:i.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:Je}}))})),updateCameraType:useActionCallback((({set:t,snapshot:n})=>async(a,i)=>{const l=await n.getPromise(rt),o=undefined;null!=l&&v.isValid(l)||!i?t(Qe,a):e.setToastMessage({type:"error",message:"Cannot change the camera type when no geometry is visible.",duration:qe})}))}}const Qe=l({key:"viewerCameraType",default:"perspective"}),et=l({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),tt=l({key:"viewerElementId",default:"vertex-viewer"}),nt=l({key:"viewerInitialSceneReady",default:!1}),at=l({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),it=l({key:"viewerPrimaryInteractionType",default:"rotate"}),lt=l({key:"viewerSceneViewId",default:void 0});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const i=await e.getPromise(et),l=await(null==i?void 0:i.scene());a.length>0&&await(null==l?void 0:l.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=A.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=A.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),a=A.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=Le.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:a,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(et),a=await(null==n?void 0:n.scene()),i=await e.getPromiseRequired(Qe);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:i})}))}}const ot=l({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),rt=o({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(ot))||void 0===t?void 0:t.boundingBox}});var st=Object.freeze({__proto__:null,DEFAULT_CAMERA_ANIMATION_DURATION:Je,useViewerCameraActions:useViewerCameraActions,useViewerSceneActions:useViewerSceneActions,viewerBaseInteractionHandlerProvider:at,viewerCameraType:Qe,viewerElement:et,viewerElementId:tt,viewerFrameScene:ot,viewerInitialSceneReady:nt,viewerPrimaryInteractionType:it,viewerSceneViewId:lt,viewerSceneVisibleBoundingBox:rt});class ct{constructor(){this.interactionStarted=!1}initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){var e;this.interactionStarted||(await(null===(e=this.api)||void 0===e?void 0:e.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){var e;await(null===(e=this.api)||void 0===e?void 0:e.endInteraction()),this.interactionStarted=!1}}const create=(e,t=0)=>({normal:e,offset:t}),forAxis=(e,t)=>{switch(e){case"x":return x(t);case"y":return y(t);case"z":return z(t)}},x=e=>create(g.left(),-e),y=e=>create(g.down(),-e),z=e=>create(g.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},dt={x:g.left(),y:g.down(),z:g.forward()},xAxis=e=>e.x,yAxis=e=>e.y||g.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||g.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,a)=>e&&e.normal&&[["x",t],["y",n],["z",a]].filter((t=>0===g.magnitude(g.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>g.dot(g.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return g.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:g.multiply(e.normal,g.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=g.normalize(e.normal),a=g.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,i)=>{const l=n.viewAll(),o=getAxis(e,t),r=null!=a&&null!=o?create(o,g.dot(o,i||v.center(a))):forAxis(e,l.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[g.create(e.min.x,e.min.y,e.min.z),g.create(e.min.x,e.min.y,e.max.z),g.create(e.min.x,e.max.y,e.min.z),g.create(e.min.x,e.max.y,e.max.z),g.create(e.max.x,e.max.y,e.max.z),g.create(e.max.x,e.max.y,e.min.z),g.create(e.max.x,e.min.y,e.max.z),g.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 ut;!function(e){e.PART="PART",e.SINGLE="SINGLE"}(ut||(ut={}));const mt="#616161",pt=1,ht="#BDBDBD",ft={default:5,min:0,max:10},vt=l({key:"crossSectioningEnabled",default:!1}),gt=l({key:"crossSectioningHighlightColor",default:mt}),yt=l({key:"crossSectioningBorderWidth",default:1}),bt=l({key:"endCapEnabledDefault",default:!1}),wt=l({key:"endCapEnabled",default:!1}),Ct=l({key:"endCapColorType",default:ut.PART}),St=l({key:"endCapCustomColor",default:ht}),xt=l({key:"crossSectioningPlanes",default:[]}),kt=l({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),At=o({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(rt)}}),Tt=l({key:"crossSectioningIsInteractive",default:!1}),Pt=l({key:"crossSectioningActiveAxis",default:"x"}),Mt=l({key:"crossSectioningAvailableAxes",default:dt}),Et=o({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(xt);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),It=o({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(xt),n=e(At),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>g.dot(e,isNegativeNormal(t[0])?g.multiply(t[0].normal,g.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return ft}}),Nt=o({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(xt),n=e(Et),a=e(It);return t.length>0?t[0].offset*n:a.default}}),Ot=l({key:"crossSectioningAdditionalToolsOpen",default:!1}),Vt=l({key:"crossSectioningAlignmentToolsOpen",default:!1}),_t=l({key:"crossSectioningAxisToolsOpen",default:!1}),Lt=l({key:"crossSectioningInteractionHandler",default:new ct,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const n=r(Lt);A.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(n))}),[e,t,n])}const Rt=l({key:"hitResultsTapDetails",default:void 0}),jt=l({key:"hitResultsLongPressDetails",default:void 0}),Dt=l({key:"previousHitResult",default:void 0}),zt=l({key:"currentHitResult",default:void 0}),Bt=o({key:"hitResult",get:async({get:e})=>{var t,n,a,i,l,o,r,s,c;const d=e(Rt),u=e(jt),m=null!=d?d:u,p=e(et),h=await(null==p?void 0:p.scene()),f=null==h?void 0:h.sceneViewId,v=null==h?void 0:h.raycaster();if(null!=m&&null!=v&&null!=f){const e=await v.hitItems(m.position),d=((null==e?void 0:e.hits)||[])[0];if(null!=d)return{id:null===(t=d.itemId)||void 0===t?void 0:t.hex,normal:g.create((null===(n=null==d?void 0:d.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==d?void 0:d.hitNormal)||void 0===a?void 0:a.y)||0,(null===(i=null==d?void 0:d.hitNormal)||void 0===i?void 0:i.z)||0),position:g.create((null===(l=null==d?void 0:d.hitPoint)||void 0===l?void 0:l.x)||0,(null===(o=null==d?void 0:d.hitPoint)||void 0===o?void 0:o.y)||0,(null===(r=null==d?void 0:d.hitPoint)||void 0===r?void 0:r.z)||0),meta:m.metaKey||m.ctrlKey||!1,metadata:[],ancestors:(null===(s=null==d?void 0:d.ancestors)||void 0===s?void 0:s.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[],annotationId:null===(c=null==d?void 0:d.annotationId)||void 0===c?void 0:c.hex}}}}),Ht=l({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=g.dot(g.normalize(e.up),t),a=Math.abs(n)>.98?g.normalize(g.scale(-n,e.viewVector)):e.up,i=g.add(g.scale(g.distance(e.position,e.lookAt),g.multiply(t,g.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:i})}{const a=g.angleTo(g.normalize(e.viewVector),t),i=null!=n?v.center(n):e.lookAt,l=g.normalize(g.cross(g.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,i,l)}};function isParallelTo(e,t){const n=b.toDegrees(g.angleTo(e,t));return 0===n||180===n}const Ft=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(yt),n=await e.getPromise(gt),a=await e.getPromise(xt),i=await e.getPromise(et),l=await(null==i?void 0:i.scene());await(null==l?void 0:l.crossSectioning().update({sectionPlanes:a,highlightColor:n?Pe.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const i=await a.getPromise(et),l=await(null==i?void 0:i.scene());if(null!=l){const a=l.camera().viewAll();n(Mt),t(xt,[towardsCamera(l.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(Bt).then((e=>e.value)),i=await t.getPromise(et),l=await(null==i?void 0:i.scene());if(null!=a&&null!=l){const t=fromHit(a,l.camera());n(xt,null!=t?[t]:[]),n(Mt,null!=t?{x:t.normal}:dt),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(xt),i=undefined;await n.getPromise(vt)||(e(vt,!0),0===a.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(vt)&&(t(vt),t(Ot),t(Vt),t(_t),t(xt),t(kt),t(Pt),await e())}));return{enable:a,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(vt)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(vt)||await a(),e(Ot,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(Ot)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(_t),e(Vt,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(Vt)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(Vt),e(_t,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(_t)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Lt);e(Tt,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(Lt);e(Tt),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(xt);if(i.length>0){const l=await n.getPromise(Et),o=await n.getPromise(It),r=l<0?-1*o.max:o.min,s=l<0?-1*o.min:o.max,c=i.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*l,r),s)})));t(xt,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(xt);t(xt,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(xt),n=await e.getPromise(et),a=await(null==n?void 0:n.scene());t.length>0&&null!=a&&await alignToNormal(a.camera(),t[0].normal,a.boundingBox()).render({animation:{milliseconds:Ft}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async i=>{const l=await a.getPromise(xt),o=await a.getPromise(Mt),r=await a.getPromise(At),s=await a.getPromise(kt),c=await a.getPromise(et),d=await(null==c?void 0:c.scene()),u=o[i],m=null!=u&&l.length>0&&isParallelTo(l[0].normal,u)&&!isNaN(g.angleTo(l[0].normal,u));if(null!=d&&!m){const e=await a.tryGetPromise(Bt).then((e=>e.value));t(Pt,i),t(xt,[toAxis(i,o,d.camera(),r,"global"!==s.mode?null==e?void 0:e.position:void 0)])}n(_t),await e()}))),updateAlignment:useActionCallback((({set:e,reset:i})=>async(l,o)=>{i(Vt),e(kt,{mode:l,hitPending:"global"!==l&&null==o}),"global"===l?(i(Pt),i(Mt),await t()):"surface"===l&&null!=o&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(kt);a.hitPending&&(e(kt,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(kt);n.hitPending&&e(kt,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Ut=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Ft,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:mt,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_END_CAPPING_COLOR:ht,DEFAULT_SLIDER_RANGE:ft,get EndCapColorType(){return ut},crossSectioningActiveAxis:Pt,crossSectioningAdditionalToolsOpen:Ot,crossSectioningAlignment:kt,crossSectioningAlignmentToolsOpen:Vt,crossSectioningAvailableAxes:Mt,crossSectioningAxisToolsOpen:_t,crossSectioningBorderWidth:yt,crossSectioningEnabled:vt,crossSectioningHighlightColor:gt,crossSectioningInteractionHandler:Lt,crossSectioningIsInteractive:Tt,crossSectioningOffsetScalar:Et,crossSectioningPlaneDisplayOffset:Nt,crossSectioningPlanes:xt,crossSectioningSliderRange:It,crossSectioningTargetBoundingBox:At,endCapColorType:Ct,endCapCustomColor:St,endCapEnabled:wt,endCapEnabledDefault:bt,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=A.useState();return A.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),A.useCallback((i=>{const handler=()=>{e(i)};null!=n&&clearTimeout(n),a(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,a=__rest(t,["onInput"]);const i=useDebouncedCallback((e=>{null==n||n(e)}),500),l=A.useCallback((e=>{const t=e.target;i(t.value)}),[i]);return e(N,Object.assign({onInput:l},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=s(gt);return e(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{i(e),await n.reapply()}})};var Wt={exports:{}},Gt;
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
- */Gt=Wt,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}Gt.exports?(classNames.default=classNames,Gt.exports=classNames):window.classNames=classNames}();var Kt=Wt.exports;const VertexSlider=n=>{var{value:a,defaultValue:i,leftLabel:l,rightLabel:o,onChange:r,onValueChange:s,onValueInput:c}=n,d=__rest(n,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[u,m]=A.useState(i);return t("div",{className:"flex w-full items-center gap-2",children:[l&&e("div",{className:"pl-0.5 text-xs text-center",children:l}),e(O,Object.assign({className:Kt("w-full",{"mt-0.5":null!=l||null!=o}),value:null!=a?a:u,onValueChange:e=>{m(e.detail.value),null==r||r(e.detail.value),null==s||s(e)},onValueInput:e=>{m(e.detail.value),null==r||r(e.detail.value),null==c||c(e)}},d)),o&&e("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:o})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=s(yt);return e(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:async e=>{i(e.detail.value),await n.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexEndCapColorOptions=({onUpdateColorType:n})=>{const[a,i]=s(Ct);return e("div",{className:"pl-2 text-sm text-neutral-700",children:t(V,{value:a,"data-testid":"end-capping-color-type-radio-group",name:"end-capping-color-type",onValueChanged:e=>{i(e.detail.toUpperCase()===ut.PART?ut.PART:ut.SINGLE),null==n||n(e.detail)},children:[e(_,{"data-testid":"end-capping-color-part-color",label:"Part Color",value:ut.PART}),e(_,{"data-testid":"end-capping-color-single-color",label:"Single Color",value:ut.SINGLE})]})})},VertexEndCapColorPicker=({onUpdateCustomColor:t})=>{const[n,a]=s(St);return e(VertexColorPicker,{"data-testid":"end-capping-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexEndCapToggle=({onEnabledChange:t})=>{const[n,a]=s(wt);return e(L,{className:"flex items-center","data-testid":"end-item-enabled-toggle",variant:"switch",checked:n,onValueChanged:async e=>{a(e.detail),null==t||t(e.detail)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i,showEndCapSettings:l,onEndCapEnabledChange:o,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:c}){const d=r(Ct);return t(n,{children:[l&&t("div",{className:"flex items-center pt-2 pb-2",children:[e(VertexEndCapToggle,{onEnabledChange:o}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Show End Cap"})]}),e("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Line Color"}),e(VertexCrossSectionAppearanceColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:i}),l&&t("div",{children:[e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Cap Color"}),e(VertexEndCapColorOptions,{onUpdateColorType:s}),d===ut.SINGLE&&e("div",{className:"mt-2",children:e(VertexEndCapColorPicker,{onUpdateCustomColor:c})})]})]})}function PanelSection({header:n,children:a}){return t("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e("div",{className:"my-2 text-base text-neutral-700",children:n}),a]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const n=useCrossSectioningActions(),[a,i]=s(vt),[l,o]=s(yt),c=r(bt),[d,u]=s(wt),[m,p]=s(Ct),[h,f]=s(St),g=a!==mt||1!==l||d!==c||m!==ut.PART||h!==ht;return e("div",{className:"ml-auto",children:e(R,{content:"Reset Cross Sectioning Appearance",children:e(j,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(mt),o(1),u(c),p(ut.PART),f(ht),null==t||t(),await n.reapply()},disabled:!g})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:n,onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i,onEndCapEnabledChange:l,onUpdateEndCapColorType:o,onUpdateEndCapCustomColor:r}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Cross Sectioning",e(VertexCrossSectionAppearanceReset,{onReset:n})]}),children:e(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i,onEndCapEnabledChange:l,onUpdateEndCapColorType:o,onUpdateEndCapCustomColor:r})})}const $t=.5,qt="#444444",Yt=l({key:"featureEdgesSelectedColor",default:qt}),Xt=l({key:"featureEdgesLineThickness",default:$t}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[n,a]=s(Yt);return e(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[n,a]=s(Xt);return e(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexFeatureEdgesColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexFeatureEdgesThicknessSlider,{onUpdate:i})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[n,a]=s(Yt),[i,l]=s(Xt),o=undefined;return e("div",{className:"ml-auto",children:e(R,{content:"Reset Feature Edges",children:e(j,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(qt),l($t),null==t||t()},disabled:!(i!==$t||n!==qt)})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:n,onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Feature Edges",e(VertexFeatureEdgesReset,{onReset:n})]}),children:e(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i})})}function contextMenuItemIsRow(e){var t;return null!=e&&null!=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.id)}function contextMenuItemIsElement(e){return null!=e&&e instanceof HTMLElement}const Zt=l({key:"contextMenuActive",default:void 0}),Jt=l({key:"contextMenuPosition",default:void 0}),Qt=l({key:"contextMenuTarget",default:void 0}),en=l({key:"contextMenuItem",default:void 0}),tn=l({key:"contextMenuActions",default:[]}),nn=o({key:"contextMenuActivePosition",get:({get:e})=>null!=e(Zt)?e(Jt):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,a=null==t?void 0:t.clientY;e(Jt,w.create(n,a)),e(Qt,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,i,l)=>{const o=await e.getPromise(Jt),r=await e.getPromise(Zt);if(null!=o&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,s=w.create(e,r),c=null!=o?w.distance(o,s):0,d=null==i||i(n);c<2&&d&&(null==l||l(n,null!=o?o:s),t(Zt,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,i)=>{if(null==a||a(t)){const a=w.create(t.touches[0].clientX,t.touches[0].clientY);e(Jt,a),e(Qt,t.target),e(Zt,n),null==i||i(t,a)}})),setContextMenuItem:useActionCallback((({snapshot:e,set:t,reset:n})=>async a=>{const i=await e.getPromise(tn);t(en,a),i.forEach((e=>e(a))),n(tn)})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Ht,!!n),e(Zt),e(tn),e(Jt)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Ht)))}}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 an=Object.freeze({__proto__:null,contextMenuActions:tn,contextMenuActive:Zt,contextMenuActivePosition:nn,contextMenuItem:en,contextMenuItemIsElement:contextMenuItemIsElement,contextMenuItemIsRow:contextMenuItemIsRow,contextMenuPosition:Jt,contextMenuTarget:Qt,targetShouldSkipNextHit:targetShouldSkipNextHit,targetWithinMenu:targetWithinMenu,useContextMenuActions:useContextMenuActions});const ln=l({key:"boxSelectionEnabled",default:!1}),on=l({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(ln,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(ln),e(on)})),setOperationType:useActionCallback((({set:e})=>t=>{e(on,t)}))});var rn=Object.freeze({__proto__:null,boxSelectionEnabled:ln,boxSelectionOperationType:on,useBoxSelectionActions:useBoxSelectionActions});async function whenComponentReady(e,t,n=customElements,a=requestAnimationFrame,i=setTimeout){return null!=e&&null!=e.nodeName&&await n.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):(await new Promise((e=>"function"==typeof a?a(e):i(e))),t())}const sn=l({key:"isEditingPointToPointMeasurement",default:!1}),cn=l({key:"pointToPointMeasurementOutcome",default:void 0}),dn=l({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=c(cn);T((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const un=2,mn=l({key:"isEditingPreciseMeasurement",default:!1}),pn=l({key:"preciseMeasurementOutcome",default:void 0}),hn=l({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),fn=l({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),gn=l({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),vn=o({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(gn).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,n){const a=c(gn),i=c(pn),l=c(hn),o=c(fn),s=r(hn);T((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{a(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,a]),T((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{i(e),null==n||n(e)}))})),()=>null==t?void 0:t.dispose()}),[e,i]),T((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==s||s.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,s]),T((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),T((()=>{whenComponentReady(e,(()=>{o(null==e?void 0:e.measurementOverlays)}))}),[e,o])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),i=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(hn);null==t||t.clearEntities()})),l=useActionCallback((()=>async(e={})=>{await i(),n(e),a()})),o=useActionCallback((({set:e,reset:n})=>async a=>{await l(),"point-to-point"===a?t():(n(pn),n(gn),e(mn,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await l(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await o(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(mn),a=await e.getPromise(sn);n?await i():a&&(t(cn),t(dn))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(dn)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(dn,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(sn)?await l():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(mn)?await l():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(sn,!0),n.keepExistingMeasurement||e(cn)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(sn),t.keepExistingMeasurement||(e(dn),e(cn))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(mn),e(pn),e(gn)}))}const yn=o({key:"isEditingMeasurement",get:({get:e})=>e(sn)||e(mn)}),bn=o({key:"measurementPanelModel",get:({get:e})=>e(cn)||e(pn)}),wn=o({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(fn)}),Cn=o({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(mn)?e(vn):void 0}}),Sn=o({key:"measurementPanelIsResettable",get:({get:e})=>e(yn)&&null!=e(bn)});var xn=Object.freeze({__proto__:null,editedPointToPointMeasurement:dn,isEditingMeasurement:yn,isEditingPointToPointMeasurement:sn,isEditingPreciseMeasurement:mn,measurementPanelIsResettable:Sn,measurementPanelMessage:Cn,measurementPanelOutcome:bn,measurementPanelOverlays:wn,pointToPointMeasurementOutcome:cn,preciseMeasurementController:hn,preciseMeasurementEntities:gn,preciseMeasurementMessage:vn,preciseMeasurementOutcome:pn,preciseMeasurementOverlays:fn,useDisablePointToPointMeasurement:useDisablePointToPointMeasurement,useDisablePreciseMeasurement:useDisablePreciseMeasurement,useEnablePointToPointMeasurement:useEnablePointToPointMeasurement,useMeasurementActions:useMeasurementActions,usePointToPointMeasurement:usePointToPointMeasurement,usePreciseMeasurementModel:usePreciseMeasurementModel});const kn="Scene Alteration Performance";var An;!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"}(An||(An={}));var Tn=Object.freeze({__proto__:null,SCENE_ALTERATION_PERFORMANCE:kn,get SceneAlterationPerformanceType(){return An}});const Pn=l({key:"fetchedItemInvalidator",default:0}),En=d({key:"fetchedItems",get:e=>async({get:t})=>{var n;const a=t(et),i=t(lt);if(t(Pn),t(da),null!=i)try{return await(null===(n=null==a?void 0:a.sceneItems)||void 0===n?void 0:n.getSceneViewItem(e,i,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}}),Mn=u({key:"selectionSelectedItems",default:void 0}),In=l({key:"selectionSelectedItemIds",default:[]}),Nn=l({key:"selectionLastSelected",default:void 0}),On=l({key:"selectionLastSelectionFromViewer",default:!1}),Vn=l({key:"selectionLastSelectWasMultiSelect",default:!1}),_n=o({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(Nn),n=undefined;return e(In).filter((e=>{var n;return e!==(null==t?void 0:t.id)&&!(null===(n=null==t?void 0:t.ancestors)||void 0===n?void 0:n.includes(e))})).length>0}}),Ln=l({key:"selectionFirstSelectedItemInTreeId",default:void 0}),Rn=o({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(Nn),i=e(In);return null!==(n=null===(t=null==a?void 0:a.ancestors)||void 0===t?void 0:t.find((e=>i.includes(e))))&&void 0!==n?n:null==a?void 0:a.id}}),jn=l({key:"selectionPreviousVisibleSummary",default:void 0}),Dn=l({key:"selectionVisibleSummary",default:void 0}),zn=o({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(Dn))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),Bn=o({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(Dn);return null!=(null==t?void 0:t.boundingBox)?g.center(t.boundingBox):v.origin()}}),Hn=o({key:"selectionIsActive",get:({get:e})=>{const t=e(In),n=undefined;return e(zn)>0||t.length>0}}),Fn=o({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(In),n=undefined;return null!=e(lt)?t.map((t=>e(En(t)))):[]}}),Un=l({key:"selectionModelViewsSelected",default:void 0});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(Pn,(e=>e+1))}))}}var Wn=Object.freeze({__proto__:null,fetchedItem:En,fetchedItemInvalidator:Pn,useSceneViewItemActions:useSceneViewItemActions});const Gn=l({key:"lengthUnit",default:"cm"}),Kn=l({key:"decimalPlace",default:"2"});var $n=Object.freeze({__proto__:null,decimalPlace:Kn,lengthUnit:Gn}),qn,Yn;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(qn||(qn={})),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"}(Yn||(Yn={}));const convertFrom=(e,t)=>{const n=undefined;return e/Yn[t]},convertTo=(e,t)=>{const n=undefined;return e*Yn[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:te(e,t)}:{world:e,local:ne(e,t)}}function convertTransformToUnits(e,t){const{position:n,rotation:a,scale:i}=e;return{position:v.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:a,scale:i}}function convertTransformFromUnits(e,t){const{position:n,rotation:a,scale:i}=e;return{position:v.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:a,scale:i}}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 Xn={position:v.create(0,0,0),rotation:v.create(0,0,0),scale:1},Zn=l({key:"transformWidgetEnabled",default:!1}),Jn=l({key:"transformWidgetPosition",default:void 0}),Qn=l({key:"transformWidgetOrientationOverride",default:void 0}),ea=o({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Qn),n=e(Nn);if(null!=t)return t;if(null!=n){const t=e(ca(n.id));return C.fromDegrees({x:null==t?void 0:t.world.rotation.x,y:null==t?void 0:t.world.rotation.y,z:null==t?void 0:t.world.rotation.z})}}}),ta=l({key:"transformWidgetCachedOrientation",default:void 0}),na=l({key:"transformWidgetSyncToSelection",default:!1}),aa=l({key:"transformWidgetIsInteracting",default:!1}),ia=u({key:"appliedItemTransform",default:void 0}),la=l({key:"appliedItemTransformIds",default:[]}),oa=l({key:"selectedCoordinateSpace",default:"world"}),ra=u({key:"editedItemTransform",default:void 0}),sa=d({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(oa),a=t(Gn),i=t(ca(e)),l=t(ra(e));if(null!=l)return l.transform;if(null!=i)return pickLocalOrWorldTransform(mapItemTransforms(i,(e=>convertTransformToUnits(e,a))),n)}},set:e=>({get:t,set:n},a)=>{if(null!=e){const i=t(oa),l=t(ua(e)),o=t(ca(e)),r=t(Gn);if(null!=o&&!(a instanceof m)&&null!=a&&null!=l){n(ra(e),{coordinateSpace:i,units:r,transform:a});const o=makeItemTransforms(convertTransformFromUnits(toValidTransform(a),r),l,i),s=t(la);n(ia(e),o),n(la,[...s,e])}}}}),ca=d({key:"fetchedItemTransforms",get:e=>({get:t})=>{var n,a;const i=t(En(e));if(null!=i){const e=(null===(n=i.override)||void 0===n?void 0:n.transform)?toTransformFromApiMatrix(null===(a=i.override)||void 0===a?void 0:a.transform):void 0,t=i.worldTransform?toTransformFromApiMatrix(i.worldTransform):void 0;return{local:null!=e?e:Xn,world:null!=t?t:Xn}}}}),da=l({key:"transformInvalidator",default:0}),ua=d({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(lt);if(null!=e&&null!=n){const n=t(En(e));if(null!=(null==n?void 0:n.parentId)){const e=t(ca(n.parentId)),a=t(ia(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return ae(ie(null!=a?a.world:e.world))}}return logger_debug(`Unable to find the world matrix for the parent of ${e}. Returning the identity matrix.`),S.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=r(Gn),n=r(oa),a=r(ia(null!=e?e:"")),[i,l]=s(ra(null!=e?e:""));T((()=>{if(null!=a&&((null==i?void 0:i.coordinateSpace)!==n||(null==i?void 0:i.units)!==t)){const e=undefined,i=convertTransformToUnits(pickLocalOrWorldTransform(a,n),t);l({units:t,coordinateSpace:n,transform:i})}}),[t,n])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const n=p(ua(e)),[a,i]=h(sa(e));return{transform:"hasValue"===a.state?a.contents:void 0,loading:"loading"===a.state||"loading"===n.state,error:"hasError"===a.state?a.contents:void 0,async update(n){t.enableSelectionSync(),i(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(Bn);e(Jn,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Jn),i=await t.getPromise(Vn),l=await t.getPromise(In),o=await t.getPromise(zn);null==a&&(l.length>0||i||o>0)&&await n(),e(na,!0)})),i=useActionCallback((({set:e})=>async t=>{e(Jn,null!=t?t:void 0)})),l=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(ea),i=undefined;(await e.getPromise(la)).forEach((e=>{n(ia(e)),n(ra(e))})),n(la),null!=a&&t(ta,a),t(da,(e=>e+1))}))),o=useActionCallback((({set:e,reset:t})=>n=>{t(ta),e(Qn,n)})),r=useActionCallback((({set:e})=>()=>{e(Jn,void 0),e(Zn,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(l,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Ke}),t(Zn,!0),o?await n():null==l?await a():await i(l)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Zn),e(Qn)})),setTransformWidgetOrientation:o,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(ta),e(Qn)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Jn))),invalidateTransforms:l,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(aa,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(na,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(na))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(jn),n=await e.getPromise(Dn),a=undefined;if(await e.getPromise(na)){const e=null==n?void 0:n.boundingBox,a=null!=e&&null!=(null==t?void 0:t.boundingBox)&&equals(e,t.boundingBox);null==e||a||await i(g.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(na),null==(null==t?void 0:t.annotationId)&&(null!=t?await i(null==t?void 0:t.position):(e(Jn),o(void 0)))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(An.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await l(),r()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(An.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await l(),r()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(et),a=await(null==n?void 0:n.scene()),i=await e.getPromise(ia(t));if(null==i)return void logger_warn(`There is no transform to apply to item ${t}.`);const l=S.transpose(ae(ie(null==i?void 0:i.local)));return null==a?void 0:a.items((e=>e.where((e=>e.withItemId(t))).transform(l))).execute()}))}};var ma=Object.freeze({__proto__:null,appliedItemTransformIds:la,appliedItemTransforms:ia,convertTransformFromUnits:convertTransformFromUnits,convertTransformToUnits:convertTransformToUnits,displayedItemTransform:sa,editedItemTransform:ra,fetchedItemTransforms:ca,identityTransform:Xn,makeItemTransforms:makeItemTransforms,mapItemTransforms:mapItemTransforms,parentItemWorldMatrix:ua,pickLocalOrWorldTransform:pickLocalOrWorldTransform,selectedCoordinateSpace:oa,toValidTransform:toValidTransform,transformInvalidator:da,transformWidgetCachedOrientation:ta,transformWidgetEnabled:Zn,transformWidgetIsInteracting:aa,transformWidgetOrientation:ea,transformWidgetOrientationOverride:Qn,transformWidgetPosition:Jn,transformWidgetSyncToSelection:na,useEditItemTransform:useEditItemTransform,useTransformActions:useTransformActions});const useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Bt).then((e=>e.value)),a=await e.getPromise(dn);null==n&&null!=(null==a?void 0:a.start)&&null!=a.end&&await t.resetMeasurement()}))),i=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Bt).then((e=>e.value));await n.orientToHitResult(t)}))),l=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Bt).then((e=>e.value));e(en,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(zt,await e.tryGetPromise(Bt).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:r},...s)=>{const c=await t.getPromise(yn),d=await t.getPromise(kt),u=2!==(null==r?void 0:r.buttons)&&!(null==r?void 0:r.altKey);r.altKey||r.ctrlKey||r.metaKey||r.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(Bt).then((e=>e.value));n(Dt,p),n(Rt,r),await a(),m&&(s.forEach((e=>e())),await i()),await l(),await e.sectionCurrentHit(),await o()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Rt),t(jt,a.detail),await e.tryGetPromise(Bt),await l(),await o()})))}},pa=o({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined,l=undefined;return{tapDetails:e(Rt),longPressDetails:e(jt),previousHitResult:e(Dt),currentHitResult:e(zt)}}});var ha=Object.freeze({__proto__:null,currentHitResult:zt,hitResult:Bt,hitResultsLongPressDetails:jt,hitResultsSkipNextTap:Ht,hitResultsTapDetails:Rt,hitState:pa,previousHitResult:Dt,useHitActions:useHitActions});const fa=u({key:"modelViewsCursor",default:void 0}),ga=u({key:"pmiAnnotationsCursor",default:void 0}),va=u({key:"loadedModelViews",default:[]}),ya=u({key:"loadedPmiAnnotations",default:[]}),ba=u({key:"visiblePmiAnnotations",default:[]}),wa=o({key:"modelViewsSceneItemName",get:async({get:e})=>{var t;const n=e(Un);if(null!=n){const a=e(En(n.id));return null!==(t=null==a?void 0:a.name)&&void 0!==t?t:void 0}}}),Ca=l({key:"loadedItemModelView",default:void 0}),Sa=d({key:"nextModelViews",get:e=>async({get:t})=>{var n;const a=t(et),i=t(fa(e));return await(null===(n=null==a?void 0:a.modelViews)||void 0===n?void 0:n.listByItem(e,{cursor:i,size:100,hasAnnotations:!0}))}}),xa=d({key:"modelViews",get:e=>({get:t})=>{var n;const a=t(va(e)),i=t(Sa(e));return a.flatMap((e=>e.modelViews)).concat(null!==(n=null==i?void 0:i.modelViews)&&void 0!==n?n:[])}}),ka=d({key:"hasMoreModelViews",get:e=>({get:t})=>{const n=t(Sa(e));return null!=(null==n?void 0:n.paging.next)}}),Aa=d({key:"nextPmiAnnotations",get:e=>async({get:t})=>{var n;const a=t(et),i=t(ga(e));return null===(n=null==a?void 0:a.pmi)||void 0===n?void 0:n.listAnnotations({modelViewId:e,cursor:i,size:100})}}),Ta=d({key:"pmiAnnotations",get:e=>({get:t})=>{const n=undefined;return t(ya(e)).flatMap((e=>e.annotations))}}),Pa=d({key:"hasMorePmiAnnotations",get:e=>({get:t})=>{const n=undefined;return null!=t(ga(e))}}),Ea=l({key:"selectedPmiAnnotationId",default:void 0});function useSceneAnnotationsOperations(){const e=A.useCallback((async(e,t,n)=>{const a=await(null==t?void 0:t.scene());null==n?await(null==a?void 0:a.elements((t=>e(t.annotations.where((e=>e.all()))))).execute()):n.length>0&&await(null==a?void 0:a.elements((t=>e(t.annotations.where((e=>e.withAnnotationIds(n)))))).execute())}),[]),t=A.useCallback((async(e,t)=>{const n=await(null==e?void 0:e.scene());null==n||n.elements((e=>[e.annotations.where((e=>e.all())).deselect(),e.annotations.where((e=>e.withAnnotationIds([t]))).select()])).execute()}),[]),n=A.useCallback((async e=>{const t=await(null==e?void 0:e.scene());null==t||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=>{var a;const i=await e.getPromise(Aa(n));if(null!=i){t(ya(n),(e=>[...e,i])),t(ba(n),(e=>[...e,...i.annotations]));const e=null===(a=null==i?void 0:i.paging)||void 0===a?void 0:a.next;t(ga(n),null!=e?()=>e:()=>{})}}));return{fetchInitialPmiAnnotations:useActionCallback((({snapshot:e})=>async n=>{const a=undefined;0===(await e.getPromise(Ta(n))).length&&await t(n)})),fetchNextPmiAnnotations:useActionCallback((()=>async e=>{await t(e)})),selectPmiAnnotation:useActionCallback((({set:t,snapshot:n})=>async a=>{t(Ea,a);const i=await n.getPromise(et);null!=i&&await(null==e?void 0:e.selectOnlyAnnotation(i,a))})),clearPmiAnnotationSelection:useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=await n.getPromise(Ea),i=await n.getPromise(et);null!=a&&null!=i&&(t(Ea),await(null==e?void 0:e.clearAnnotationSelection(i)))}))}}const Ma=l({key:"sceneTreeLoaderVisible",default:!1}),Ia=l({key:"sceneTreeElement",default:void 0}),Na=l({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0}),Oa=l({key:"sceneTreeOpenPopover",default:void 0}),Va=d({key:"sceneTreePopoverIsOpen",get:e=>({get:t})=>t(Oa)===e});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,i)=>{var l,o;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await i.deselectItem(a):a.selected?await i.selectItem(a,{recurseParent:!0}):a.selected||await i.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const i=await t.getPromise(Nn);e.syncSelection({id:null===(l=a.id)||void 0===l?void 0:l.hex,ancestors:null!==(o=null==i?void 0:i.ancestors)&&void 0!==o?o:[]},{selected:!n.metaKey&&!n.ctrlKey||!a.selected,multiSelect:n.shiftKey||n.metaKey||n.ctrlKey})}})),toggleExpansion:useActionCallback((()=>(e,t,n)=>{n.toggleExpandItem(t)})),toggleVisibility:useActionCallback((()=>(e,t,n)=>{n.toggleItemVisibility(t)})),flyToRow:useActionCallback((({snapshot:e})=>async n=>{var a;const i=await e.getPromise(Ia),l=await(null==i?void 0:i.getRowAtClientY(n));null!=(null===(a=null==l?void 0:l.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(l.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ia),n=await e.getPromise(Ln);null!=n&&(null==t||t.scrollToItem(n))})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Ia),i=await(null==a?void 0:a.getRowAtClientY(n));e(en,i)})),openSceneTreePopover:useActionCallback((({set:e})=>t=>{e(Oa,t)})),closeSceneTreePopover:useActionCallback((({set:e})=>()=>{e(Oa,void 0)}))}}var _a=Object.freeze({__proto__:null,sceneTreeController:Na,sceneTreeElement:Ia,sceneTreeLoaderVisible:Ma,sceneTreeOpenPopover:Oa,sceneTreePopoverIsOpen:Va,useSceneTreeActions:useSceneTreeActions});function useSelectionActions(){const e=usePmiAnnotationActions(),t=useSceneViewItemActions(),n=useTransformActions(),a=useViewerSceneActions(),i=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(In)).forEach((e=>t(Mn(e))))})),l=useActionCallback((({snapshot:e,reset:t,set:n})=>async(i,l)=>{var o,r;const s=await e.getPromise(Mn(i.id)),c=await e.getPromise(In),d=null===(r=[...null!==(o=i.ancestors)&&void 0!==o?o:[]])||void 0===r?void 0:r.reverse().find((e=>!c.includes(e)));null!=s&&null!=d?(n(Mn(d),{id:d}),n(In,(e=>[...e,d])),await a.execute(An.SELECTING_ANCESTOR,a.selectItemsTransform(d))):(null==l?void 0:l.clear)?(n(Mn(i.id),i),n(In,[i.id]),await a.execute(An.SELECTING_ONLY_ITEM,a.clearSelectionTransform,a.selectItemsTransform(i.id))):(n(Mn(i.id),i),n(In,(e=>[...e,i.id])),await a.execute(An.SELECTING_ITEMS,a.selectItemsTransform(i.id))),m(i),n(Nn,i),n(On,!0),t(Vn);try{const t=await e.getPromise(Ia);await(null==t?void 0:t.scrollToItem(i.id))}catch(e){logger_debug(`The scene item was not found in the tree. [itemId={${i.id}}]`)}})),o=useActionCallback((({reset:e,set:t})=>async n=>{e(Mn(n)),e(Vn),t(In,(e=>e.filter((e=>e!==n)))),await a.execute(An.DESELECTING_ITEMS,a.deselectItemsTransform(n))})),r=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Mn(t.id));null!=n?await o(n.id):await l(t)})),s=useActionCallback((({snapshot:a,reset:i,set:o})=>async(r,s={})=>{const c=await a.getPromise(Mn(r.id)),d=await a.getPromise(In);if(d.filter((e=>{var t;return e!==r.id&&!(null===(t=r.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>i(Mn(e)))),i(Vn),c)if(s.ignoreAncestorSelection)i(In),i(Mn(c.id));else{const e=d.filter((e=>{var t;return e===r.id||(null===(t=r.ancestors)||void 0===t?void 0:t.includes(e))}));o(In,e)}else i(In);t.invalidateCachedItems(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection(),await l(r,{clear:!0})})),c=useActionCallback((({reset:t})=>async()=>{await i(),t(In),t(Nn),t(On),t(Vn),n.clearTransformWidgetPosition(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection()})),d=useActionCallback((()=>async()=>{await c(),await a.execute(An.CLEAR_SELECTION,a.clearSelectionTransform)})),u=useActionCallback((({set:e})=>async t=>{e(Vn,t)})),m=useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Un);(null==a?void 0:a.id)!==(null==n?void 0:n.id)&&e(Un,n)}));return{select:l,toggleSelection:r,clearAndSelect:s,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:t})=>async()=>{const n=await t.tryGetPromise(Bt).then((e=>e.value)),a=await t.getPromise(Rt),i=(null==a?void 0:a.metaKey)||(null==a?void 0:a.ctrlKey)||(null==a?void 0:a.shiftKey);null!=(null==n?void 0:n.annotationId)?await e.selectPmiAnnotation(n.annotationId):null==n||i?null!=n&&i?await r(n):await d():await s(n)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(n,a)=>{a.selected?(await i(),e(Mn(n.id),n),a.multiSelect?e(In,(e=>[...e.filter((e=>e!==n.id)),n.id])):e(In,[n.id]),await m(n),e(Nn,n),e(On,!1),e(Vn,!!a.multiSelect)):(t(Mn(n.id)),t(Vn),e(In,(e=>e.filter((e=>e!==n.id)))))})),deselect:o,clearSelection:d,resetSelectionState:c,toggleLastSelectWasMultiSelect:u,selectForModelViewsPanel:m}}const La=o({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined;return{selectedItemIds:e(In),lastSelected:e(Nn),highestSelectedAncestorId:e(Rn)}}});var Ra=Object.freeze({__proto__:null,fetchedAndSelectedItems:Fn,selectionBoundingBoxCenter:Bn,selectionFirstSelectedItemInTreeId:Ln,selectionHasMultipleSelected:_n,selectionHighestSelectedAncestor:Rn,selectionIsActive:Hn,selectionLastSelectWasMultiSelect:Vn,selectionLastSelected:Nn,selectionLastSelectionFromViewer:On,selectionModelViewsSelected:Un,selectionPreviousVisibleSummary:jn,selectionSelectedItemIds:In,selectionSelectedItems:Mn,selectionState:La,selectionVisibleCount:zn,selectionVisibleSummary:Dn,useSelectionActions:useSelectionActions});function createColorMaterialWithId(e,t=Le.create()){return Object.assign({id:t},le.fromHex(e))}const ja=255,Da=18,za=l({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),Ba=l({key:"sceneItemAdjustmentsRecentColors",default:[]}),Ha=l({key:"sceneItemAdjustmentsCustomColors",default:[createColorMaterialWithId("#ffffff"),createColorMaterialWithId("#616161")]}),Fa=l({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),Ua=u({key:"appliedItemMaterialOverride",default:void 0}),Wa=l({key:"appliedItemMaterialOverrideIds",default:[]}),Ga=o({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Nn);if(null!=t)return e(Ua(t.id))}}),Ka=l({key:"applyMaterialToAllUserAction",default:void 0}),$a=l({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),qa=l({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Wa);t(za),n.forEach((e=>t(Ua(e)))),t(Wa)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(za,t)})),saveRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Ba),i=[n,...a.filter((e=>e!==n))],l=i.length>Da?i.slice(0,-(i.length-Da)):i;e(za,n),e(Ba,l)})),removeRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=(await t.getPromise(Ba)).filter((e=>e.id!==n));e(Ba,i)})),setCustomColors:useActionCallback((({set:e})=>async t=>{e(Ha,t)})),saveCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=[...await t.getPromise(Ha),n],l=i.length>Da?i.slice(i.length-Da):i;e(za,n),e(Ha,l)})),removeCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=(await t.getPromise(Ha)).filter((e=>e.id!==n));e(Ha,i)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(za)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(Fa)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(In);a(za),i.forEach((e=>a(Ua(e)))),n(Wa,(e=>e.filter((e=>!i.includes(e))))),await e.execute(An.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(An.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(Fa,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(za),i=await t.getPromise(Fa),l=await t.getPromise(In),o=await t.getPromise(Ga),r=null!=a?a:o,s=null!=i?i:null==o?void 0:o.opacity;if(null!=r){const t=Object.assign(Object.assign({},r),{opacity:null!=s?s:r.opacity});await e.execute(An.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),l.forEach((e=>n(Ua(e),t))),n(Wa,(e=>[...e,...l]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(qa,!0),e(Ka,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(qa),e(Ka)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(za),i=await t.getPromise(Fa);if(null!=a){const l=await t.getPromise(Wa),o=Object.assign(Object.assign({},a),{opacity:null!=i?i:a.opacity});await e.execute(An.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),l.forEach((e=>n(Ua(e))));const r=await t.getPromise(Ka);null==r||r(o),n(qa),n(Ka)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e($a,!1)}))}},Ya="#ffff00",Xa=35,Za=1,Ja=l({key:"selectionHighlightingSelectedColor",default:Ya}),Qa=l({key:"selectionHighlightingSelectedOpacity",default:Xa}),ei=l({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 ti="#FFFFFF",ni=l({key:"viewerBackgroundSelectedColor",default:ti});var ai=Object.freeze({__proto__:null,DEFAULT_FEATURE_EDGE_COLOR:qt,DEFAULT_FEATURE_EDGE_THICKNESS_VALUE:$t,DEFAULT_SELECTION_HIGHLIGHTING_COLOR:Ya,DEFAULT_SELECTION_HIGHLIGHTING_LINE_THICKNESS:1,DEFAULT_SELECTION_HIGHLIGHTING_OPACITY:Xa,DEFAULT_VIEWER_BACKGROUND_COLOR:ti,MAXIMUM_MATERIAL_OVERRIDE_OPACITY:ja,MAX_STORED_COLOR_ARRAY_LENGTH:Da,appliedItemMaterialOverride:Ua,appliedItemMaterialOverrideIds:Wa,applyMaterialToAllUserAction:Ka,confirmApplyMaterialToAllDialogOpen:qa,elementHasColorAttribute:elementHasColorAttribute,elementIsColorSwatch:elementIsColorSwatch,featureEdgesLineThickness:Xt,featureEdgesSelectedColor:Yt,sceneItemAdjustmentsCustomColors:Ha,sceneItemAdjustmentsLastSelectedOverride:Ga,sceneItemAdjustmentsRecentColors:Ba,sceneItemAdjustmentsSelectedColor:za,sceneItemAdjustmentsSelectedOpacity:Fa,selectionHighlightingSelectedColor:Ja,selectionHighlightingSelectedLineThickness:ei,selectionHighlightingSelectedOpacity:Qa,showConfirmDialogWhenApplyingMaterialToAll:$a,useSceneItemMaterialActions:useSceneItemMaterialActions,viewerBackgroundSelectedColor:ni});const VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const n=useSceneItemMaterialActions(),a=p(Ga),i=r(za),l=r($a),o=k.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(R,{content:"Apply to All",children:e(j,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==o,onClick:async()=>{l?n.confirmApplyAll(t):(await n.applyAll(),null==t||t(o))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const a=useSceneItemMaterialActions(),i=r(qa),[l,o]=A.useState(!1),onCloseDialog=()=>{a.cancelApplyAll(),o(!1)};return i?t(D,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e("div",{slot:"heading",children:"Apply to All Parts"}),e("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."}),t("div",{className:"flex mt-8 gap-2 items-center",children:[t("div",{className:"flex gap-2",children:[e(L,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:l,onValueChanged:e=>{o(e.detail)}}),"Don't show again this session"]}),t("div",{className:"flex ml-auto gap-2",children:[e(B,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e(B,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await a.applyAll(),l&&a.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e(n,{})}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=p(Ga),i=r(za),l=k.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=l?Pe.toHexString(l.diffuse):void 0,onValueChanged:async()=>{null!=l&&(await n.apply(),null==t||t(l),await n.saveRecentColor(createColorMaterialWithId(Pe.toHexString(l.diffuse))))},onInput:async e=>{n.updateColor(createColorMaterialWithId(e)),await n.apply()}})},ColorSwatch=t=>{var{color:n,hideTooltip:a,onClick:i}=t,l=__rest(t,["color","hideTooltip","onClick"]);const o="string"==typeof n?n:Pe.toHexString(n.diffuse);return e(R,{className:"flex-grow-0",content:o,disabled:!!a,children:e("button",{onClick:()=>null==i?void 0:i(n),children:e(H,Object.assign({"data-testid":`color-swatch-${o}`,variant:"square",color:o},l))})})},VertexSceneItemMaterialColorSwatches=({onAddCustomColor:a,onApplyCustomColor:i,onApplyRecentColor:l})=>{const o=useSceneItemMaterialActions(),s=r(Ha),c=r(Ba),d=s.length===Da;return t(n,{children:[t("div",{"data-testid":"appearance-custom-colors",className:"flex flex-wrap gap-2 mt-1 mb-4",children:[s.map((t=>e(ColorSwatch,{color:t,onClick:async()=>{o.updateColor(t),await o.apply(),null==i||i(t)},"data-custom-color":!0,"data-color-id":t.id},t.id))),!d&&e(N,{"data-testid":"appearance-custom-colors-add",variant:"swatch",size:"md",onValueChanged:async e=>{const t=createColorMaterialWithId(e.detail);await o.saveCustomColor(t),await o.apply(),null==a||a(t)},children:e("div",{slot:"overlay",className:"flex items-center justify-center w-full h-full",children:e(F,{className:"bg-white p-2",name:"plus",size:"sm"})})})]}),!!c.length&&e("div",{"data-testid":"appearance-recent-colors",className:"flex flex-wrap gap-2",children:c.map((t=>e(ColorSwatch,{color:t,onClick:async()=>{o.updateColor(t),await o.apply(),null==l||l(t)},"data-recent-color":!0,"data-color-id":t.id},t.id)))})]})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=r(Fa),i=p(Ga),l=k.useMemo((()=>{var e,t;return"hasValue"===i.state?null!==(t=null!=a?a:null===(e=i.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:ja:null!=a?a:ja}),[a,i]),o=useDebouncedCallback((()=>{n.apply()}),500),s=k.useCallback((e=>{n.updateOpacity(e.detail.value),o(e.detail.value)}),[o,n]),c=k.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e(R,{className:"flex w-full",content:c?"Select a part and apply a color to enable opacity":`${Math.floor(l/ja*100)}%`,placement:"top",children:e(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:c,value:null!=l?l:ja,step:5,min:0,max:ja,onValueChange:e=>{n.updateOpacity(e.detail.value),n.apply(),null==t||t(e.detail.value)},onValueInput:s})})};function VertexMaterialControls({customColors:a,onApplyMaterial:i,onApplyMaterialToAll:l,onAddCustomColor:o,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d}){const u=useSceneItemMaterialActions(),m=r(Nn);return A.useEffect((()=>{u.clearCurrentColor(),u.clearCurrentOpacity()}),[null==m?void 0:m.id]),A.useEffect((()=>{if(null!=a){const e=a.map((e=>Object.assign(Object.assign({},e),{id:Le.create()})));u.setCustomColors(e)}}),[a]),t(n,{children:[t("div",{className:"flex flex-col",children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),t("div",{className:"flex items-center gap-2",children:[e(VertexSceneItemMaterialColorPicker,{onApply:i}),e(VertexSceneItemMaterialApplyAll,{onApplyAll:l})]})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Color Swatches"}),e(VertexSceneItemMaterialColorSwatches,{onAddCustomColor:o,onApplyCustomColor:s,onApplyRecentColor:c}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSceneItemMaterialOpacitySlider,{onApply:d}),e(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:n,tooltip:a,children:i})=>{const[l,o]=A.useState(!1);return e("div",{className:"ml-auto",children:t(U,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${n}`,placement:"bottom-end",onMenuOpened:()=>o(!0),onMenuClosed:()=>o(!1),children:[e("div",{slot:"anchor",className:"flex items-center h-full",children:e(R,{content:a,disabled:l,placement:"bottom",children:t(B,{className:Kt("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":l}),"data-testid":`reset-button-${n}`,variant:"plaintext",children:[e(F,{className:"px-0.5",name:"reset",size:"sm"}),e(F,{name:"chevron-down",size:"sm"})]})})}),e("div",{className:"whitespace-nowrap",children:i})]})})},VertexSceneItemMaterialClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemMaterialActions(),l=r(Hn);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e("div",{className:"pt-1"}),e(W,{"data-testid":"clear-selected-materials",onClick:()=>{i.clear(),null==n||n()},disabled:!l,children:"Clear selected materials"}),e(W,{"data-testid":"clear-all-materials",onClick:()=>{i.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({customColors:n,onClearMaterial:a,onClearAllMaterials:i,onApplyMaterial:l,onApplyMaterialToAll:o,onAddCustomColor:r,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Material",e(VertexSceneItemMaterialClear,{onClear:a,onClearAll:i})]}),children:e(VertexMaterialControls,{customColors:n,onApplyMaterial:l,onApplyMaterialToAll:o,onAddCustomColor:r,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d})})}const VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[n,a]=s(Ja);return e(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[n,a]=s(ei);return e(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[n,a]=s(Qa);return e(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexSelectionHighlightingColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSelectionHighlightingOpacitySlider,{onUpdate:i}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:l})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[n,a]=s(Ja),[i,l]=s(Qa),[o,r]=s(ei),c=undefined;return e("div",{className:"ml-auto",children:e(R,{content:"Reset Selection Highlighting",children:e(j,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(Ya),l(Xa),r(1),null==t||t()},disabled:!(n!==Ya||i!==Xa||1!==o)})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:n,onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Selection Highlighting",e(VertexSelectionHighlightingReset,{onReset:n})]}),children:e(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[n,a]=s(ni);return e(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:a}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexViewerBackgroundColorPicker,{onUpdate:a})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[n,a]=s(ni),i=undefined;return e("div",{className:"ml-auto",children:e(R,{content:"Reset Background Color",children:e(j,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(ti),null==t||t()},disabled:!(n!==ti)})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:n,onUpdateViewerBackgroundColor:a}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Viewer Background",e(VertexViewerBackgroundReset,{onReset:n})]}),children:e(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:a})})}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,i=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,l=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,o=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,r=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||i||l||o||r},useRecoilReducer=({reducer:e,atom:t})=>{const n=undefined,a=undefined;return[r(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const n=i((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[]);return n},ii=l({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,i,l;switch(t.type){case"push-key-binding":const o=undefined;return null!=(null===(n=e.bindings[t.binding.keyBind])||void 0===n?void 0:n.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:[...null!==(a=e.bindings[t.binding.keyBind])&&void 0!==a?a:[],t.binding]})});case"remove-key-binding":const r=undefined;return null==(null===(i=e.bindings[t.binding.keyBind])||void 0===i?void 0:i.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(l=e.bindings[t.binding.keyBind])&&void 0!==l?l:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:ii}),useKeyBindingReadonlyState=()=>r(ii);function pressedValue(e,t){return e.includes("!")?!t[e.replace("!","")]&&!t[e.replace("!","").toLowerCase()]:t[e]||t[e.toLowerCase()]}function isPressed(e,t){const n=e.split("||");return n.length>1?n.some((e=>pressedValue(e,t))):pressedValue(n[0],t)}function allPressed(e,t){const n=undefined;return e.split("+").every((e=>isPressed(e,t)))}function matchingSingleFnBindings(e,t,n){return e.filter((e=>!e.repeat)).filter((e=>{var a;return null!=e.keyBind&&null!=n&&(null===(a=e.keyBind)||void 0===a?void 0:a.includes(n))&&allPressed(e.keyBind,t)})).map((e=>e.fn))}function matchingOffBindings(e,t,n){return e.filter((e=>e.off&&e.active&&null!=e.keyBind&&null==n&&!allPressed(e.keyBind,t))).map((e=>e.off))}const useApplyKeyBinding=e=>{const[t,n]=useKeyBindingState();A.useEffect((()=>{const a=Le.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:a,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:a})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();A.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),a=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),a&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,a]=useKeyBindingState(),i=A.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,Object.assign(Object.assign({},n.pressed),{[e]:!0})))).forEach((e=>{const t=n.bindings[e],i=t.length>0?t[t.length-1]:void 0;null!=i&&(i.fn(),a({type:"remove-key-binding",binding:i}))}))}),[n]);A.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),i(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),l=matchingSingleFnBindings(n.applyBindings,t,e.key),o=matchingOffBindings(n.applyBindings,t,e.key);(l.length>0||o.length>0)&&e.preventDefault()}},handleKeyUp=e=>{a({type:"set-key-pressed",key:e.key,pressed:!1})};return window.addEventListener("keydown",handleKeyDown),window.addEventListener("keyup",handleKeyUp),()=>{window.removeEventListener("keydown",handleKeyDown),window.removeEventListener("keyup",handleKeyUp)}}),[i,n.applyBindings,n.pressed]),A.useEffect((()=>{const e=matchingSingleFnBindings(n.applyBindings,n.pressed,n.lastPressed),t=matchingOffBindings(n.applyBindings,n.pressed,n.lastPressed);e.forEach((e=>e())),t.forEach((e=>e()))}),[n.pressed,n.lastPressed]),A.useEffect((()=>{const t=n.applyBindings.filter((e=>e.repeat&&null!=e.keyBind&&allPressed(e.keyBind,n.pressed))).map((e=>e.fn));if(t.length>0){const n=setInterval((()=>{t.forEach((e=>e()))}),e);return()=>{clearInterval(n)}}return()=>{}}),[n.applyBindings,n.lastPressed])},VertexBoxSelectionButton=()=>{const t=useBoxSelectionActions(),n=r(ln);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>n,cancelPredicate:()=>!n},[n]),e(R,{content:"Box Selection",children:e(j,{iconName:"box-cursor",iconColor:n?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:n?t.disable:t.enable})})},li=1,VertexResizableContent=n=>{var{className:a,style:i,displayShadow:l,heading:o,id:r,initialScale:s,placement:c="left",children:d,onResize:u}=n,m=__rest(n,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const p="left"===c||"right"===c,h="top"===c;function getHorizontalResizeDirection(){switch(c){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===c?"top":"none"}const f=null!=s?s:1;return e(G,Object.assign({id:r,"data-testid":`resizable-content-position-${c}`,className:Kt(a,"pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300",{"border-r min-w-75 max-w-half":"left"===c,"sidebar-shadow-right":"left"===c&&l,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&l,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},i),initialHorizontalScale:p?s:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==u?void 0:u()},m,{children:t("div",{className:"flex flex-col h-full w-full",children:["top"===c&&e("div",{className:"flex justify-center w-full",children:e("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),o,e("div",{className:Kt("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(et),n=await(null==t?void 0:t.scene()),a={milliseconds:500};await(null==n?void 0:n.camera().viewAll().render({animation:a}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[i,l]=k.useState(),[o,r]=k.useState();k.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=i&&clearTimeout(i),r(w.create(a.touches[0].clientX,a.touches[0].clientY)),l(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=i&&null!=o&&w.distance(o,w.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(i),null==a||a())},handleTouchEnd=()=>{null!=i&&clearTimeout(i)};return null==e||e.addEventListener("touchstart",handleTouchStart),null==e||e.addEventListener("touchmove",handleTouchMove),null==e||e.addEventListener("touchend",handleTouchEnd),()=>{null==e||e.removeEventListener("touchstart",handleTouchStart),null==e||e.removeEventListener("touchmove",handleTouchMove),null==e||e.removeEventListener("touchend",handleTouchEnd)}}),[e,i,o])}var oi=Object.freeze({__proto__:null,isInputElement:isInputElement,keyBindings:ii,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:n,disableBackdrop:a,openPredicate:i,onOpen:l,onClose:o,children:s})=>{const c=useContextMenuActions(),d=r(Zt),u=r(nn),m=A.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),p=d===n;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:c.clearActiveContextMenu,addPredicate:()=>null!=d&&d===n,cancelPredicate:()=>null==d},[d]);const h=A.useMemo((()=>null!=t?t:null!=i?window:void 0),[t,i]);return useLongPress({target:h,callback:e=>c.longPress(e,n,i,l),onMovement:()=>c.clearActiveContextMenu()}),A.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&d===n){const t=targetShouldSkipNextHit(e);c.clearActiveContextMenu(t)}};if(a)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[a,n,d]),A.useEffect((()=>{const handlePointerDown=e=>{c.pointerDown(e)},handlePointerUp=e=>{c.pointerUp(e,n,i,l)},handleContextMenu=e=>c.contextMenu(e,i);return null==h||h.addEventListener("pointerdown",handlePointerDown),null==h||h.addEventListener("pointerup",handlePointerUp),null==h||h.addEventListener("contextmenu",handleContextMenu),()=>{null==h||h.removeEventListener("pointerdown",handlePointerDown),null==h||h.removeEventListener("pointerup",handlePointerUp),null==h||h.removeEventListener("contextmenu",handleContextMenu)}}),[t,n,i]),e("div",{className:Kt({hidden:!p}),children:e(K,{"data-testid":`${n}-context-menu`,open:asBooleanAttribute(p),position:u,fallbackPlacements:m,backdrop:!a,onMenuClosed:()=>{c.clearActiveContextMenu(),null==o||o()},children:e("div",{className:"pt-1",children:s})})})},VertexFitSelectedMenuItem=()=>{const n=r(In),a=r(Dn),i=useViewerCameraActions();return e(W,{"data-testid":"fit-selected-menu-option",onClick:async()=>{null!=(null==a?void 0:a.boundingBox)&&await i.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"fit-selected",size:"sm"}),"Fit Selected"]})})},VertexFlyToMenuItem=()=>{const n=useViewerCameraActions(),a=r(en);return e(W,{"data-testid":"fly-to-part-menu-option",onClick:async()=>{var e;const t=undefined,i=contextMenuItemIsRow(a)?null===(e=null==a?void 0:a.node.id)||void 0===e?void 0:e.hex:null==a?void 0:a.id;null!=i&&await n.flyToById(i)},disabled:asBooleanAttribute(null==a),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"paper-airplane",size:"sm"}),"Fly To"]})})};function useSceneItemsOperations(){const e=r(et),t=undefined,n=undefined,a=undefined,i=undefined,l=undefined,o=undefined;return{sceneItemsOperation:A.useCallback((async(t,n)=>{const a=await(null==e?void 0:e.scene());null==n?await(null==a?void 0:a.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==a?void 0:a.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:A.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withSelected())).show()])).execute()}),[e]),hideSelected:A.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).hide()])).execute()}),[e]),showOnlyItem:A.useCallback((async t=>{const n=await(null==e?void 0:e.scene());null==n||n.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withItemIds([t]))).show()])).execute()}),[e]),ghostSelected:A.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!0)])).execute()}),[e]),unGhostSelected:A.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const n=useSceneItemsOperations();return e(W,{"data-testid":"hide-all-menu-option",onClick:async()=>{await n.sceneItemsOperation((e=>e.hide()))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide All Parts"]})})},VertexHidePartMenuItem=()=>{const n=r(en),a=useSceneItemsOperations();return e(W,{"data-testid":"hide-menu-option",onClick:async()=>{var e;const t=undefined,i=contextMenuItemIsRow(n)?null===(e=null==n?void 0:n.node.id)||void 0===e?void 0:e.hex:n.id;null!=i&&await a.sceneItemsOperation((e=>e.hide()),[i])},disabled:asBooleanAttribute(null==n),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Part"]})})},VertexHideSelectedMenuItem=()=>{const n=r(In),a=useSceneItemsOperations();return e(W,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Selected"]})})},VertexShowAllMenuItem=()=>{const n=useSceneItemsOperations();return e(W,{"data-testid":"show-all-menu-option",onClick:async()=>{await n.sceneItemsOperation((e=>e.show()))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show All Parts"]})})},VertexShowOnlyMenuItem=()=>{const n=r(en),a=useSceneItemsOperations();return e(W,{"data-testid":"show-only-menu-option",onClick:async()=>{var e;const t=undefined,i=contextMenuItemIsRow(n)?null===(e=null==n?void 0:n.node.id)||void 0===e?void 0:e.hex:null==n?void 0:n.id;null!=i&&await a.showOnlyItem(i)},disabled:asBooleanAttribute(null==n),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Part"]})})},VertexShowOnlySelectedMenuItem=()=>{const n=r(In),a=useSceneItemsOperations();return e(W,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Selected"]})})},ri=l({key:"openedPanelActivePrimaryLeft",default:void 0}),si=l({key:"openedPanelActivePrimaryRight",default:void 0}),ci=l({key:"openedPanelActiveSceneTreeSecondary",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?ri:si,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?ri:si,void 0)})),openSecondary:useActionCallback((({set:e})=>t=>e(ci,t))),closeSecondary:useActionCallback((({reset:e})=>()=>e(ci)))}}var di=Object.freeze({__proto__:null,openedPanelActivePrimaryLeft:ri,openedPanelActivePrimaryRight:si,openedPanelActiveSceneTreeSecondary:ci,usePanelActions:usePanelActions});const VertexShowPropertiesMenuItem=()=>{const n=usePanelActions(),a=useSelectionActions(),i=r(en);return e(W,{"data-testid":"show-properties-menu-option",disabled:asBooleanAttribute(null==i),onClick:()=>{var e;const t=undefined,l=contextMenuItemIsRow(i)?null===(e=null==i?void 0:i.node.id)||void 0===e?void 0:e.hex:null==i?void 0:i.id;null!=l&&(a.clearAndSelect({id:l}),n.openSecondary("Properties"))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"info",size:"sm"}),"Show Properties"]})})};function fromApiProperty(e){var t,n;return{key:null!==(n=null===(t=e.key)||void 0===t?void 0:t.name)&&void 0!==n?n:"",value:apiMetadataPropertyDisplayValue(e.value)}}function apiMetadataPropertyDisplayValue(e){var t,n,a,i;let l="";switch(null==e?void 0:e.type){case"string":l=null!==(t=e.value)&&void 0!==t?t:l;break;case"long":l=null!==(n=e.value.toString())&&void 0!==n?n:l;break;case"double":l=null!==(a=e.value.toString())&&void 0!==a?a:l;break;case"timestamp":l=null!==(i=e.value.seconds.toLocaleString())&&void 0!==i?i:l}return l}const ui=l({key:"showMetadataSceneItemProperties",default:!0}),mi=d({key:"nextMetadataSceneItemProperties",get:e=>async({get:t})=>{var n,a,i;const l=t(et),o=t(hi(e));try{const t=await(null===(n=null==l?void 0:l.sceneItems)||void 0===n?void 0:n.listSceneItemMetadata(e,{cursor:o,size:20})),r=null===(a=null==t?void 0:t.entries)||void 0===a?void 0:a.map((e=>fromApiProperty(e))),s=undefined;return{metadata:null!=r?null===(i=[...r])||void 0===i?void 0:i.sort(((e,t)=>e.key>t.key?1:-1)):void 0,cursor:null==t?void 0:t.paging.next}}catch(t){return void logger_debug(`Error encountered get metadata for scene item. [itemId={${e}}]`,t)}}}),pi=u({key:"loadedMetadataSceneItemProperties",default:[]}),hi=u({key:"metadataSceneItemPropertiesCursor",default:void 0}),fi=d({key:"hasMoreMetadataSceneItemProperties",get:e=>({get:t})=>{const n=undefined;return null!=t(hi(e))}}),gi=u({key:"isFetchingMetadataSceneItemProperties",default:!1}),vi=o({key:"metadataSceneItemName",get:async({get:e})=>{var t;const n=e(Nn);if(null!=n){const a=e(En(n.id));return null!==(t=null==a?void 0:a.name)&&void 0!==t?t:void 0}}});var yi=Object.freeze({__proto__:null,apiMetadataPropertyDisplayValue:apiMetadataPropertyDisplayValue,fromApiProperty:fromApiProperty,hasMoreMetadataSceneItemProperties:fi,isFetchingMetadataSceneItemProperties:gi,loadedMetadataSceneItemProperties:pi,metadataSceneItemName:vi,metadataSceneItemPropertiesCursor:hi,nextMetadataSceneItemProperties:mi,showMetadataSceneItemProperties:ui});const VertexGhostSelectedMenuItem=()=>{const n=r(In),a=useSceneItemsOperations();return e(W,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-partial",size:"sm"}),"Ghost Selected"]})})};function BetaLabel({children:n,label:a="Beta",placement:i="end",borderColor:l="border-purple-400",textColor:o="text-purple-500"}){return t("div",{className:"flex items-center",children:[n,e("div",{className:Kt(`flex border ${l} rounded-md px-1.5 text-xs ${o} uppercase items-center justify-center ml-2 select-none max-h-5`,{"ml-auto":"end"===i}),style:{height:"fit-content"},children:a})]})}const VertexShowModelViewsMenuItem=()=>{const n=usePanelActions(),a=useSelectionActions(),i=r(en);return e(W,{"data-testid":"viewer-show-model-views",disabled:asBooleanAttribute(null==i),onClick:async()=>{var e;const t=undefined,l=contextMenuItemIsRow(i)?null===(e=null==i?void 0:i.node.id)||void 0===e?void 0:e.hex:null==i?void 0:i.id;null!=l&&(n.openPrimary("model-views","right"),a.selectForModelViewsPanel({id:l}))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"views",size:"sm"}),t("div",{className:"flex gap-2",children:["Show Model Views ",e(BetaLabel,{})]})]})})},VertexUnghostSelectedMenuItem=()=>{const n=r(In),a=useSceneItemsOperations();return e(W,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-visible",size:"sm"}),"Unghost Selected"]})})},DefaultSceneTreeContextMenu=()=>{const n=r(ui);return t("div",{className:"w-56",children:[e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e($,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{}),e($,{}),n&&e(VertexShowPropertiesMenuItem,{}),e(VertexShowModelViewsMenuItem,{})]})},VertexSceneTreeContextMenu=({children:t})=>{const n=useSceneTreeActions(),a=r(Ia),i=undefined;return e(VertexContextMenu,{menuType:"scene-tree",targetElement:a,onOpen:async(e,t)=>{const a=e;await n.setContextMenuItem(a.clientY)},disableBackdrop:!0,children:null!=t&&!1!==t?t:e(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>{const n=r(ui);return t("div",{className:"w-56",children:[e(VertexHidePartMenuItem,{}),e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e($,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{}),e($,{}),n&&e(VertexShowPropertiesMenuItem,{}),e(VertexShowModelViewsMenuItem,{})]})},VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=A.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:a,children:n?t:e(DefaultViewerContextMenu,{})})},bi=35,wi=l({key:"sceneItemGhostingSelectedOpacity",default:bi}),Ci=u({key:"appliedItemPhantomState",default:void 0}),Si=l({key:"appliedItemPhantomStateIds",default:[]}),xi=o({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Nn);return null!=n&&(null!==(t=e(Ci(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[n,a]=s(wi);return e(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Si)).forEach((e=>t(Ci(e)))),t(Si)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const i=await t.getPromise(In);i.forEach((e=>n(Ci(e),a))),n(Si,(e=>[...e,...i])),await e.execute(An.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(a)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(In);i.forEach((e=>a(Ci(e)))),n(Si,(e=>e.filter((e=>!i.includes(e))))),await e.execute(An.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(An.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}};var ki=Object.freeze({__proto__:null,DEFAULT_GHOSTING_OPACITY:bi,appliedItemPhantomState:Ci,appliedItemPhantomStateIds:Si,sceneItemGhostingLastSelectedPhantom:xi,sceneItemGhostingSelectedOpacity:wi,useSceneItemPhantomActions:useSceneItemPhantomActions});const VertexSceneItemGhostingToggle=({onApply:t})=>{const n=useSceneItemPhantomActions(),a=r(Hn),i=p(xi);return e(R,{content:"Select a part to display as ghost",disabled:a,children:e(L,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!a,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await n.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:a,onApplyOpacity:i}){return t(n,{children:[t("div",{className:"flex items-center py-3",children:[e(VertexSceneItemGhostingToggle,{onApply:a}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e(VertexSceneItemGhostingOpacitySlider,{onApply:i})]})}const VertexSceneItemGhostingClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemPhantomActions(),l=r(xi);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e("div",{className:"pt-1"}),e(W,{"data-testid":"reset-selected-phantom",onClick:async()=>{await i.clearPhantomState(),null==n||n()},disabled:!l,children:"Clear ghosting for selected"}),e(W,{"data-testid":"reset-all-phantom",onClick:async()=>{await i.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:n,onClearAllGhostState:a,onApplyGhostingChange:i,onApplyOpacity:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Ghosting",e(VertexSceneItemGhostingClear,{onClear:n,onClearAll:a})]}),children:e(VertexGhostingControls,{onApplyGhostingChange:i,onApplyOpacity:l})})}function VertexMeasurementContextMenu({onDelete:n}){const a=r(Qt);return e(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:t(W,{"data-testid":"measurement-delete",onClick:()=>null!=a&&n(a.id),children:[e(F,{slot:"icon",name:"delete",size:"sm"}),e("div",{className:"pl-2",children:"Delete"})]})})}function useDockedPlacement(e,t){const[n,a]=k.useState(w.create(0,0));return k.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),i=w.create(n.left,n.bottom),l=w.create(n.right,n.bottom);a("left"===t?i:l)}}),[e,t]),n}function VertexMeasurementDetails({placement:n,size:a}){const i=useMeasurementActions(),l=r(et),o=r(tt),s=useDockedPlacement(null!=l?l:null,n),c=r(bn),d=r(wn),u=r(Cn),m=r(Sn),p=r(Gn),h=r(Kn);return e(q,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${o}`,position:s,children:t("div",{className:Kt("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:[t("div",{className:"pb-2 flex justify-between items-center",children:[e("div",{className:Kt("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("div",{className:Kt("mr-0.5",{hidden:!m}),children:e(R,{content:"Reset",placement:"left-start",children:e(j,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:i.resetMeasurement})})})]}),e(oe,{"data-testid":"measurement-details-viewer-measurement-details",className:Kt("gap-y-1.5",{hidden:null==c}),measurementOutcome:c,measurementOverlays:d,distanceUnits:toUnitType(p),fractionalDigits:parseInt(h,10)}),e("div",{"data-testid":"measurement-details-message",className:Kt({hidden:null==u}),children:u})]})})}function useCallbackRef(e){var t;const[n,a]=A.useState(null!==(t=null==e?void 0:e.override)&&void 0!==t?t:null),i=A.useCallback((t=>{var n;return a(null!==(n=null==e?void 0:e.override)&&void 0!==n?n:t)}),[]);return{element:n,callback:i}}function VertexPointToPointMeasurement({detailsPlacement:a,detailsSize:i,onPointToPointMeasurementChange:l}){const o=useMeasurementActions(),s=r(et),c=r(sn),d=r(dn),u=r(Gn),m=r(Kn),{callback:p,element:h}=useCallbackRef();usePointToPointMeasurement(h);const f=P((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};o.setEditedPointToPointMeasurement(t),null==l||l(t)}),[o]);return c?t(n,{children:[e(re,{"data-testid":"point-to-point-measurement",ref:p,viewer:null!=s?s:void 0,mode:"replace",start:null==d?void 0:d.start,end:null==d?void 0:d.end,invalid:null==d?void 0:d.invalid,units:toUnitType(u),fractionalDigits:parseInt(m,10),showAxisReferenceLines:!0,onEditEnd:f}),e(VertexMeasurementDetails,{placement:a,size:i}),e(VertexMeasurementContextMenu,{onDelete:o.resetMeasurement})]}):e(n,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),n=r(sn);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>n,cancelPredicate:()=>!n},[n,t]),e(R,{content:"Point to Point Measurement",children:e(j,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Ai=l({key:"viewerToolkitSdkConfig",default:void 0});var Ti=Object.freeze({__proto__:null,sdkConfig:Ai});const VertexPreciseMeasurement=({detailsPlacement:a,detailsSize:i,onEntitiesChanged:l,onOutcomeChanged:o})=>{var s,c,d,u;const m=r(et),p=r(Ai),h=r(mn),{callback:f,element:g}=useCallbackRef();return usePreciseMeasurementModel(g,l,o),h?t(n,{children:[e(se,{"data-testid":"precise-measurement-viewer-tool",ref:f,viewer:null!=m?m:void 0,config:JSON.stringify({network:{apiHost:null===(s=null==p?void 0:p.network)||void 0===s?void 0:s.apiHost,renderingHost:null===(c=null==p?void 0:p.network)||void 0===c?void 0:c.renderingHost,sceneTreeHost:null===(d=null==p?void 0:p.network)||void 0===d?void 0:d.sceneTreeHost,sceneViewHost:null===(u=null==p?void 0:p.network)||void 0===u?void 0:u.sceneViewHost}})}),e(VertexMeasurementDetails,{placement:a,size:i})]}):e(n,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),n=r(mn);return e(R,{content:"Precise Measurement",children:e(j,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const a=r(Xe),i=r(Ye);return t(n,{children:[null!=a&&e(Y,{className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id),null!=i&&e(X,{placement:"bottom-left",className:"z-[16000]",duration:i.duration,open:!0,content:i.message,type:i.type},i.id)]})}const Pi={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 Ei=l({key:"sceneTreeColumnsRefreshTrigger",default:0}),Mi=l({key:"sceneTreeColumnsWhitelistedColumns",default:[]}),Ii=o({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(Na);return e(Ei),null!=t?await t.fetchMetadataKeys():[]}}),Ni=o({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Ii).filter((e=>e!==Pi.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),Oi=l({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),Vi=o({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(Oi),n=e(Ia),a=null==n?void 0:n.clientWidth;if(null!=a&&a>0){const e=1/(t.length+1)*a,n=(a-e)/t.length;return t.reduce(((e,t)=>{const a=mapToColumn(t,n);return Object.assign(Object.assign({},e),{[a.label]:a})}),{Name:Object.assign(Object.assign({},Pi),{initialWidth:e,minWidth:n})})}return{Name:Pi}}}),_i=o({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Vi))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e})=>async t=>{e(Oi,t)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(Ei,(e=>e+1))}))}}const Li=16,Ri=-8;var ji;function useOpenPositionedPopover({open:e,buttonElement:t,horizontalOffset:n,verticalOffset:a}){const[i,l]=k.useState(),[o,r]=k.useState(),s=undefined;return{position:i,direction:o,handleOpen:k.useCallback((()=>{if(!e){const e=null==t?void 0:t.getBoundingClientRect();if(null!=e){const t=null!=n?n:Li,i=null!=a?a:Ri,o=e.x>window.innerWidth/2?ji.LEFT:ji.RIGHT;l({x:o===ji.LEFT?e.left-t:e.right+t,y:e.top+i}),r(o)}}}),[e,t])}}!function(e){e.LEFT="left",e.RIGHT="right"}(ji||(ji={}));var Di=Object.freeze({__proto__:null,DEFAULT_HORIZONTAL_POSITION_OFFSET:Li,DEFAULT_NAME_COLUMN:Pi,DEFAULT_VERTICAL_POSITION_OFFSET:Ri,get PlacementDirection(){return ji},mapToColumn:mapToColumn,sceneTreeColumnsActiveColumnNames:_i,sceneTreeColumnsActiveColumns:Vi,sceneTreeColumnsAvailableColumns:Ii,sceneTreeColumnsAvailableSortedColumns:Ni,sceneTreeColumnsRefreshTrigger:Ei,sceneTreeColumnsVisibleMetadataColumnNames:Oi,sceneTreeColumnsWhitelistedColumns:Mi,useOpenPositionedPopover:useOpenPositionedPopover,useSceneTreeColumnActions:useSceneTreeColumnActions});const zi=l({key:"sceneTreeSearchActive",default:!1}),Bi=l({key:"sceneTreeColumnsPartial",default:!1}),Hi=l({key:"sceneTreeSearchValue",default:void 0}),Fi=l({key:"sceneTreeSearchExactMatch",default:!1}),Ui=l({key:"sceneTreeSearchRemoveHiddenItems",default:!1}),Wi=l({key:"sceneTreeSearchResultCount",default:0}),Gi=l({key:"sceneTreeSearchActiveColumns",default:[]}),Ki=o({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(Gi);return 0===t.length||t.includes(Pi.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),n=r(zi),a=c(Wi),i=c(Ln);A.useEffect((()=>{let t;return whenComponentReady(e,(()=>{var n;t=null===(n=null==e?void 0:e.controller)||void 0===n?void 0:n.stateChanged((e=>{void 0!==(null==e?void 0:e.totalFilteredRows)&&a(null==e?void 0:e.totalFilteredRows)}))})),()=>{null==t||t.dispose()}}),[e]),A.useEffect((()=>{if(null!=e){let a;return whenComponentReady(e,(()=>{var l;a=null===(l=null==e?void 0:e.controller)||void 0===l?void 0:l.stateChanged((e=>{var a;if(null!=(null==e?void 0:e.filterTerm)){const t=null==e?void 0:e.rows.find((e=>{var t;return null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.selected}));i(null===(a=null==t?void 0:t.node.id)||void 0===a?void 0:a.hex)}else n&&t.flyToFirstSelectedItem()}))})),()=>{null==a||a.dispose()}}}),[e,null==e?void 0:e.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=c(Bi);A.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var a;n=null===(a=null==e?void 0:e.controller)||void 0===a?void 0:a.stateChanged((e=>{t(!!(null==e?void 0:e.isPartialKeysResponse))}))})),()=>{null==n||n.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(Gi,t)})),t=useActionCallback((({snapshot:t})=>async(n,a,i,l)=>{const o=await t.getPromise(Ia),r=await t.getPromise(Fi),s=await t.getPromise(Ui),c=await t.getPromise(Gi),d=c.length>0?a?[...c,n]:c.filter((e=>e!==n)):[...i,Pi.metadataKeyName].filter((e=>e!==n));e(d),l&&(null==o||o.filterItems(l,{columns:d,exactMatch:r,removeHiddenItems:s}))})),n=useActionCallback((({snapshot:e,set:t})=>async(n,a,i)=>{const l=await e.getPromise(Ia),o=await e.getPromise(Fi),r=await e.getPromise(Ui),s=await e.getPromise(Gi),c=n.filter((e=>!a.includes(e))),d=a.filter((e=>!n.includes(e))),u=s.length>0?[...s.filter((e=>!c.includes(e))),...d]:[...a,Pi.metadataKeyName],m=u.length>0?u:[...a,Pi.metadataKeyName];t(Gi,m),i&&(null==l||l.filterItems(i,{columns:m,exactMatch:o,removeHiddenItems:r}))})),a=useActionCallback((({set:e})=>t=>{e(Fi,t)})),i=useActionCallback((({set:e})=>t=>{e(Ui,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:a,setMetadataSearchRemoveHiddenItems:i}};var $i=Object.freeze({__proto__:null,sceneTreeColumnsPartial:Bi,sceneTreeSearchActive:zi,sceneTreeSearchActiveColumns:Gi,sceneTreeSearchExactMatch:Fi,sceneTreeSearchNameColumnActive:Ki,sceneTreeSearchRemoveHiddenItems:Ui,sceneTreeSearchResultCount:Wi,sceneTreeSearchValue:Hi,useSceneTreePartialResults:useSceneTreePartialResults,useSceneTreeSearch:useSceneTreeSearch,useSceneTreeSearchActions:useSceneTreeSearchActions});const targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=i((({set:t})=>n=>{t(e,n)}),[]);return t}var qi;function styleFromOptionalFont(e){return null!=e?{"--scene-tree-default-font-family":styleFromFontFace(e.fontFace),"--scene-tree-default-font-color":e.color}:{}}function styleFromOptionalBackgroundColors(e){const t=null==e?void 0:e.depthColors,n=null!=t?Object.keys(t).reduce(((e,n)=>Object.assign(Object.assign({},e),{[`--scene-tree-row-background-color-depth-${n}`]:t[parseInt(n)]})),{}):{};return null!=e?Object.assign(Object.assign({},n),{"--scene-tree-hovered-row-background-color":e.hovered,"--scene-tree-selected-row-background-color":e.selected,"--scene-tree-row-background-color":e.defaultColor}):{}}function styleFromFontFace(e){return e===qi.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(qi||(qi={}));const Yi=l({key:"sceneTreeAdditionalMetadataKeys",default:[]}),Xi=o({key:"sceneTreeActiveMetadataKeys",get:({get:e})=>{const t=e(Yi),n=e(Oi),a=e(Mi),i=new Set([...t,...n]),l=new Set(a);return 0===a.length?Array.from(i):Array.from(i.intersection(l))}});var Zi=Object.freeze({__proto__:null,sceneTreeActiveMetadataKeys:Xi,sceneTreeAdditionalMetadataKeys:Yi});function childrenAsArray(e){return Array.isArray(e)?e:[e]}function filterChildElements(e,t){return childrenAsArray(e).filter((e=>A.isValidElement(e)&&e.type===t))}function findChildElement(e,t){return filterChildElements(e,t)[0]}function cloneChildNodeOrFunction(e,t){return"object"==typeof e?A.cloneElement(e,t):e(t)}function useStateSyncedValue(e,t,{transform:n}={}){const[a,i]=s(e);return A.useEffect((()=>{null!=t&&i(null!=n?n(t):t)}),[t]),a}const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const n=c(zi);return e(R,{className:"flex ml-auto",content:"Scene Tree Search",children:e(j,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{n(!0),null==t||t()}})})},VertexSceneTreeMetadataCheck=({checked:n,disabled:a,onChange:i,children:l})=>{const o="string"==typeof l?l.replace(" ","-"):"";return t("div",{className:"flex items-center",children:[e(L,{"data-testid":`scene-tree-metadata-check-${o}`,variant:"check",checked:n,disabled:a,onValueChanged:e=>null==i?void 0:i(e.detail)}),e("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${o}`,onClick:()=>{a||null==i||i(!n)},children:l})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:a,onSearchForExactMatchChange:i})=>{const l=useSceneTreeActions(),o=useSceneTreeSearchActions(),s=r(Ia),c=r(Ki),d=r(Gi),u=r(Hi),m=r(Fi),p=r(Ui),h=r(Oi),{element:f,callback:g}=useCallbackRef(),v="scene-tree-search",b=r(Va(v)),{position:w,direction:C,handleOpen:S}=useOpenPositionedPopover({open:b,buttonElement:f,horizontalOffset:20}),A=k.useCallback((()=>{l.closeSceneTreePopover()}),[]),T=C===ji.LEFT?"left-end":"right-start",updateSearch=async(e,t)=>{if(u){const n=d.length>0?d:[...h,Pi.metadataKeyName];await(null==s?void 0:s.filterItems(u,{columns:n,exactMatch:e,removeHiddenItems:t}))}};return t(n,{children:[e(R,{content:"Search Options",placement:"top",children:e(j,{"data-testid":"scene-tree-search-options-popover-button",className:"text-neutral-700",ref:g,iconName:"gear",iconSize:"sm",onClick:()=>{b?A():(S(),l.openSceneTreePopover(v))}})}),b&&e(Z,{"data-testid":"scene-tree-search-options-popover",open:b,backdrop:!1,position:w,resizeBehavior:"fixed",placement:T,className:"z-popover",children:t("div",{className:Kt("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!b}),children:[t("div",{className:"flex items-center text-[0.875rem] p-3 border-b border-neutral-300 pb-2",children:[e("div",{className:"pr-2 text-[0.875rem] whitespace-nowrap",children:"Column Properties Search"}),e(j,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{A()}})]}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e("div",{className:"text-[0.875rem] pb-2 pr-2",children:"Select properties to perform the search on:"}),e(VertexSceneTreeMetadataCheck,{checked:c,disabled:0===d.length||d.every((e=>e===Pi.metadataKeyName)),onChange:async e=>{await o.updateMetadataSearchAfterSearchKeysChange(Pi.metadataKeyName,e,h,u),null==a||a()},children:Pi.label},Pi.metadataKeyName),h.map((t=>e(VertexSceneTreeMetadataCheck,{checked:d.includes(t),disabled:d.length>0&&d.every((e=>e===t)),onChange:async e=>{await o.updateMetadataSearchAfterSearchKeysChange(t,e,h,u),null==a||a()},children:t},t)))]}),t("div",{className:"flex p-3 border-t border-neutral-300",children:[e(L,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:m,onValueChanged:async e=>{o.setMetadataSearchExactMatch(e.detail),null==i||i(),await updateSearch(e.detail,p)}}),e("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]}),t("div",{className:"flex px-3 pb-3",children:[e(L,{className:"flex items-center","data-testid":"filter-remove-hidden-items-toggle",variant:"switch",checked:p,onValueChanged:async e=>{o.setMetadataSearchRemoveHiddenItems(e.detail),await updateSearch(m,e.detail)}}),e("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Search only visible items"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:n,onClearSearch:a,onExitSearchMode:i,onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o,sceneTreeSearchElement:c,children:d})=>{const u=useSceneTreeActions(),m=r(Ia),[p,h]=s(zi),[f,g]=s(Hi),v=r(Va("scene-tree-search"));useSceneTreeSearch({sceneTreeElement:null!=m?m:null});const{element:b,callback:w}=useCallbackRef({override:c}),C=null==f||""===f;return k.useEffect((()=>{p&&(null==b||b.setFocus())}),[b,p]),t("div",{className:"flex w-full py-3 px-2",children:[e(R,{className:"self-center mr-1",content:"Exit Search",children:e(j,{"data-testid":"scene-tree-search-close-button",iconName:"caret-left",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{h(!1),g(void 0),await(null==b?void 0:b.clear()),await(null==m?void 0:m.filterItems("")),v&&u.closeSceneTreePopover(),await u.flyToFirstSelectedItem(),null==i||i()}})}),t(ce,{"data-testid":"scene-tree-search-bar",ref:w,controller:null==m?void 0:m.controller,onBlur:()=>{C&&(h(!1),null==i||i(),v&&u.closeSceneTreePopover())},onSearch:()=>{g(null==b?void 0:b.value),null==n||n(null==b?void 0:b.value)},children:[d,e(F,{slot:"clear-icon",name:"close-circle-fill",size:"sm",onPointerDown:async()=>{await u.flyToFirstSelectedItem(),null==a||a()}})]}),e("div",{className:"self-center pl-1",onPointerDown:e=>{e.preventDefault()},children:e(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o})})]})},VertexSceneTreeSearch=({onEnterSearchMode:n,onExitSearchMode:a,onSearch:i,onClearSearch:l,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:s,children:c})=>{const d=r(zi);return t(de,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[d&&e(VertexSceneTreeSearchBar,{onSearch:i,onClearSearch:l,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:s,children:c}),!d&&e("div",{className:"ml-auto mr-2",children:e(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:n})})]})};function useCacheableLoadable(e,t){const n=E(),[a,i]=M(0),l=p(e);T((()=>{"hasValue"===l.state&&(n.current=l.contents)}),[t,l]);const[o,r]=I((()=>"hasValue"!==l.state&&null!=n.current?[n.current,!0]:"hasValue"===l.state?[l.contents,!1]:[void 0,!1]),[l.state,l.contents,a]),s=P((()=>{n.current=void 0,i(a+1)}),[a]),c=undefined;return I((()=>({data:o,state:l.state,cached:r,invalidate:s})),[s,o,r,l.state])}const VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:a})=>{const i=useSceneTreeActions(),l=useSceneTreeColumnActions(),o=useSceneTreeSearchActions(),s=r(Ia);useSceneTreePartialResults({sceneTreeElement:null!=s?s:null});const c=r(Hi),d=r(Mi),u=useCacheableLoadable(Ni),m=d.length>0?d:u.data,p=r(Oi),h=r(Bi),[f,g]=k.useState(p),[v,b]=k.useState(""),{element:w,callback:C}=useCallbackRef(),S="scene-tree-columns",A=r(Va(S)),{position:T,direction:P,handleOpen:E}=useOpenPositionedPopover({open:A,buttonElement:w}),M=k.useCallback((()=>{i.closeSceneTreePopover()}),[]),I=P===ji.LEFT?"left-end":"right-start",N=k.useMemo((()=>{if(null!=m){const e=m.filter((e=>f.indexOf(e)<0)),t=undefined;return[...[...f].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[f,m]),O=k.useMemo((()=>N),[A,m]);return t(n,{children:[e(R,{content:"Configure Columns",placement:"top",children:e(j,{"data-testid":"scene-tree-column-popover-button",ref:C,iconName:"columns-add",iconSize:"sm",onClick:()=>{A?M():(E(),i.openSceneTreePopover(S))}})}),A&&e(Z,{"data-testid":"scene-tree-column-popover",open:A,backdrop:!1,position:T,resizeBehavior:"fixed",placement:I,className:"z-popover",children:t("div",{className:Kt("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!A}),children:[t("div",{className:"flex items-center text-[0.875rem] p-3",children:[t("div",{className:"pr-2",children:[e("div",{className:"text-[0.875rem]",children:"Assembly Properties"}),e("div",{className:"text-[0.75rem] text-neutral-700 mt-1.5",children:"Select up to six properties to appear in the Assembly panel."})]}),e(j,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{b(""),M()}})]}),e(J,{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&&b(t.toLowerCase())}}),h&&e(ue,{"data-testid":"partial-key-list-notification-banner",message:"loading"===u.state?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>l.refreshKeyList()}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:Pi.label}),O.filter((e=>""===v||e.toLowerCase().includes(v))).map((t=>e(VertexSceneTreeMetadataCheck,{checked:f.includes(t),disabled:f.length>=6&&!f.includes(t),onChange:e=>{g(e?[...f,t]:f.filter((e=>e!==t)))},children:t},t)))]}),t("div",{className:"flex items-center p-3 border-t border-neutral-300 space-x-4",children:[e("div",{className:"text-[0.75rem] text-[var(--vertex-ui-blue-700)] cursor-pointer","data-testid":"scene-tree-column-clear-selection",onClick:()=>g([]),children:"Clear selection"}),e("div",{className:"flex-grow"}),t("div",{className:"flex space-x-2",children:[e(B,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{b(""),M()},children:"Cancel"}),e(B,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await o.updateMetadataSearchAfterColumnVisibilityChange(p,f,c),await l.setActive(f),null==a||a(f),b(""),M()},children:"Apply"})]})]})]})})]})};function VertexToolbarDivider(){return e("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1"})}const VertexSceneTreeSearchInformationForToolbar=()=>{const a=useSelectionActions(),i=r(Ia),l=r(Hi),o=r(Wi),s=undefined,c=`${o} ${1===o?"result":"results"}`;return t(n,{children:[e(VertexToolbarDivider,{}),t("div",{className:"flex flex-row items-center overflow-hidden",children:[e("div",{className:"px-2 text-[0.8125rem] leading-4 text-neutral-900 truncate","data-testid":"search-result-info",children:`${c}`}),e(R,{className:"w-auto",content:"Select Results",placement:"top",children:e(B,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=i&&null!=l&&(await i.selectFilteredItems(l),a.toggleLastSelectWasMultiSelect(!0))},children:t("div",{className:"flex h-6 items-center gap-1",children:[e(F,{size:"sm",name:"check-circle"}),e("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},VertexSceneTreeCollapseAll=()=>{const t=r(Ia);return e(R,{className:"w-auto",content:"Collapse All",placement:"top",children:e(F,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{null==t||t.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=r(Ia);return e(R,{className:"w-auto",content:"Expand All",placement:"top",children:e(F,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{null==t||t.expandAll()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:n})=>{const a=r(Hi),i=null==a||""===a;return e(de,{className:"h-10 border-b border-neutral-300 box-border",children:t("div",{className:"flex w-full text-neutral-700 items-center gap mx-2",children:[e(VertexSceneTreeExpandAll,{}),e(VertexSceneTreeCollapseAll,{}),!i&&e(VertexSceneTreeSearchInformationForToolbar,{}),e("div",{className:"ml-auto",children:e(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:n})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,onVisibleSceneTreeColumnsChange:r,children:s})=>{const c=undefined;return e("div",{slot:"header",className:"flex flex-col",children:null!=s&&!1!==s?s:t(n,{children:[e(VertexSceneTreeSearch,{onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,children:e("div",{slot:"clear-icon"})}),e(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:r})]})})};function useMetadataActions(){const e=useActionCallback((({snapshot:e,set:t})=>async n=>{const a=undefined;if(await e.getPromise(gi(n)))return;t(gi(n),!0);const i=await e.getPromise(mi(n));if(null!=(null==i?void 0:i.metadata)){const e=[...i.metadata];t(pi(n),(t=>[...t,...e]))}const l=null==i?void 0:i.cursor;t(hi(n),l),t(gi(n),!1)}));return{fetchInitialMetadata:useActionCallback((({snapshot:t})=>async n=>{const a=undefined;0===(await t.getPromise(pi(n))).length&&await e(n)})),fetchNextMetadata:useActionCallback((()=>async t=>{await e(t)}))}}var Ji={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=A,i=_interopRequireDefault(a),l,o=_interopRequireDefault(Ce);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 r=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 i=document.documentElement||document.body.parentNode||document.body,l=void 0!==t.pageYOffset?t.pageYOffset:i.scrollTop;a=this.props.isReverse?l:this.calculateOffset(e,l)}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,l=t.hasMore;t.initialLoad;var o=t.isReverse,r=t.loader;t.loadMore,t.pageStart;var s=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,s&&s(t)};var d=[n];return l&&(r?o?d.unshift(r):d.push(r):this.defaultLoader&&(o?d.unshift(this.defaultLoader):d.push(this.defaultLoader))),i.default.createElement(a,c,d)}}]),InfiniteScroll}(a.Component);r.propTypes={children:o.default.node.isRequired,element:o.default.node,hasMore:o.default.bool,initialLoad:o.default.bool,isReverse:o.default.bool,loader:o.default.node,loadMore:o.default.func.isRequired,pageStart:o.default.number,ref:o.default.func,getScrollParent:o.default.func,threshold:o.default.number,useCapture:o.default.bool,useWindow:o.default.bool},r.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=r,e.exports=t.default}(Ji,Ji.exports);var Qi=Ji.exports;const CopyButton=({id:t,textToCopy:n,iconSize:a,disableTooltip:i,onCopyValue:l})=>{const[o,r]=A.useState(!1),s=undefined,c=useDebouncedCallback((()=>{r(!1)}),2e3);return e(R,{className:"h-fit self-center z-[16000]",content:o?"Copied to Clipboard":"Copy",placement:"bottom",disabled:i,children:e("div",{className:Kt({"text-green-700":o}),children:e(j,{className:"ml-auto","data-testid":`${t}-copy-button`,iconName:o?"check":"copy",iconSize:null!=a?a:"xs",onClick:e=>{e.stopPropagation(),e.preventDefault(),null!=n&&(navigator.clipboard.writeText(n),null==l||l(n)),r(!0),c(!0)},style:{"--hover-box-shadow":"none"}})})})};function MetadataPropertyValue({value:n,onCopyMetadataValue:a}){const[i,l]=A.useState(!1),o=""!==n.replace(/^\s*$/,"").trim();return o?t("div",{className:"flex w-full border-b border-neutral-300 pl-1 pr-3","data-testid":`${n}-metadata-property`,onMouseEnter:()=>{l(!0)},onMouseLeave:()=>l(!1),children:[e(R,{className:"w-full shrink truncate pr-2 py-1.5",content:n,placement:"bottom-start",children:e("div",{className:"truncate",children:n})}),i&&e(CopyButton,{id:n,textToCopy:n,onCopyValue:a})]}):e("div",{className:Kt("overflow-visible border-b border-neutral-300 pl-1 pr-4 py-1.5",{"text-neutral-500":!o}),children:"--"})}const MetadataPanelContents=({sceneItemId:a,onCopyMetadataValue:i})=>{const l=useMetadataActions(),o=p(vi),s=r(pi(a)),c=r(fi(a)),d=r(gi(a)),u=(null==s?void 0:s.length)>0;function getMessage(){if(!d&&0===(null==s?void 0:s.length)&&"hasValue"===o.state)return"This part does not contain properties"}return A.useEffect((()=>{null!=a&&l.fetchInitialMetadata(a)}),[a]),t(n,{children:[e(Qi,{initialLoad:!1,hasMore:c,loadMore:async()=>{c&&await l.fetchNextMetadata(a)},useWindow:!1,children:t("div",{className:"flex w-full text-xs leading-5 grow-0",children:[e(G,{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("div",{className:"flex flex-col w-full overflow-hidden whitespace-nowrap",children:s.map(((t,n)=>e(R,{className:"border-b border-neutral-300 pl-4 pr-1 py-1.5",content:t.key,placement:"bottom-start",children:e("div",{className:"truncate",children:t.key})},n)))})}),e("div",{id:"metadata-value-column",className:"flex flex-col w-full min-w-24",children:s.map(((t,n)=>e(MetadataPropertyValue,{value:t.value,onCopyMetadataValue:i},n)))})]})}),!u&&e("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:getMessage()})]})},MetadataPanel=({onCopyMetadataValue:n})=>{const a=usePanelActions(),i=r(Nn),l=p(vi);return t("div",{id:"metadata-panel-wrapper","data-testid":"metadata-panel-wrapper",className:"w-full h-full flex flex-col mt-auto text-neutral-800",children:[t("div",{className:"flex h-10 border-b border-neutral-300 p-3 pl-4 text-[0.875rem] items-center",children:["hasValue"===l.state&&e("span",{className:"flex flex-col w-full",children:e(R,{content:l.contents,children:e("div",{className:"truncate",children:l.contents||""})})}),"loading"===l.state&&e("div",{className:"flex items-center w-full h-full",children:e("div",{className:"w-1/2 h-1/2 bg-neutral-300 animate-pulse rounded"})}),e(F,{className:"ml-auto cursor-pointer",onClick:a.closeSecondary,name:"close",size:"sm"})]}),t("div",{className:"w-full h-full overflow-y-auto overflow-x-hidden",children:[null!=i&&e(MetadataPanelContents,{sceneItemId:i.id,onCopyMetadataValue:n}),null==i&&e("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(G,{"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(MetadataPanel,{onCopyMetadataValue:n})}),VertexSceneTreeCustomColumn=({label:n,rowDataBinding:a,expandToggle:i,visibilityToggle:l,isolateButton:o,initialWidth:s,minWidth:c})=>{const d=r(Ia);return A.useEffect((()=>{null==d||d.invalidateRows()}),[a]),t(me,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:s,minWidth:c,children:[e("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${Kt("truncate",{"pl-2":i,"pr-2":l})}">\n ${n}\n </div>\n </div>\n `}}),e("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 ${i?"expand-toggle":""}\n ${l?"visibility-toggle":""}\n ${o?"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="${l?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${a}</div>\n </div>\n </vertex-tooltip>\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 `}})]},n)},VertexSceneTreeMetadataColumns=({children:t})=>{const a=r(Vi),i=r(_i),l=[],o=i.filter((e=>e!==Pi.label)).map((e=>a[e]));return e(n,null!=t?{children:t({columns:o.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))})}:{children:o.map(((t,n)=>{var a;const i=null!==(a=l[n])&&void 0!==a?a:t.initialWidth;return e(VertexSceneTreeCustomColumn,{label:t.label,visibilityToggle:n===o.length-1,isolateButton:n===o.length-1,rowDataBinding:t.binding,initialWidth:i,minWidth:t.minWidth},t.label)}))})},VertexSceneTreeTableLayout=n=>{var a,i;const{children:l}=n,o=__rest(n,["children"]),s=r(Vi),c=r(_i),d=[],u=A.useMemo((()=>findChildElement(l,NameColumn)),[l]),m=A.useMemo((()=>findChildElement(l,MetadataColumns)),[l]),p=null!==(a=s[Pi.label])&&void 0!==a?a:Pi,h=c.filter((e=>e!==Pi.label)).map((e=>s[e]));return t(pe,Object.assign({"data-testid":"scene-tree-table-layout"},o,{children:[u?cloneChildNodeOrFunction(u.props.children,{columnCount:c.length,initialWidth:p.initialWidth,minWidth:p.minWidth}):e(VertexSceneTreeCustomColumn,{expandToggle:!0,visibilityToggle:1===c.length,isolateButton:1===c.length,rowDataBinding:p.binding,label:p.label,initialWidth:null!==(i=d[0])&&void 0!==i?i:p.initialWidth,minWidth:p.minWidth}),null!=m?cloneChildNodeOrFunction(m.props.children,{columns:h.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))}):e(VertexSceneTreeMetadataColumns,{})]}))},NameColumn=({children:t})=>e(n,{children:t}),MetadataColumns=({children:t})=>e(n,{children:t});VertexSceneTreeTableLayout.NameColumn=NameColumn,VertexSceneTreeTableLayout.MetadataColumns=MetadataColumns;const VertexSceneTree=n=>{var{id:a,font:i,backgroundColors:l,additionalLoadedMetadataProperties:o,whitelistedMetadataProperties:s,allowViewingMetadataPropertiesPanel:d,children:u,style:m,onPointerDown:p,onClick:h,onToggleSelection:f,onToggleExpansion:g,onToggleVisibility:v,onCopyMetadataValue:b,className:w,rowData:C}=n,S=__rest(n,["id","font","backgroundColors","additionalLoadedMetadataProperties","whitelistedMetadataProperties","allowViewingMetadataPropertiesPanel","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","onCopyMetadataValue","className","rowData"]);const k=useSceneTreeActions(),T=useSelectionActions(),P=r(Ai),E=r(et),M=r(ci),I=r(Xi),N=r(Gi),O=r(Fi),V=r(Ui),_=r(Hi),L=null==_||""===_,R=useRecoilRef({state:Ia}),j=A.useMemo((()=>findChildElement(u,Header)),[u]),D=A.useMemo((()=>findChildElement(u,TableLayout)),[u]),B=A.useMemo((()=>findChildElement(u,ContextMenu)),[u]),wrappedExpansionHandler=(e,t,n)=>{k.toggleExpansion(e,t,n),null==g||g(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{k.toggleSelection(e,t,n),null==f||f(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{k.toggleVisibility(e,t,n),null==v||v(e,t,n)},handleClick=async e=>{e.altKey&&await k.flyToRow(e.clientY),null==h||h(e)},handlePointerDown=async e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&await T.clearSelection(),null==p||p(e)},H=c(Na),handleFirstRowRendered=e=>{var t;H(e.target.controller),null===(t=null==S?void 0:S.onFirstRowRendered)||void 0===t||t.call(S,e)},F=A.useMemo((()=>({metadataSearchKeys:N,exactMatch:O,removeHiddenItems:V})),[N,O,V]);return useStateSyncedValue(Mi,s,{transform:e=>e.sort(((e,t)=>e.localeCompare(t)))}),useStateSyncedValue(ui,d),useStateSyncedValue(Yi,o),t("div",{id:"scene-tree-panel",className:"flex flex-col w-full h-full grow-0",children:[e("div",{id:"scene-tree-container",className:"flex group h-full min-h-32 overflow-auto",children:t(he,Object.assign({id:null!=a?a:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:P,ref:R,className:Kt("flex-1",{filtered:!L}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(i)),styleFromOptionalBackgroundColors(l)),m),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:E,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==C?void 0:C(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)},searchOptions:F,metadataKeys:I},S,{onFirstRowRendered:handleFirstRowRendered,children:[null!=j?j:e(VertexSceneTreeHeader,{}),null!=D?D:e(VertexSceneTreeTableLayout,{}),null!=B?B:e(VertexSceneTreeContextMenu,{})]}))}),void 0!==M&&e(SceneTreeSecondaryPanel,{panelId:"scene-tree-panel",onCopyMetadataValue:b})]})},Header=({children:t})=>e(n,{children:t}),TableLayout=({children:t})=>e(n,{children:t}),ContextMenu=({children:t})=>e(n,{children:t});VertexSceneTree.Header=Header,VertexSceneTree.TableLayout=TableLayout,VertexSceneTree.ContextMenu=ContextMenu;const VertexDecimalPlaceSelector=({onApply:n})=>{const[a,i]=s(Kn);return t(Q,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{i(e.detail),null==n||n(e.detail)},children:[e("div",{className:"py-1.5 px-3",children:"0"}),e("div",{className:"py-1.5 px-3",children:"1"}),e("div",{className:"py-1.5 px-3",children:"2"}),e("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:n})=>{const[a,i]=s(Gn);return t(Q,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{i(e.detail),null==n||n(e.detail)},children:[e("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:a,onDecimalPlaceChange:i}){return t(n,{children:[t("div",{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e(VertexLengthUnitSelector,{onApply:a})]}),t("div",{children:[e("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e(VertexDecimalPlaceSelector,{onApply:i})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e(PanelSection,{header:e("div",{className:"flex items-center text-base",children:"Units"}),children:e(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}function useModelViewActions(){const e=usePmiAnnotationActions(),t=useSelectionActions();return{fetchNextModelViews:useActionCallback((({snapshot:e,set:t})=>async n=>{var a;const i=await e.getPromise(Sa(n));if(null!=i){const e=null===(a=null==i?void 0:i.paging)||void 0===a?void 0:a.next;null!=e&&(t(va(n),(e=>[...e,i])),t(fa(n),(()=>e)))}})),loadModelView:useActionCallback((({set:n,snapshot:a})=>async(i,l)=>{var o;const r=await a.getPromiseRequired(et),s=await a.getPromiseRequired(In);try{await(null===(o=null==r?void 0:r.modelViews)||void 0===o?void 0:o.load(i,l.id)),n(Ca,{itemId:i,modelView:l}),0!==s.length&&await t.clearSelection(),await e.fetchInitialPmiAnnotations(l.id)}catch(e){logger_error("Failed to load model view",e)}})),clearModelView:useActionCallback((({reset:t,snapshot:n})=>async()=>{var a;const i=undefined;if(null!=await n.getPromise(Ca)){const i=await n.getPromiseRequired(et);try{await(null===(a=null==i?void 0:i.modelViews)||void 0===a?void 0:a.unload()),t(Ca),await e.clearPmiAnnotationSelection()}catch(e){logger_error("Failed to remove model view",e)}}}))}}var el=Object.freeze({__proto__:null,hasMoreModelViews:ka,hasMorePmiAnnotations:Pa,loadedItemModelView:Ca,loadedModelViews:va,loadedPmiAnnotations:ya,modelViews:xa,modelViewsCursor:fa,modelViewsSceneItemName:wa,nextModelViews:Sa,nextPmiAnnotations:Aa,pmiAnnotations:Ta,pmiAnnotationsCursor:ga,selectedPmiAnnotationId:Ea,useModelViewActions:useModelViewActions,visiblePmiAnnotations:ba});function FileWithMagnifyingGlassImage(){return e("div",{children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"160",height:"160",viewBox:"0 0 220 220",children:[e("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("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("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("path",{d:"M79.12 123.99H110v30.88H79.12z",fill:"#e0f3f9"}),e("path",{d:"M110 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M105.4 154.87H82.17",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M80.62 154.87h-1.5v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("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("path",{d:"M79.12 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M83.72 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M108.5 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M110 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M110 123.99h30.88v30.88H110z",fill:"#e0f3f9"}),e("path",{d:"M140.88 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("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("path",{d:"M111.5 154.87H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M110 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M110 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M114.6 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M139.38 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M140.88 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M110 93.11h30.88v30.88H110z",fill:"#e0f3f9"}),e("path",{d:"M140.88 122.49v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("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("path",{d:"M111.5 123.99H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M110 119.39V96.15",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M110 94.61v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M114.6 93.11h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M139.38 93.11h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M140.88 97.7v23.24",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("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("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("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("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("path",{fill:"none",stroke:"#b43296","stroke-linecap":"round","stroke-linejoin":"round",d:"M14.89 132.63h5.88v5.88h-5.88z"}),e("path",{fill:"none",stroke:"#f90","stroke-linecap":"round","stroke-linejoin":"round",d:"M174.49 36v5.88m-2.94-2.94h5.88"}),e("circle",{cx:"199.1",cy:"164.76",r:"2.45",fill:"none",stroke:"#0c0","stroke-linecap":"round","stroke-linejoin":"round"}),e("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("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("circle",{cx:"110.2",cy:"124.35",r:"27.74",fill:"#e0f3f9",opacity:".7"}),e("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("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("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("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("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:n}){const a=n?"There are no model views associated with this part":"Select a part to display model views";return t("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(FileWithMagnifyingGlassImage,{}),e("div",{className:"text-lg text-neutral-700 text-center p-3",children:a})]})}const VertexModelViewsViewRow=({view:n,currentlyViewing:a,itemId:i,onLoadModelView:l,onClearModelView:o})=>{const r=useModelViewActions();return e("div",{"data-testid":`model-view-${n.id}`,onClick:async()=>{a?(await r.clearModelView(),null==o||o()):(await r.loadModelView(i,n),null==l||l(i,n.id))},className:Kt("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)]":a,"hover:bg-[var(--vertex-ui-blue-100)]":!a}),children:t("div",{className:Kt("flex w-full h-full items-center",{"text-neutral-900 font-extrabold":a}),children:[t(R,{className:"flex w-20 grow","data-testid":`model-view-${n.id}-tooltip`,placement:"bottom-start",content:n.displayName,children:[e(F,{name:"views",size:"sm"}),e("div",{className:"truncate mx-2",children:n.displayName}),e("span",{className:"font-normal text-neutral-700 ml-auto pr-1",children:a&&"(Viewing)"})]}),a&&e("div",{className:"ml-auto pr-1",children:e(j,{"data-testid":"model-views-clear-selection",iconSize:"sm",iconName:"close",onClick:async()=>await r.clearModelView()})})]})},n.id)};function VertexModelViewsList({itemId:n,onLoadModelView:a,onClearModelView:i}){const l=useModelViewActions(),o=r(Ca),s=r(xa(n)),c=r(ka(n)),d=p(wa),u=0===s.length;return t("div",{className:"w-full h-full flex flex-col",children:[("hasValue"!==d.state||null!=d.contents)&&t("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("div",{className:"truncate items-center",children:e(R,{content:d.contents,children:e("div",{className:"truncate",children:d.contents||""})})}),"loading"===d.state&&e("div",{className:"flex items-center h-11 w-full",children:e("div",{className:"w-3/4 h-3 bg-neutral-300 animate-pulse rounded"})})]}),u&&e(ModelViewsEmptyState,{itemSelected:!0}),!u&&e("div",{className:"h-full overflow-y-auto",children:e(Qi,{hasMore:c,loadMore:()=>{l.fetchNextModelViews(n)},useWindow:!1,children:s.map((t=>{var l;const r=undefined,s=(null===(l=null==o?void 0:o.modelView)||void 0===l?void 0:l.id.toString())===(null==t?void 0:t.id);return e(VertexModelViewsViewRow,{view:t,currentlyViewing:s,itemId:n,onLoadModelView:a,onClearModelView:i},t.id)}))})})]})}const VertexPMIAnnotationRow=({annotation:n,checked:a,onCheckedChange:i,selected:l,onSelectedChange:o})=>t("div",{"data-testid":`annotation-entry-${n.displayName}`,className:Kt("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)]":l,"hover:bg-[var(--vertex-ui-blue-100)]":!l}),onClick:()=>o(!l),children:[e(L,{"data-testid":`annotation-entry-${n.displayName}-check`,variant:"check",checked:a,onClick:e=>e.stopPropagation(),onValueChanged:e=>{i(e.detail)}}),e("div",{className:"w-1/2 flex-grow",children:e(R,{content:n.displayName,placement:"bottom-start",children:e("div",{className:"truncate",children:n.displayName})})})]}),VertexPMIAnnotationsSecondaryPanel=({modelViewId:n,parentPanelId:a,verticalSiblingId:i,sceneAnnotationOperations:l,onToggleSelectionOfPMIAnnotation:o,onToggleVisibilityOfPMIAnnotation:c})=>{const d=usePmiAnnotationActions(),u=r(et),m=r(Ta(n)),p=r(Pa(n)),h=r(Ea),[f,g]=s(ba(n)),[v,b]=k.useState("");k.useEffect((()=>{n!==v&&(g(m),b(n))}),[m,v,n,g,b]);const toggleVisibilityOfAllAnnotations=e=>{e?(g(m),null==l||l.sceneAnnotationsOperation((e=>e.show()),u)):(g([]),null==l||l.sceneAnnotationsOperation((e=>e.hide()),u))};return e(G,{"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:`#${i}`,children:t("div",{className:"flex flex-col h-full overflow-hidden",children:[e("div",{className:"flex items-center w-full h-9 border-b border-[var(--vertex-ui-neutral-300)] px-4 shrink-0",children:"3D PMI"}),t("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(L,{"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("div",{className:"h-full overflow-y-auto text-[0.8125rem] py-1",children:e(Qi,{hasMore:p,loadMore:async()=>{await d.fetchNextPmiAnnotations(n)},useWindow:!1,children:m.map(((t,a)=>e(VertexPMIAnnotationRow,{annotation:t,checked:f.includes(t),onCheckedChange:e=>{e?(g([...f,t]),null==l||l.sceneAnnotationsOperation((e=>e.show()),u,[t.id])):(g(f.filter((e=>e!==t))),null==l||l.sceneAnnotationsOperation((e=>e.hide()),u,[t.id])),null==c||c(n,t.id,e)},selected:t.id===h,onSelectedChange:async e=>{e?await d.selectPmiAnnotation(t.id):await d.clearPmiAnnotationSelection(),null==o||o(n,t.id,e)}},a)))})})]})})},VertexModelViewsPanelSection=({onLoadModelView:n,onClearModelView:a,onToggleSelectionOfPMIAnnotation:i,onToggleVisibilityOfPMIAnnotation:l})=>{const o=useSceneAnnotationsOperations(),s=r(Un),c=null!=(null==s?void 0:s.id),d=r(Ca),u=(null==d?void 0:d.itemId)===(null==s?void 0:s.id);return t("div",{id:"model-views-panel-wrapper",className:"w-full h-full flex flex-col text-neutral-800",children:[t("div",{"data-testid":"model-views-container",className:"group h-full flex overflow-auto min-h-29 relative",children:[c&&e(k.Suspense,{fallback:e(ModelViewsItemListLoading,{}),children:e(VertexModelViewsList,{itemId:s.id,onLoadModelView:n,onClearModelView:a})}),!c&&e(ModelViewsEmptyState,{itemSelected:!1})]}),null!=d&&u&&e(k.Suspense,{fallback:e(ModelViewsItemListLoading,{}),children:e(VertexPMIAnnotationsSecondaryPanel,{modelViewId:d.modelView.id,parentPanelId:"model-views-panel-wrapper",verticalSiblingId:"model-views-container",sceneAnnotationOperations:o,onToggleSelectionOfPMIAnnotation:i,onToggleVisibilityOfPMIAnnotation:l})})]})};function ModelViewsItemListLoading(){return t("div",{className:"flex flex-col w-full h-full items-center justify-center text-[0.8125rem] overflow-y-auto",children:[e(ee,{"data-testid":"model-views-panel-spinner",size:"lg",color:"grey"}),e("div",{className:"pt-3 px-10 text-center",children:"Loading model views for the selected part..."})]})}function VertexModelViewsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexModelViewsPanelSection,{})})}function ColorSwatchContextMenu({onRemoveCustomColor:n}){const a=useContextMenuActions(),i=useSceneItemMaterialActions(),l=r(en);return e(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(W,{"data-testid":"color-swatch-delete",onClick:async()=>{if(contextMenuItemIsElement(l)&&elementIsColorSwatch(l)){const e=null==l?void 0:l.getAttribute("data-color-id");null!=e&&"true"===l.getAttribute("data-custom-color")?(await i.removeCustomColor(e),null==n||n(e)):null!=e&&"true"===l.getAttribute("data-recent-color")&&await i.removeRecentColor(e)}},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"delete",size:"sm"}),"Delete"]})})})}function DefaultAppearancePanel(){return t("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e(VertexMaterialPanelSection,{}),e(VertexGhostingPanelSection,{}),e(VertexFeatureEdgesPanelSection,{}),e(VertexViewerBackgroundPanelSection,{}),e(VertexSelectionHighlightingPanelSection,{}),e(VertexCrossSectionAppearancePanelSection,{}),e(ColorSwatchContextMenu,{})]})}function DefaultSettingsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:n,onClearAll:a})=>{const i=useTransformActions(),l=useCacheableLoadable(Fn),o=r(Rn),s=useCacheableLoadable(ia(null!=o?o:"")),c=A.useMemo((()=>{var e;const t=null===(e=l.data)||void 0===e?void 0:e.some((e=>{var t;return null!=(null===(t=null==e?void 0:e.override)||void 0===t?void 0:t.transform)})),n=null!=s.data;return t||n}),[l,s]);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e("div",{className:"pt-1"}),e(W,{"data-testid":"clear-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==n||n()},disabled:!c,children:"Clear selected transforms"}),e(W,{"data-testid":"clear-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:n,value:a,step:i,min:l,max:o,disabled:s,testId:c,onBlur:d,onInput:u,onChange:m})=>{const p=A.useRef(null),h=r(Kn),[f,g]=A.useState(!0);A.useEffect((()=>{var e;const t=null!=p.current&&Number.isNaN(p.current.valueAsNumber),n=f||t;null!=p.current&&n?p.current.value=null!==(e=null==a?void 0:a.toFixed(Number(h)))&&void 0!==e?e:"":g(!0)}),[a]);const v=A.useCallback((e=>{g(!1),null==m||m(e)}),[g,m]),b=A.useCallback((e=>{g(!0),null==d||d(e),null!=p.current&&null!=a&&(p.current.value=a.toFixed(Number(h)))}),[d,a,g]);return t("div",{children:[e("div",{className:"truncate rounded-md w-full",children:e("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:i,min:l,max:o,"data-testid":c,disabled:s,defaultValue:Number.isNaN(a)?"":null==a?void 0:a.toFixed(Number(h)),onBlur:b,onInput:u,onChange:v})}),null!=n&&e("div",{className:"flex justify-center items-center pointer-events-none text-neutral-500",children:e("span",{children:n})})]})},VertexTransformInputs=({onUpdateTransform:n})=>{const a=r(Gn),i=r(_n),l=r(Vn),o=i||l,s=r(Rn),{transform:c,error:d,update:u}=useEditItemTransform(s),m=o?void 0:c,p=useDebouncedCallback((async e=>{await u(e),null==n||n(e)}),50);function updateTransform(e){return t=>{if(null!=m){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||null==p||p(Object.assign(Object.assign({},m),e(n,m)))}}}function updatePosition(e){return updateTransform(((t,n)=>({position:Object.assign(Object.assign({},n.position),e(t))})))}function updateRotation(e){return updateTransform(((t,n)=>({rotation:Object.assign(Object.assign({},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),i=undefined;(isNaN(a)||!!(null==t?void 0:t(a)))&&null!=m&&p(Me.defaults(e,m))}}return t("div",{children:[t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Position"}),t("div",{className:"flex flex-wrap w-full gap-2",children:[t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"X"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-x",value:null!=m?m.position.x:void 0,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({position:{x:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Y"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-y",value:null==m?void 0:m.position.y,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({position:{y:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Z"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-z",value:null==m?void 0:m.position.z,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({position:{z:0}})})})]})]})]}),t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Rotation"}),t("div",{className:"flex flex-wrap w-full gap-2",children:[t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"X"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-x",value:null==m?void 0:m.rotation.x,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{x:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Y"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-y",value:null==m?void 0:m.rotation.y,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{y:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Z"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-z",value:null==m?void 0:m.rotation.z,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{z:0}})})})]})]})]}),t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Scale"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"scale",value:null==m?void 0:m.scale,step:.1,min:.1,disabled:null==m,onChange:updateScale(),onBlur:updateToDefaultValueIfInvalid({scale:1},(e=>e<=0))})}),o&&e("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!=d&&e("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 n=useTransformActions(),a=r(Zn),i=c(oa);return e(L,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:a,onValueChanged:async()=>{a?(n.disableTransformWidget(),null==t||t(!1)):(i("world"),await n.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:a,onUpdateTransform:i}){return t(n,{children:[t("div",{className:"flex items-center py-3",children:[e(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:a}),e("span",{className:"pl-4 text-[0.8125rem] text-neutral-700",children:"Enable manipulator"})]}),e(VertexTransformInputs,{onUpdateTransform:i})]})}function VertexTransformPanelSection({onClearTransforms:n,onClearAllTransforms:a,onToggleTransformsManipulator:i,onUpdateTransform:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e(VertexTransformClear,{onClear:n,onClearAll:a})]}),children:e(VertexTransformControls,{onToggleTransformsManipulator:i,onUpdateTransform:l})})}function DefaultTransformsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexTransformPanelSection,{})})}const tl="Appearance",nl="Model Views",al="Settings",il="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:n})=>{const a=r(si),i=getHeading(a,n),l=undefined;return e("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:t("div",{className:"flex items-center w-full leading-6 text-md align-center font-medium text-neutral-800 gap-2",children:[i,"model-views"===a&&e(BetaLabel,{})]})})};function getHeading(e,t={}){switch(e){case"appearance":return tl;case"model-views":return nl;case"settings":return al;case"transforms":return il;default:const n=null!=e?t[e]:void 0;return null!=n?n:"None"}}function VertexViewerRightOpenedPanel({children:a}){const i=r(si),l=A.useMemo((()=>filterChildElements(a,CustomPanelContent)),[a]),o=A.useMemo((()=>l.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.props.panelName]:t.props.panelTitle})),{})),[l]),s=A.useMemo((()=>["appearance","model-views","settings","transforms",...l.map((e=>e.props.panelName))]),[l]);return e(n,{children:null!=i&&s.includes(i)&&t(VertexResizableContent,{displayShadow:!0,heading:e(ViewerRightPanelHeader,{additionalHeaderMap:o}),placement:"right",children:["appearance"===i&&e(DefaultAppearancePanel,{}),"transforms"===i&&e(DefaultTransformsPanel,{}),"settings"===i&&e(DefaultSettingsPanel,{}),"model-views"===i&&e(VertexModelViewsPanel,{}),a]})})}function CustomPanelContent({panelName:t,children:a}){const i=r(si);return e(n,{children:i===t&&a})}function Sidebar({children:t}){return e("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:n,iconName:a,active:i,responsive:l,disabled:o,content:r,tooltipPlacement:s,children:c,onSelect:d,onDeselect:u}){return e("div",{className:Kt({"text-[var(--vertex-ui-blue-700)]":i===n&&!o,"text-neutral-700 hover:text-neutral-800":i!==n&&!o,"cursor-pointer hover:bg-neutral-200":!o,"text-neutral-400":o,"rounded-full md:p-3":l,"p-3":!l&&null==c,"px-3 py-1":null!=c}),"data-testid":`${n}-sidebar-panel`,onClick:()=>{o||(i===n?u():d())},children:t(R,{placement:null!=s?s:void 0,content:A.isValidElement(r)?void 0:r,children:[e("div",{slot:"content",children:r}),e("div",{className:"flex flex-col",children:null!=c?c:e(F,{name:a})})]})})}function VertexViewerRightSidebar({children:n}){const a=usePanelActions(),i=useTransformActions(),l=r(si);return e("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:t(Sidebar,{children:[n,e(SidebarIcon,{name:"appearance",active:l,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{a.openPrimary("appearance","right")},onDeselect:()=>a.closePrimary("right")}),e(SidebarIcon,{name:"transforms",active:l,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{a.openPrimary("transforms","right"),await i.enableTransformWidget(void 0,!0)},onDeselect:()=>a.closePrimary("right")}),e(SidebarIcon,{name:"model-views",active:l,iconName:"views",tooltipPlacement:"right",content:"Model Views",onSelect:async()=>{a.openPrimary("model-views","right")},onDeselect:()=>a.closePrimary("right")}),e(SidebarIcon,{name:"settings",active:l,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{a.openPrimary("settings","right")},onDeselect:()=>a.closePrimary("right")})]})})}function CustomPanelIcon(t){const n=usePanelActions(),a=r(si),{panelName:i,tooltipContent:l,iconName:o}=t,s=__rest(t,["panelName","tooltipContent","iconName"]);if(null==o&&null==s.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e(SidebarIcon,Object.assign({},s,{name:i,iconName:null!=o?o:"help",active:a,content:l,onSelect:()=>{n.openPrimary(t.panelName,"right")},onDeselect:()=>{n.closePrimary("right")}}))}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=a=>{var{open:i,children:l}=a,o=__rest(a,["open","children"]);const r=l.find((e=>e.type===Anchor)),s=l.filter((e=>e.type!==Anchor));return null==r?e(n,{}):t(Z,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(i)},o,{children:[r,e("div",{className:Kt("flex mb-1.5",{hidden:!i}),"data-testid":"align-plane-popover-menu",children:s})]}))},Anchor=({tooltipContent:t,children:n})=>e("div",{slot:"anchor",children:e(R,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu({disabled:n}){const a=useCrossSectioningActions(),i=r(Vt),l=r(kt),getBaseIcon=()=>`align-to-${null==l?void 0:l.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:a.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==l?void 0:l.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==l?void 0:l.hitPending)},[null==l?void 0:l.hitPending]),t(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:a.closeAlignmentTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e(j,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:i?a.closeAlignmentTools:a.openAlignmentTools,disabled:n,children:e(F,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),t(fe,{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(j,{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("div",{className:"text-base ml-2",children:"Align to Global"})}),e(j,{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("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu({disabled:n}){const a=useCrossSectioningActions(),i=r(_t),l=r(xt),o=p(Et),s=A.useMemo((()=>{const e=l.length>0&&"hasValue"===o.state?axis(l[0],xAxis(o.contents),yAxis(o.contents),zAxis(o.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[o.state,o.contents,l]);return t(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:a.closeAxisTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e(j,{onClick:i?a.closeAxisTools:a.openAxisTools,iconName:s,"data-testid":"align-plane-icon",iconColor:"secondary",disabled:n,children:e(F,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),t(fe,{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(j,{"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("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e(j,{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("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e(j,{"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("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:n,disabled:a,onOffsetChange:i}){const l=r(Gn),o=r(Kn),[s,c]=A.useState(convertTo(n,l));A.useEffect((()=>{c(convertTo(n,l))}),[l,n]);const d=createDistanceFormatter(l,parseInt(o,10)),handleIncrementalUpdate=e=>{const t=convertFrom(s+e,l);i(t)},u=undefined,handleBlur=()=>{i(convertFrom(s,l))};return e(R,{content:"Plane Offset",children:e("form",{"data-testid":"cross-section-stepper-form",onSubmit:e=>{e.preventDefault(),i(convertFrom(s,l))},children:t(J,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:d(parseFloat(n.toFixed(3))),onInputInput:e=>{c(null!=e.detail.value?parseFloat(e.detail.value):n)},onBlur:handleBlur,disabled:a,children:[e("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>{a||handleIncrementalUpdate(-1)},children:e(F,{name:"chevron-left",size:"sm"})}),e("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>{a||handleIncrementalUpdate(1)},children:e(F,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const ll=400;function VertexViewerCrossSectionPopupMenu(){const n=useCrossSectioningActions(),a=r(Ot),i=p(It),l=p(Nt),o=A.useRef(),s=A.useMemo((()=>"hasValue"===i.state&&Number.isFinite(i.contents.max)&&Number.isFinite(i.contents.min)),[i.state,i.contents]),c=A.useMemo((()=>"hasValue"===i.state?i.contents:ft),[i.state,i.contents]),d=A.useMemo((()=>"hasValue"===l.state&&Number.isFinite(l.contents)?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(o.current),o.current=window.setTimeout((()=>{n.endInteraction()}),ll),n.beginInteraction(),n.updatePlanes(e)};return t(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:n.closeAdditionalTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e("div",{className:"-ml-px py-1.5",children:e(F,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?n.closeAdditionalTools:n.openAdditionalTools})})}),t(fe,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexViewerCrossSectionAlignmentPopoverMenu,{disabled:!s}),e(R,{className:"w-auto",content:"Reverse",children:e(j,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:n.flipPlanes,iconColor:"secondary",disabled:!s})}),e(R,{className:"w-auto",content:"Align View to Plane",children:e(j,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:n.alignViewToPlane,iconColor:"secondary",disabled:!s})}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionAxisPopoverMenu,{disabled:!s}),e("div",{className:"w-52 mx-2",children:e(VertexSlider,{value:d,defaultValue:c.default,disabled:asBooleanAttribute("hasValue"!==i.state)||!s,min:c.min,max:c.max,step:.01,onChange:handleCrossSectionValueChange})}),e("div",{className:"px-4",children:e(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state&&s?l.contents:0,disabled:!s,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const a=useCrossSectioningActions(),i=r(gt);return t(n,{children:[e(R,{content:i?"Hide Section":"Show Section",children:e(j,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:i?"primary":"secondary",onClick:()=>i?a.disable():a.enable()})}),e(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=r(et);return e(R,{content:"Fit All",children:e(j,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(null==t?void 0:t.scene());await(null==e?void 0:e.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=r(et),n=r(nt),[a,i]=s(it),[l,o]=s(at);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(R,{content:"Pan",children:e(j,{iconName:"pan",iconColor:"pan"===a?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(i("pan"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=r(et),n=r(nt),[a,i]=s(it),[l,o]=s(at);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(R,{content:"Rotate",children:e(j,{iconName:"rotate",iconColor:"rotate"===a?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(i("rotate"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=r(et),n=r(nt),[a,i]=s(it),[l,o]=s(at);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(R,{content:"Zoom",children:e(j,{iconName:"zoom",iconColor:"zoom"===a?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(i("zoom"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e(ge,{placement:"bottom-center",children:t(fe,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexRotateButton,{}),e(VertexPanButton,{}),e(VertexZoomButton,{}),e(VertexFitAllButton,{}),e(VertexToolbarDivider,{}),e(VertexBoxSelectionButton,{}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionButton,{}),e(VertexToolbarDivider,{}),e(VertexPointToPointMeasurementTool,{}),e(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({endCapEnabledByDefault:t,children:n})=>{const a=c(wt),i=c(bt);A.useEffect((()=>{null!=t&&(a(t),i(t))}),[t]);const l=undefined;return e(ge,{placement:"bottom-center",children:null!=n&&!1!==n?e(fe,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:n}):e(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:i,onRotationChange:l}){const o=useTransformActions(),s=r(na),c=r(Zn),d=r(Jn),u=r(ta),m=p(ea),h=r(Gn),f=r(Kn),g=A.useMemo((()=>"hasValue"===m.state?m.contents:u),[m,u]),v=A.useMemo((()=>{const e=undefined;return c&&(null!=g||s)}),[c,g,s]);return e(n,{children:v&&e(ve,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?g:void 0,decimalPlaces:parseInt(f,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:null==a||a,onInteractionStarted:()=>{o.disableSelectionSync(),o.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{o.invalidateTransforms(),o.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await o.setTransformWidgetPosition(e.detail),null==i||i(e.detail)},onRotationChanged:e=>{o.setTransformWidgetOrientation(e.detail),null==l||l(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),i=useTransformActions(),l=useViewerSceneActions(),o=undefined;return e(R,{content:"Reset View",children:e(j,{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:async()=>{await n.disable(),await a.resetSelectionState(),i.clearTransformWidgetPosition(),await i.invalidateTransforms(),null==t||t(),await l.reset()},variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(Dn);t(ot,a.detail.scene),t(Dn,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(jn,i);const l=undefined;await n.getPromise(Zn)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:n}=useCallbackRef(),a=useBoxSelectionActions(),i=useTransformActions(),l=r(on);return k.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===l&&(i.clearTransformWidgetOrientation(),i.clearTransformWidgetPosition(),i.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,l]),useApplyKeyBinding({keyBind:"Shift",fn:k.useCallback((()=>a.setOperationType("select")),[]),off:k.useCallback((()=>a.setOperationType("clearAndSelect")),[])}),e(ye,{ref:n,"data-testid":"viewer-box-query-tool",operationType:l})};function VertexViewerCameraTypeMenu({open:n,onOpen:a,onDismiss:i,onCameraTypeChange:l}){const o=useViewerCameraActions(),s=r(Qe);return t(K,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(n),onMenuClosed:i,children:[e("div",{slot:"anchor",children:e("div",{className:Kt("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!n,"opacity-100 text-neutral-700 bg-neutral-200":n}),children:e(R,{content:"Change View",children:e(j,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===s?"cube-orthographic":"cube-perspective",children:e(F,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),t("div",{className:"w-36",children:[e("div",{className:"pt-1"}),t(W,{"data-testid":"set-perspective-view",onClick:()=>{o.updateCameraType("perspective",!0),null==l||l("perspective")},children:[e(F,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:Kt({"text-[var(--vertex-ui-blue-700)]":"perspective"===s})}),e("div",{className:Kt("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===s}),children:"Perspective"})]}),t(W,{"data-testid":"set-orthographic-view",onClick:()=>{o.updateCameraType("orthographic",!0),null==l||l("orthographic")},children:[e(F,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:Kt({"text-[var(--vertex-ui-blue-700)]":"orthographic"===s})}),e("div",{className:Kt("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===s}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=n=>{var{placement:a,children:i}=n,l=__rest(n,["placement","children"]);const o=Array.isArray(i)?i:[i],r=o.filter((e=>!A.isValidElement(e)||e.type!==be)).filter((e=>null!=e&&!1!==e)),s=o.find((e=>A.isValidElement(e)&&e.type===be)),[c,d]=A.useState(!1);return t(ge,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=a?a:"top-right",children:[null!=s?s:e(be,Object.assign({className:"m-7"},l)),0===r.length?t("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e(VertexViewerSceneReset,{}),e(VertexViewerCameraTypeMenu,{open:c,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e("div",{className:"mt-3",children:r})]})},VertexViewer=a=>{var{id:i,src:l,className:o,disableSelection:d,onTap:u,onLongpress:m,onFrameDrawn:p,onSceneReady:h,viewerRefCallback:f,children:g}=a,v=__rest(a,["id","src","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const b=r(Ai),w=useRecoilRef({state:et}),C=useViewerCameraActions(),S=useCrossSectioningActions(),k=useHitActions(),T=useSelectionActions(),P=useViewerFrameActions(),E=r(Qe),M=r(kt),I=r(ln),N=c(lt),[O,V]=s(nt);A.useEffect((()=>{O&&(V(!1),S.disable())}),[l]);const[_,L]=s(tt);A.useEffect((()=>{null!=i&&L(i)}),[i]);const R=r(wi),j=A.useMemo((()=>({opacity:R/100})),[R]),D=r(Yt),B=r(Xt),H=A.useMemo((()=>({color:D,width:B})),[D,B]),F=r(wt),U=r(Ct),W=r(St),G=A.useMemo((()=>Object.assign({endCapEnabled:F,endCapUsePartColor:U===ut.PART},F&&U===ut.SINGLE&&{endCapColor:W})),[F,U,W]),K=r(ni),$=r(Ja),q=r(Qa),Y=r(ei),X=A.useMemo((()=>({color:$,opacity:q/100,lineWidth:Y})),[$,q,Y]),Z=r(mn),J=null!=g&&!1!==g;return useKeyBindings(),useDefaultKeybindings(),t(we,Object.assign({id:_,"data-testid":"vertex-viewer",src:l,ref:e=>{null==f||f(e),w(e)},className:Kt("flex w-full h-full",o,{"cursor-crosshair":M.hitPending}),style:{"--viewer-background":K},config:b,cameraType:O?E:void 0,onCameraTypeChanged:e=>{O&&C.updateCameraType(e.detail,!1)},phantom:j,featureLines:H,selectionHighlighting:X,crossSectioning:G,featureMaps:Z?"final":void 0,onTap:e=>{const t=[...d?[]:[T.selectCurrentHit]];k.tap(e,...t),null==u||u(e)},onLongpress:e=>{k.longPress(e),null==m||m(e)},onFrameDrawn:e=>{P.frameDrawn(e),null==p||p(e)},onSceneReady:async e=>{var t;if(!O){V(!0);const n=await(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.scene());N(null==n?void 0:n.sceneViewId)}null==h||h(e)}},v,{children:[I&&e(VertexBoxSelectionTool,{}),J?g:t(n,{children:[e(VertexViewerViewCube,{}),e(VertexToolbar,{}),e(VertexViewerContextMenu,{})]})]}))};function toSdkConfig(e){return isOnlyNetworkConfig(e)?{network:e}:e}function isOnlyNetworkConfig(e){const t=undefined;return null!=e.renderingHost}const VertexViewerToolkitEventListener=({onHitStateChange:t,onSelectionStateChange:a})=>{const i=r(pa),l=r(La);return A.useEffect((()=>{null==t||t(i)}),[i,t]),A.useEffect((()=>{null==a||a(l)}),[l,a]),e(n,{})},VertexViewerToolkitRoot=a=>{var{override:i,autoDefineCustomElements:l,children:o,config:r}=a,s=__rest(a,["override","autoDefineCustomElements","children","config"]);return A.useEffect((()=>{(null==l||l)&&(xe(),Se())}),[l]),e(f,{override:i,children:t(n,{children:[e(VertexViewerToolkitEventListener,Object.assign({},s)),e(VertexViewerToolkitRootConfig,{config:r,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const i=c(Ai);return A.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;i(e)}),[t,i]),e(n,{children:a})};var ol=Object.freeze({__proto__:null,get AssemblyFontFace(){return qi},Columns:Di,Core:_a,Metadata:Zi,Search:$i});export{ai as Appearance,rn as BoxSelection,Ti as Config,an as ContextMenu,Ut as CrossSection,ki as Ghosting,ha as Hits,oi as Keybinding,xn as Measurement,Ze as Messages,yi as Metadata,el as ModelViews,di as Panel,Tn as Performance,ol as SceneTree,Wn as SceneViewItem,Ra as Selection,$n as Settings,ma as Transforms,VertexApplicationMessages,VertexBoxSelectionButton,VertexContextMenu,VertexCrossSectionAppearanceColorPicker,VertexCrossSectionAppearanceControls,VertexCrossSectionAppearanceLineThicknessSlider,VertexCrossSectionAppearancePanelSection,VertexCrossSectionAppearanceReset,VertexDecimalPlaceSelector,VertexFeatureEdgesColorPicker,VertexFeatureEdgesControls,VertexFeatureEdgesPanelSection,VertexFeatureEdgesReset,VertexFeatureEdgesThicknessSlider,VertexFitAllButton,VertexFitSelectedMenuItem,VertexFlyToMenuItem,VertexGhostingControls,VertexGhostingPanelSection,VertexHideAllMenuItem,VertexHidePartMenuItem,VertexHideSelectedMenuItem,VertexLengthUnitSelector,VertexMaterialControls,VertexMaterialPanelSection,VertexMeasurementContextMenu,VertexMeasurementDetails,VertexModelViewsPanel,VertexPanButton,VertexPointToPointMeasurement,VertexPointToPointMeasurementTool,VertexPreciseMeasurement,VertexPreciseMeasurementTool,VertexResizableContent,VertexRotateButton,VertexSceneItemGhostingClear,VertexSceneItemGhostingOpacitySlider,VertexSceneItemGhostingToggle,VertexSceneItemMaterialClear,VertexSceneItemMaterialColorPicker,VertexSceneItemMaterialColorSwatches,VertexSceneItemMaterialOpacitySlider,VertexSceneTree,VertexSceneTreeColumnPopover,VertexSceneTreeContextMenu,VertexSceneTreeCustomColumn,VertexSceneTreeHeader,VertexSceneTreeMetadataColumns,VertexSceneTreeSearchBar,VertexSceneTreeSearchInformationForToolbar,VertexSceneTreeSearchOptionsPopover,VertexSceneTreeTableLayout,VertexSelectionHighlightingColorPicker,VertexSelectionHighlightingControls,VertexSelectionHighlightingLineThicknessSlider,VertexSelectionHighlightingOpacitySlider,VertexSelectionHighlightingPanelSection,VertexSelectionHighlightingReset,VertexShowAllMenuItem,VertexShowOnlyMenuItem,VertexShowOnlySelectedMenuItem,VertexShowPropertiesMenuItem,VertexToolbar,VertexToolbarDivider,VertexTransformClear,VertexTransformControls,VertexTransformInputs,VertexTransformManipulatorToggle,VertexTransformPanelSection,VertexTransformWidget,VertexUnitsControls,VertexUnitsPanelSection,VertexViewer,VertexViewerBackgroundColorPicker,VertexViewerBackgroundControls,VertexViewerBackgroundPanelSection,VertexViewerBackgroundReset,VertexViewerContextMenu,VertexViewerCrossSectionButton,VertexViewerRightOpenedPanel,VertexViewerRightSidebar,VertexViewerSceneReset,VertexViewerToolkitRoot,VertexViewerViewCube,VertexZoomButton,st as Viewer};
18
+ */Gt=Wt,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}Gt.exports?(classNames.default=classNames,Gt.exports=classNames):window.classNames=classNames}();var Kt=Wt.exports;const VertexSlider=n=>{var{value:a,defaultValue:i,leftLabel:l,rightLabel:o,onChange:r,onValueChange:s,onValueInput:c}=n,d=__rest(n,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[u,m]=A.useState(i);return t("div",{className:"flex w-full items-center gap-2",children:[l&&e("div",{className:"pl-0.5 text-xs text-center",children:l}),e(O,Object.assign({className:Kt("w-full",{"mt-0.5":null!=l||null!=o}),value:null!=a?a:u,onValueChange:e=>{m(e.detail.value),null==r||r(e.detail.value),null==s||s(e)},onValueInput:e=>{m(e.detail.value),null==r||r(e.detail.value),null==c||c(e)}},d)),o&&e("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:o})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=s(yt);return e(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:async e=>{i(e.detail.value),await n.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexEndCapColorOptions=({onUpdateColorType:n})=>{const[a,i]=s(Ct);return e("div",{className:"pl-2 text-sm text-neutral-700",children:t(V,{value:a,"data-testid":"end-capping-color-type-radio-group",name:"end-capping-color-type",onValueChanged:e=>{i(e.detail.toUpperCase()===ut.PART?ut.PART:ut.SINGLE),null==n||n(e.detail)},children:[e(_,{"data-testid":"end-capping-color-part-color",label:"Part Color",value:ut.PART}),e(_,{"data-testid":"end-capping-color-single-color",label:"Single Color",value:ut.SINGLE})]})})},VertexEndCapColorPicker=({onUpdateCustomColor:t})=>{const[n,a]=s(St);return e(VertexColorPicker,{"data-testid":"end-capping-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexEndCapToggle=({onEnabledChange:t})=>{const[n,a]=s(wt);return e(L,{className:"flex items-center","data-testid":"end-item-enabled-toggle",variant:"switch",checked:n,onValueChanged:async e=>{a(e.detail),null==t||t(e.detail)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i,showEndCapSettings:l,onEndCapEnabledChange:o,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:c}){const d=r(Ct);return t(n,{children:[l&&t("div",{className:"flex items-center pt-2 pb-2",children:[e(VertexEndCapToggle,{onEnabledChange:o}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Show End Cap"})]}),e("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Line Color"}),e(VertexCrossSectionAppearanceColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:i}),l&&t("div",{children:[e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Cap Color"}),e(VertexEndCapColorOptions,{onUpdateColorType:s}),d===ut.SINGLE&&e("div",{className:"mt-2",children:e(VertexEndCapColorPicker,{onUpdateCustomColor:c})})]})]})}function PanelSection({header:n,children:a}){return t("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e("div",{className:"my-2 text-base text-neutral-700",children:n}),a]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const n=useCrossSectioningActions(),[a,i]=s(gt),[l,o]=s(yt),c=r(bt),[d,u]=s(wt),[m,p]=s(Ct),[h,f]=s(St),v=a!==mt||1!==l||d!==c||m!==ut.PART||h!==ht;return e("div",{className:"ml-auto",children:e(R,{content:"Reset Cross Sectioning Appearance",children:e(j,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(mt),o(1),u(c),p(ut.PART),f(ht),null==t||t(),await n.reapply()},disabled:!v})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:n,onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i,onEndCapEnabledChange:l,onUpdateEndCapColorType:o,onUpdateEndCapCustomColor:r}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Cross Sectioning",e(VertexCrossSectionAppearanceReset,{onReset:n})]}),children:e(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i,onEndCapEnabledChange:l,onUpdateEndCapColorType:o,onUpdateEndCapCustomColor:r})})}const $t=.5,qt="#444444",Yt=l({key:"featureEdgesSelectedColor",default:qt}),Xt=l({key:"featureEdgesLineThickness",default:$t}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[n,a]=s(Yt);return e(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[n,a]=s(Xt);return e(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexFeatureEdgesColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexFeatureEdgesThicknessSlider,{onUpdate:i})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[n,a]=s(Yt),[i,l]=s(Xt),o=undefined;return e("div",{className:"ml-auto",children:e(R,{content:"Reset Feature Edges",children:e(j,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(qt),l($t),null==t||t()},disabled:!(i!==$t||n!==qt)})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:n,onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Feature Edges",e(VertexFeatureEdgesReset,{onReset:n})]}),children:e(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i})})}function contextMenuItemIsRow(e){var t;return null!=e&&null!=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.id)}function contextMenuItemIsElement(e){return null!=e&&e instanceof HTMLElement}const Zt=l({key:"contextMenuActive",default:void 0}),Jt=l({key:"contextMenuPosition",default:void 0}),Qt=l({key:"contextMenuTarget",default:void 0}),en=l({key:"contextMenuItem",default:void 0}),tn=l({key:"contextMenuActions",default:[]}),nn=o({key:"contextMenuActivePosition",get:({get:e})=>null!=e(Zt)?e(Jt):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,a=null==t?void 0:t.clientY;e(Jt,w.create(n,a)),e(Qt,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,i,l)=>{const o=await e.getPromise(Jt),r=await e.getPromise(Zt);if(null!=o&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,s=w.create(e,r),c=null!=o?w.distance(o,s):0,d=null==i||i(n);c<2&&d&&(null==l||l(n,null!=o?o:s),t(Zt,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,i)=>{if(null==a||a(t)){const a=w.create(t.touches[0].clientX,t.touches[0].clientY);e(Jt,a),e(Qt,t.target),e(Zt,n),null==i||i(t,a)}})),setContextMenuItem:useActionCallback((({snapshot:e,set:t,reset:n})=>async a=>{const i=await e.getPromise(tn);t(en,a),i.forEach((e=>e(a))),n(tn)})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Ht,!!n),e(Zt),e(tn),e(Jt)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Ht)))}}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 an=Object.freeze({__proto__:null,contextMenuActions:tn,contextMenuActive:Zt,contextMenuActivePosition:nn,contextMenuItem:en,contextMenuItemIsElement:contextMenuItemIsElement,contextMenuItemIsRow:contextMenuItemIsRow,contextMenuPosition:Jt,contextMenuTarget:Qt,targetShouldSkipNextHit:targetShouldSkipNextHit,targetWithinMenu:targetWithinMenu,useContextMenuActions:useContextMenuActions});const ln=l({key:"boxSelectionEnabled",default:!1}),on=l({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(ln,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(ln),e(on)})),setOperationType:useActionCallback((({set:e})=>t=>{e(on,t)}))});var rn=Object.freeze({__proto__:null,boxSelectionEnabled:ln,boxSelectionOperationType:on,useBoxSelectionActions:useBoxSelectionActions});async function whenComponentReady(e,t,n=customElements,a=requestAnimationFrame,i=setTimeout){return null!=e&&null!=e.nodeName&&await n.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):(await new Promise((e=>"function"==typeof a?a(e):i(e))),t())}const sn=l({key:"isEditingPointToPointMeasurement",default:!1}),cn=l({key:"pointToPointMeasurementOutcome",default:void 0}),dn=l({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=c(cn);T((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const un=2,mn=l({key:"isEditingPreciseMeasurement",default:!1}),pn=l({key:"preciseMeasurementOutcome",default:void 0}),hn=l({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),fn=l({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),vn=l({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),gn=o({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(vn).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,n){const a=c(vn),i=c(pn),l=c(hn),o=c(fn),s=r(hn);T((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{a(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,a]),T((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{i(e),null==n||n(e)}))})),()=>null==t?void 0:t.dispose()}),[e,i]),T((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==s||s.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,s]),T((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),T((()=>{whenComponentReady(e,(()=>{o(null==e?void 0:e.measurementOverlays)}))}),[e,o])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),i=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(hn);null==t||t.clearEntities()})),l=useActionCallback((()=>async(e={})=>{await i(),n(e),a()})),o=useActionCallback((({set:e,reset:n})=>async a=>{await l(),"point-to-point"===a?t():(n(pn),n(vn),e(mn,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await l(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await o(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(mn),a=await e.getPromise(sn);n?await i():a&&(t(cn),t(dn))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(dn)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(dn,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(sn)?await l():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(mn)?await l():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(sn,!0),n.keepExistingMeasurement||e(cn)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(sn),t.keepExistingMeasurement||(e(dn),e(cn))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(mn),e(pn),e(vn)}))}const yn=o({key:"isEditingMeasurement",get:({get:e})=>e(sn)||e(mn)}),bn=o({key:"measurementPanelModel",get:({get:e})=>e(cn)||e(pn)}),wn=o({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(fn)}),Cn=o({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(mn)?e(gn):void 0}}),Sn=o({key:"measurementPanelIsResettable",get:({get:e})=>e(yn)&&null!=e(bn)});var xn=Object.freeze({__proto__:null,editedPointToPointMeasurement:dn,isEditingMeasurement:yn,isEditingPointToPointMeasurement:sn,isEditingPreciseMeasurement:mn,measurementPanelIsResettable:Sn,measurementPanelMessage:Cn,measurementPanelOutcome:bn,measurementPanelOverlays:wn,pointToPointMeasurementOutcome:cn,preciseMeasurementController:hn,preciseMeasurementEntities:vn,preciseMeasurementMessage:gn,preciseMeasurementOutcome:pn,preciseMeasurementOverlays:fn,useDisablePointToPointMeasurement:useDisablePointToPointMeasurement,useDisablePreciseMeasurement:useDisablePreciseMeasurement,useEnablePointToPointMeasurement:useEnablePointToPointMeasurement,useMeasurementActions:useMeasurementActions,usePointToPointMeasurement:usePointToPointMeasurement,usePreciseMeasurementModel:usePreciseMeasurementModel});const kn="Scene Alteration Performance";var An;!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"}(An||(An={}));var Tn=Object.freeze({__proto__:null,SCENE_ALTERATION_PERFORMANCE:kn,get SceneAlterationPerformanceType(){return An}});const Pn=l({key:"fetchedItemInvalidator",default:0}),Mn=d({key:"fetchedItems",get:e=>async({get:t})=>{var n;const a=t(et),i=t(lt);if(t(Pn),t(da),null!=i)try{return await(null===(n=null==a?void 0:a.sceneItems)||void 0===n?void 0:n.getSceneViewItem(e,i,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}}),En=u({key:"selectionSelectedItems",default:void 0}),In=l({key:"selectionSelectedItemIds",default:[]}),Nn=l({key:"selectionLastSelected",default:void 0}),On=l({key:"selectionLastSelectionFromViewer",default:!1}),Vn=l({key:"selectionLastSelectWasMultiSelect",default:!1}),_n=o({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(Nn),n=undefined;return e(In).filter((e=>{var n;return e!==(null==t?void 0:t.id)&&!(null===(n=null==t?void 0:t.ancestors)||void 0===n?void 0:n.includes(e))})).length>0}}),Ln=l({key:"selectionFirstSelectedItemInTreeId",default:void 0}),Rn=o({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(Nn),i=e(In);return null!==(n=null===(t=null==a?void 0:a.ancestors)||void 0===t?void 0:t.find((e=>i.includes(e))))&&void 0!==n?n:null==a?void 0:a.id}}),jn=l({key:"selectionPreviousVisibleSummary",default:void 0}),Dn=l({key:"selectionVisibleSummary",default:void 0}),zn=o({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(Dn))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),Bn=o({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(Dn);return null!=(null==t?void 0:t.boundingBox)?v.center(t.boundingBox):g.origin()}}),Hn=o({key:"selectionIsActive",get:({get:e})=>{const t=e(In),n=undefined;return e(zn)>0||t.length>0}}),Fn=o({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(In),n=undefined;return null!=e(lt)?t.map((t=>e(Mn(t)))):[]}}),Un=l({key:"selectionModelViewsSelected",default:void 0});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(Pn,(e=>e+1))}))}}var Wn=Object.freeze({__proto__:null,fetchedItem:Mn,fetchedItemInvalidator:Pn,useSceneViewItemActions:useSceneViewItemActions});const Gn=l({key:"lengthUnit",default:"cm"}),Kn=l({key:"decimalPlace",default:"2"});var $n=Object.freeze({__proto__:null,decimalPlace:Kn,lengthUnit:Gn}),qn,Yn;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(qn||(qn={})),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"}(Yn||(Yn={}));const convertFrom=(e,t)=>{const n=undefined;return e/Yn[t]},convertTo=(e,t)=>{const n=undefined;return e*Yn[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:te(e,t)}:{world:e,local:ne(e,t)}}function convertTransformToUnits(e,t){const{position:n,rotation:a,scale:i}=e;return{position:g.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:a,scale:i}}function convertTransformFromUnits(e,t){const{position:n,rotation:a,scale:i}=e;return{position:g.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:a,scale:i}}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 Xn={position:g.create(0,0,0),rotation:g.create(0,0,0),scale:1},Zn=l({key:"transformWidgetEnabled",default:!1}),Jn=l({key:"transformWidgetPosition",default:void 0}),Qn=l({key:"transformWidgetOrientationOverride",default:void 0}),ea=o({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Qn),n=e(Nn);if(null!=t)return t;if(null!=n){const t=e(ca(n.id));return C.fromDegrees({x:null==t?void 0:t.world.rotation.x,y:null==t?void 0:t.world.rotation.y,z:null==t?void 0:t.world.rotation.z})}}}),ta=l({key:"transformWidgetCachedOrientation",default:void 0}),na=l({key:"transformWidgetSyncToSelection",default:!1}),aa=l({key:"transformWidgetIsInteracting",default:!1}),ia=u({key:"appliedItemTransform",default:void 0}),la=l({key:"appliedItemTransformIds",default:[]}),oa=l({key:"selectedCoordinateSpace",default:"world"}),ra=u({key:"editedItemTransform",default:void 0}),sa=d({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(oa),a=t(Gn),i=t(ca(e)),l=t(ra(e));if(null!=l)return l.transform;if(null!=i)return pickLocalOrWorldTransform(mapItemTransforms(i,(e=>convertTransformToUnits(e,a))),n)}},set:e=>({get:t,set:n},a)=>{if(null!=e){const i=t(oa),l=t(ua(e)),o=t(ca(e)),r=t(Gn);if(null!=o&&!(a instanceof m)&&null!=a&&null!=l){n(ra(e),{coordinateSpace:i,units:r,transform:a});const o=makeItemTransforms(convertTransformFromUnits(toValidTransform(a),r),l,i),s=t(la);n(ia(e),o),n(la,[...s,e])}}}}),ca=d({key:"fetchedItemTransforms",get:e=>({get:t})=>{var n,a;const i=t(Mn(e));if(null!=i){const e=(null===(n=i.override)||void 0===n?void 0:n.transform)?toTransformFromApiMatrix(null===(a=i.override)||void 0===a?void 0:a.transform):void 0,t=i.worldTransform?toTransformFromApiMatrix(i.worldTransform):void 0;return{local:null!=e?e:Xn,world:null!=t?t:Xn}}}}),da=l({key:"transformInvalidator",default:0}),ua=d({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(lt);if(null!=e&&null!=n){const n=t(Mn(e));if(null!=(null==n?void 0:n.parentId)){const e=t(ca(n.parentId)),a=t(ia(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return ae(ie(null!=a?a.world:e.world))}}return logger_debug(`Unable to find the world matrix for the parent of ${e}. Returning the identity matrix.`),S.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=r(Gn),n=r(oa),a=r(ia(null!=e?e:"")),[i,l]=s(ra(null!=e?e:""));T((()=>{if(null!=a&&((null==i?void 0:i.coordinateSpace)!==n||(null==i?void 0:i.units)!==t)){const e=undefined,i=convertTransformToUnits(pickLocalOrWorldTransform(a,n),t);l({units:t,coordinateSpace:n,transform:i})}}),[t,n])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const n=p(ua(e)),[a,i]=h(sa(e));return{transform:"hasValue"===a.state?a.contents:void 0,loading:"loading"===a.state||"loading"===n.state,error:"hasError"===a.state?a.contents:void 0,async update(n){t.enableSelectionSync(),i(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(Bn);e(Jn,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Jn),i=await t.getPromise(Vn),l=await t.getPromise(In),o=await t.getPromise(zn);null==a&&(l.length>0||i||o>0)&&await n(),e(na,!0)})),i=useActionCallback((({set:e})=>async t=>{e(Jn,null!=t?t:void 0)})),l=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(ea),i=undefined;(await e.getPromise(la)).forEach((e=>{n(ia(e)),n(ra(e))})),n(la),null!=a&&t(ta,a),t(da,(e=>e+1))}))),o=useActionCallback((({set:e,reset:t})=>n=>{t(ta),e(Qn,n)})),r=useActionCallback((({set:e})=>()=>{e(Jn,void 0),e(Zn,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(l,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Ke}),t(Zn,!0),o?await n():null==l?await a():await i(l)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Zn),e(Qn)})),setTransformWidgetOrientation:o,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(ta),e(Qn)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Jn))),invalidateTransforms:l,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(aa,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(na,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(na))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(jn),n=await e.getPromise(Dn),a=undefined;if(await e.getPromise(na)){const e=null==n?void 0:n.boundingBox,a=null!=e&&null!=(null==t?void 0:t.boundingBox)&&equals(e,t.boundingBox);null==e||a||await i(v.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(na),null==(null==t?void 0:t.annotationId)&&(null!=t?await i(null==t?void 0:t.position):(e(Jn),o(void 0)))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(An.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await l(),r()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(An.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await l(),r()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(et),a=await(null==n?void 0:n.scene()),i=await e.getPromise(ia(t));if(null==i)return void logger_warn(`There is no transform to apply to item ${t}.`);const l=S.transpose(ae(ie(null==i?void 0:i.local)));return null==a?void 0:a.items((e=>e.where((e=>e.withItemId(t))).transform(l))).execute()}))}};var ma=Object.freeze({__proto__:null,appliedItemTransformIds:la,appliedItemTransforms:ia,convertTransformFromUnits:convertTransformFromUnits,convertTransformToUnits:convertTransformToUnits,displayedItemTransform:sa,editedItemTransform:ra,fetchedItemTransforms:ca,identityTransform:Xn,makeItemTransforms:makeItemTransforms,mapItemTransforms:mapItemTransforms,parentItemWorldMatrix:ua,pickLocalOrWorldTransform:pickLocalOrWorldTransform,selectedCoordinateSpace:oa,toValidTransform:toValidTransform,transformInvalidator:da,transformWidgetCachedOrientation:ta,transformWidgetEnabled:Zn,transformWidgetIsInteracting:aa,transformWidgetOrientation:ea,transformWidgetOrientationOverride:Qn,transformWidgetPosition:Jn,transformWidgetSyncToSelection:na,useEditItemTransform:useEditItemTransform,useTransformActions:useTransformActions});const useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Bt).then((e=>e.value)),a=await e.getPromise(dn);null==n&&null!=(null==a?void 0:a.start)&&null!=a.end&&await t.resetMeasurement()}))),i=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Bt).then((e=>e.value));await n.orientToHitResult(t)}))),l=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Bt).then((e=>e.value));e(en,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(zt,await e.tryGetPromise(Bt).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:r},...s)=>{const c=await t.getPromise(yn),d=await t.getPromise(kt),u=2!==(null==r?void 0:r.buttons)&&!(null==r?void 0:r.altKey);r.altKey||r.ctrlKey||r.metaKey||r.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(Bt).then((e=>e.value));n(Dt,p),n(Rt,r),await a(),m&&(s.forEach((e=>e())),await i()),await l(),await e.sectionCurrentHit(),await o()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Rt),t(jt,a.detail),await e.tryGetPromise(Bt),await l(),await o()})))}},pa=o({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined,l=undefined;return{tapDetails:e(Rt),longPressDetails:e(jt),previousHitResult:e(Dt),currentHitResult:e(zt)}}});var ha=Object.freeze({__proto__:null,currentHitResult:zt,hitResult:Bt,hitResultsLongPressDetails:jt,hitResultsSkipNextTap:Ht,hitResultsTapDetails:Rt,hitState:pa,previousHitResult:Dt,useHitActions:useHitActions});const fa=u({key:"modelViewsCursor",default:void 0}),va=u({key:"pmiAnnotationsCursor",default:void 0}),ga=u({key:"loadedModelViews",default:[]}),ya=u({key:"loadedPmiAnnotations",default:[]}),ba=u({key:"visiblePmiAnnotations",default:[]}),wa=o({key:"modelViewsSceneItemName",get:async({get:e})=>{var t;const n=e(Un);if(null!=n){const a=e(Mn(n.id));return null!==(t=null==a?void 0:a.name)&&void 0!==t?t:void 0}}}),Ca=l({key:"loadedItemModelView",default:void 0}),Sa=d({key:"nextModelViews",get:e=>async({get:t})=>{var n;const a=t(et),i=t(fa(e));return await(null===(n=null==a?void 0:a.modelViews)||void 0===n?void 0:n.listByItem(e,{cursor:i,size:100,hasAnnotations:!0}))}}),xa=d({key:"modelViews",get:e=>({get:t})=>{var n;const a=t(ga(e)),i=t(Sa(e));return a.flatMap((e=>e.modelViews)).concat(null!==(n=null==i?void 0:i.modelViews)&&void 0!==n?n:[])}}),ka=d({key:"hasMoreModelViews",get:e=>({get:t})=>{const n=t(Sa(e));return null!=(null==n?void 0:n.paging.next)}}),Aa=d({key:"nextPmiAnnotations",get:e=>async({get:t})=>{var n;const a=t(et),i=t(va(e));return null===(n=null==a?void 0:a.pmi)||void 0===n?void 0:n.listAnnotations({modelViewId:e,cursor:i,size:100})}}),Ta=d({key:"pmiAnnotations",get:e=>({get:t})=>{const n=undefined;return t(ya(e)).flatMap((e=>e.annotations))}}),Pa=d({key:"hasMorePmiAnnotations",get:e=>({get:t})=>{const n=undefined;return null!=t(va(e))}}),Ma=l({key:"selectedPmiAnnotationId",default:void 0});function useSceneAnnotationsOperations(){const e=A.useCallback((async(e,t,n)=>{const a=await(null==t?void 0:t.scene());null==n?await(null==a?void 0:a.elements((t=>e(t.annotations.where((e=>e.all()))))).execute()):n.length>0&&await(null==a?void 0:a.elements((t=>e(t.annotations.where((e=>e.withAnnotationIds(n)))))).execute())}),[]),t=A.useCallback((async(e,t)=>{const n=await(null==e?void 0:e.scene());null==n||n.elements((e=>[e.annotations.where((e=>e.all())).deselect(),e.annotations.where((e=>e.withAnnotationIds([t]))).select()])).execute()}),[]),n=A.useCallback((async e=>{const t=await(null==e?void 0:e.scene());null==t||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=>{var a;const i=await e.getPromise(Aa(n));if(null!=i){t(ya(n),(e=>[...e,i])),t(ba(n),(e=>[...e,...i.annotations]));const e=null===(a=null==i?void 0:i.paging)||void 0===a?void 0:a.next;t(va(n),null!=e?()=>e:()=>{})}}));return{fetchInitialPmiAnnotations:useActionCallback((({snapshot:e})=>async n=>{const a=undefined;0===(await e.getPromise(Ta(n))).length&&await t(n)})),fetchNextPmiAnnotations:useActionCallback((()=>async e=>{await t(e)})),selectPmiAnnotation:useActionCallback((({set:t,snapshot:n})=>async a=>{t(Ma,a);const i=await n.getPromise(et);null!=i&&await(null==e?void 0:e.selectOnlyAnnotation(i,a))})),clearPmiAnnotationSelection:useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=await n.getPromise(Ma),i=await n.getPromise(et);null!=a&&null!=i&&(t(Ma),await(null==e?void 0:e.clearAnnotationSelection(i)))}))}}const Ea=l({key:"sceneTreeLoaderVisible",default:!1}),Ia=l({key:"sceneTreeElement",default:void 0}),Na=l({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0}),Oa=l({key:"sceneTreeOpenPopover",default:void 0}),Va=d({key:"sceneTreePopoverIsOpen",get:e=>({get:t})=>t(Oa)===e});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,i)=>{var l,o;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await i.deselectItem(a):a.selected?await i.selectItem(a,{recurseParent:!0}):a.selected||await i.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const i=await t.getPromise(Nn);e.syncSelection({id:null===(l=a.id)||void 0===l?void 0:l.hex,ancestors:null!==(o=null==i?void 0:i.ancestors)&&void 0!==o?o:[]},{selected:!n.metaKey&&!n.ctrlKey||!a.selected,multiSelect:n.shiftKey||n.metaKey||n.ctrlKey})}})),toggleExpansion:useActionCallback((()=>(e,t,n)=>{n.toggleExpandItem(t)})),toggleVisibility:useActionCallback((()=>(e,t,n)=>{n.toggleItemVisibility(t)})),flyToRow:useActionCallback((({snapshot:e})=>async n=>{var a;const i=await e.getPromise(Ia),l=await(null==i?void 0:i.getRowAtClientY(n));null!=(null===(a=null==l?void 0:l.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(l.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ia),n=await e.getPromise(Ln);null!=n&&(null==t||t.scrollToItem(n))})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Ia),i=await(null==a?void 0:a.getRowAtClientY(n));e(en,i)})),openSceneTreePopover:useActionCallback((({set:e})=>t=>{e(Oa,t)})),closeSceneTreePopover:useActionCallback((({set:e})=>()=>{e(Oa,void 0)}))}}var _a=Object.freeze({__proto__:null,sceneTreeController:Na,sceneTreeElement:Ia,sceneTreeLoaderVisible:Ea,sceneTreeOpenPopover:Oa,sceneTreePopoverIsOpen:Va,useSceneTreeActions:useSceneTreeActions});function useSelectionActions(){const e=usePmiAnnotationActions(),t=useSceneViewItemActions(),n=useTransformActions(),a=useViewerSceneActions(),i=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(In)).forEach((e=>t(En(e))))})),l=useActionCallback((({snapshot:e,reset:t,set:n})=>async(i,l)=>{var o,r;const s=await e.getPromise(En(i.id)),c=await e.getPromise(In),d=null===(r=[...null!==(o=i.ancestors)&&void 0!==o?o:[]])||void 0===r?void 0:r.reverse().find((e=>!c.includes(e)));null!=s&&null!=d?(n(En(d),{id:d}),n(In,(e=>[...e,d])),await a.execute(An.SELECTING_ANCESTOR,a.selectItemsTransform(d))):(null==l?void 0:l.clear)?(n(En(i.id),i),n(In,[i.id]),await a.execute(An.SELECTING_ONLY_ITEM,a.clearSelectionTransform,a.selectItemsTransform(i.id))):(n(En(i.id),i),n(In,(e=>[...e,i.id])),await a.execute(An.SELECTING_ITEMS,a.selectItemsTransform(i.id))),m(i),n(Nn,i),n(On,!0),t(Vn);try{const t=await e.getPromise(Ia);await(null==t?void 0:t.scrollToItem(i.id))}catch(e){logger_debug(`The scene item was not found in the tree. [itemId={${i.id}}]`)}})),o=useActionCallback((({reset:e,set:t})=>async n=>{e(En(n)),e(Vn),t(In,(e=>e.filter((e=>e!==n)))),await a.execute(An.DESELECTING_ITEMS,a.deselectItemsTransform(n))})),r=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(En(t.id));null!=n?await o(n.id):await l(t)})),s=useActionCallback((({snapshot:a,reset:i,set:o})=>async(r,s={})=>{const c=await a.getPromise(En(r.id)),d=await a.getPromise(In);if(d.filter((e=>{var t;return e!==r.id&&!(null===(t=r.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>i(En(e)))),i(Vn),c)if(s.ignoreAncestorSelection)i(In),i(En(c.id));else{const e=d.filter((e=>{var t;return e===r.id||(null===(t=r.ancestors)||void 0===t?void 0:t.includes(e))}));o(In,e)}else i(In);t.invalidateCachedItems(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection(),await l(r,{clear:!0})})),c=useActionCallback((({reset:t})=>async()=>{await i(),t(In),t(Nn),t(On),t(Vn),n.clearTransformWidgetPosition(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection()})),d=useActionCallback((()=>async()=>{await c(),await a.execute(An.CLEAR_SELECTION,a.clearSelectionTransform)})),u=useActionCallback((({set:e})=>async t=>{e(Vn,t)})),m=useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Un);(null==a?void 0:a.id)!==(null==n?void 0:n.id)&&e(Un,n)}));return{select:l,toggleSelection:r,clearAndSelect:s,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:t})=>async()=>{const n=await t.tryGetPromise(Bt).then((e=>e.value)),a=await t.getPromise(Rt),i=(null==a?void 0:a.metaKey)||(null==a?void 0:a.ctrlKey)||(null==a?void 0:a.shiftKey);null!=(null==n?void 0:n.annotationId)?await e.selectPmiAnnotation(n.annotationId):null==n||i?null!=n&&i?await r(n):await d():await s(n)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(n,a)=>{a.selected?(await i(),e(En(n.id),n),a.multiSelect?e(In,(e=>[...e.filter((e=>e!==n.id)),n.id])):e(In,[n.id]),await m(n),e(Nn,n),e(On,!1),e(Vn,!!a.multiSelect)):(t(En(n.id)),t(Vn),e(In,(e=>e.filter((e=>e!==n.id)))))})),deselect:o,clearSelection:d,resetSelectionState:c,toggleLastSelectWasMultiSelect:u,selectForModelViewsPanel:m}}const La=o({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined;return{selectedItemIds:e(In),lastSelected:e(Nn),highestSelectedAncestorId:e(Rn)}}});var Ra=Object.freeze({__proto__:null,fetchedAndSelectedItems:Fn,selectionBoundingBoxCenter:Bn,selectionFirstSelectedItemInTreeId:Ln,selectionHasMultipleSelected:_n,selectionHighestSelectedAncestor:Rn,selectionIsActive:Hn,selectionLastSelectWasMultiSelect:Vn,selectionLastSelected:Nn,selectionLastSelectionFromViewer:On,selectionModelViewsSelected:Un,selectionPreviousVisibleSummary:jn,selectionSelectedItemIds:In,selectionSelectedItems:En,selectionState:La,selectionVisibleCount:zn,selectionVisibleSummary:Dn,useSelectionActions:useSelectionActions});function createColorMaterialWithId(e,t=Le.create()){return Object.assign({id:t},le.fromHex(e))}const ja=255,Da=18,za=l({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),Ba=l({key:"sceneItemAdjustmentsRecentColors",default:[]}),Ha=l({key:"sceneItemAdjustmentsCustomColors",default:[createColorMaterialWithId("#ffffff"),createColorMaterialWithId("#616161")]}),Fa=l({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),Ua=u({key:"appliedItemMaterialOverride",default:void 0}),Wa=l({key:"appliedItemMaterialOverrideIds",default:[]}),Ga=o({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Nn);if(null!=t)return e(Ua(t.id))}}),Ka=l({key:"applyMaterialToAllUserAction",default:void 0}),$a=l({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),qa=l({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Wa);t(za),n.forEach((e=>t(Ua(e)))),t(Wa)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(za,t)})),saveRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Ba),i=[n,...a.filter((e=>e!==n))],l=i.length>Da?i.slice(0,-(i.length-Da)):i;e(za,n),e(Ba,l)})),removeRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=(await t.getPromise(Ba)).filter((e=>e.id!==n));e(Ba,i)})),setCustomColors:useActionCallback((({set:e})=>async t=>{e(Ha,t)})),saveCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=[...await t.getPromise(Ha),n],l=i.length>Da?i.slice(i.length-Da):i;e(za,n),e(Ha,l)})),removeCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=(await t.getPromise(Ha)).filter((e=>e.id!==n));e(Ha,i)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(za)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(Fa)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(In);a(za),i.forEach((e=>a(Ua(e)))),n(Wa,(e=>e.filter((e=>!i.includes(e))))),await e.execute(An.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(An.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(Fa,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(za),i=await t.getPromise(Fa),l=await t.getPromise(In),o=await t.getPromise(Ga),r=null!=a?a:o,s=null!=i?i:null==o?void 0:o.opacity;if(null!=r){const t=Object.assign(Object.assign({},r),{opacity:null!=s?s:r.opacity});await e.execute(An.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),l.forEach((e=>n(Ua(e),t))),n(Wa,(e=>[...e,...l]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(qa,!0),e(Ka,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(qa),e(Ka)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(za),i=await t.getPromise(Fa);if(null!=a){const l=await t.getPromise(Wa),o=Object.assign(Object.assign({},a),{opacity:null!=i?i:a.opacity});await e.execute(An.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),l.forEach((e=>n(Ua(e))));const r=await t.getPromise(Ka);null==r||r(o),n(qa),n(Ka)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e($a,!1)}))}},Ya="#ffff00",Xa=35,Za=1,Ja=l({key:"selectionHighlightingSelectedColor",default:Ya}),Qa=l({key:"selectionHighlightingSelectedOpacity",default:Xa}),ei=l({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 ti="#FFFFFF",ni=l({key:"viewerBackgroundSelectedColor",default:ti});var ai=Object.freeze({__proto__:null,DEFAULT_FEATURE_EDGE_COLOR:qt,DEFAULT_FEATURE_EDGE_THICKNESS_VALUE:$t,DEFAULT_SELECTION_HIGHLIGHTING_COLOR:Ya,DEFAULT_SELECTION_HIGHLIGHTING_LINE_THICKNESS:1,DEFAULT_SELECTION_HIGHLIGHTING_OPACITY:Xa,DEFAULT_VIEWER_BACKGROUND_COLOR:ti,MAXIMUM_MATERIAL_OVERRIDE_OPACITY:ja,MAX_STORED_COLOR_ARRAY_LENGTH:Da,appliedItemMaterialOverride:Ua,appliedItemMaterialOverrideIds:Wa,applyMaterialToAllUserAction:Ka,confirmApplyMaterialToAllDialogOpen:qa,elementHasColorAttribute:elementHasColorAttribute,elementIsColorSwatch:elementIsColorSwatch,featureEdgesLineThickness:Xt,featureEdgesSelectedColor:Yt,sceneItemAdjustmentsCustomColors:Ha,sceneItemAdjustmentsLastSelectedOverride:Ga,sceneItemAdjustmentsRecentColors:Ba,sceneItemAdjustmentsSelectedColor:za,sceneItemAdjustmentsSelectedOpacity:Fa,selectionHighlightingSelectedColor:Ja,selectionHighlightingSelectedLineThickness:ei,selectionHighlightingSelectedOpacity:Qa,showConfirmDialogWhenApplyingMaterialToAll:$a,useSceneItemMaterialActions:useSceneItemMaterialActions,viewerBackgroundSelectedColor:ni});const VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const n=useSceneItemMaterialActions(),a=p(Ga),i=r(za),l=r($a),o=k.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(R,{content:"Apply to All",children:e(j,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==o,onClick:async()=>{l?n.confirmApplyAll(t):(await n.applyAll(),null==t||t(o))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const a=useSceneItemMaterialActions(),i=r(qa),[l,o]=A.useState(!1),onCloseDialog=()=>{a.cancelApplyAll(),o(!1)};return i?t(D,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e("div",{slot:"heading",children:"Apply to All Parts"}),e("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."}),t("div",{className:"flex mt-8 gap-2 items-center",children:[t("div",{className:"flex gap-2",children:[e(L,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:l,onValueChanged:e=>{o(e.detail)}}),"Don't show again this session"]}),t("div",{className:"flex ml-auto gap-2",children:[e(B,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e(B,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await a.applyAll(),l&&a.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e(n,{})}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=p(Ga),i=r(za),l=k.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=l?Pe.toHexString(l.diffuse):void 0,onValueChanged:async()=>{null!=l&&(await n.apply(),null==t||t(l),await n.saveRecentColor(createColorMaterialWithId(Pe.toHexString(l.diffuse))))},onInput:async e=>{n.updateColor(createColorMaterialWithId(e)),await n.apply()}})},ColorSwatch=t=>{var{color:n,hideTooltip:a,onClick:i}=t,l=__rest(t,["color","hideTooltip","onClick"]);const o="string"==typeof n?n:Pe.toHexString(n.diffuse);return e(R,{className:"flex-grow-0",content:o,disabled:!!a,children:e("button",{onClick:()=>null==i?void 0:i(n),children:e(H,Object.assign({"data-testid":`color-swatch-${o}`,variant:"square",color:o},l))})})},VertexSceneItemMaterialColorSwatches=({onAddCustomColor:a,onApplyCustomColor:i,onApplyRecentColor:l})=>{const o=useSceneItemMaterialActions(),s=r(Ha),c=r(Ba),d=s.length===Da;return t(n,{children:[t("div",{"data-testid":"appearance-custom-colors",className:"flex flex-wrap gap-2 mt-1 mb-4",children:[s.map((t=>e(ColorSwatch,{color:t,onClick:async()=>{o.updateColor(t),await o.apply(),null==i||i(t)},"data-custom-color":!0,"data-color-id":t.id},t.id))),!d&&e(N,{"data-testid":"appearance-custom-colors-add",variant:"swatch",size:"md",onValueChanged:async e=>{const t=createColorMaterialWithId(e.detail);await o.saveCustomColor(t),await o.apply(),null==a||a(t)},children:e("div",{slot:"overlay",className:"flex items-center justify-center w-full h-full",children:e(F,{className:"bg-white p-2",name:"plus",size:"sm"})})})]}),!!c.length&&e("div",{"data-testid":"appearance-recent-colors",className:"flex flex-wrap gap-2",children:c.map((t=>e(ColorSwatch,{color:t,onClick:async()=>{o.updateColor(t),await o.apply(),null==l||l(t)},"data-recent-color":!0,"data-color-id":t.id},t.id)))})]})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=r(Fa),i=p(Ga),l=k.useMemo((()=>{var e,t;return"hasValue"===i.state?null!==(t=null!=a?a:null===(e=i.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:ja:null!=a?a:ja}),[a,i]),o=useDebouncedCallback((()=>{n.apply()}),500),s=k.useCallback((e=>{n.updateOpacity(e.detail.value),o(e.detail.value)}),[o,n]),c=k.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e(R,{className:"flex w-full",content:c?"Select a part and apply a color to enable opacity":`${Math.floor(l/ja*100)}%`,placement:"top",children:e(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:c,value:null!=l?l:ja,step:5,min:0,max:ja,onValueChange:e=>{n.updateOpacity(e.detail.value),n.apply(),null==t||t(e.detail.value)},onValueInput:s})})};function VertexMaterialControls({customColors:a,onApplyMaterial:i,onApplyMaterialToAll:l,onAddCustomColor:o,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d}){const u=useSceneItemMaterialActions(),m=r(Nn);return A.useEffect((()=>{u.clearCurrentColor(),u.clearCurrentOpacity()}),[null==m?void 0:m.id]),A.useEffect((()=>{if(null!=a){const e=a.map((e=>Object.assign(Object.assign({},e),{id:Le.create()})));u.setCustomColors(e)}}),[a]),t(n,{children:[t("div",{className:"flex flex-col",children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),t("div",{className:"flex items-center gap-2",children:[e(VertexSceneItemMaterialColorPicker,{onApply:i}),e(VertexSceneItemMaterialApplyAll,{onApplyAll:l})]})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Color Swatches"}),e(VertexSceneItemMaterialColorSwatches,{onAddCustomColor:o,onApplyCustomColor:s,onApplyRecentColor:c}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSceneItemMaterialOpacitySlider,{onApply:d}),e(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:n,tooltip:a,children:i})=>{const[l,o]=A.useState(!1);return e("div",{className:"ml-auto",children:t(U,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${n}`,placement:"bottom-end",onMenuOpened:()=>o(!0),onMenuClosed:()=>o(!1),children:[e("div",{slot:"anchor",className:"flex items-center h-full",children:e(R,{content:a,disabled:l,placement:"bottom",children:t(B,{className:Kt("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":l}),"data-testid":`reset-button-${n}`,variant:"plaintext",children:[e(F,{className:"px-0.5",name:"reset",size:"sm"}),e(F,{name:"chevron-down",size:"sm"})]})})}),e("div",{className:"whitespace-nowrap",children:i})]})})},VertexSceneItemMaterialClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemMaterialActions(),l=r(Hn);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e("div",{className:"pt-1"}),e(W,{"data-testid":"clear-selected-materials",onClick:()=>{i.clear(),null==n||n()},disabled:!l,children:"Clear selected materials"}),e(W,{"data-testid":"clear-all-materials",onClick:()=>{i.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({customColors:n,onClearMaterial:a,onClearAllMaterials:i,onApplyMaterial:l,onApplyMaterialToAll:o,onAddCustomColor:r,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Material",e(VertexSceneItemMaterialClear,{onClear:a,onClearAll:i})]}),children:e(VertexMaterialControls,{customColors:n,onApplyMaterial:l,onApplyMaterialToAll:o,onAddCustomColor:r,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d})})}const VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[n,a]=s(Ja);return e(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[n,a]=s(ei);return e(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[n,a]=s(Qa);return e(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexSelectionHighlightingColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSelectionHighlightingOpacitySlider,{onUpdate:i}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:l})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[n,a]=s(Ja),[i,l]=s(Qa),[o,r]=s(ei),c=undefined;return e("div",{className:"ml-auto",children:e(R,{content:"Reset Selection Highlighting",children:e(j,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(Ya),l(Xa),r(1),null==t||t()},disabled:!(n!==Ya||i!==Xa||1!==o)})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:n,onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Selection Highlighting",e(VertexSelectionHighlightingReset,{onReset:n})]}),children:e(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[n,a]=s(ni);return e(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:a}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexViewerBackgroundColorPicker,{onUpdate:a})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[n,a]=s(ni),i=undefined;return e("div",{className:"ml-auto",children:e(R,{content:"Reset Background Color",children:e(j,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(ti),null==t||t()},disabled:!(n!==ti)})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:n,onUpdateViewerBackgroundColor:a}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Viewer Background",e(VertexViewerBackgroundReset,{onReset:n})]}),children:e(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:a})})}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,i=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,l=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,o=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,r=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||i||l||o||r},useRecoilReducer=({reducer:e,atom:t})=>{const n=undefined,a=undefined;return[r(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const n=i((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[]);return n},ii=l({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,i,l;switch(t.type){case"push-key-binding":const o=undefined;return null!=(null===(n=e.bindings[t.binding.keyBind])||void 0===n?void 0:n.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:[...null!==(a=e.bindings[t.binding.keyBind])&&void 0!==a?a:[],t.binding]})});case"remove-key-binding":const r=undefined;return null==(null===(i=e.bindings[t.binding.keyBind])||void 0===i?void 0:i.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(l=e.bindings[t.binding.keyBind])&&void 0!==l?l:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:ii}),useKeyBindingReadonlyState=()=>r(ii);function pressedValue(e,t){return e.includes("!")?!t[e.replace("!","")]&&!t[e.replace("!","").toLowerCase()]:t[e]||t[e.toLowerCase()]}function isPressed(e,t){const n=e.split("||");return n.length>1?n.some((e=>pressedValue(e,t))):pressedValue(n[0],t)}function allPressed(e,t){const n=undefined;return e.split("+").every((e=>isPressed(e,t)))}function matchingSingleFnBindings(e,t,n){return e.filter((e=>!e.repeat)).filter((e=>{var a;return null!=e.keyBind&&null!=n&&(null===(a=e.keyBind)||void 0===a?void 0:a.includes(n))&&allPressed(e.keyBind,t)})).map((e=>e.fn))}function matchingOffBindings(e,t,n){return e.filter((e=>e.off&&e.active&&null!=e.keyBind&&null==n&&!allPressed(e.keyBind,t))).map((e=>e.off))}const useApplyKeyBinding=e=>{const[t,n]=useKeyBindingState();A.useEffect((()=>{const a=Le.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:a,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:a})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();A.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),a=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),a&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,a]=useKeyBindingState(),i=A.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,Object.assign(Object.assign({},n.pressed),{[e]:!0})))).forEach((e=>{const t=n.bindings[e],i=t.length>0?t[t.length-1]:void 0;null!=i&&(i.fn(),a({type:"remove-key-binding",binding:i}))}))}),[n]);A.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),i(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),l=matchingSingleFnBindings(n.applyBindings,t,e.key),o=matchingOffBindings(n.applyBindings,t,e.key);(l.length>0||o.length>0)&&e.preventDefault()}},handleKeyUp=e=>{a({type:"set-key-pressed",key:e.key,pressed:!1})};return window.addEventListener("keydown",handleKeyDown),window.addEventListener("keyup",handleKeyUp),()=>{window.removeEventListener("keydown",handleKeyDown),window.removeEventListener("keyup",handleKeyUp)}}),[i,n.applyBindings,n.pressed]),A.useEffect((()=>{const e=matchingSingleFnBindings(n.applyBindings,n.pressed,n.lastPressed),t=matchingOffBindings(n.applyBindings,n.pressed,n.lastPressed);e.forEach((e=>e())),t.forEach((e=>e()))}),[n.pressed,n.lastPressed]),A.useEffect((()=>{const t=n.applyBindings.filter((e=>e.repeat&&null!=e.keyBind&&allPressed(e.keyBind,n.pressed))).map((e=>e.fn));if(t.length>0){const n=setInterval((()=>{t.forEach((e=>e()))}),e);return()=>{clearInterval(n)}}return()=>{}}),[n.applyBindings,n.lastPressed])},VertexBoxSelectionButton=()=>{const t=useBoxSelectionActions(),n=r(ln);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>n,cancelPredicate:()=>!n},[n]),e(R,{content:"Box Selection",children:e(j,{iconName:"box-cursor",iconColor:n?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:n?t.disable:t.enable})})},li=1,VertexResizableContent=n=>{var{className:a,style:i,displayShadow:l,heading:o,id:r,initialScale:s,placement:c="left",children:d,onResize:u}=n,m=__rest(n,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const p="left"===c||"right"===c,h="top"===c;function getHorizontalResizeDirection(){switch(c){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===c?"top":"none"}const f=null!=s?s:1;return e(G,Object.assign({id:r,"data-testid":`resizable-content-position-${c}`,className:Kt(a,"pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300",{"border-r min-w-75 max-w-half":"left"===c,"sidebar-shadow-right":"left"===c&&l,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&l,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},i),initialHorizontalScale:p?s:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==u?void 0:u()},m,{children:t("div",{className:"flex flex-col h-full w-full",children:["top"===c&&e("div",{className:"flex justify-center w-full",children:e("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),o,e("div",{className:Kt("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(et),n=await(null==t?void 0:t.scene()),a={milliseconds:500};await(null==n?void 0:n.camera().viewAll().render({animation:a}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[i,l]=k.useState(),[o,r]=k.useState();k.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=i&&clearTimeout(i),r(w.create(a.touches[0].clientX,a.touches[0].clientY)),l(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=i&&null!=o&&w.distance(o,w.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(i),null==a||a())},handleTouchEnd=()=>{null!=i&&clearTimeout(i)};return null==e||e.addEventListener("touchstart",handleTouchStart),null==e||e.addEventListener("touchmove",handleTouchMove),null==e||e.addEventListener("touchend",handleTouchEnd),()=>{null==e||e.removeEventListener("touchstart",handleTouchStart),null==e||e.removeEventListener("touchmove",handleTouchMove),null==e||e.removeEventListener("touchend",handleTouchEnd)}}),[e,i,o])}var oi=Object.freeze({__proto__:null,isInputElement:isInputElement,keyBindings:ii,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:n,disableBackdrop:a,openPredicate:i,onOpen:l,onClose:o,children:s})=>{const c=useContextMenuActions(),d=r(Zt),u=r(nn),m=A.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),p=d===n;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:c.clearActiveContextMenu,addPredicate:()=>null!=d&&d===n,cancelPredicate:()=>null==d},[d]);const h=A.useMemo((()=>null!=t?t:null!=i?window:void 0),[t,i]);return useLongPress({target:h,callback:e=>c.longPress(e,n,i,l),onMovement:()=>c.clearActiveContextMenu()}),A.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&d===n){const t=targetShouldSkipNextHit(e);c.clearActiveContextMenu(t)}};if(a)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[a,n,d]),A.useEffect((()=>{const handlePointerDown=e=>{c.pointerDown(e)},handlePointerUp=e=>{c.pointerUp(e,n,i,l)},handleContextMenu=e=>c.contextMenu(e,i);return null==h||h.addEventListener("pointerdown",handlePointerDown),null==h||h.addEventListener("pointerup",handlePointerUp),null==h||h.addEventListener("contextmenu",handleContextMenu),()=>{null==h||h.removeEventListener("pointerdown",handlePointerDown),null==h||h.removeEventListener("pointerup",handlePointerUp),null==h||h.removeEventListener("contextmenu",handleContextMenu)}}),[t,n,i]),e("div",{className:Kt({hidden:!p}),children:e(K,{"data-testid":`${n}-context-menu`,open:asBooleanAttribute(p),position:u,fallbackPlacements:m,backdrop:!a,onMenuClosed:()=>{c.clearActiveContextMenu(),null==o||o()},children:e("div",{className:"pt-1",children:s})})})},VertexFitSelectedMenuItem=()=>{const n=r(In),a=r(Dn),i=useViewerCameraActions();return e(W,{"data-testid":"fit-selected-menu-option",onClick:async()=>{null!=(null==a?void 0:a.boundingBox)&&await i.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"fit-selected",size:"sm"}),"Fit Selected"]})})},VertexFlyToMenuItem=()=>{const n=useViewerCameraActions(),a=r(en);return e(W,{"data-testid":"fly-to-part-menu-option",onClick:async()=>{var e;const t=undefined,i=contextMenuItemIsRow(a)?null===(e=null==a?void 0:a.node.id)||void 0===e?void 0:e.hex:null==a?void 0:a.id;null!=i&&await n.flyToById(i)},disabled:asBooleanAttribute(null==a),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"paper-airplane",size:"sm"}),"Fly To"]})})};function useSceneItemsOperations(){const e=r(et),t=undefined,n=undefined,a=undefined,i=undefined,l=undefined,o=undefined;return{sceneItemsOperation:A.useCallback((async(t,n)=>{const a=await(null==e?void 0:e.scene());null==n?await(null==a?void 0:a.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==a?void 0:a.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:A.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withSelected())).show()])).execute()}),[e]),hideSelected:A.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).hide()])).execute()}),[e]),showOnlyItem:A.useCallback((async t=>{const n=await(null==e?void 0:e.scene());null==n||n.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withItemIds([t]))).show()])).execute()}),[e]),ghostSelected:A.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!0)])).execute()}),[e]),unGhostSelected:A.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const n=useSceneItemsOperations();return e(W,{"data-testid":"hide-all-menu-option",onClick:async()=>{await n.sceneItemsOperation((e=>e.hide()))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide All Parts"]})})},VertexHidePartMenuItem=()=>{const n=r(en),a=useSceneItemsOperations();return e(W,{"data-testid":"hide-menu-option",onClick:async()=>{var e;const t=undefined,i=contextMenuItemIsRow(n)?null===(e=null==n?void 0:n.node.id)||void 0===e?void 0:e.hex:n.id;null!=i&&await a.sceneItemsOperation((e=>e.hide()),[i])},disabled:asBooleanAttribute(null==n),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Part"]})})},VertexHideSelectedMenuItem=()=>{const n=r(In),a=useSceneItemsOperations();return e(W,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Selected"]})})},VertexShowAllMenuItem=()=>{const n=useSceneItemsOperations();return e(W,{"data-testid":"show-all-menu-option",onClick:async()=>{await n.sceneItemsOperation((e=>e.show()))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show All Parts"]})})},VertexShowOnlyMenuItem=()=>{const n=r(en),a=useSceneItemsOperations();return e(W,{"data-testid":"show-only-menu-option",onClick:async()=>{var e;const t=undefined,i=contextMenuItemIsRow(n)?null===(e=null==n?void 0:n.node.id)||void 0===e?void 0:e.hex:null==n?void 0:n.id;null!=i&&await a.showOnlyItem(i)},disabled:asBooleanAttribute(null==n),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Part"]})})},VertexShowOnlySelectedMenuItem=()=>{const n=r(In),a=useSceneItemsOperations();return e(W,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Selected"]})})},ri=l({key:"openedPanelActivePrimaryLeft",default:void 0}),si=l({key:"openedPanelActivePrimaryRight",default:void 0}),ci=l({key:"openedPanelActiveSceneTreeSecondary",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?ri:si,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?ri:si,void 0)})),openSecondary:useActionCallback((({set:e})=>t=>e(ci,t))),closeSecondary:useActionCallback((({reset:e})=>()=>e(ci)))}}var di=Object.freeze({__proto__:null,openedPanelActivePrimaryLeft:ri,openedPanelActivePrimaryRight:si,openedPanelActiveSceneTreeSecondary:ci,usePanelActions:usePanelActions});const VertexShowPropertiesMenuItem=()=>{const n=usePanelActions(),a=useSelectionActions(),i=r(en);return e(W,{"data-testid":"show-properties-menu-option",disabled:asBooleanAttribute(null==i),onClick:()=>{var e;const t=undefined,l=contextMenuItemIsRow(i)?null===(e=null==i?void 0:i.node.id)||void 0===e?void 0:e.hex:null==i?void 0:i.id;null!=l&&(a.clearAndSelect({id:l}),n.openSecondary("Properties"))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"info",size:"sm"}),"Show Properties"]})})};function fromApiProperty(e){var t,n;return{key:null!==(n=null===(t=e.key)||void 0===t?void 0:t.name)&&void 0!==n?n:"",value:apiMetadataPropertyDisplayValue(e.value)}}function apiMetadataPropertyDisplayValue(e){var t,n,a,i;let l="";switch(null==e?void 0:e.type){case"string":l=null!==(t=e.value)&&void 0!==t?t:l;break;case"long":l=null!==(n=e.value.toString())&&void 0!==n?n:l;break;case"double":l=null!==(a=e.value.toString())&&void 0!==a?a:l;break;case"timestamp":l=null!==(i=e.value.seconds.toLocaleString())&&void 0!==i?i:l}return l}const ui=l({key:"showMetadataSceneItemProperties",default:!0}),mi=d({key:"nextMetadataSceneItemProperties",get:e=>async({get:t})=>{var n,a,i;const l=t(et),o=t(hi(e));try{const t=await(null===(n=null==l?void 0:l.sceneItems)||void 0===n?void 0:n.listSceneItemMetadata(e,{cursor:o,size:20})),r=null===(a=null==t?void 0:t.entries)||void 0===a?void 0:a.map((e=>fromApiProperty(e))),s=undefined;return{metadata:null!=r?null===(i=[...r])||void 0===i?void 0:i.sort(((e,t)=>e.key>t.key?1:-1)):void 0,cursor:null==t?void 0:t.paging.next}}catch(t){return void logger_debug(`Error encountered get metadata for scene item. [itemId={${e}}]`,t)}}}),pi=u({key:"loadedMetadataSceneItemProperties",default:[]}),hi=u({key:"metadataSceneItemPropertiesCursor",default:void 0}),fi=d({key:"hasMoreMetadataSceneItemProperties",get:e=>({get:t})=>{const n=undefined;return null!=t(hi(e))}}),vi=u({key:"isFetchingMetadataSceneItemProperties",default:!1}),gi=o({key:"metadataSceneItemName",get:async({get:e})=>{var t;const n=e(Nn);if(null!=n){const a=e(Mn(n.id));return null!==(t=null==a?void 0:a.name)&&void 0!==t?t:void 0}}});var yi=Object.freeze({__proto__:null,apiMetadataPropertyDisplayValue:apiMetadataPropertyDisplayValue,fromApiProperty:fromApiProperty,hasMoreMetadataSceneItemProperties:fi,isFetchingMetadataSceneItemProperties:vi,loadedMetadataSceneItemProperties:pi,metadataSceneItemName:gi,metadataSceneItemPropertiesCursor:hi,nextMetadataSceneItemProperties:mi,showMetadataSceneItemProperties:ui});const VertexGhostSelectedMenuItem=()=>{const n=r(In),a=useSceneItemsOperations();return e(W,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-partial",size:"sm"}),"Ghost Selected"]})})};function BetaLabel({children:n,label:a="Beta",placement:i="end",borderColor:l="border-purple-400",textColor:o="text-purple-500"}){return t("div",{className:"flex items-center",children:[n,e("div",{className:Kt(`flex border ${l} rounded-md px-1.5 text-xs ${o} uppercase items-center justify-center ml-2 select-none max-h-5`,{"ml-auto":"end"===i}),style:{height:"fit-content"},children:a})]})}const VertexShowModelViewsMenuItem=()=>{const n=usePanelActions(),a=useSelectionActions(),i=r(en);return e(W,{"data-testid":"viewer-show-model-views",disabled:asBooleanAttribute(null==i),onClick:async()=>{var e;const t=undefined,l=contextMenuItemIsRow(i)?null===(e=null==i?void 0:i.node.id)||void 0===e?void 0:e.hex:null==i?void 0:i.id;null!=l&&(n.openPrimary("model-views","right"),a.selectForModelViewsPanel({id:l}))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"views",size:"sm"}),t("div",{className:"flex gap-2",children:["Show Model Views ",e(BetaLabel,{})]})]})})},VertexUnghostSelectedMenuItem=()=>{const n=r(In),a=useSceneItemsOperations();return e(W,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"visibility-visible",size:"sm"}),"Unghost Selected"]})})},DefaultSceneTreeContextMenu=()=>{const n=r(ui);return t("div",{className:"w-56",children:[e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e($,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{}),e($,{}),n&&e(VertexShowPropertiesMenuItem,{}),e(VertexShowModelViewsMenuItem,{})]})},VertexSceneTreeContextMenu=({children:t})=>{const n=useSceneTreeActions(),a=r(Ia),i=undefined;return e(VertexContextMenu,{menuType:"scene-tree",targetElement:a,onOpen:async(e,t)=>{const a=e;await n.setContextMenuItem(a.clientY)},disableBackdrop:!0,children:null!=t&&!1!==t?t:e(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>{const n=r(ui);return t("div",{className:"w-56",children:[e(VertexHidePartMenuItem,{}),e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e($,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{}),e($,{}),n&&e(VertexShowPropertiesMenuItem,{}),e(VertexShowModelViewsMenuItem,{})]})},VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=A.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:a,children:n?t:e(DefaultViewerContextMenu,{})})},bi=35,wi=l({key:"sceneItemGhostingSelectedOpacity",default:bi}),Ci=u({key:"appliedItemPhantomState",default:void 0}),Si=l({key:"appliedItemPhantomStateIds",default:[]}),xi=o({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Nn);return null!=n&&(null!==(t=e(Ci(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[n,a]=s(wi);return e(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Si)).forEach((e=>t(Ci(e)))),t(Si)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const i=await t.getPromise(In);i.forEach((e=>n(Ci(e),a))),n(Si,(e=>[...e,...i])),await e.execute(An.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(a)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(In);i.forEach((e=>a(Ci(e)))),n(Si,(e=>e.filter((e=>!i.includes(e))))),await e.execute(An.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(An.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}};var ki=Object.freeze({__proto__:null,DEFAULT_GHOSTING_OPACITY:bi,appliedItemPhantomState:Ci,appliedItemPhantomStateIds:Si,sceneItemGhostingLastSelectedPhantom:xi,sceneItemGhostingSelectedOpacity:wi,useSceneItemPhantomActions:useSceneItemPhantomActions});const VertexSceneItemGhostingToggle=({onApply:t})=>{const n=useSceneItemPhantomActions(),a=r(Hn),i=p(xi);return e(R,{content:"Select a part to display as ghost",disabled:a,children:e(L,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!a,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await n.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:a,onApplyOpacity:i}){return t(n,{children:[t("div",{className:"flex items-center py-3",children:[e(VertexSceneItemGhostingToggle,{onApply:a}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e(VertexSceneItemGhostingOpacitySlider,{onApply:i})]})}const VertexSceneItemGhostingClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemPhantomActions(),l=r(xi);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e("div",{className:"pt-1"}),e(W,{"data-testid":"reset-selected-phantom",onClick:async()=>{await i.clearPhantomState(),null==n||n()},disabled:!l,children:"Clear ghosting for selected"}),e(W,{"data-testid":"reset-all-phantom",onClick:async()=>{await i.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:n,onClearAllGhostState:a,onApplyGhostingChange:i,onApplyOpacity:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Ghosting",e(VertexSceneItemGhostingClear,{onClear:n,onClearAll:a})]}),children:e(VertexGhostingControls,{onApplyGhostingChange:i,onApplyOpacity:l})})}function VertexMeasurementContextMenu({onDelete:n}){const a=r(Qt);return e(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:t(W,{"data-testid":"measurement-delete",onClick:()=>null!=a&&n(a.id),children:[e(F,{slot:"icon",name:"delete",size:"sm"}),e("div",{className:"pl-2",children:"Delete"})]})})}function useDockedPlacement(e,t){const[n,a]=k.useState(w.create(0,0));return k.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),i=w.create(n.left,n.bottom),l=w.create(n.right,n.bottom);a("left"===t?i:l)}}),[e,t]),n}function VertexMeasurementDetails({placement:n,size:a}){const i=useMeasurementActions(),l=r(et),o=r(tt),s=useDockedPlacement(null!=l?l:null,n),c=r(bn),d=r(wn),u=r(Cn),m=r(Sn),p=r(Gn),h=r(Kn);return e(q,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${o}`,position:s,children:t("div",{className:Kt("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:[t("div",{className:"pb-2 flex justify-between items-center",children:[e("div",{className:Kt("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("div",{className:Kt("mr-0.5",{hidden:!m}),children:e(R,{content:"Reset",placement:"left-start",children:e(j,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:i.resetMeasurement})})})]}),e(oe,{"data-testid":"measurement-details-viewer-measurement-details",className:Kt("gap-y-1.5",{hidden:null==c}),measurementOutcome:c,measurementOverlays:d,distanceUnits:toUnitType(p),fractionalDigits:parseInt(h,10)}),e("div",{"data-testid":"measurement-details-message",className:Kt({hidden:null==u}),children:u})]})})}function useCallbackRef(e){var t;const[n,a]=A.useState(null!==(t=null==e?void 0:e.override)&&void 0!==t?t:null),i=A.useCallback((t=>{var n;return a(null!==(n=null==e?void 0:e.override)&&void 0!==n?n:t)}),[]);return{element:n,callback:i}}function VertexPointToPointMeasurement({detailsPlacement:a,detailsSize:i,onPointToPointMeasurementChange:l}){const o=useMeasurementActions(),s=r(et),c=r(sn),d=r(dn),u=r(Gn),m=r(Kn),{callback:p,element:h}=useCallbackRef();usePointToPointMeasurement(h);const f=P((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};o.setEditedPointToPointMeasurement(t),null==l||l(t)}),[o]);return c?t(n,{children:[e(re,{"data-testid":"point-to-point-measurement",ref:p,viewer:null!=s?s:void 0,mode:"replace",start:null==d?void 0:d.start,end:null==d?void 0:d.end,invalid:null==d?void 0:d.invalid,units:toUnitType(u),fractionalDigits:parseInt(m,10),showAxisReferenceLines:!0,onEditEnd:f}),e(VertexMeasurementDetails,{placement:a,size:i}),e(VertexMeasurementContextMenu,{onDelete:o.resetMeasurement})]}):e(n,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),n=r(sn);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>n,cancelPredicate:()=>!n},[n,t]),e(R,{content:"Point to Point Measurement",children:e(j,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Ai=l({key:"viewerToolkitSdkConfig",default:void 0});var Ti=Object.freeze({__proto__:null,sdkConfig:Ai});const VertexPreciseMeasurement=({detailsPlacement:a,detailsSize:i,onEntitiesChanged:l,onOutcomeChanged:o})=>{var s,c,d,u;const m=r(et),p=r(Ai),h=r(mn),{callback:f,element:v}=useCallbackRef();return usePreciseMeasurementModel(v,l,o),h?t(n,{children:[e(se,{"data-testid":"precise-measurement-viewer-tool",ref:f,viewer:null!=m?m:void 0,config:JSON.stringify({network:{apiHost:null===(s=null==p?void 0:p.network)||void 0===s?void 0:s.apiHost,renderingHost:null===(c=null==p?void 0:p.network)||void 0===c?void 0:c.renderingHost,sceneTreeHost:null===(d=null==p?void 0:p.network)||void 0===d?void 0:d.sceneTreeHost,sceneViewHost:null===(u=null==p?void 0:p.network)||void 0===u?void 0:u.sceneViewHost}})}),e(VertexMeasurementDetails,{placement:a,size:i})]}):e(n,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),n=r(mn);return e(R,{content:"Precise Measurement",children:e(j,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const a=r(Xe),i=r(Ye);return t(n,{children:[null!=a&&e(Y,{className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id),null!=i&&e(X,{placement:"bottom-left",className:"z-[16000]",duration:i.duration,open:!0,content:i.message,type:i.type},i.id)]})}const Pi={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 Mi=l({key:"sceneTreeColumnsRefreshTrigger",default:0}),Ei=l({key:"sceneTreeColumnsWhitelistedColumns",default:[]}),Ii=o({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(Na);return e(Mi),null!=t?await t.fetchMetadataKeys():[]}}),Ni=o({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Ii).filter((e=>e!==Pi.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),Oi=l({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),Vi=o({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(Oi),n=e(Ia),a=null==n?void 0:n.clientWidth;if(null!=a&&a>0){const e=1/(t.length+1)*a,n=(a-e)/t.length;return t.reduce(((e,t)=>{const a=mapToColumn(t,n);return Object.assign(Object.assign({},e),{[a.label]:a})}),{Name:Object.assign(Object.assign({},Pi),{initialWidth:e,minWidth:n})})}return{Name:Pi}}}),_i=o({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Vi))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e})=>async t=>{e(Oi,t)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(Mi,(e=>e+1))}))}}const Li=16,Ri=-8;var ji;function useOpenPositionedPopover({open:e,buttonElement:t,horizontalOffset:n,verticalOffset:a}){const[i,l]=k.useState(),[o,r]=k.useState(),s=undefined;return{position:i,direction:o,handleOpen:k.useCallback((()=>{if(!e){const e=null==t?void 0:t.getBoundingClientRect();if(null!=e){const t=null!=n?n:Li,i=null!=a?a:Ri,o=e.x>window.innerWidth/2?ji.LEFT:ji.RIGHT;l({x:o===ji.LEFT?e.left-t:e.right+t,y:e.top+i}),r(o)}}}),[e,t])}}!function(e){e.LEFT="left",e.RIGHT="right"}(ji||(ji={}));var Di=Object.freeze({__proto__:null,DEFAULT_HORIZONTAL_POSITION_OFFSET:Li,DEFAULT_NAME_COLUMN:Pi,DEFAULT_VERTICAL_POSITION_OFFSET:Ri,get PlacementDirection(){return ji},mapToColumn:mapToColumn,sceneTreeColumnsActiveColumnNames:_i,sceneTreeColumnsActiveColumns:Vi,sceneTreeColumnsAvailableColumns:Ii,sceneTreeColumnsAvailableSortedColumns:Ni,sceneTreeColumnsRefreshTrigger:Mi,sceneTreeColumnsVisibleMetadataColumnNames:Oi,sceneTreeColumnsWhitelistedColumns:Ei,useOpenPositionedPopover:useOpenPositionedPopover,useSceneTreeColumnActions:useSceneTreeColumnActions});const zi=l({key:"sceneTreeSearchActive",default:!1}),Bi=l({key:"sceneTreeColumnsPartial",default:!1}),Hi=l({key:"sceneTreeSearchValue",default:void 0}),Fi=l({key:"sceneTreeSearchExactMatch",default:!1}),Ui=l({key:"sceneTreeSearchRemoveHiddenItems",default:!1}),Wi=l({key:"sceneTreeSearchResultCount",default:0}),Gi=l({key:"sceneTreeSearchActiveColumns",default:[]}),Ki=o({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(Gi);return 0===t.length||t.includes(Pi.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),n=r(zi),a=c(Wi),i=c(Ln);A.useEffect((()=>{let t;return whenComponentReady(e,(()=>{var n;t=null===(n=null==e?void 0:e.controller)||void 0===n?void 0:n.stateChanged((e=>{void 0!==(null==e?void 0:e.totalFilteredRows)&&a(null==e?void 0:e.totalFilteredRows)}))})),()=>{null==t||t.dispose()}}),[e]),A.useEffect((()=>{if(null!=e){let a;return whenComponentReady(e,(()=>{var l;a=null===(l=null==e?void 0:e.controller)||void 0===l?void 0:l.stateChanged((e=>{var a;if(null!=(null==e?void 0:e.filterTerm)){const t=null==e?void 0:e.rows.find((e=>{var t;return null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.selected}));i(null===(a=null==t?void 0:t.node.id)||void 0===a?void 0:a.hex)}else n&&t.flyToFirstSelectedItem()}))})),()=>{null==a||a.dispose()}}}),[e,null==e?void 0:e.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=c(Bi);A.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var a;n=null===(a=null==e?void 0:e.controller)||void 0===a?void 0:a.stateChanged((e=>{t(!!(null==e?void 0:e.isPartialKeysResponse))}))})),()=>{null==n||n.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(Gi,t)})),t=useActionCallback((({snapshot:t})=>async(n,a,i,l)=>{const o=await t.getPromise(Ia),r=await t.getPromise(Fi),s=await t.getPromise(Ui),c=await t.getPromise(Gi),d=c.length>0?a?[...c,n]:c.filter((e=>e!==n)):[...i,Pi.metadataKeyName].filter((e=>e!==n));e(d),l&&(null==o||o.filterItems(l,{columns:d,exactMatch:r,removeHiddenItems:s}))})),n=useActionCallback((({snapshot:e,set:t})=>async(n,a,i)=>{const l=await e.getPromise(Ia),o=await e.getPromise(Fi),r=await e.getPromise(Ui),s=await e.getPromise(Gi),c=n.filter((e=>!a.includes(e))),d=a.filter((e=>!n.includes(e))),u=s.length>0?[...s.filter((e=>!c.includes(e))),...d]:[...a,Pi.metadataKeyName],m=u.length>0?u:[...a,Pi.metadataKeyName];t(Gi,m),i&&(null==l||l.filterItems(i,{columns:m,exactMatch:o,removeHiddenItems:r}))})),a=useActionCallback((({set:e})=>t=>{e(Fi,t)})),i=useActionCallback((({set:e})=>t=>{e(Ui,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:a,setMetadataSearchRemoveHiddenItems:i}};var $i=Object.freeze({__proto__:null,sceneTreeColumnsPartial:Bi,sceneTreeSearchActive:zi,sceneTreeSearchActiveColumns:Gi,sceneTreeSearchExactMatch:Fi,sceneTreeSearchNameColumnActive:Ki,sceneTreeSearchRemoveHiddenItems:Ui,sceneTreeSearchResultCount:Wi,sceneTreeSearchValue:Hi,useSceneTreePartialResults:useSceneTreePartialResults,useSceneTreeSearch:useSceneTreeSearch,useSceneTreeSearchActions:useSceneTreeSearchActions});const targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=i((({set:t})=>n=>{t(e,n)}),[]);return t}var qi;function styleFromOptionalFont(e){return null!=e?{"--scene-tree-default-font-family":styleFromFontFace(e.fontFace),"--scene-tree-default-font-color":e.color}:{}}function styleFromOptionalBackgroundColors(e){const t=null==e?void 0:e.depthColors,n=null!=t?Object.keys(t).reduce(((e,n)=>Object.assign(Object.assign({},e),{[`--scene-tree-row-background-color-depth-${n}`]:t[parseInt(n)]})),{}):{};return null!=e?Object.assign(Object.assign({},n),{"--scene-tree-hovered-row-background-color":e.hovered,"--scene-tree-selected-row-background-color":e.selected,"--scene-tree-row-background-color":e.defaultColor}):{}}function styleFromFontFace(e){return e===qi.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(qi||(qi={}));const Yi=l({key:"sceneTreeAdditionalMetadataKeys",default:[]}),Xi=o({key:"sceneTreeActiveMetadataKeys",get:({get:e})=>{const t=e(Yi),n=e(Oi),a=e(Ei),i=new Set([...t,...n]),l=new Set(a);return 0===a.length?Array.from(i):Array.from(i.intersection(l))}});var Zi=Object.freeze({__proto__:null,sceneTreeActiveMetadataKeys:Xi,sceneTreeAdditionalMetadataKeys:Yi});function childrenAsArray(e){return Array.isArray(e)?e:[e]}function filterChildElements(e,t){return childrenAsArray(e).filter((e=>A.isValidElement(e)&&e.type===t))}function findChildElement(e,t){return filterChildElements(e,t)[0]}function cloneChildNodeOrFunction(e,t){return"object"==typeof e?A.cloneElement(e,t):e(t)}function useStateSyncedValue(e,t,{transform:n}={}){const[a,i]=s(e);return A.useEffect((()=>{null!=t&&i(null!=n?n(t):t)}),[t]),a}const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const n=c(zi);return e(R,{className:"flex ml-auto",content:"Scene Tree Search",children:e(j,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{n(!0),null==t||t()}})})},VertexSceneTreeMetadataCheck=({checked:n,disabled:a,onChange:i,children:l})=>{const o="string"==typeof l?l.replace(" ","-"):"";return t("div",{className:"flex items-center",children:[e(L,{"data-testid":`scene-tree-metadata-check-${o}`,variant:"check",checked:n,disabled:a,onValueChanged:e=>null==i?void 0:i(e.detail)}),e("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${o}`,onClick:()=>{a||null==i||i(!n)},children:l})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:a,onSearchForExactMatchChange:i})=>{const l=useSceneTreeActions(),o=useSceneTreeSearchActions(),s=r(Ia),c=r(Ki),d=r(Gi),u=r(Hi),m=r(Fi),p=r(Ui),h=r(Oi),{element:f,callback:v}=useCallbackRef(),g="scene-tree-search",b=r(Va(g)),{position:w,direction:C,handleOpen:S}=useOpenPositionedPopover({open:b,buttonElement:f,horizontalOffset:20}),A=k.useCallback((()=>{l.closeSceneTreePopover()}),[]),T=C===ji.LEFT?"left-end":"right-start",updateSearch=async(e,t)=>{if(u){const n=d.length>0?d:[...h,Pi.metadataKeyName];await(null==s?void 0:s.filterItems(u,{columns:n,exactMatch:e,removeHiddenItems:t}))}};return t(n,{children:[e(R,{content:"Search Options",placement:"top",children:e(j,{"data-testid":"scene-tree-search-options-popover-button",className:"text-neutral-700",ref:v,iconName:"gear",iconSize:"sm",onClick:()=>{b?A():(S(),l.openSceneTreePopover(g))}})}),b&&e(Z,{"data-testid":"scene-tree-search-options-popover",open:b,backdrop:!1,position:w,resizeBehavior:"fixed",placement:T,className:"z-popover",children:t("div",{className:Kt("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!b}),children:[t("div",{className:"flex items-center text-[0.875rem] p-3 border-b border-neutral-300 pb-2",children:[e("div",{className:"pr-2 text-[0.875rem] whitespace-nowrap",children:"Column Properties Search"}),e(j,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{A()}})]}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e("div",{className:"text-[0.875rem] pb-2 pr-2",children:"Select properties to perform the search on:"}),e(VertexSceneTreeMetadataCheck,{checked:c,disabled:0===d.length||d.every((e=>e===Pi.metadataKeyName)),onChange:async e=>{await o.updateMetadataSearchAfterSearchKeysChange(Pi.metadataKeyName,e,h,u),null==a||a()},children:Pi.label},Pi.metadataKeyName),h.map((t=>e(VertexSceneTreeMetadataCheck,{checked:d.includes(t),disabled:d.length>0&&d.every((e=>e===t)),onChange:async e=>{await o.updateMetadataSearchAfterSearchKeysChange(t,e,h,u),null==a||a()},children:t},t)))]}),t("div",{className:"flex p-3 border-t border-neutral-300",children:[e(L,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:m,onValueChanged:async e=>{o.setMetadataSearchExactMatch(e.detail),null==i||i(),await updateSearch(e.detail,p)}}),e("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]}),t("div",{className:"flex px-3 pb-3",children:[e(L,{className:"flex items-center","data-testid":"filter-remove-hidden-items-toggle",variant:"switch",checked:p,onValueChanged:async e=>{o.setMetadataSearchRemoveHiddenItems(e.detail),await updateSearch(m,e.detail)}}),e("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Search only visible items"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:n,onClearSearch:a,onExitSearchMode:i,onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o,sceneTreeSearchElement:c,children:d})=>{const u=useSceneTreeActions(),m=r(Ia),[p,h]=s(zi),[f,v]=s(Hi),g=r(Va("scene-tree-search"));useSceneTreeSearch({sceneTreeElement:null!=m?m:null});const{element:b,callback:w}=useCallbackRef({override:c}),C=null==f||""===f;return k.useEffect((()=>{p&&(null==b||b.setFocus())}),[b,p]),t("div",{className:"flex w-full py-3 px-2",children:[e(R,{className:"self-center mr-1",content:"Exit Search",children:e(j,{"data-testid":"scene-tree-search-close-button",iconName:"caret-left",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{h(!1),v(void 0),await(null==b?void 0:b.clear()),await(null==m?void 0:m.filterItems("")),g&&u.closeSceneTreePopover(),await u.flyToFirstSelectedItem(),null==i||i()}})}),t(ce,{"data-testid":"scene-tree-search-bar",ref:w,controller:null==m?void 0:m.controller,onBlur:()=>{C&&(h(!1),null==i||i(),g&&u.closeSceneTreePopover())},onSearch:()=>{v(null==b?void 0:b.value),null==n||n(null==b?void 0:b.value)},children:[d,e(F,{slot:"clear-icon",name:"close-circle-fill",size:"sm",onPointerDown:async()=>{await u.flyToFirstSelectedItem(),null==a||a()}})]}),e("div",{className:"self-center pl-1",onPointerDown:e=>{e.preventDefault()},children:e(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o})})]})},VertexSceneTreeSearch=({onEnterSearchMode:n,onExitSearchMode:a,onSearch:i,onClearSearch:l,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:s,children:c})=>{const d=r(zi);return t(de,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[d&&e(VertexSceneTreeSearchBar,{onSearch:i,onClearSearch:l,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:s,children:c}),!d&&e("div",{className:"ml-auto mr-2",children:e(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:n})})]})};function useCacheableLoadable(e,t){const n=M(),[a,i]=E(0),l=p(e);T((()=>{"hasValue"===l.state&&(n.current=l.contents)}),[t,l]);const[o,r]=I((()=>"hasValue"!==l.state&&null!=n.current?[n.current,!0]:"hasValue"===l.state?[l.contents,!1]:[void 0,!1]),[l.state,l.contents,a]),s=P((()=>{n.current=void 0,i(a+1)}),[a]),c=undefined;return I((()=>({data:o,state:l.state,cached:r,invalidate:s})),[s,o,r,l.state])}const VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:a})=>{const i=useSceneTreeActions(),l=useSceneTreeColumnActions(),o=useSceneTreeSearchActions(),s=r(Ia);useSceneTreePartialResults({sceneTreeElement:null!=s?s:null});const c=r(Hi),d=r(Ei),u=useCacheableLoadable(Ni),m=d.length>0?d:u.data,p=r(Oi),h=r(Bi),[f,v]=k.useState(p),[g,b]=k.useState(""),{element:w,callback:C}=useCallbackRef(),S="scene-tree-columns",A=r(Va(S)),{position:T,direction:P,handleOpen:M}=useOpenPositionedPopover({open:A,buttonElement:w}),E=k.useCallback((()=>{i.closeSceneTreePopover()}),[]),I=P===ji.LEFT?"left-end":"right-start",N=k.useMemo((()=>{if(null!=m){const e=m.filter((e=>f.indexOf(e)<0)),t=undefined;return[...[...f].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[f,m]),O=k.useMemo((()=>N),[A,m]);return t(n,{children:[e(R,{content:"Configure Columns",placement:"top",children:e(j,{"data-testid":"scene-tree-column-popover-button",ref:C,iconName:"columns-add",iconSize:"sm",onClick:()=>{A?E():(M(),i.openSceneTreePopover(S))}})}),A&&e(Z,{"data-testid":"scene-tree-column-popover",open:A,backdrop:!1,position:T,resizeBehavior:"fixed",placement:I,className:"z-popover",children:t("div",{className:Kt("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!A}),children:[t("div",{className:"flex items-center text-[0.875rem] p-3",children:[t("div",{className:"pr-2",children:[e("div",{className:"text-[0.875rem]",children:"Assembly Properties"}),e("div",{className:"text-[0.75rem] text-neutral-700 mt-1.5",children:"Select up to six properties to appear in the Assembly panel."})]}),e(j,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{b(""),E()}})]}),e(J,{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&&b(t.toLowerCase())}}),h&&e(ue,{"data-testid":"partial-key-list-notification-banner",message:"loading"===u.state?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>l.refreshKeyList()}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:Pi.label}),O.filter((e=>""===g||e.toLowerCase().includes(g))).map((t=>e(VertexSceneTreeMetadataCheck,{checked:f.includes(t),disabled:f.length>=6&&!f.includes(t),onChange:e=>{v(e?[...f,t]:f.filter((e=>e!==t)))},children:t},t)))]}),t("div",{className:"flex items-center p-3 border-t border-neutral-300 space-x-4",children:[e("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("div",{className:"flex-grow"}),t("div",{className:"flex space-x-2",children:[e(B,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{b(""),E()},children:"Cancel"}),e(B,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await o.updateMetadataSearchAfterColumnVisibilityChange(p,f,c),await l.setActive(f),null==a||a(f),b(""),E()},children:"Apply"})]})]})]})})]})};function VertexToolbarDivider(){return e("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1"})}const VertexSceneTreeSearchInformationForToolbar=()=>{const a=useSelectionActions(),i=r(Ia),l=r(Hi),o=r(Wi),s=undefined,c=`${o} ${1===o?"result":"results"}`;return t(n,{children:[e(VertexToolbarDivider,{}),t("div",{className:"flex flex-row items-center overflow-hidden",children:[e("div",{className:"px-2 text-[0.8125rem] leading-4 text-neutral-900 truncate","data-testid":"search-result-info",children:`${c}`}),e(R,{className:"w-auto",content:"Select Results",placement:"top",children:e(B,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=i&&null!=l&&(await i.selectFilteredItems(l),a.toggleLastSelectWasMultiSelect(!0))},children:t("div",{className:"flex h-6 items-center gap-1",children:[e(F,{size:"sm",name:"check-circle"}),e("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},VertexSceneTreeCollapseAll=()=>{const t=r(Ia);return e(R,{className:"w-auto",content:"Collapse All",placement:"top",children:e(F,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{null==t||t.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=r(Ia);return e(R,{className:"w-auto",content:"Expand All",placement:"top",children:e(F,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{null==t||t.expandAll()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:n})=>{const a=r(Hi),i=null==a||""===a;return e(de,{className:"h-10 border-b border-neutral-300 box-border",children:t("div",{className:"flex w-full text-neutral-700 items-center gap mx-2",children:[e(VertexSceneTreeExpandAll,{}),e(VertexSceneTreeCollapseAll,{}),!i&&e(VertexSceneTreeSearchInformationForToolbar,{}),e("div",{className:"ml-auto",children:e(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:n})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,onVisibleSceneTreeColumnsChange:r,children:s})=>{const c=undefined;return e("div",{slot:"header",className:"flex flex-col",children:null!=s&&!1!==s?s:t(n,{children:[e(VertexSceneTreeSearch,{onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,children:e("div",{slot:"clear-icon"})}),e(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:r})]})})};function useMetadataActions(){const e=useActionCallback((({snapshot:e,set:t})=>async n=>{const a=undefined;if(await e.getPromise(vi(n)))return;t(vi(n),!0);const i=await e.getPromise(mi(n));if(null!=(null==i?void 0:i.metadata)){const e=[...i.metadata];t(pi(n),(t=>[...t,...e]))}const l=null==i?void 0:i.cursor;t(hi(n),l),t(vi(n),!1)}));return{fetchInitialMetadata:useActionCallback((({snapshot:t})=>async n=>{const a=undefined;0===(await t.getPromise(pi(n))).length&&await e(n)})),fetchNextMetadata:useActionCallback((()=>async t=>{await e(t)}))}}var Ji={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=A,i=_interopRequireDefault(a),l,o=_interopRequireDefault(Ce);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 r=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 i=document.documentElement||document.body.parentNode||document.body,l=void 0!==t.pageYOffset?t.pageYOffset:i.scrollTop;a=this.props.isReverse?l:this.calculateOffset(e,l)}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,l=t.hasMore;t.initialLoad;var o=t.isReverse,r=t.loader;t.loadMore,t.pageStart;var s=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,s&&s(t)};var d=[n];return l&&(r?o?d.unshift(r):d.push(r):this.defaultLoader&&(o?d.unshift(this.defaultLoader):d.push(this.defaultLoader))),i.default.createElement(a,c,d)}}]),InfiniteScroll}(a.Component);r.propTypes={children:o.default.node.isRequired,element:o.default.node,hasMore:o.default.bool,initialLoad:o.default.bool,isReverse:o.default.bool,loader:o.default.node,loadMore:o.default.func.isRequired,pageStart:o.default.number,ref:o.default.func,getScrollParent:o.default.func,threshold:o.default.number,useCapture:o.default.bool,useWindow:o.default.bool},r.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=r,e.exports=t.default}(Ji,Ji.exports);var Qi=Ji.exports;const CopyButton=({id:t,textToCopy:n,iconSize:a,disableTooltip:i,onCopyValue:l})=>{const[o,r]=A.useState(!1),s=undefined,c=useDebouncedCallback((()=>{r(!1)}),2e3);return e(R,{className:"h-fit self-center z-[16000]",content:o?"Copied to Clipboard":"Copy",placement:"bottom",disabled:i,children:e("div",{className:Kt({"text-green-700":o}),children:e(j,{className:"ml-auto","data-testid":`${t}-copy-button`,iconName:o?"check":"copy",iconSize:null!=a?a:"xs",onClick:e=>{e.stopPropagation(),e.preventDefault(),null!=n&&(navigator.clipboard.writeText(n),null==l||l(n)),r(!0),c(!0)},style:{"--hover-box-shadow":"none"}})})})};function MetadataPropertyValue({value:n,onCopyMetadataValue:a}){const[i,l]=A.useState(!1),o=""!==n.replace(/^\s*$/,"").trim();return o?t("div",{className:"flex w-full border-b border-neutral-300 pl-1 pr-3","data-testid":`${n}-metadata-property`,onMouseEnter:()=>{l(!0)},onMouseLeave:()=>l(!1),children:[e(R,{className:"w-full shrink truncate pr-2 py-1.5",content:n,placement:"bottom-start",children:e("div",{className:"truncate",children:n})}),i&&e(CopyButton,{id:n,textToCopy:n,onCopyValue:a})]}):e("div",{className:Kt("overflow-visible border-b border-neutral-300 pl-1 pr-4 py-1.5",{"text-neutral-500":!o}),children:"--"})}const MetadataPanelContents=({sceneItemId:a,onCopyMetadataValue:i})=>{const l=useMetadataActions(),o=p(gi),s=r(pi(a)),c=r(fi(a)),d=r(vi(a)),u=(null==s?void 0:s.length)>0;function getMessage(){if(!d&&0===(null==s?void 0:s.length)&&"hasValue"===o.state)return"This part does not contain properties"}return A.useEffect((()=>{null!=a&&l.fetchInitialMetadata(a)}),[a]),t(n,{children:[e(Qi,{initialLoad:!1,hasMore:c,loadMore:async()=>{c&&await l.fetchNextMetadata(a)},useWindow:!1,children:t("div",{className:"flex w-full text-xs leading-5 grow-0",children:[e(G,{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("div",{className:"flex flex-col w-full overflow-hidden whitespace-nowrap",children:s.map(((t,n)=>e(R,{className:"border-b border-neutral-300 pl-4 pr-1 py-1.5",content:t.key,placement:"bottom-start",children:e("div",{className:"truncate",children:t.key})},n)))})}),e("div",{id:"metadata-value-column",className:"flex flex-col w-full min-w-24",children:s.map(((t,n)=>e(MetadataPropertyValue,{value:t.value,onCopyMetadataValue:i},n)))})]})}),!u&&e("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:getMessage()})]})},MetadataPanel=({onCopyMetadataValue:n})=>{const a=usePanelActions(),i=r(Nn),l=p(gi);return t("div",{id:"metadata-panel-wrapper","data-testid":"metadata-panel-wrapper",className:"w-full h-full flex flex-col mt-auto text-neutral-800",children:[t("div",{className:"flex h-10 border-b border-neutral-300 p-3 pl-4 text-[0.875rem] items-center",children:["hasValue"===l.state&&e("span",{className:"flex flex-col w-full",children:e(R,{content:l.contents,children:e("div",{className:"truncate",children:l.contents||""})})}),"loading"===l.state&&e("div",{className:"flex items-center w-full h-full",children:e("div",{className:"w-1/2 h-1/2 bg-neutral-300 animate-pulse rounded"})}),e(F,{className:"ml-auto cursor-pointer",onClick:a.closeSecondary,name:"close",size:"sm"})]}),t("div",{className:"w-full h-full overflow-y-auto overflow-x-hidden",children:[null!=i&&e(MetadataPanelContents,{sceneItemId:i.id,onCopyMetadataValue:n}),null==i&&e("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(G,{"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(MetadataPanel,{onCopyMetadataValue:n})}),VertexSceneTreeCustomColumn=({label:n,rowDataBinding:a,expandToggle:i,visibilityToggle:l,isolateButton:o,modelViewsButton:s,initialWidth:c,minWidth:d})=>{const u=r(Ia);return A.useEffect((()=>{null==u||u.invalidateRows()}),[a]),t(me,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:c,minWidth:d,children:[e("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${Kt("truncate",{"pl-2":i,"pr-2":l})}">\n ${n}\n </div>\n </div>\n `}}),e("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 ${i?"expand-toggle":""}\n ${l?"visibility-toggle":""}\n ${o?"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="${l?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${a}</div>\n </div>\n </vertex-tooltip>\n\n ${s?'<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 `}})]},n)},VertexSceneTreeMetadataColumns=({children:t})=>{const a=r(Vi),i=r(_i),l=[],o=i.filter((e=>e!==Pi.label)).map((e=>a[e]));return e(n,null!=t?{children:t({columns:o.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))})}:{children:o.map(((t,n)=>{var a;const i=null!==(a=l[n])&&void 0!==a?a:t.initialWidth;return e(VertexSceneTreeCustomColumn,{label:t.label,visibilityToggle:n===o.length-1,isolateButton:n===o.length-1,rowDataBinding:t.binding,initialWidth:i,minWidth:t.minWidth},t.label)}))})},VertexSceneTreeTableLayout=n=>{var a,i;const{children:l}=n,o=__rest(n,["children"]),s=r(Vi),c=r(_i),d=[],u=A.useMemo((()=>findChildElement(l,NameColumn)),[l]),m=A.useMemo((()=>findChildElement(l,MetadataColumns)),[l]),p=null!==(a=s[Pi.label])&&void 0!==a?a:Pi,h=c.filter((e=>e!==Pi.label)).map((e=>s[e]));return t(pe,Object.assign({"data-testid":"scene-tree-table-layout"},o,{children:[u?cloneChildNodeOrFunction(u.props.children,{columnCount:c.length,initialWidth:p.initialWidth,minWidth:p.minWidth}):e(VertexSceneTreeCustomColumn,{expandToggle:!0,visibilityToggle:1===c.length,isolateButton:1===c.length,rowDataBinding:p.binding,label:p.label,initialWidth:null!==(i=d[0])&&void 0!==i?i:p.initialWidth,minWidth:p.minWidth}),null!=m?cloneChildNodeOrFunction(m.props.children,{columns:h.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))}):e(VertexSceneTreeMetadataColumns,{})]}))},NameColumn=({children:t})=>e(n,{children:t}),MetadataColumns=({children:t})=>e(n,{children:t});VertexSceneTreeTableLayout.NameColumn=NameColumn,VertexSceneTreeTableLayout.MetadataColumns=MetadataColumns;const VertexSceneTree=n=>{var{id:a,font:i,backgroundColors:l,additionalLoadedMetadataProperties:o,whitelistedMetadataProperties:s,allowViewingMetadataPropertiesPanel:d,children:u,style:m,onPointerDown:p,onClick:h,onToggleSelection:f,onToggleExpansion:v,onToggleVisibility:g,onCopyMetadataValue:b,className:w,rowData:C}=n,S=__rest(n,["id","font","backgroundColors","additionalLoadedMetadataProperties","whitelistedMetadataProperties","allowViewingMetadataPropertiesPanel","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","onCopyMetadataValue","className","rowData"]);const k=usePanelActions(),T=useSceneTreeActions(),P=useSelectionActions(),M=r(Ai),E=r(et),I=r(ci),N=r(Xi),O=r(Gi),V=r(Fi),_=r(Ui),L=r(Hi),R=null==L||""===L,j=useRecoilRef({state:Ia}),D=A.useMemo((()=>findChildElement(u,Header)),[u]),B=A.useMemo((()=>findChildElement(u,TableLayout)),[u]),H=A.useMemo((()=>findChildElement(u,ContextMenu)),[u]),wrappedExpansionHandler=(e,t,n)=>{T.toggleExpansion(e,t,n),null==v||v(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{T.toggleSelection(e,t,n),null==f||f(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{T.toggleVisibility(e,t,n),null==g||g(e,t,n)},handleClick=async e=>{e.altKey&&await T.flyToRow(e.clientY),null==h||h(e)},handlePointerDown=async e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&await P.clearSelection(),null==p||p(e)},F=c(Na),handleFirstRowRendered=e=>{var t;F(e.target.controller),null===(t=null==S?void 0:S.onFirstRowRendered)||void 0===t||t.call(S,e)},U=A.useMemo((()=>({metadataSearchKeys:O,exactMatch:V,removeHiddenItems:_})),[O,V,_]);useStateSyncedValue(Ei,s,{transform:e=>e.sort(((e,t)=>e.localeCompare(t)))}),useStateSyncedValue(ui,d),useStateSyncedValue(Yi,o);const W=r(Un),G=A.useCallback((e=>{e.preventDefault(),e.stopPropagation(),k.openPrimary("model-views","right")}),[k]);return t("div",{id:"scene-tree-panel",className:"flex flex-col w-full h-full grow-0",children:[e("div",{id:"scene-tree-container",className:"flex group h-full min-h-32 overflow-auto",children:t(he,Object.assign({id:null!=a?a:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:M,ref:j,className:Kt("flex-1",{filtered:!R}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(i)),styleFromOptionalBackgroundColors(l)),m),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:E,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t,n;const a=null!==(t=null==C?void 0:C(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler,handleShowModelViews:G,modelViewIndicatorStyle:(null===(n=null==e?void 0:e.node.id)||void 0===n?void 0:n.hex)===(null==W?void 0:W.id)?"display: flex;":"display: none;"},a)},searchOptions:U,metadataKeys:N},S,{onFirstRowRendered:handleFirstRowRendered,children:[null!=D?D:e(VertexSceneTreeHeader,{}),null!=B?B:e(VertexSceneTreeTableLayout,{}),null!=H?H:e(VertexSceneTreeContextMenu,{})]}))}),void 0!==I&&e(SceneTreeSecondaryPanel,{panelId:"scene-tree-panel",onCopyMetadataValue:b})]})},Header=({children:t})=>e(n,{children:t}),TableLayout=({children:t})=>e(n,{children:t}),ContextMenu=({children:t})=>e(n,{children:t});VertexSceneTree.Header=Header,VertexSceneTree.TableLayout=TableLayout,VertexSceneTree.ContextMenu=ContextMenu;const VertexDecimalPlaceSelector=({onApply:n})=>{const[a,i]=s(Kn);return t(Q,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{i(e.detail),null==n||n(e.detail)},children:[e("div",{className:"py-1.5 px-3",children:"0"}),e("div",{className:"py-1.5 px-3",children:"1"}),e("div",{className:"py-1.5 px-3",children:"2"}),e("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:n})=>{const[a,i]=s(Gn);return t(Q,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{i(e.detail),null==n||n(e.detail)},children:[e("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:a,onDecimalPlaceChange:i}){return t(n,{children:[t("div",{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e(VertexLengthUnitSelector,{onApply:a})]}),t("div",{children:[e("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e(VertexDecimalPlaceSelector,{onApply:i})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e(PanelSection,{header:e("div",{className:"flex items-center text-base",children:"Units"}),children:e(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}function useModelViewActions(){const e=usePmiAnnotationActions(),t=useSelectionActions();return{fetchNextModelViews:useActionCallback((({snapshot:e,set:t})=>async n=>{var a;const i=await e.getPromise(Sa(n));if(null!=i){const e=null===(a=null==i?void 0:i.paging)||void 0===a?void 0:a.next;null!=e&&(t(ga(n),(e=>[...e,i])),t(fa(n),(()=>e)))}})),loadModelView:useActionCallback((({set:n,snapshot:a})=>async(i,l)=>{var o;const r=await a.getPromiseRequired(et),s=await a.getPromiseRequired(In);try{await(null===(o=null==r?void 0:r.modelViews)||void 0===o?void 0:o.load(i,l.id)),n(Ca,{itemId:i,modelView:l}),0!==s.length&&await t.clearSelection(),await e.fetchInitialPmiAnnotations(l.id)}catch(e){logger_error("Failed to load model view",e)}})),clearModelView:useActionCallback((({reset:t,snapshot:n})=>async()=>{var a;const i=undefined;if(null!=await n.getPromise(Ca)){const i=await n.getPromiseRequired(et);try{await(null===(a=null==i?void 0:i.modelViews)||void 0===a?void 0:a.unload()),t(Ca),await e.clearPmiAnnotationSelection()}catch(e){logger_error("Failed to remove model view",e)}}}))}}var el=Object.freeze({__proto__:null,hasMoreModelViews:ka,hasMorePmiAnnotations:Pa,loadedItemModelView:Ca,loadedModelViews:ga,loadedPmiAnnotations:ya,modelViews:xa,modelViewsCursor:fa,modelViewsSceneItemName:wa,nextModelViews:Sa,nextPmiAnnotations:Aa,pmiAnnotations:Ta,pmiAnnotationsCursor:va,selectedPmiAnnotationId:Ma,useModelViewActions:useModelViewActions,visiblePmiAnnotations:ba});function FileWithMagnifyingGlassImage(){return e("div",{children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"160",height:"160",viewBox:"0 0 220 220",children:[e("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("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("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("path",{d:"M79.12 123.99H110v30.88H79.12z",fill:"#e0f3f9"}),e("path",{d:"M110 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M105.4 154.87H82.17",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M80.62 154.87h-1.5v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("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("path",{d:"M79.12 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M83.72 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M108.5 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M110 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M110 123.99h30.88v30.88H110z",fill:"#e0f3f9"}),e("path",{d:"M140.88 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("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("path",{d:"M111.5 154.87H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M110 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M110 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M114.6 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M139.38 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M140.88 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M110 93.11h30.88v30.88H110z",fill:"#e0f3f9"}),e("path",{d:"M140.88 122.49v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("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("path",{d:"M111.5 123.99H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M110 119.39V96.15",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M110 94.61v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M114.6 93.11h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("path",{d:"M139.38 93.11h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M140.88 97.7v23.24",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e("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("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("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("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("path",{fill:"none",stroke:"#b43296","stroke-linecap":"round","stroke-linejoin":"round",d:"M14.89 132.63h5.88v5.88h-5.88z"}),e("path",{fill:"none",stroke:"#f90","stroke-linecap":"round","stroke-linejoin":"round",d:"M174.49 36v5.88m-2.94-2.94h5.88"}),e("circle",{cx:"199.1",cy:"164.76",r:"2.45",fill:"none",stroke:"#0c0","stroke-linecap":"round","stroke-linejoin":"round"}),e("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("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("circle",{cx:"110.2",cy:"124.35",r:"27.74",fill:"#e0f3f9",opacity:".7"}),e("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("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("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("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("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:n}){const a=n?"There are no model views associated with this part":"Select a part to display model views";return t("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(FileWithMagnifyingGlassImage,{}),e("div",{className:"text-lg text-neutral-700 text-center p-3",children:a})]})}const VertexModelViewsViewRow=({view:n,currentlyViewing:a,itemId:i,onLoadModelView:l,onClearModelView:o})=>{const r=useModelViewActions();return e("div",{"data-testid":`model-view-${n.id}`,onClick:async()=>{a?(await r.clearModelView(),null==o||o()):(await r.loadModelView(i,n),null==l||l(i,n.id))},className:Kt("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)]":a,"hover:bg-[var(--vertex-ui-blue-100)]":!a}),children:t("div",{className:Kt("flex w-full h-full items-center",{"text-neutral-900 font-extrabold":a}),children:[t(R,{className:"flex w-20 grow","data-testid":`model-view-${n.id}-tooltip`,placement:"bottom-start",content:n.displayName,children:[e(F,{name:"views",size:"sm"}),e("div",{className:"truncate mx-2",children:n.displayName}),e("span",{className:"font-normal text-neutral-700 ml-auto pr-1",children:a&&"(Viewing)"})]}),a&&e("div",{className:"ml-auto pr-1",children:e(j,{"data-testid":"model-views-clear-selection",iconSize:"sm",iconName:"close",onClick:async()=>await r.clearModelView()})})]})},n.id)};function VertexModelViewsList({itemId:n,onLoadModelView:a,onClearModelView:i}){const l=useModelViewActions(),o=r(Ca),s=r(xa(n)),c=r(ka(n)),d=p(wa),u=0===s.length;return t("div",{className:"w-full h-full flex flex-col",children:[("hasValue"!==d.state||null!=d.contents)&&t("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("div",{className:"truncate items-center",children:e(R,{content:d.contents,children:e("div",{className:"truncate",children:d.contents||""})})}),"loading"===d.state&&e("div",{className:"flex items-center h-11 w-full",children:e("div",{className:"w-3/4 h-3 bg-neutral-300 animate-pulse rounded"})})]}),u&&e(ModelViewsEmptyState,{itemSelected:!0}),!u&&e("div",{className:"h-full overflow-y-auto",children:e(Qi,{hasMore:c,loadMore:()=>{l.fetchNextModelViews(n)},useWindow:!1,children:s.map((t=>{var l;const r=undefined,s=(null===(l=null==o?void 0:o.modelView)||void 0===l?void 0:l.id.toString())===(null==t?void 0:t.id);return e(VertexModelViewsViewRow,{view:t,currentlyViewing:s,itemId:n,onLoadModelView:a,onClearModelView:i},t.id)}))})})]})}const VertexPMIAnnotationRow=({annotation:n,checked:a,onCheckedChange:i,selected:l,onSelectedChange:o})=>t("div",{"data-testid":`annotation-entry-${n.displayName}`,className:Kt("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)]":l,"hover:bg-[var(--vertex-ui-blue-100)]":!l}),onClick:()=>o(!l),children:[e(L,{"data-testid":`annotation-entry-${n.displayName}-check`,variant:"check",checked:a,onClick:e=>e.stopPropagation(),onValueChanged:e=>{i(e.detail)}}),e("div",{className:"w-1/2 flex-grow",children:e(R,{content:n.displayName,placement:"bottom-start",children:e("div",{className:"truncate",children:n.displayName})})})]}),VertexPMIAnnotationsSecondaryPanel=({modelViewId:n,parentPanelId:a,verticalSiblingId:i,sceneAnnotationOperations:l,onToggleSelectionOfPMIAnnotation:o,onToggleVisibilityOfPMIAnnotation:c})=>{const d=usePmiAnnotationActions(),u=r(et),m=r(Ta(n)),p=r(Pa(n)),h=r(Ma),[f,v]=s(ba(n)),[g,b]=k.useState("");k.useEffect((()=>{n!==g&&(v(m),b(n))}),[m,g,n,v,b]);const toggleVisibilityOfAllAnnotations=e=>{e?(v(m),null==l||l.sceneAnnotationsOperation((e=>e.show()),u)):(v([]),null==l||l.sceneAnnotationsOperation((e=>e.hide()),u))};return e(G,{"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:`#${i}`,children:t("div",{className:"flex flex-col h-full overflow-hidden",children:[e("div",{className:"flex items-center w-full h-9 border-b border-[var(--vertex-ui-neutral-300)] px-4 shrink-0",children:"3D PMI"}),t("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(L,{"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("div",{className:"h-full overflow-y-auto text-[0.8125rem] py-1",children:e(Qi,{hasMore:p,loadMore:async()=>{await d.fetchNextPmiAnnotations(n)},useWindow:!1,children:m.map(((t,a)=>e(VertexPMIAnnotationRow,{annotation:t,checked:f.includes(t),onCheckedChange:e=>{e?(v([...f,t]),null==l||l.sceneAnnotationsOperation((e=>e.show()),u,[t.id])):(v(f.filter((e=>e!==t))),null==l||l.sceneAnnotationsOperation((e=>e.hide()),u,[t.id])),null==c||c(n,t.id,e)},selected:t.id===h,onSelectedChange:async e=>{e?await d.selectPmiAnnotation(t.id):await d.clearPmiAnnotationSelection(),null==o||o(n,t.id,e)}},a)))})})]})})},VertexModelViewsPanelSection=({onLoadModelView:n,onClearModelView:a,onToggleSelectionOfPMIAnnotation:i,onToggleVisibilityOfPMIAnnotation:l})=>{const o=useSceneAnnotationsOperations(),s=r(Un),c=null!=(null==s?void 0:s.id),d=r(Ca),u=(null==d?void 0:d.itemId)===(null==s?void 0:s.id);return t("div",{id:"model-views-panel-wrapper",className:"w-full h-full flex flex-col text-neutral-800",children:[t("div",{"data-testid":"model-views-container",className:"group h-full flex overflow-auto min-h-29 relative",children:[c&&e(k.Suspense,{fallback:e(ModelViewsItemListLoading,{}),children:e(VertexModelViewsList,{itemId:s.id,onLoadModelView:n,onClearModelView:a})}),!c&&e(ModelViewsEmptyState,{itemSelected:!1})]}),null!=d&&u&&e(k.Suspense,{fallback:e(ModelViewsItemListLoading,{}),children:e(VertexPMIAnnotationsSecondaryPanel,{modelViewId:d.modelView.id,parentPanelId:"model-views-panel-wrapper",verticalSiblingId:"model-views-container",sceneAnnotationOperations:o,onToggleSelectionOfPMIAnnotation:i,onToggleVisibilityOfPMIAnnotation:l})})]})};function ModelViewsItemListLoading(){return t("div",{className:"flex flex-col w-full h-full items-center justify-center text-[0.8125rem] overflow-y-auto",children:[e(ee,{"data-testid":"model-views-panel-spinner",size:"lg",color:"grey"}),e("div",{className:"pt-3 px-10 text-center",children:"Loading model views for the selected part..."})]})}function VertexModelViewsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexModelViewsPanelSection,{})})}function ColorSwatchContextMenu({onRemoveCustomColor:n}){const a=useContextMenuActions(),i=useSceneItemMaterialActions(),l=r(en);return e(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(W,{"data-testid":"color-swatch-delete",onClick:async()=>{if(contextMenuItemIsElement(l)&&elementIsColorSwatch(l)){const e=null==l?void 0:l.getAttribute("data-color-id");null!=e&&"true"===l.getAttribute("data-custom-color")?(await i.removeCustomColor(e),null==n||n(e)):null!=e&&"true"===l.getAttribute("data-recent-color")&&await i.removeRecentColor(e)}},children:t("div",{className:"flex align-middle gap-2.5",children:[e(F,{slot:"icon",name:"delete",size:"sm"}),"Delete"]})})})}function DefaultAppearancePanel(){return t("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e(VertexMaterialPanelSection,{}),e(VertexGhostingPanelSection,{}),e(VertexFeatureEdgesPanelSection,{}),e(VertexViewerBackgroundPanelSection,{}),e(VertexSelectionHighlightingPanelSection,{}),e(VertexCrossSectionAppearancePanelSection,{}),e(ColorSwatchContextMenu,{})]})}function DefaultSettingsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:n,onClearAll:a})=>{const i=useTransformActions(),l=useCacheableLoadable(Fn),o=r(Rn),s=useCacheableLoadable(ia(null!=o?o:"")),c=A.useMemo((()=>{var e;const t=null===(e=l.data)||void 0===e?void 0:e.some((e=>{var t;return null!=(null===(t=null==e?void 0:e.override)||void 0===t?void 0:t.transform)})),n=null!=s.data;return t||n}),[l,s]);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e("div",{className:"pt-1"}),e(W,{"data-testid":"clear-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==n||n()},disabled:!c,children:"Clear selected transforms"}),e(W,{"data-testid":"clear-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:n,value:a,step:i,min:l,max:o,disabled:s,testId:c,onBlur:d,onInput:u,onChange:m})=>{const p=A.useRef(null),h=r(Kn),[f,v]=A.useState(!0);A.useEffect((()=>{var e;const t=null!=p.current&&Number.isNaN(p.current.valueAsNumber),n=f||t;null!=p.current&&n?p.current.value=null!==(e=null==a?void 0:a.toFixed(Number(h)))&&void 0!==e?e:"":v(!0)}),[a]);const g=A.useCallback((e=>{v(!1),null==m||m(e)}),[v,m]),b=A.useCallback((e=>{v(!0),null==d||d(e),null!=p.current&&null!=a&&(p.current.value=a.toFixed(Number(h)))}),[d,a,v]);return t("div",{children:[e("div",{className:"truncate rounded-md w-full",children:e("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:i,min:l,max:o,"data-testid":c,disabled:s,defaultValue:Number.isNaN(a)?"":null==a?void 0:a.toFixed(Number(h)),onBlur:b,onInput:u,onChange:g})}),null!=n&&e("div",{className:"flex justify-center items-center pointer-events-none text-neutral-500",children:e("span",{children:n})})]})},VertexTransformInputs=({onUpdateTransform:n})=>{const a=r(Gn),i=r(_n),l=r(Vn),o=i||l,s=r(Rn),{transform:c,error:d,update:u}=useEditItemTransform(s),m=o?void 0:c,p=useDebouncedCallback((async e=>{await u(e),null==n||n(e)}),50);function updateTransform(e){return t=>{if(null!=m){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||null==p||p(Object.assign(Object.assign({},m),e(n,m)))}}}function updatePosition(e){return updateTransform(((t,n)=>({position:Object.assign(Object.assign({},n.position),e(t))})))}function updateRotation(e){return updateTransform(((t,n)=>({rotation:Object.assign(Object.assign({},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),i=undefined;(isNaN(a)||!!(null==t?void 0:t(a)))&&null!=m&&p(Ee.defaults(e,m))}}return t("div",{children:[t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Position"}),t("div",{className:"flex flex-wrap w-full gap-2",children:[t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"X"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-x",value:null!=m?m.position.x:void 0,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({position:{x:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Y"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-y",value:null==m?void 0:m.position.y,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({position:{y:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Z"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-z",value:null==m?void 0:m.position.z,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({position:{z:0}})})})]})]})]}),t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Rotation"}),t("div",{className:"flex flex-wrap w-full gap-2",children:[t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"X"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-x",value:null==m?void 0:m.rotation.x,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{x:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Y"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-y",value:null==m?void 0:m.rotation.y,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{y:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Z"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-z",value:null==m?void 0:m.rotation.z,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{z:0}})})})]})]})]}),t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Scale"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"scale",value:null==m?void 0:m.scale,step:.1,min:.1,disabled:null==m,onChange:updateScale(),onBlur:updateToDefaultValueIfInvalid({scale:1},(e=>e<=0))})}),o&&e("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!=d&&e("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 n=useTransformActions(),a=r(Zn),i=c(oa);return e(L,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:a,onValueChanged:async()=>{a?(n.disableTransformWidget(),null==t||t(!1)):(i("world"),await n.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:a,onUpdateTransform:i}){return t(n,{children:[t("div",{className:"flex items-center py-3",children:[e(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:a}),e("span",{className:"pl-4 text-[0.8125rem] text-neutral-700",children:"Enable manipulator"})]}),e(VertexTransformInputs,{onUpdateTransform:i})]})}function VertexTransformPanelSection({onClearTransforms:n,onClearAllTransforms:a,onToggleTransformsManipulator:i,onUpdateTransform:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e(VertexTransformClear,{onClear:n,onClearAll:a})]}),children:e(VertexTransformControls,{onToggleTransformsManipulator:i,onUpdateTransform:l})})}function DefaultTransformsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexTransformPanelSection,{})})}const tl="Appearance",nl="Model Views",al="Settings",il="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:n})=>{const a=r(si),i=getHeading(a,n),l=undefined;return e("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:t("div",{className:"flex items-center w-full leading-6 text-md align-center font-medium text-neutral-800 gap-2",children:[i,"model-views"===a&&e(BetaLabel,{})]})})};function getHeading(e,t={}){switch(e){case"appearance":return tl;case"model-views":return nl;case"settings":return al;case"transforms":return il;default:const n=null!=e?t[e]:void 0;return null!=n?n:"None"}}function VertexViewerRightOpenedPanel({children:a}){const i=r(si),l=A.useMemo((()=>filterChildElements(a,CustomPanelContent)),[a]),o=A.useMemo((()=>l.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.props.panelName]:t.props.panelTitle})),{})),[l]),s=A.useMemo((()=>["appearance","model-views","settings","transforms",...l.map((e=>e.props.panelName))]),[l]);return e(n,{children:null!=i&&s.includes(i)&&t(VertexResizableContent,{displayShadow:!0,heading:e(ViewerRightPanelHeader,{additionalHeaderMap:o}),placement:"right",children:["appearance"===i&&e(DefaultAppearancePanel,{}),"transforms"===i&&e(DefaultTransformsPanel,{}),"settings"===i&&e(DefaultSettingsPanel,{}),"model-views"===i&&e(VertexModelViewsPanel,{}),a]})})}function CustomPanelContent({panelName:t,children:a}){const i=r(si);return e(n,{children:i===t&&a})}function Sidebar({children:t}){return e("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:n,iconName:a,active:i,responsive:l,disabled:o,content:r,tooltipPlacement:s,children:c,onSelect:d,onDeselect:u}){return e("div",{className:Kt({"text-[var(--vertex-ui-blue-700)]":i===n&&!o,"text-neutral-700 hover:text-neutral-800":i!==n&&!o,"cursor-pointer hover:bg-neutral-200":!o,"text-neutral-400":o,"rounded-full md:p-3":l,"p-3":!l&&null==c,"px-3 py-1":null!=c}),"data-testid":`${n}-sidebar-panel`,onClick:()=>{o||(i===n?u():d())},children:t(R,{placement:null!=s?s:void 0,content:A.isValidElement(r)?void 0:r,children:[e("div",{slot:"content",children:r}),e("div",{className:"flex flex-col",children:null!=c?c:e(F,{name:a})})]})})}function VertexViewerRightSidebar({children:n}){const a=usePanelActions(),i=useTransformActions(),l=r(si);return e("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:t(Sidebar,{children:[n,e(SidebarIcon,{name:"appearance",active:l,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{a.openPrimary("appearance","right")},onDeselect:()=>a.closePrimary("right")}),e(SidebarIcon,{name:"transforms",active:l,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{a.openPrimary("transforms","right"),await i.enableTransformWidget(void 0,!0)},onDeselect:()=>a.closePrimary("right")}),e(SidebarIcon,{name:"model-views",active:l,iconName:"views",tooltipPlacement:"right",content:"Model Views",onSelect:async()=>{a.openPrimary("model-views","right")},onDeselect:()=>a.closePrimary("right")}),e(SidebarIcon,{name:"settings",active:l,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{a.openPrimary("settings","right")},onDeselect:()=>a.closePrimary("right")})]})})}function CustomPanelIcon(t){const n=usePanelActions(),a=r(si),{panelName:i,tooltipContent:l,iconName:o}=t,s=__rest(t,["panelName","tooltipContent","iconName"]);if(null==o&&null==s.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e(SidebarIcon,Object.assign({},s,{name:i,iconName:null!=o?o:"help",active:a,content:l,onSelect:()=>{n.openPrimary(t.panelName,"right")},onDeselect:()=>{n.closePrimary("right")}}))}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=a=>{var{open:i,children:l}=a,o=__rest(a,["open","children"]);const r=l.find((e=>e.type===Anchor)),s=l.filter((e=>e.type!==Anchor));return null==r?e(n,{}):t(Z,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(i)},o,{children:[r,e("div",{className:Kt("flex mb-1.5",{hidden:!i}),"data-testid":"align-plane-popover-menu",children:s})]}))},Anchor=({tooltipContent:t,children:n})=>e("div",{slot:"anchor",children:e(R,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu({disabled:n}){const a=useCrossSectioningActions(),i=r(Vt),l=r(kt),getBaseIcon=()=>`align-to-${null==l?void 0:l.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:a.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==l?void 0:l.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==l?void 0:l.hitPending)},[null==l?void 0:l.hitPending]),t(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:a.closeAlignmentTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e(j,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:i?a.closeAlignmentTools:a.openAlignmentTools,disabled:n,children:e(F,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),t(fe,{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(j,{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("div",{className:"text-base ml-2",children:"Align to Global"})}),e(j,{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("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu({disabled:n}){const a=useCrossSectioningActions(),i=r(_t),l=r(xt),o=p(Mt),s=A.useMemo((()=>{const e=l.length>0&&"hasValue"===o.state?axis(l[0],xAxis(o.contents),yAxis(o.contents),zAxis(o.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[o.state,o.contents,l]);return t(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:a.closeAxisTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e(j,{onClick:i?a.closeAxisTools:a.openAxisTools,iconName:s,"data-testid":"align-plane-icon",iconColor:"secondary",disabled:n,children:e(F,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),t(fe,{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(j,{"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("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e(j,{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("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e(j,{"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("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:n,disabled:a,onOffsetChange:i}){const l=r(Gn),o=r(Kn),[s,c]=A.useState(convertTo(n,l));A.useEffect((()=>{c(convertTo(n,l))}),[l,n]);const d=createDistanceFormatter(l,parseInt(o,10)),handleIncrementalUpdate=e=>{const t=convertFrom(s+e,l);i(t)},u=undefined,handleBlur=()=>{i(convertFrom(s,l))};return e(R,{content:"Plane Offset",children:e("form",{"data-testid":"cross-section-stepper-form",onSubmit:e=>{e.preventDefault(),i(convertFrom(s,l))},children:t(J,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:d(parseFloat(n.toFixed(3))),onInputInput:e=>{c(null!=e.detail.value?parseFloat(e.detail.value):n)},onBlur:handleBlur,disabled:a,children:[e("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>{a||handleIncrementalUpdate(-1)},children:e(F,{name:"chevron-left",size:"sm"})}),e("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>{a||handleIncrementalUpdate(1)},children:e(F,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const ll=400;function VertexViewerCrossSectionPopupMenu(){const n=useCrossSectioningActions(),a=r(Ot),i=p(It),l=p(Nt),o=A.useRef(),s=A.useMemo((()=>"hasValue"===i.state&&Number.isFinite(i.contents.max)&&Number.isFinite(i.contents.min)),[i.state,i.contents]),c=A.useMemo((()=>"hasValue"===i.state?i.contents:ft),[i.state,i.contents]),d=A.useMemo((()=>"hasValue"===l.state&&Number.isFinite(l.contents)?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(o.current),o.current=window.setTimeout((()=>{n.endInteraction()}),ll),n.beginInteraction(),n.updatePlanes(e)};return t(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:n.closeAdditionalTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e("div",{className:"-ml-px py-1.5",children:e(F,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?n.closeAdditionalTools:n.openAdditionalTools})})}),t(fe,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexViewerCrossSectionAlignmentPopoverMenu,{disabled:!s}),e(R,{className:"w-auto",content:"Reverse",children:e(j,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:n.flipPlanes,iconColor:"secondary",disabled:!s})}),e(R,{className:"w-auto",content:"Align View to Plane",children:e(j,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:n.alignViewToPlane,iconColor:"secondary",disabled:!s})}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionAxisPopoverMenu,{disabled:!s}),e("div",{className:"w-52 mx-2",children:e(VertexSlider,{value:d,defaultValue:c.default,disabled:asBooleanAttribute("hasValue"!==i.state)||!s,min:c.min,max:c.max,step:.01,onChange:handleCrossSectionValueChange})}),e("div",{className:"px-4",children:e(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state&&s?l.contents:0,disabled:!s,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const a=useCrossSectioningActions(),i=r(vt);return t(n,{children:[e(R,{content:i?"Hide Section":"Show Section",children:e(j,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:i?"primary":"secondary",onClick:()=>i?a.disable():a.enable()})}),e(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=r(et);return e(R,{content:"Fit All",children:e(j,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(null==t?void 0:t.scene());await(null==e?void 0:e.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=r(et),n=r(nt),[a,i]=s(it),[l,o]=s(at);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(R,{content:"Pan",children:e(j,{iconName:"pan",iconColor:"pan"===a?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(i("pan"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=r(et),n=r(nt),[a,i]=s(it),[l,o]=s(at);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(R,{content:"Rotate",children:e(j,{iconName:"rotate",iconColor:"rotate"===a?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(i("rotate"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=r(et),n=r(nt),[a,i]=s(it),[l,o]=s(at);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(R,{content:"Zoom",children:e(j,{iconName:"zoom",iconColor:"zoom"===a?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(i("zoom"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e(ve,{placement:"bottom-center",children:t(fe,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexRotateButton,{}),e(VertexPanButton,{}),e(VertexZoomButton,{}),e(VertexFitAllButton,{}),e(VertexToolbarDivider,{}),e(VertexBoxSelectionButton,{}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionButton,{}),e(VertexToolbarDivider,{}),e(VertexPointToPointMeasurementTool,{}),e(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({endCapEnabledByDefault:t,children:n})=>{const a=c(wt),i=c(bt);A.useEffect((()=>{null!=t&&(a(t),i(t))}),[t]);const l=undefined;return e(ve,{placement:"bottom-center",children:null!=n&&!1!==n?e(fe,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:n}):e(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:i,onRotationChange:l}){const o=useTransformActions(),s=r(na),c=r(Zn),d=r(Jn),u=r(ta),m=p(ea),h=r(Gn),f=r(Kn),v=A.useMemo((()=>"hasValue"===m.state?m.contents:u),[m,u]),g=A.useMemo((()=>{const e=undefined;return c&&(null!=v||s)}),[c,v,s]);return e(n,{children:g&&e(ge,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?v:void 0,decimalPlaces:parseInt(f,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:null==a||a,onInteractionStarted:()=>{o.disableSelectionSync(),o.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{o.invalidateTransforms(),o.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await o.setTransformWidgetPosition(e.detail),null==i||i(e.detail)},onRotationChanged:e=>{o.setTransformWidgetOrientation(e.detail),null==l||l(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),i=useTransformActions(),l=useViewerSceneActions(),o=undefined;return e(R,{content:"Reset View",children:e(j,{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:async()=>{await n.disable(),await a.resetSelectionState(),i.clearTransformWidgetPosition(),await i.invalidateTransforms(),null==t||t(),await l.reset()},variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(Dn);t(ot,a.detail.scene),t(Dn,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(jn,i);const l=undefined;await n.getPromise(Zn)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:n}=useCallbackRef(),a=useBoxSelectionActions(),i=useTransformActions(),l=r(on);return k.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===l&&(i.clearTransformWidgetOrientation(),i.clearTransformWidgetPosition(),i.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,l]),useApplyKeyBinding({keyBind:"Shift",fn:k.useCallback((()=>a.setOperationType("select")),[]),off:k.useCallback((()=>a.setOperationType("clearAndSelect")),[])}),e(ye,{ref:n,"data-testid":"viewer-box-query-tool",operationType:l})};function VertexViewerCameraTypeMenu({open:n,onOpen:a,onDismiss:i,onCameraTypeChange:l}){const o=useViewerCameraActions(),s=r(Qe);return t(K,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(n),onMenuClosed:i,children:[e("div",{slot:"anchor",children:e("div",{className:Kt("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!n,"opacity-100 text-neutral-700 bg-neutral-200":n}),children:e(R,{content:"Change View",children:e(j,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===s?"cube-orthographic":"cube-perspective",children:e(F,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),t("div",{className:"w-36",children:[e("div",{className:"pt-1"}),t(W,{"data-testid":"set-perspective-view",onClick:()=>{o.updateCameraType("perspective",!0),null==l||l("perspective")},children:[e(F,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:Kt({"text-[var(--vertex-ui-blue-700)]":"perspective"===s})}),e("div",{className:Kt("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===s}),children:"Perspective"})]}),t(W,{"data-testid":"set-orthographic-view",onClick:()=>{o.updateCameraType("orthographic",!0),null==l||l("orthographic")},children:[e(F,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:Kt({"text-[var(--vertex-ui-blue-700)]":"orthographic"===s})}),e("div",{className:Kt("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===s}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=n=>{var{placement:a,children:i}=n,l=__rest(n,["placement","children"]);const o=Array.isArray(i)?i:[i],r=o.filter((e=>!A.isValidElement(e)||e.type!==be)).filter((e=>null!=e&&!1!==e)),s=o.find((e=>A.isValidElement(e)&&e.type===be)),[c,d]=A.useState(!1);return t(ve,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=a?a:"top-right",children:[null!=s?s:e(be,Object.assign({className:"m-7"},l)),0===r.length?t("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e(VertexViewerSceneReset,{}),e(VertexViewerCameraTypeMenu,{open:c,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e("div",{className:"mt-3",children:r})]})},VertexViewer=a=>{var{id:i,src:l,className:o,disableSelection:d,onTap:u,onLongpress:m,onFrameDrawn:p,onSceneReady:h,viewerRefCallback:f,children:v}=a,g=__rest(a,["id","src","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const b=r(Ai),w=useRecoilRef({state:et}),C=useViewerCameraActions(),S=useCrossSectioningActions(),k=useHitActions(),T=useSelectionActions(),P=useViewerFrameActions(),M=r(Qe),E=r(kt),I=r(ln),N=c(lt),[O,V]=s(nt);A.useEffect((()=>{O&&(V(!1),S.disable())}),[l]);const[_,L]=s(tt);A.useEffect((()=>{null!=i&&L(i)}),[i]);const R=r(wi),j=A.useMemo((()=>({opacity:R/100})),[R]),D=r(Yt),B=r(Xt),H=A.useMemo((()=>({color:D,width:B})),[D,B]),F=r(wt),U=r(Ct),W=r(St),G=A.useMemo((()=>Object.assign({endCapEnabled:F,endCapUsePartColor:U===ut.PART},F&&U===ut.SINGLE&&{endCapColor:W})),[F,U,W]),K=r(ni),$=r(Ja),q=r(Qa),Y=r(ei),X=A.useMemo((()=>({color:$,opacity:q/100,lineWidth:Y})),[$,q,Y]),Z=r(mn),J=null!=v&&!1!==v;return useKeyBindings(),useDefaultKeybindings(),t(we,Object.assign({id:_,"data-testid":"vertex-viewer",src:l,ref:e=>{null==f||f(e),w(e)},className:Kt("flex w-full h-full",o,{"cursor-crosshair":E.hitPending}),style:{"--viewer-background":K},config:b,cameraType:O?M:void 0,onCameraTypeChanged:e=>{O&&C.updateCameraType(e.detail,!1)},phantom:j,featureLines:H,selectionHighlighting:X,crossSectioning:G,featureMaps:Z?"final":void 0,onTap:e=>{const t=[...d?[]:[T.selectCurrentHit]];k.tap(e,...t),null==u||u(e)},onLongpress:e=>{k.longPress(e),null==m||m(e)},onFrameDrawn:e=>{P.frameDrawn(e),null==p||p(e)},onSceneReady:async e=>{var t;if(!O){V(!0);const n=await(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.scene());N(null==n?void 0:n.sceneViewId)}null==h||h(e)}},g,{children:[I&&e(VertexBoxSelectionTool,{}),J?v:t(n,{children:[e(VertexViewerViewCube,{}),e(VertexToolbar,{}),e(VertexViewerContextMenu,{})]})]}))};function toSdkConfig(e){return isOnlyNetworkConfig(e)?{network:e}:e}function isOnlyNetworkConfig(e){const t=undefined;return null!=e.renderingHost}const VertexViewerToolkitEventListener=({onHitStateChange:t,onSelectionStateChange:a})=>{const i=r(pa),l=r(La);return A.useEffect((()=>{null==t||t(i)}),[i,t]),A.useEffect((()=>{null==a||a(l)}),[l,a]),e(n,{})},VertexViewerToolkitRoot=a=>{var{override:i,autoDefineCustomElements:l,children:o,config:r}=a,s=__rest(a,["override","autoDefineCustomElements","children","config"]);return A.useEffect((()=>{(null==l||l)&&(xe(),Se())}),[l]),e(f,{override:i,children:t(n,{children:[e(VertexViewerToolkitEventListener,Object.assign({},s)),e(VertexViewerToolkitRootConfig,{config:r,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const i=c(Ai);return A.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;i(e)}),[t,i]),e(n,{children:a})};var ol=Object.freeze({__proto__:null,get AssemblyFontFace(){return qi},Columns:Di,Core:_a,Metadata:Zi,Search:$i});export{ai as Appearance,rn as BoxSelection,Ti as Config,an as ContextMenu,Ut as CrossSection,ki as Ghosting,ha as Hits,oi as Keybinding,xn as Measurement,Ze as Messages,yi as Metadata,el as ModelViews,di as Panel,Tn as Performance,ol as SceneTree,Wn as SceneViewItem,Ra as Selection,$n as Settings,ma as Transforms,VertexApplicationMessages,VertexBoxSelectionButton,VertexContextMenu,VertexCrossSectionAppearanceColorPicker,VertexCrossSectionAppearanceControls,VertexCrossSectionAppearanceLineThicknessSlider,VertexCrossSectionAppearancePanelSection,VertexCrossSectionAppearanceReset,VertexDecimalPlaceSelector,VertexFeatureEdgesColorPicker,VertexFeatureEdgesControls,VertexFeatureEdgesPanelSection,VertexFeatureEdgesReset,VertexFeatureEdgesThicknessSlider,VertexFitAllButton,VertexFitSelectedMenuItem,VertexFlyToMenuItem,VertexGhostingControls,VertexGhostingPanelSection,VertexHideAllMenuItem,VertexHidePartMenuItem,VertexHideSelectedMenuItem,VertexLengthUnitSelector,VertexMaterialControls,VertexMaterialPanelSection,VertexMeasurementContextMenu,VertexMeasurementDetails,VertexModelViewsPanel,VertexPanButton,VertexPointToPointMeasurement,VertexPointToPointMeasurementTool,VertexPreciseMeasurement,VertexPreciseMeasurementTool,VertexResizableContent,VertexRotateButton,VertexSceneItemGhostingClear,VertexSceneItemGhostingOpacitySlider,VertexSceneItemGhostingToggle,VertexSceneItemMaterialClear,VertexSceneItemMaterialColorPicker,VertexSceneItemMaterialColorSwatches,VertexSceneItemMaterialOpacitySlider,VertexSceneTree,VertexSceneTreeColumnPopover,VertexSceneTreeContextMenu,VertexSceneTreeCustomColumn,VertexSceneTreeHeader,VertexSceneTreeMetadataColumns,VertexSceneTreeSearchBar,VertexSceneTreeSearchInformationForToolbar,VertexSceneTreeSearchOptionsPopover,VertexSceneTreeTableLayout,VertexSelectionHighlightingColorPicker,VertexSelectionHighlightingControls,VertexSelectionHighlightingLineThicknessSlider,VertexSelectionHighlightingOpacitySlider,VertexSelectionHighlightingPanelSection,VertexSelectionHighlightingReset,VertexShowAllMenuItem,VertexShowOnlyMenuItem,VertexShowOnlySelectedMenuItem,VertexShowPropertiesMenuItem,VertexToolbar,VertexToolbarDivider,VertexTransformClear,VertexTransformControls,VertexTransformInputs,VertexTransformManipulatorToggle,VertexTransformPanelSection,VertexTransformWidget,VertexUnitsControls,VertexUnitsPanelSection,VertexViewer,VertexViewerBackgroundColorPicker,VertexViewerBackgroundControls,VertexViewerBackgroundPanelSection,VertexViewerBackgroundReset,VertexViewerContextMenu,VertexViewerCrossSectionButton,VertexViewerRightOpenedPanel,VertexViewerRightSidebar,VertexViewerSceneReset,VertexViewerToolkitRoot,VertexViewerViewCube,VertexZoomButton,st as Viewer};
19
19
  //# sourceMappingURL=bundle.esm.js.map