@vertexvis/viewer-toolkit-react 0.0.3-canary.9 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/bundle.esm.js.map +1 -1
- package/dist/components/measurement/__tests__/measurement-context-menu.spec.d.ts +1 -0
- package/dist/components/measurement/__tests__/point-to-point-measurement-tool.spec.d.ts +1 -0
- package/dist/components/measurement/__tests__/point-to-point-measurement.spec.d.ts +1 -0
- package/dist/components/measurement/__tests__/precise-measurement-tool.spec.d.ts +1 -0
- package/dist/components/measurement/__tests__/precise-measurement.spec.d.ts +1 -0
- package/dist/components/measurement/measurement-context-menu.d.ts +5 -0
- package/dist/components/measurement/measurement-details.d.ts +5 -0
- package/dist/components/measurement/point-to-point-measurement-tool.d.ts +1 -0
- package/dist/components/measurement/point-to-point-measurement.d.ts +7 -0
- package/dist/components/measurement/precise-measurement-tool.d.ts +1 -0
- package/dist/components/measurement/precise-measurement.d.ts +8 -0
- package/dist/components/scene-tree/scene-tree-columns/__tests__/scene-tree-columns-popover.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-columns/scene-tree-columns-popover.d.ts +4 -0
- package/dist/components/scene-tree/scene-tree-columns/scene-tree-metadata-check.d.ts +8 -0
- package/dist/components/scene-tree/scene-tree-search/__tests__/enter-scene-tree-search-mode-button.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/__tests__/scene-tree-search-bar.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/__tests__/scene-tree-search-information-for-toolbar.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/__tests__/scene-tree-search-options-popover.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/enter-scene-tree-search-mode-button.d.ts +4 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search-bar.d.ts +10 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search-information-for-toolbar.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search-options-popover.d.ts +5 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search.d.ts +11 -0
- package/dist/components/scene-tree/scene-tree-toolbar/scene-tree-toolbar.d.ts +4 -1
- package/dist/components/scene-tree/vertex-scene-tree-header.d.ts +6 -1
- package/dist/components/settings/__tests__/units-panel-section.spec.d.ts +1 -0
- package/dist/components/settings/decimal-place-selector.d.ts +4 -0
- package/dist/components/settings/length-unit-selector.d.ts +4 -0
- package/dist/components/settings/units-controls.d.ts +5 -0
- package/dist/components/settings/units-panel-section.d.ts +5 -0
- package/dist/components/sidebar/viewer-right-sidebar/__tests__/viewer-right-sidebar.spec.d.ts +1 -0
- package/dist/components/sidebar/viewer-right-sidebar/settings-panel.d.ts +1 -0
- package/dist/components/sidebar/viewer-right-sidebar/viewer-right-panel-header.d.ts +1 -0
- package/dist/components/toolbar/cross-section/cross-section-offset-stepper.d.ts +1 -4
- package/dist/components/toolbar/cross-section/cross-section-popup-menu.d.ts +1 -6
- package/dist/components/toolbar/cross-section/cross-section.d.ts +1 -6
- package/dist/components/toolbar/toolbar-divider.d.ts +1 -1
- package/dist/components/transforms/transform-widget.d.ts +1 -4
- package/dist/index.css +2 -2
- package/dist/index.d.ts +16 -2
- package/dist/state/context-menu/context-menu.d.ts +1 -1
- package/dist/state/measurement/actions.d.ts +19 -0
- package/dist/state/measurement/index.d.ts +4 -0
- package/dist/state/measurement/measurement.d.ts +6 -0
- package/dist/state/measurement/point-to-point-measurement.d.ts +11 -0
- package/dist/state/measurement/precise-measurement.d.ts +8 -0
- package/dist/state/panel/panel.d.ts +1 -1
- package/dist/state/scene-tree/columns/actions.d.ts +4 -0
- package/dist/state/scene-tree/columns/columns.d.ts +4 -3
- package/dist/state/scene-tree/columns/index.d.ts +2 -0
- package/dist/state/scene-tree/columns/open-column-popover.d.ts +21 -0
- package/dist/state/scene-tree/core/core.d.ts +1 -2
- package/dist/state/scene-tree/search/actions.d.ts +7 -0
- package/dist/state/scene-tree/search/index.d.ts +2 -0
- package/dist/state/scene-tree/search/search.d.ts +13 -0
- package/dist/state/settings/index.d.ts +1 -0
- package/dist/state/settings/settings.d.ts +2 -0
- package/dist/state/viewer/core/core.d.ts +1 -0
- package/dist/util/logging/__tests__/logger.spec.d.ts +1 -0
- package/dist/util/logging/index.d.ts +1 -0
- package/dist/util/logging/logger.d.ts +8 -0
- package/dist/util/popover/popover.d.ts +3 -0
- package/package.json +6 -5
package/dist/bundle.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import i from"react";import a from"react-dom";import{Vector3 as r,BoundingBox as s,Angle as l,Point as c}from"@vertexvis/geometry";import{VertexColorPicker as u,VertexSlider as d,VertexTooltip as p,VertexIconButton as f,VertexDialog as h,VertexToggle as m,VertexButton as g,VertexDropdownMenu as v,VertexIcon as b,VertexMenuItem as S,VertexResizable as w,VertexMenu as _,VertexMenuDivider as A,VertexBanner as C,VertexToast as E,VertexPopover as T,VertexTextfield as k}from"@vertexvis/ui-react";import N from"classnames";import{ColorMaterial as R}from"@vertexvis/viewer";import{VertexSceneTreeToolbar as V,VertexSceneTreeSearch as P,VertexSceneTreeTableLayout as O,VertexSceneTreeTableColumn as L,VertexSceneTree as I,VertexViewerToolbarGroup as M,VertexViewerToolbar as D,VertexViewerTransformWidget as B,VertexViewerBoxQueryTool as U,VertexViewerViewCube as F,VertexViewer as j}from"@vertexvis/viewer-react";import{defineCustomElements as H}from"@vertexvis/ui/loader";import{defineCustomElements as W}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 __)}function __rest(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]]);return n}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o=n.call(e),i,a=[],r;try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}"function"==typeof SuppressedError&&SuppressedError;var G={exports:{}},$;function tryStringify(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}function format$1(e,t,n){var o=n&&n.stringify||tryStringify,i=1;if("object"==typeof e&&null!==e){var a=t.length+1;if(1===a)return e;var r=new Array(a);r[0]=o(e);for(var s=1;s<a;s++)r[s]=o(t[s]);return r.join(" ")}if("string"!=typeof e)return e;var l=t.length;if(0===l)return e;for(var c="",u=0,d=-1,p=e&&e.length||0,f=0;f<p;){if(37===e.charCodeAt(f)&&f+1<p){switch(d=d>-1?d:0,e.charCodeAt(f+1)){case 100:case 102:if(u>=l)break;if(null==t[u])break;d<f&&(c+=e.slice(d,f)),c+=Number(t[u]),d=f+2,f++;break;case 105:if(u>=l)break;if(null==t[u])break;d<f&&(c+=e.slice(d,f)),c+=Math.floor(Number(t[u])),d=f+2,f++;break;case 79:case 111:case 106:if(u>=l)break;if(void 0===t[u])break;d<f&&(c+=e.slice(d,f));var h=typeof t[u];if("string"===h){c+="'"+t[u]+"'",d=f+2,f++;break}if("function"===h){c+=t[u].name||"<anonymous>",d=f+2,f++;break}c+=o(t[u]),d=f+2,f++;break;case 115:if(u>=l)break;d<f&&(c+=e.slice(d,f)),c+=String(t[u]),d=f+2,f++;break;case 37:d<f&&(c+=e.slice(d,f)),c+="%",d=f+2,f++,u--}++u}++f}return-1===d?e:(d<p&&(c+=e.slice(d)),c)}const K=format$1;G.exports=pino;const q=pfGlobalThisOrFallback().console||{},Y={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 Z=Symbol("pino.logFuncs"),X=Symbol("pino.hierarchy"),J={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[X]};t[X]=n}function setupBaseLogFunctions(e,t,n){const o={};t.forEach((e=>{o[e]=n[e]?n[e]:q[e]||q[J[e]||"log"]||noop})),e[Z]=o}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||q;e.browser.write&&(e.browser.asObject=!0);const o=e.serializers||{},i=shouldSerialize(e.browser.serialize,o);let a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);const r=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(r);"function"==typeof n&&s.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const l=e.level||"info",c=Object.create(n);c.log||(c.log=noop),setupBaseLogFunctions(c,s,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const u={transmit:t,serialize:i,asObject:e.browser.asObject,formatters:e.browser.formatters,levels:s,timestamp:getTimeFunction(e),messageKey:e.messageKey||"msg",onChild:e.onChild||noop};function getLevelVal(){return levelToValue(this.level,this)}function getLevel(){return this._level}function setLevel(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set(this,u,c,"error"),set(this,u,c,"fatal"),set(this,u,c,"warn"),set(this,u,c,"info"),set(this,u,c,"debug"),set(this,u,c,"trace"),r.forEach((e=>{set(this,u,c,e)}))}function child(n,a,r){if(!a)throw new Error("missing bindings for child Pino");r=r||{},i&&a.serializers&&(r.serializers=a.serializers);const s=r.serializers;if(i&&s){var l=Object.assign({},o,s),c=!0===e.browser.serialize?Object.keys(l):i;delete a.serializers,applySerializers([a],c,l,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=a,l&&(this.serializers=l,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,a)))}Child.prototype=this;const u=new Child(this);return appendChildLogger(this,u),u.child=function(...e){return child.call(this,n,...e)},u.level=r.level||this.level,n.onChild(u),u}return c.levels=getLevels(e),c.level=l,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=o,c._serialize=i,c._stdErrSerialize=a,c.child=function(...e){return child.call(this,u,...e)},t&&(c._logEvent=createLogEventShape()),c}function getLevels(e){const t=e.customLevels||{},n=undefined,o=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[X];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}function set(e,t,n,o){if(Object.defineProperty(e,o,{value:levelToValue(e.level,n)>levelToValue(o,n)?noop:n[Z][o],writable:!0,enumerable:!0,configurable:!0}),e[o]===noop){if(!t.transmit)return;const i=undefined,a=levelToValue(t.transmit.level||e.level,n),r=undefined;if(levelToValue(o,n)<a)return}e[o]=createWrap(e,t,n,o);const i=getBindingChain(e);0!==i.length&&(e[o]=prependBindingsInArguments(i,e[o]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,o){return i=e[Z][o],function LOG(){const a=t.timestamp(),r=new Array(arguments.length),s=Object.getPrototypeOf&&Object.getPrototypeOf(this)===q?q:this;for(var l=0;l<r.length;l++)r[l]=arguments[l];var c=!1;if(t.serialize&&(applySerializers(r,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?i.call(s,asObject(this,o,r,a,t)):i.apply(s,r),t.transmit){const i=void 0,s=levelToValue(t.transmit.level||e._level,n),l=levelToValue(o,n);if(l<s)return;transmit(this,{ts:a,methodLevel:o,methodValue:l,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},r,c)}};var i}function asObject(e,t,n,o,i){const{level:a,log:r=e=>e}=i.formatters||{},s=n.slice();let l=s[0];const c={};if(o&&(c.time=o),a){const n=a(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];let u=1+(0|e._childLevel);if(u<1&&(u=1),null!==l&&"object"==typeof l){for(;u--&&"object"==typeof s[0];)Object.assign(c,s.shift());l=s.length?K(s.shift(),s):void 0}else"string"==typeof l&&(l=K(s.shift(),s));void 0!==l&&(c[i.messageKey]=l);const d=undefined;return r(c)}function applySerializers(e,t,n,o){for(const i in e)if(o&&e[i]instanceof Error)e[i]=pino.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(const o in e[i])t.indexOf(o)>-1&&o in n&&(e[i][o]=n[o](e[i][o]))}function transmit(e,t,n,o=!1){const i=t.send,a=t.ts,r=t.methodLevel,s=t.methodValue,l=t.val,c=e._logEvent.bindings;o||applySerializers(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=a,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=r,e._logEvent.level.value=s,i(r,e._logEvent,l),e._logEvent=createLogEventShape(c)}function createLogEventShape(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function asErrValue(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function getTimeFunction(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?nullTime:epochTime}function mock(){return{}}function passthrough(e){return e}function noop(){}function nullTime(){return!1}function epochTime(){return Date.now()}function unixTime(){return Math.round(Date.now()/1e3)}function isoTime(){return new Date(Date.now()).toISOString()}function pfGlobalThisOrFallback(){function defd(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return defd(self)||defd(window)||defd(this)||{}}}var Q;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=Y,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),G.exports.default=pino,G.exports.pino=pino;const ee=(0,G.exports)({formatters:{level:e=>({level:e})}}),te={error:(e,t)=>{null!=t?ee.error(t,e):ee.error(e)},info:(e,t)=>{null!=t?ee.info(t,e):ee.info(e)},warn:(e,t)=>{null!=t?ee.warn(t,e):ee.warn(e)},debug:(e,t)=>{null!=t?ee.debug(t,e):ee.debug(e)}};var ne=te;function err(e){const t=new Error(e);if(void 0===t.stack)try{throw t}catch(e){}return t}var oe,ie=err;function isPromise(e){return!!e&&"function"==typeof e.then}var ae=isPromise;function nullthrows(e,t){if(null!=e)return e;throw ie(null!=t?t:"Got unexpected null or undefined")}var re=nullthrows;function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class se{getValue(){throw ie("BaseLoadable")}toPromise(){throw ie("BaseLoadable")}valueMaybe(){throw ie("BaseLoadable")}valueOrThrow(){throw ie(`Loadable expected value, but in "${this.state}" state`)}promiseMaybe(){throw ie("BaseLoadable")}promiseOrThrow(){throw ie(`Loadable expected promise, but in "${this.state}" state`)}errorMaybe(){throw ie("BaseLoadable")}errorOrThrow(){throw ie(`Loadable expected error, but in "${this.state}" state`)}is(e){return e.state===this.state&&e.contents===this.contents}map(e){throw ie("BaseLoadable")}}class le extends se{constructor(e){super(),_defineProperty(this,"state","hasValue"),_defineProperty(this,"contents",void 0),this.contents=e}getValue(){return this.contents}toPromise(){return Promise.resolve(this.contents)}valueMaybe(){return this.contents}valueOrThrow(){return this.contents}promiseMaybe(){}errorMaybe(){}map(e){try{const t=e(this.contents);return ae(t)?loadableWithPromise(t):isLoadable(t)?t:loadableWithValue(t)}catch(t){return ae(t)?loadableWithPromise(t.next((()=>this.map(e)))):loadableWithError(t)}}}class ce extends se{constructor(e){super(),_defineProperty(this,"state","hasError"),_defineProperty(this,"contents",void 0),this.contents=e}getValue(){throw this.contents}toPromise(){return Promise.reject(this.contents)}valueMaybe(){}promiseMaybe(){}errorMaybe(){return this.contents}errorOrThrow(){return this.contents}map(e){return this}}class ue extends se{constructor(e){super(),_defineProperty(this,"state","loading"),_defineProperty(this,"contents",void 0),this.contents=e}getValue(){throw this.contents}toPromise(){return this.contents}valueMaybe(){}promiseMaybe(){return this.contents}promiseOrThrow(){return this.contents}errorMaybe(){}map(e){return loadableWithPromise(this.contents.then((t=>{const n=e(t);if(isLoadable(n)){const e=n;switch(e.state){case"hasValue":case"loading":return e.contents;case"hasError":throw e.contents}}return n})).catch((t=>{if(ae(t))return t.then((()=>this.map(e).contents));throw t})))}}function loadableWithValue(e){return Object.freeze(new le(e))}function loadableWithError(e){return Object.freeze(new ce(e))}function loadableWithPromise(e){return Object.freeze(new ue(e))}function loadableLoading(){return Object.freeze(new ue(new Promise((()=>{}))))}function loadableAllArray(e){return e.every((e=>"hasValue"===e.state))?loadableWithValue(e.map((e=>e.contents))):e.some((e=>"hasError"===e.state))?loadableWithError(re(e.find((e=>"hasError"===e.state)),"Invalid loadable passed to loadableAll").contents):loadableWithPromise(Promise.all(e.map((e=>e.contents))))}function loadableAll(e){const t=undefined,n=(Array.isArray(e)?e:Object.getOwnPropertyNames(e).map((t=>e[t]))).map((e=>isLoadable(e)?e:ae(e)?loadableWithPromise(e):loadableWithValue(e))),o=loadableAllArray(n);return Array.isArray(e)?o:o.map((t=>Object.getOwnPropertyNames(e).reduce(((e,n,o)=>({...e,[n]:t[o]})),{})))}function isLoadable(e){return e instanceof se}const de={of:e=>ae(e)?loadableWithPromise(e):isLoadable(e)?e:loadableWithValue(e),error:e=>loadableWithError(e),loading:()=>loadableLoading(),all:loadableAll,isLoadable:isLoadable};var pe={loadableWithValue:loadableWithValue,loadableWithError:loadableWithError,loadableWithPromise:loadableWithPromise,loadableLoading:loadableLoading,loadableAll:loadableAll,isLoadable:isLoadable,RecoilLoadable:de},fe=pe.loadableWithValue,he=pe.loadableWithError,me=pe.loadableWithPromise,ge=pe.loadableLoading,ve=pe.loadableAll,ye=pe.isLoadable,be=pe.RecoilLoadable,Se=Object.freeze({__proto__:null,loadableWithValue:fe,loadableWithError:he,loadableWithPromise:me,loadableLoading:ge,loadableAll:ve,isLoadable:ye,RecoilLoadable:be});const we={RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED:!0,RECOIL_GKS_ENABLED:new Set(["recoil_hamt_2020","recoil_sync_external_store","recoil_suppress_rerender_in_callback","recoil_memory_managament_2020"])};function readProcessEnvBooleanFlag(e,t){var n,o;const i=null===(n=process.env[e])||void 0===n||null===(o=n.toLowerCase())||void 0===o?void 0:o.trim();if(null==i||""===i)return;const a=undefined;if(!["true","false"].includes(i))throw ie(`process.env.${e} value must be 'true', 'false', or empty: ${i}`);t("true"===i)}function readProcessEnvStringArrayFlag(e,t){var n;const o=null===(n=process.env[e])||void 0===n?void 0:n.trim();null!=o&&""!==o&&t(o.split(/\s*,\s*|\s+/))}function applyProcessEnvFlagOverrides(){var e;"undefined"!=typeof process&&null!=(null===(e=process)||void 0===e?void 0:e.env)&&(readProcessEnvBooleanFlag("RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED",(e=>{we.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=e})),readProcessEnvStringArrayFlag("RECOIL_GKS_ENABLED",(e=>{e.forEach((e=>{we.RECOIL_GKS_ENABLED.add(e)}))})))}applyProcessEnvFlagOverrides();var _e=we;function Recoil_gkx_OSS(e){return _e.RECOIL_GKS_ENABLED.has(e)}Recoil_gkx_OSS.setPass=e=>{_e.RECOIL_GKS_ENABLED.add(e)},Recoil_gkx_OSS.setFail=e=>{_e.RECOIL_GKS_ENABLED.delete(e)},Recoil_gkx_OSS.clear=()=>{_e.RECOIL_GKS_ENABLED.clear()};var Ae=Recoil_gkx_OSS;function recoverableViolation(e,t,{error:n}={}){return"production"!==process.env.NODE_ENV&&console.error(e,n),null}var Ce,Ee=recoverableViolation,Te,ke,xe;const Ne=null!==(Te=i.createMutableSource)&&void 0!==Te?Te:i.unstable_createMutableSource,Re=null!==(ke=i.useMutableSource)&&void 0!==ke?ke:i.unstable_useMutableSource,Ve=null!==(xe=i.useSyncExternalStore)&&void 0!==xe?xe:i.unstable_useSyncExternalStore;let Pe=!1;function currentRendererSupportsUseSyncExternalStore(){var e;const{ReactCurrentDispatcher:t,ReactCurrentOwner:n}=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,o=undefined,a=null!=(null!==(e=null==t?void 0:t.current)&&void 0!==e?e:n.currentDispatcher).useSyncExternalStore;return!Ve||a||Pe||(Pe=!0,Ee("A React renderer without React 18+ API support is being used with React 18+.")),a}function reactMode(){return Ae("recoil_transition_support")?{mode:"TRANSITION_SUPPORT",early:!0,concurrent:!0}:Ae("recoil_sync_external_store")&&null!=Ve?{mode:"SYNC_EXTERNAL_STORE",early:!0,concurrent:!1}:Ae("recoil_mutable_source")&&null!=Re&&"undefined"!=typeof window&&!window.$disableRecoilValueMutableSource_TEMP_HACK_DO_NOT_USE?Ae("recoil_suppress_rerender_in_callback")?{mode:"MUTABLE_SOURCE",early:!0,concurrent:!0}:{mode:"MUTABLE_SOURCE",early:!1,concurrent:!1}:Ae("recoil_suppress_rerender_in_callback")?{mode:"LEGACY",early:!0,concurrent:!1}:{mode:"LEGACY",early:!1,concurrent:!1}}var Oe={createMutableSource:Ne,useMutableSource:Re,useSyncExternalStore:Ve,currentRendererSupportsUseSyncExternalStore:currentRendererSupportsUseSyncExternalStore,reactMode:reactMode};class Le{constructor(e){_defineProperty(this,"key",void 0),this.key=e}toJSON(){return{key:this.key}}}class Ie extends Le{}class Me extends Le{}function isRecoilValue(e){return e instanceof Ie||e instanceof Me}var De={AbstractRecoilValue:Le,RecoilState:Ie,RecoilValueReadOnly:Me,isRecoilValue:isRecoilValue},Be=De.AbstractRecoilValue,ze=De.RecoilState,Ue=De.RecoilValueReadOnly,Fe=De.isRecoilValue,je=Object.freeze({__proto__:null,AbstractRecoilValue:Be,RecoilState:ze,RecoilValueReadOnly:Ue,isRecoilValue:Fe});function sprintf(e,...t){let n=0;return e.replace(/%s/g,(()=>String(t[n++])))}var He=sprintf;function expectationViolation(e,...t){if("production"!==process.env.NODE_ENV){const n=He.call(null,e,...t),o=new Error(n);o.name="Expectation Violation",console.error(o)}}var We,Ge=expectationViolation;function mapIterable(e,t){return function*(){let n=0;for(const o of e)yield t(o,n++)}()}var $e=mapIterable;class Ke{}const qe=new Ke,Ye=new Map,Ze=new Map;function recoilValuesForKeys(e){return $e(e,(e=>re(Ze.get(e))))}function checkForDuplicateAtomKey(e){if(Ye.has(e)){const t=`Duplicate atom key "${e}". This is a FATAL ERROR in\n production. But it is safe to ignore this warning if it occurred because of\n hot module replacement.`;"production"!==process.env.NODE_ENV?Ge(t,"recoil"):console.warn(t)}}function registerNode(e){_e.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED&&checkForDuplicateAtomKey(e.key),Ye.set(e.key,e);const t=null==e.set?new je.RecoilValueReadOnly(e.key):new je.RecoilState(e.key);return Ze.set(e.key,t),t}class Xe extends Error{}function getNode(e){const t=Ye.get(e);if(null==t)throw new Xe(`Missing definition for RecoilValue: "${e}""`);return t}function getNodeMaybe(e){return Ye.get(e)}const Je=new Map;function deleteNodeConfigIfPossible(e){var t;if(!Ae("recoil_memory_managament_2020"))return;const n=Ye.get(e);var o;null!=n&&null!==(t=n.shouldDeleteConfigOnRelease)&&void 0!==t&&t.call(n)&&(Ye.delete(e),null===(o=getConfigDeletionHandler(e))||void 0===o||o(),Je.delete(e))}function setConfigDeletionHandler(e,t){Ae("recoil_memory_managament_2020")&&(void 0===t?Je.delete(e):Je.set(e,t))}function getConfigDeletionHandler(e){return Je.get(e)}var Qe={recoilValues:Ze,registerNode:registerNode,getNode:getNode,getNodeMaybe:getNodeMaybe,deleteNodeConfigIfPossible:deleteNodeConfigIfPossible,setConfigDeletionHandler:setConfigDeletionHandler,getConfigDeletionHandler:getConfigDeletionHandler,recoilValuesForKeys:recoilValuesForKeys,DefaultValue:Ke,DEFAULT_VALUE:qe};function enqueueExecution(e,t){t()}var et={enqueueExecution:enqueueExecution};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var tt=createCommonjsModule((function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n={},o=5,i=Math.pow(2,5),a=i-1,r=i/2,s=i/4,l={},c=function constant(e){return function(){return e}},u=n.hash=function(e){var n=void 0===e?"undefined":t(e);if("number"===n)return e;"string"!==n&&(e+="");for(var o=0,i=0,a=e.length;i<a;++i){var r;o=(o<<5)-o+e.charCodeAt(i)|0}return o},d=function popcount(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)},p=function hashFragment(e,t){return t>>>e&a},f=function toBitmap(e){return 1<<e},h=function fromBitmap(e,t){return d(e&t-1)},m=function arrayUpdate(e,t,n,o){var i=o;if(!e){var a=o.length;i=new Array(a);for(var r=0;r<a;++r)i[r]=o[r]}return i[t]=n,i},g=function arraySpliceOut(e,t,n){var o=n.length-1,i=0,a=0,r=n;if(e)i=a=t;else for(r=new Array(o);i<t;)r[a++]=n[i++];for(++i;i<=o;)r[a++]=n[i++];return e&&(r.length=o),r},v=function arraySpliceIn(e,t,n,o){var i=o.length;if(e){for(var a=i;a>=t;)o[a--]=o[a];return o[t]=n,o}for(var r=0,s=0,l=new Array(i+1);r<t;)l[s++]=o[r++];for(l[t]=n;r<i;)l[++s]=o[r++];return l},b=1,S=2,w=3,_=4,A={__hamt_isEmpty:!0},C=function isEmptyNode(e){return e===A||e&&e.__hamt_isEmpty},E=function Leaf(e,t,n,o){return{type:1,edit:e,hash:t,key:n,value:o,_modify:M}},T=function Collision(e,t,n){return{type:2,edit:e,hash:t,children:n,_modify:D}},k=function IndexedNode(e,t,n){return{type:3,edit:e,mask:t,children:n,_modify:B}},N=function ArrayNode(e,t,n){return{type:4,edit:e,size:t,children:n,_modify:U}},R=function isLeaf(e){return e===A||1===e.type||2===e.type},V=function expand(e,t,n,o,i){for(var a=[],r=o,s=0,l=0;r;++l)1&r&&(a[l]=i[s++]),r>>>=1;return a[t]=n,N(e,s+1,a)},P=function pack(e,t,n,o){for(var i=new Array(t-1),a=0,r=0,s=0,l=o.length;s<l;++s)if(s!==n){var c=o[s];c&&!C(c)&&(i[a++]=c,r|=1<<s)}return k(e,r,i)},O=function mergeLeaves(e,t,n,o,i,a){if(n===i)return T(e,n,[a,o]);var r=p(t,n),s=p(t,i);return k(e,f(r)|f(s),r===s?[mergeLeaves(e,t+5,n,o,i,a)]:r<s?[o,a]:[a,o])},L=function updateCollisionList(e,t,n,o,i,a,r,s){for(var c=i.length,u=0;u<c;++u){var d=i[u];if(n(r,d.key)){var p=d.value,f=a(p);return f===p?i:f===l?(--s.value,g(e,u,i)):m(e,u,E(t,o,r,f),i)}}var h=a();return h===l?i:(++s.value,m(e,c,E(t,o,r,h),i))},I=function canEditNode(e,t){return e===t.edit},M=function Leaf__modify(e,t,n,o,i,a,r){if(t(a,this.key)){var s=o(this.value);return s===this.value?this:s===l?(--r.value,A):I(e,this)?(this.value=s,this):E(e,i,a,s)}var c=o();return c===l?this:(++r.value,O(e,n,this.hash,this,i,E(e,i,a,c)))},D=function Collision__modify(e,t,n,o,i,a,r){if(i===this.hash){var s=I(e,this),c=L(s,e,t,this.hash,this.children,o,a,r);return c===this.children?this:c.length>1?T(e,this.hash,c):c[0]}var u=o();return u===l?this:(++r.value,O(e,n,this.hash,this,i,E(e,i,a,u)))},B=function IndexedNode__modify(e,t,n,o,i,a,s){var l=this.mask,c=this.children,u=p(n,i),d=f(u),b=h(l,d),S=l&d,w=S?c[b]:A,_=w._modify(e,t,n+5,o,i,a,s);if(w===_)return this;var E=I(e,this),T=l,N=void 0;if(S&&C(_)){if(!(T&=~d))return A;if(c.length<=2&&R(c[1^b]))return c[1^b];N=g(E,b,c)}else if(S||C(_))N=m(E,b,_,c);else{if(c.length>=r)return V(e,u,_,l,c);T|=d,N=v(E,b,_,c)}return E?(this.mask=T,this.children=N,this):k(e,T,N)},U=function ArrayNode__modify(e,t,n,o,i,a,r){var l=this.size,c=this.children,u=p(n,i),d=c[u],f=(d||A)._modify(e,t,n+5,o,i,a,r);if(d===f)return this;var h=I(e,this),g=void 0;if(C(d)&&!C(f))++l,g=m(h,u,f,c);else if(!C(d)&&C(f)){if(--l<=s)return P(e,l,u,c);g=m(h,u,A,c)}else g=m(h,u,f,c);return h?(this.size=l,this.children=g,this):N(e,l,g)};function Map(e,t,n,o,i){this._editable=e,this._edit=t,this._config=n,this._root=o,this._size=i}A._modify=function(e,t,n,o,i,a,r){var s=o();return s===l?A:(++r.value,E(e,i,a,s))},Map.prototype.setTree=function(e,t){return this._editable?(this._root=e,this._size=t,this):e===this._root?this:new Map(this._editable,this._edit,this._config,e,t)};var F=n.tryGetHash=function(e,t,n,o){for(var i=o._root,a=0,r=o._config.keyEq;;)switch(i.type){case 1:return r(n,i.key)?i.value:e;case 2:if(t===i.hash)for(var s=i.children,l=0,c=s.length;l<c;++l){var u=s[l];if(r(n,u.key))return u.value}return e;case 3:var d=p(a,t),m=f(d);if(i.mask&m){i=i.children[h(i.mask,m)],a+=5;break}return e;case 4:if(i=i.children[p(a,t)]){a+=5;break}return e;default:return e}};Map.prototype.tryGetHash=function(e,t,n){return F(e,t,n,this)};var j=n.tryGet=function(e,t,n){return F(e,n._config.hash(t),t,n)};Map.prototype.tryGet=function(e,t){return j(e,t,this)};var H=n.getHash=function(e,t,n){return F(void 0,e,t,n)};Map.prototype.getHash=function(e,t){return H(e,t,this)},n.get=function(e,t){return F(void 0,t._config.hash(e),e,t)},Map.prototype.get=function(e,t){return j(t,e,this)};var W=n.has=function(e,t,n){return F(l,e,t,n)!==l};Map.prototype.hasHash=function(e,t){return W(e,t,this)};var G=n.has=function(e,t){return W(t._config.hash(e),e,t)};Map.prototype.has=function(e){return G(e,this)};var $=function defKeyCompare(e,t){return e===t};n.make=function(e){return new Map(0,0,{keyEq:e&&e.keyEq||$,hash:e&&e.hash||u},A,0)},n.empty=n.make();var K=n.isEmpty=function(e){return e&&!!C(e._root)};Map.prototype.isEmpty=function(){return K(this)};var q=n.modifyHash=function(e,t,n,o){var i={value:o._size},a=o._root._modify(o._editable?o._edit:NaN,o._config.keyEq,0,e,t,n,i);return o.setTree(a,i.value)};Map.prototype.modifyHash=function(e,t,n){return q(n,e,t,this)};var Y=n.modify=function(e,t,n){return q(e,n._config.hash(t),t,n)};Map.prototype.modify=function(e,t){return Y(t,e,this)};var Z=n.setHash=function(e,t,n,o){return q(c(n),e,t,o)};Map.prototype.setHash=function(e,t,n){return Z(e,t,n,this)};var X=n.set=function(e,t,n){return Z(n._config.hash(e),e,t,n)};Map.prototype.set=function(e,t){return X(e,t,this)};var J=c(l),Q=n.removeHash=function(e,t,n){return q(J,e,t,n)};Map.prototype.removeHash=Map.prototype.deleteHash=function(e,t){return Q(e,t,this)};var ee=n.remove=function(e,t){return Q(t._config.hash(e),e,t)};Map.prototype.remove=Map.prototype.delete=function(e){return ee(e,this)};var te=n.beginMutation=function(e){return new Map(e._editable+1,e._edit+1,e._config,e._root,e._size)};Map.prototype.beginMutation=function(){return te(this)};var ne=n.endMutation=function(e){return e._editable=e._editable&&e._editable-1,e};Map.prototype.endMutation=function(){return ne(this)};var oe=n.mutate=function(e,t){var n=te(t);return e(n),ne(n)};Map.prototype.mutate=function(e){return oe(e,this)};var ie=function appk(e){return e&&ae(e[0],e[1],e[2],e[3],e[4])},ae=function lazyVisitChildren(e,t,n,o,i){for(;n<e;){var a=t[n++];if(a&&!C(a))return re(a,o,[e,t,n,o,i])}return ie(i)},re=function lazyVisit(e,t,n){switch(e.type){case 1:return{value:t(e),rest:n};case 2:case 4:case 3:var o=e.children;return ae(o.length,o,0,t,n);default:return ie(n)}},se={done:!0};function MapIterator(e){this.v=e}MapIterator.prototype.next=function(){if(!this.v)return se;var e=this.v;return this.v=ie(e.rest),e},MapIterator.prototype[Symbol.iterator]=function(){return this};var le=function visit(e,t){return new MapIterator(re(e._root,t))},ce=function buildPairs(e){return[e.key,e.value]},ue=n.entries=function(e){return le(e,ce)};Map.prototype.entries=Map.prototype[Symbol.iterator]=function(){return ue(this)};var de=function buildKeys(e){return e.key},pe=n.keys=function(e){return le(e,de)};Map.prototype.keys=function(){return pe(this)};var fe=function buildValues(e){return e.value},he=n.values=Map.prototype.values=function(e){return le(e,fe)};Map.prototype.values=function(){return he(this)};var me=n.fold=function(e,t,n){var o=n._root;if(1===o.type)return e(t,o.value,o.key);for(var i=[o.children],a=void 0;a=i.pop();)for(var r=0,s=a.length;r<s;){var l=a[r++];l&&l.type&&(1===l.type?t=e(t,l.value,l.key):i.push(l.children))}return t};Map.prototype.fold=function(e,t){return me(e,t,this)};var ge=n.forEach=function(e,t){return me((function(n,o,i){return e(o,i,t)}),null,t)};Map.prototype.forEach=function(e){return ge(e,this)};var ve=n.count=function(e){return e._size};Map.prototype.count=function(){return ve(this)},Object.defineProperty(Map.prototype,"size",{get:Map.prototype.count}),e.exports?e.exports=n:(void 0).hamt=n}));class nt{constructor(e){_defineProperty(this,"_map",void 0),this._map=new Map(null==e?void 0:e.entries())}keys(){return this._map.keys()}entries(){return this._map.entries()}get(e){return this._map.get(e)}has(e){return this._map.has(e)}set(e,t){return this._map.set(e,t),this}delete(e){return this._map.delete(e),this}clone(){return persistentMap(this)}toMap(){return new Map(this._map)}}class ot{constructor(e){if(_defineProperty(this,"_hamt",tt.empty.beginMutation()),e instanceof ot){const t=e._hamt.endMutation();e._hamt=t.beginMutation(),this._hamt=t.beginMutation()}else if(e)for(const[t,n]of e.entries())this._hamt.set(t,n)}keys(){return this._hamt.keys()}entries(){return this._hamt.entries()}get(e){return this._hamt.get(e)}has(e){return this._hamt.has(e)}set(e,t){return this._hamt.set(e,t),this}delete(e){return this._hamt.delete(e),this}clone(){return persistentMap(this)}toMap(){return new Map(this._hamt)}}function persistentMap(e){return Ae("recoil_hamt_2020")?new ot(e):new nt(e)}var it,at=persistentMap,rt=Object.freeze({__proto__:null,persistentMap:at});function differenceSets(e,...t){const n=new Set;e:for(const o of e){for(const e of t)if(e.has(o))continue e;n.add(o)}return n}var st=differenceSets;function mapMap(e,t){const n=new Map;return e.forEach(((e,o)=>{n.set(o,t(e,o))})),n}var lt=mapMap;function makeGraph(){return{nodeDeps:new Map,nodeToNodeSubscriptions:new Map}}function cloneGraph(e){return{nodeDeps:lt(e.nodeDeps,(e=>new Set(e))),nodeToNodeSubscriptions:lt(e.nodeToNodeSubscriptions,(e=>new Set(e)))}}function mergeDepsIntoGraph(e,t,n,o){const{nodeDeps:i,nodeToNodeSubscriptions:a}=n,r=i.get(e);if(r&&o&&r!==o.nodeDeps.get(e))return;i.set(e,t);const s=null==r?t:st(t,r);for(const t of s){a.has(t)||a.set(t,new Set);const n=undefined;re(a.get(t)).add(e)}if(r){const n=st(r,t);for(const t of n){if(!a.has(t))return;const n=re(a.get(t));n.delete(e),0===n.size&&a.delete(t)}}}function saveDepsToStore(e,t,n,o){var i,a,r,s;const l=n.getState();o!==l.currentTree.version&&o!==(null===(i=l.nextTree)||void 0===i?void 0:i.version)&&o!==(null===(a=l.previousTree)||void 0===a?void 0:a.version)&&Ee("Tried to save dependencies to a discarded tree");const c=n.getGraph(o);if(mergeDepsIntoGraph(e,t,c),o===(null===(r=l.previousTree)||void 0===r?void 0:r.version)){const o=undefined;mergeDepsIntoGraph(e,t,n.getGraph(l.currentTree.version),c)}if(o===(null===(s=l.previousTree)||void 0===s?void 0:s.version)||o===l.currentTree.version){var u;const o=null===(u=l.nextTree)||void 0===u?void 0:u.version;if(void 0!==o){const i=undefined;mergeDepsIntoGraph(e,t,n.getGraph(o),c)}}}var ct={cloneGraph:cloneGraph,graph:makeGraph,saveDepsToStore:saveDepsToStore};let ut=0;const dt=undefined;let pt=0;const ft=undefined;let ht=0;const mt=undefined;var gt={getNextTreeStateVersion:()=>ut++,getNextStoreID:()=>pt++,getNextComponentID:()=>ht++};const{persistentMap:vt}=rt,{graph:yt}=ct,{getNextTreeStateVersion:bt}=gt;function makeEmptyTreeState(){const e=bt();return{version:e,stateID:e,transactionMetadata:{},dirtyAtoms:new Set,atomValues:vt(),nonvalidatedAtoms:vt()}}function makeEmptyStoreState(){const e=makeEmptyTreeState();return{currentTree:e,nextTree:null,previousTree:null,commitDepth:0,knownAtoms:new Set,knownSelectors:new Set,transactionSubscriptions:new Map,nodeTransactionSubscriptions:new Map,nodeToComponentSubscriptions:new Map,queuedComponentCallbacks_DEPRECATED:[],suspendedComponentResolvers:new Set,graphsByVersion:(new Map).set(e.version,yt()),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map}}var St={makeEmptyStoreState:makeEmptyStoreState,getNextTreeStateVersion:bt};class wt{}var _t={RetentionZone:wt};function setByAddingToSet(e,t){const n=new Set(e);return n.add(t),n}var At={setByAddingToSet:setByAddingToSet};function*filterIterable(e,t){let n=0;for(const o of e)t(o,n++)&&(yield o)}var Ct=filterIterable;function lazyProxy(e,t){const n=undefined;return new Proxy(e,{get:(e,n)=>(!(n in e)&&n in t&&(e[n]=t[n]()),e[n]),ownKeys:e=>Object.keys(e)})}var Et=lazyProxy;const{getNode:Tt,getNodeMaybe:kt,recoilValuesForKeys:xt}=Qe,{RetentionZone:Nt}=_t,{setByAddingToSet:Rt}=At,Vt=Object.freeze(new Set);class Pt extends Error{}function initializeRetentionForNode(e,t,n){if(!Ae("recoil_memory_managament_2020"))return()=>{};const{nodesRetainedByZone:o}=e.getState().retention;function addToZone(e){let n=o.get(e);n||o.set(e,n=new Set),n.add(t)}if(n instanceof Nt)addToZone(n);else if(Array.isArray(n))for(const e of n)addToZone(e);return()=>{if(!Ae("recoil_memory_managament_2020"))return;const{retention:o}=e.getState();function deleteFromZone(e){const n=o.nodesRetainedByZone.get(e);null==n||n.delete(t),n&&0===n.size&&o.nodesRetainedByZone.delete(e)}if(n instanceof Nt)deleteFromZone(n);else if(Array.isArray(n))for(const e of n)deleteFromZone(e)}}function initializeNodeIfNewToStore(e,t,n,o){const i=e.getState();if(i.nodeCleanupFunctions.has(n))return;const a=Tt(n),r=initializeRetentionForNode(e,n,a.retainedBy),s=a.init(e,t,o);i.nodeCleanupFunctions.set(n,(()=>{s(),r()}))}function initializeNode(e,t,n){initializeNodeIfNewToStore(e,e.getState().currentTree,t,n)}function cleanUpNode(e,t){var n;const o=e.getState();null===(n=o.nodeCleanupFunctions.get(t))||void 0===n||n(),o.nodeCleanupFunctions.delete(t)}function getNodeLoadable(e,t,n){return initializeNodeIfNewToStore(e,t,n,"get"),Tt(n).get(e,t)}function peekNodeLoadable(e,t,n){return Tt(n).peek(e,t)}function setUnvalidatedAtomValue_DEPRECATED(e,t,n){var o;const i=kt(t);return null==i||null===(o=i.invalidate)||void 0===o||o.call(i,e),{...e,atomValues:e.atomValues.clone().delete(t),nonvalidatedAtoms:e.nonvalidatedAtoms.clone().set(t,n),dirtyAtoms:Rt(e.dirtyAtoms,t)}}function setNodeValue(e,t,n,o){const i=Tt(n);if(null==i.set)throw new Pt(`Attempt to set read-only RecoilValue: ${n}`);const a=i.set;return initializeNodeIfNewToStore(e,t,n,"set"),a(e,t,o)}function peekNodeInfo(e,t,n){const o=e.getState(),i=e.getGraph(t.version),a=Tt(n).nodeType;return Et({type:a},{loadable:()=>peekNodeLoadable(e,t,n),isActive:()=>o.knownAtoms.has(n)||o.knownSelectors.has(n),isSet:()=>"selector"!==a&&t.atomValues.has(n),isModified:()=>t.dirtyAtoms.has(n),deps:()=>{var e;return xt(null!==(e=i.nodeDeps.get(n))&&void 0!==e?e:[])},subscribers:()=>{var i,a;return{nodes:xt(Ct(getDownstreamNodes(e,t,new Set([n])),(e=>e!==n))),components:$e(null!==(i=null===(a=o.nodeToComponentSubscriptions.get(n))||void 0===a?void 0:a.values())&&void 0!==i?i:[],(([e])=>({name:e})))}}})}function getDownstreamNodes(e,t,n){const o=new Set,i=Array.from(n),a=e.getGraph(t.version);for(let e=i.pop();e;e=i.pop()){var r;o.add(e);const t=null!==(r=a.nodeToNodeSubscriptions.get(e))&&void 0!==r?r:Vt;for(const e of t)o.has(e)||i.push(e)}return o}var Ot={getNodeLoadable:getNodeLoadable,peekNodeLoadable:peekNodeLoadable,setNodeValue:setNodeValue,initializeNode:initializeNode,cleanUpNode:cleanUpNode,setUnvalidatedAtomValue_DEPRECATED:setUnvalidatedAtomValue_DEPRECATED,peekNodeInfo:peekNodeInfo,getDownstreamNodes:getDownstreamNodes};let Lt=null;function setInvalidateMemoizedSnapshot(e){Lt=e}function invalidateMemoizedSnapshot(){var e;null===(e=Lt)||void 0===e||e()}var It={setInvalidateMemoizedSnapshot:setInvalidateMemoizedSnapshot,invalidateMemoizedSnapshot:invalidateMemoizedSnapshot};const{getDownstreamNodes:Mt,getNodeLoadable:Dt,setNodeValue:Bt}=Ot,{getNextComponentID:zt}=gt,{getNode:Ut,getNodeMaybe:Ft}=Qe,{DefaultValue:jt}=Qe,{reactMode:Ht}=Oe,{AbstractRecoilValue:Wt,RecoilState:Gt,RecoilValueReadOnly:$t,isRecoilValue:Kt}=je,{invalidateMemoizedSnapshot:qt}=It;function getRecoilValueAsLoadable(e,{key:t},n=e.getState().currentTree){var o,i;const a=e.getState();n.version!==a.currentTree.version&&n.version!==(null===(o=a.nextTree)||void 0===o?void 0:o.version)&&n.version!==(null===(i=a.previousTree)||void 0===i?void 0:i.version)&&Ee("Tried to read from a discarded tree");const r=Dt(e,n,t);return"loading"===r.state&&r.contents.catch((()=>{})),r}function applyAtomValueWrites(e,t){const n=e.clone();return t.forEach(((e,t)=>{"hasValue"===e.state&&e.contents instanceof jt?n.delete(t):n.set(t,e)})),n}function valueFromValueOrUpdater(e,t,{key:n},o){if("function"==typeof o){const i=Dt(e,t,n);if("loading"===i.state){const e=`Tried to set atom or selector "${n}" using an updater function while the current state is pending, this is not currently supported.`;throw Ee(e),ie(e)}if("hasError"===i.state)throw i.contents;return o(i.contents)}return o}function applyAction(e,t,n){if("set"===n.type){const{recoilValue:o,valueOrUpdater:i}=n,a=valueFromValueOrUpdater(e,t,o,i),r=Bt(e,t,o.key,a);for(const[e,n]of r.entries())writeLoadableToTreeState(t,e,n)}else if("setLoadable"===n.type){const{recoilValue:{key:e},loadable:o}=n;writeLoadableToTreeState(t,e,o)}else if("markModified"===n.type){const{recoilValue:{key:e}}=n;t.dirtyAtoms.add(e)}else if("setUnvalidated"===n.type){var o;const{recoilValue:{key:e},unvalidatedValue:i}=n,a=Ft(e);null==a||null===(o=a.invalidate)||void 0===o||o.call(a,t),t.atomValues.delete(e),t.nonvalidatedAtoms.set(e,i),t.dirtyAtoms.add(e)}else Ee(`Unknown action ${n.type}`)}function writeLoadableToTreeState(e,t,n){"hasValue"===n.state&&n.contents instanceof jt?e.atomValues.delete(t):e.atomValues.set(t,n),e.dirtyAtoms.add(t),e.nonvalidatedAtoms.delete(t)}function applyActionsToStore(e,t){e.replaceState((n=>{const o=copyTreeState(n);for(const n of t)applyAction(e,o,n);return invalidateDownstreams(e,o),qt(),o}))}function queueOrPerformStateUpdate(e,t){if(Yt.length){const n=Yt[Yt.length-1];let o=n.get(e);o||n.set(e,o=[]),o.push(t)}else applyActionsToStore(e,[t])}const Yt=[];function batchStart(){const e=new Map;return Yt.push(e),()=>{for(const[t,n]of e)applyActionsToStore(t,n);const t=undefined;Yt.pop()!==e&&Ee("Incorrect order of batch popping")}}function copyTreeState(e){return{...e,atomValues:e.atomValues.clone(),nonvalidatedAtoms:e.nonvalidatedAtoms.clone(),dirtyAtoms:new Set(e.dirtyAtoms)}}function invalidateDownstreams(e,t){const n=Mt(e,t,t.dirtyAtoms);for(const e of n){var o,i;null===(o=Ft(e))||void 0===o||null===(i=o.invalidate)||void 0===i||i.call(o,t)}}function setRecoilValue(e,t,n){queueOrPerformStateUpdate(e,{type:"set",recoilValue:t,valueOrUpdater:n})}function setRecoilValueLoadable(e,t,n){if(n instanceof jt)return setRecoilValue(e,t,n);queueOrPerformStateUpdate(e,{type:"setLoadable",recoilValue:t,loadable:n})}function markRecoilValueModified(e,t){queueOrPerformStateUpdate(e,{type:"markModified",recoilValue:t})}function setUnvalidatedRecoilValue(e,t,n){queueOrPerformStateUpdate(e,{type:"setUnvalidated",recoilValue:t,unvalidatedValue:n})}function subscribeToRecoilValue(e,{key:t},n,o=null){const i=zt(),a=e.getState();a.nodeToComponentSubscriptions.has(t)||a.nodeToComponentSubscriptions.set(t,new Map),re(a.nodeToComponentSubscriptions.get(t)).set(i,[null!=o?o:"<not captured>",n]);const r=Ht();if(r.early&&("LEGACY"===r.mode||"MUTABLE_SOURCE"===r.mode)){const o=e.getState().nextTree;o&&o.dirtyAtoms.has(t)&&n(o)}return{release:()=>{const n=e.getState(),o=n.nodeToComponentSubscriptions.get(t);void 0!==o&&o.has(i)?(o.delete(i),0===o.size&&n.nodeToComponentSubscriptions.delete(t)):Ee(`Subscription missing at release time for atom ${t}. This is a bug in Recoil.`)}}}function refreshRecoilValue(e,t){var n;const{currentTree:o}=e.getState(),i=Ut(t.key);null===(n=i.clearCache)||void 0===n||n.call(i,e,o)}var Zt={AbstractRecoilValue:Wt,getRecoilValueAsLoadable:getRecoilValueAsLoadable,setRecoilValue:setRecoilValue,setRecoilValueLoadable:setRecoilValueLoadable,markRecoilValueModified:markRecoilValueModified,setUnvalidatedRecoilValue:setUnvalidatedRecoilValue,subscribeToRecoilValue:subscribeToRecoilValue,applyAtomValueWrites:applyAtomValueWrites,batchStart:batchStart,writeLoadableToTreeState:writeLoadableToTreeState,invalidateDownstreams:invalidateDownstreams,copyTreeState:copyTreeState,refreshRecoilValue:refreshRecoilValue};function someSet(e,t,n){const o=e.entries();let i=o.next();for(;!i.done;){const a=i.value;if(t.call(n,a[1],a[0],e))return!0;i=o.next()}return!1}var Xt=someSet;const{cleanUpNode:Jt}=Ot,{deleteNodeConfigIfPossible:Qt,getNode:en}=Qe,{RetentionZone:tn}=_t,nn=12e4,on=new Set;function releaseRetainablesNowOnCurrentTree(e,t){const n=e.getState(),o=n.currentTree;if(n.nextTree)return void Ee("releaseNodesNowOnCurrentTree should only be called at the end of a batch");const i=new Set;for(const e of t)if(e instanceof tn)for(const t of nodesRetainedByZone(n,e))i.add(t);else i.add(e);const a=findReleasableNodes(e,i);for(const t of a)releaseNode(e,o,t)}function findReleasableNodes(e,t){const n=e.getState(),o=n.currentTree,i=e.getGraph(o.version),a=new Set,r=new Set;return findReleasableNodesInner(t),a;function findReleasableNodesInner(t){const s=new Set,l=getDownstreamNodesInTopologicalOrder(e,o,t,a,r);for(const e of l){var c;if("recoilRoot"===en(e).retainedBy){r.add(e);continue}if((null!==(c=n.retention.referenceCounts.get(e))&&void 0!==c?c:0)>0){r.add(e);continue}if(zonesThatCouldRetainNode(e).some((e=>n.retention.referenceCounts.get(e)))){r.add(e);continue}const t=i.nodeToNodeSubscriptions.get(e);t&&Xt(t,(e=>r.has(e)))?r.add(e):(a.add(e),s.add(e))}const u=new Set;for(const e of s)for(const t of null!==(d=i.nodeDeps.get(e))&&void 0!==d?d:on){var d;a.has(t)||u.add(t)}u.size&&findReleasableNodesInner(u)}}function getDownstreamNodesInTopologicalOrder(e,t,n,o,i){const a=e.getGraph(t.version),r=[],s=new Set;for(;n.size>0;)visit(re(n.values().next().value));return r;function visit(e){if(o.has(e)||i.has(e))return void n.delete(e);if(s.has(e))return;const t=a.nodeToNodeSubscriptions.get(e);if(t)for(const e of t)visit(e);s.add(e),n.delete(e),r.push(e)}}function releaseNode(e,t,n){if(!Ae("recoil_memory_managament_2020"))return;Jt(e,n);const o=e.getState();o.knownAtoms.delete(n),o.knownSelectors.delete(n),o.nodeTransactionSubscriptions.delete(n),o.retention.referenceCounts.delete(n);const i=zonesThatCouldRetainNode(n);for(const e of i){var a;null===(a=o.retention.nodesRetainedByZone.get(e))||void 0===a||a.delete(n)}t.atomValues.delete(n),t.dirtyAtoms.delete(n),t.nonvalidatedAtoms.delete(n);const r=o.graphsByVersion.get(t.version);if(r){const e=r.nodeDeps.get(n);if(void 0!==e){r.nodeDeps.delete(n);for(const t of e){var s;null===(s=r.nodeToNodeSubscriptions.get(t))||void 0===s||s.delete(n)}}r.nodeToNodeSubscriptions.delete(n)}Qt(n)}function nodesRetainedByZone(e,t){var n;return null!==(n=e.retention.nodesRetainedByZone.get(t))&&void 0!==n?n:on}function zonesThatCouldRetainNode(e){const t=en(e).retainedBy;return void 0===t||"components"===t||"recoilRoot"===t?[]:t instanceof tn?[t]:t}function scheduleOrPerformPossibleReleaseOfRetainable(e,t){const n=e.getState();n.nextTree?n.retention.retainablesToCheckForRelease.add(t):releaseRetainablesNowOnCurrentTree(e,new Set([t]))}function updateRetainCount(e,t,n){var o;if(!Ae("recoil_memory_managament_2020"))return;const i=e.getState().retention.referenceCounts,a=(null!==(o=i.get(t))&&void 0!==o?o:0)+n;0===a?updateRetainCountToZero(e,t):i.set(t,a)}function updateRetainCountToZero(e,t){if(!Ae("recoil_memory_managament_2020"))return;const n=undefined;e.getState().retention.referenceCounts.delete(t),scheduleOrPerformPossibleReleaseOfRetainable(e,t)}function releaseScheduledRetainablesNow(e){if(!Ae("recoil_memory_managament_2020"))return;const t=e.getState();releaseRetainablesNowOnCurrentTree(e,t.retention.retainablesToCheckForRelease),t.retention.retainablesToCheckForRelease.clear()}function retainedByOptionWithDefault(e){return void 0===e?"recoilRoot":e}var an={SUSPENSE_TIMEOUT_MS:nn,updateRetainCount:updateRetainCount,releaseScheduledRetainablesNow:releaseScheduledRetainablesNow,retainedByOptionWithDefault:retainedByOptionWithDefault};const{unstable_batchedUpdates:rn}=a;var sn={unstable_batchedUpdates:rn};const{unstable_batchedUpdates:ln}=sn;var cn={unstable_batchedUpdates:ln};const{batchStart:un}=Zt,{unstable_batchedUpdates:dn}=cn;let pn=dn||(e=>e());const fn=undefined;var hn={batchUpdates:e=>{pn((()=>{let batchEnd=()=>{};try{batchEnd=un(),e()}finally{batchEnd()}}))}};function*concatIterables(e){for(const t of e)for(const e of t)yield e}var mn=concatIterables;const gn="undefined"==typeof Window||"undefined"==typeof window,isWindow=e=>!gn&&(e===window||e instanceof Window),vn="undefined"!=typeof navigator&&"ReactNative"===navigator.product;var yn={isSSR:gn,isReactNative:vn,isWindow:isWindow};function memoizeOneWithArgsHashAndInvalidation(e,t){let n,o;const i=undefined,a=undefined;return[(...i)=>{const a=t(...i);return n===a||(n=a,o=e(...i)),o},()=>{n=null}]}var bn={memoizeOneWithArgsHashAndInvalidation:memoizeOneWithArgsHashAndInvalidation};const{batchUpdates:Sn}=hn,{initializeNode:wn,peekNodeInfo:_n}=Ot,{graph:An}=ct,{getNextStoreID:Cn}=gt,{DEFAULT_VALUE:En,recoilValues:Tn,recoilValuesForKeys:kn}=Qe,{AbstractRecoilValue:xn,getRecoilValueAsLoadable:Nn,setRecoilValue:Rn,setUnvalidatedRecoilValue:Vn}=Zt,{updateRetainCount:Pn}=an,{setInvalidateMemoizedSnapshot:On}=It,{getNextTreeStateVersion:Ln,makeEmptyStoreState:In}=St,{isSSR:Mn}=yn,{memoizeOneWithArgsHashAndInvalidation:Dn}=bn,Bn="\nRecoil Snapshots only last for the duration of the callback they are provided to. To keep a Snapshot longer, do this:\n\n const release = snapshot.retain();\n try {\n await doSomethingWithSnapshot(snapshot);\n } finally {\n release();\n }\n\nThis is currently a DEV-only warning but will become a thrown exception in the next release of Recoil.\n";class zn{constructor(e,t){_defineProperty(this,"_store",void 0),_defineProperty(this,"_refCount",1),_defineProperty(this,"getLoadable",(e=>(this.checkRefCount_INTERNAL(),Nn(this._store,e)))),_defineProperty(this,"getPromise",(e=>(this.checkRefCount_INTERNAL(),this.getLoadable(e).toPromise()))),_defineProperty(this,"getNodes_UNSTABLE",(e=>{if(this.checkRefCount_INTERNAL(),!0===(null==e?void 0:e.isModified)){if(!1===(null==e?void 0:e.isInitialized))return[];const t=this._store.getState().currentTree;return kn(t.dirtyAtoms)}const t=this._store.getState().knownAtoms,n=this._store.getState().knownSelectors;return null==(null==e?void 0:e.isInitialized)?Tn.values():!0===e.isInitialized?kn(mn([t,n])):Ct(Tn.values(),(({key:e})=>!t.has(e)&&!n.has(e)))})),_defineProperty(this,"getInfo_UNSTABLE",(({key:e})=>(this.checkRefCount_INTERNAL(),_n(this._store,this._store.getState().currentTree,e)))),_defineProperty(this,"map",(e=>{this.checkRefCount_INTERNAL();const t=new jn(this,Sn);return e(t),t})),_defineProperty(this,"asyncMap",(async e=>{this.checkRefCount_INTERNAL();const t=new jn(this,Sn);return t.retain(),await e(t),t.autoRelease_INTERNAL(),t})),this._store={storeID:Cn(),parentStoreID:t,getState:()=>e,replaceState:t=>{e.currentTree=t(e.currentTree)},getGraph:t=>{const n=e.graphsByVersion;if(n.has(t))return re(n.get(t));const o=An();return n.set(t,o),o},subscribeToTransactions:()=>({release:()=>{}}),addTransactionMetadata:()=>{throw ie("Cannot subscribe to Snapshots")}};for(const e of this._store.getState().knownAtoms)wn(this._store,e,"get"),Pn(this._store,e,1);this.autoRelease_INTERNAL()}retain(){if(this._refCount<=0){if("production"!==process.env.NODE_ENV)throw ie("Snapshot has already been released.");Ee("Attempt to retain() Snapshot that was already released.")}this._refCount++;let e=!1;return()=>{e||(e=!0,this._release())}}autoRelease_INTERNAL(){Mn||window.setTimeout((()=>this._release()),10)}_release(){if(this._refCount--,0===this._refCount){if(this._store.getState().nodeCleanupFunctions.forEach((e=>e())),this._store.getState().nodeCleanupFunctions.clear(),!Ae("recoil_memory_managament_2020"))return}else this._refCount<0&&"production"!==process.env.NODE_ENV&&Ee("Snapshot released an extra time.")}isRetained(){return this._refCount>0}checkRefCount_INTERNAL(){Ae("recoil_memory_managament_2020")&&this._refCount<=0&&"production"!==process.env.NODE_ENV&&Ee(Bn)}getStore_INTERNAL(){return this.checkRefCount_INTERNAL(),this._store}getID(){return this.checkRefCount_INTERNAL(),this._store.getState().currentTree.stateID}getStoreID(){return this.checkRefCount_INTERNAL(),this._store.storeID}}function cloneStoreState(e,t,n=!1){const o=e.getState(),i=n?Ln():t.version;return{currentTree:{version:n?i:t.version,stateID:n?i:t.stateID,transactionMetadata:{...t.transactionMetadata},dirtyAtoms:new Set(t.dirtyAtoms),atomValues:t.atomValues.clone(),nonvalidatedAtoms:t.nonvalidatedAtoms.clone()},commitDepth:0,nextTree:null,previousTree:null,knownAtoms:new Set(o.knownAtoms),knownSelectors:new Set(o.knownSelectors),transactionSubscriptions:new Map,nodeTransactionSubscriptions:new Map,nodeToComponentSubscriptions:new Map,queuedComponentCallbacks_DEPRECATED:[],suspendedComponentResolvers:new Set,graphsByVersion:(new Map).set(i,e.getGraph(t.version)),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map($e(o.nodeCleanupFunctions.entries(),(([e])=>[e,()=>{}])))}}function freshSnapshot(e){const t=new zn(In());return null!=e?t.map(e):t}const[Un,Fn]=Dn(((e,t)=>{var n;const o=e.getState(),i="latest"===t?null!==(n=o.nextTree)&&void 0!==n?n:o.currentTree:re(o.previousTree);return new zn(cloneStoreState(e,i),e.storeID)}),((e,t)=>{var n,o;return String(t)+String(e.storeID)+String(null===(n=e.getState().nextTree)||void 0===n?void 0:n.version)+String(e.getState().currentTree.version)+String(null===(o=e.getState().previousTree)||void 0===o?void 0:o.version)}));function cloneSnapshot(e,t="latest"){const n=Un(e,t);return n.isRetained()?n:(Fn(),Un(e,t))}On(Fn);class jn extends zn{constructor(e,t){super(cloneStoreState(e.getStore_INTERNAL(),e.getStore_INTERNAL().getState().currentTree,!0),e.getStoreID()),_defineProperty(this,"_batch",void 0),_defineProperty(this,"set",((e,t)=>{this.checkRefCount_INTERNAL();const n=this.getStore_INTERNAL();this._batch((()=>{Pn(n,e.key,1),Rn(this.getStore_INTERNAL(),e,t)}))})),_defineProperty(this,"reset",(e=>{this.checkRefCount_INTERNAL();const t=this.getStore_INTERNAL();this._batch((()=>{Pn(t,e.key,1),Rn(this.getStore_INTERNAL(),e,En)}))})),_defineProperty(this,"setUnvalidatedAtomValues_DEPRECATED",(e=>{this.checkRefCount_INTERNAL();const t=this.getStore_INTERNAL();Sn((()=>{for(const[n,o]of e.entries())Pn(t,n,1),Vn(t,new xn(n),o)}))})),this._batch=t}}var Hn={Snapshot:zn,MutableSnapshot:jn,freshSnapshot:freshSnapshot,cloneSnapshot:cloneSnapshot},Wn=Hn.Snapshot,Gn=Hn.MutableSnapshot,$n=Hn.freshSnapshot,Kn=Hn.cloneSnapshot,qn=Object.freeze({__proto__:null,Snapshot:Wn,MutableSnapshot:Gn,freshSnapshot:$n,cloneSnapshot:Kn});function unionSets(...e){const t=new Set;for(const n of e)for(const e of n)t.add(e);return t}var Yn=unionSets;const{useRef:Zn}=i;function useRefInitOnce(e){const t=Zn(e);return t.current===e&&"function"==typeof e&&(t.current=e()),t}var Xn=useRefInitOnce;const{getNextTreeStateVersion:Jn,makeEmptyStoreState:Qn}=St,{cleanUpNode:eo,getDownstreamNodes:to,initializeNode:no,setNodeValue:oo,setUnvalidatedAtomValue_DEPRECATED:io}=Ot,{graph:ao}=ct,{cloneGraph:ro}=ct,{getNextStoreID:so}=gt,{createMutableSource:lo,reactMode:co}=Oe,{applyAtomValueWrites:uo}=Zt,{releaseScheduledRetainablesNow:po}=an,{freshSnapshot:fo}=qn,{useCallback:ho,useContext:mo,useEffect:go,useMemo:vo,useRef:yo,useState:bo}=i;function notInAContext(){throw ie("This component must be used inside a <RecoilRoot> component.")}const So=Object.freeze({storeID:so(),getState:notInAContext,replaceState:notInAContext,getGraph:notInAContext,subscribeToTransactions:notInAContext,addTransactionMetadata:notInAContext});let wo=!1;function startNextTreeIfNeeded(e){if(wo)throw ie("An atom update was triggered within the execution of a state updater function. State updater functions provided to Recoil must be pure functions.");const t=e.getState();if(null===t.nextTree){Ae("recoil_memory_managament_2020")&&Ae("recoil_release_on_cascading_update_killswitch_2021")&&t.commitDepth>0&&po(e);const n=t.currentTree.version,o=Jn();t.nextTree={...t.currentTree,version:o,stateID:o,dirtyAtoms:new Set,transactionMetadata:{}},t.graphsByVersion.set(o,ro(re(t.graphsByVersion.get(n))))}}const _o=i.createContext({current:So}),useStoreRef=()=>mo(_o),Ao=i.createContext(null);function useRecoilMutableSource(){const e=mo(Ao);return null==e&&Ge("Attempted to use a Recoil hook outside of a <RecoilRoot>. <RecoilRoot> must be an ancestor of any component that uses Recoil hooks."),e}function notifyComponents(e,t,n){const o=to(e,n,n.dirtyAtoms);for(const e of o){const o=t.nodeToComponentSubscriptions.get(e);if(o)for(const[e,[t,i]]of o)i(n)}}function sendEndOfBatchNotifications(e){const t=e.getState(),n=t.currentTree,o=n.dirtyAtoms;if(o.size){for(const[n,i]of t.nodeTransactionSubscriptions)if(o.has(n))for(const[t,n]of i)n(e);for(const[n,o]of t.transactionSubscriptions)o(e);(!co().early||t.suspendedComponentResolvers.size>0)&&(notifyComponents(e,t,n),t.suspendedComponentResolvers.forEach((e=>e())),t.suspendedComponentResolvers.clear())}t.queuedComponentCallbacks_DEPRECATED.forEach((e=>e(n))),t.queuedComponentCallbacks_DEPRECATED.splice(0,t.queuedComponentCallbacks_DEPRECATED.length)}function endBatch(e){const t=e.getState();t.commitDepth++;try{const{nextTree:n}=t;if(null==n)return;t.previousTree=t.currentTree,t.currentTree=n,t.nextTree=null,sendEndOfBatchNotifications(e),null!=t.previousTree?t.graphsByVersion.delete(t.previousTree.version):Ee("Ended batch with no previous state, which is unexpected","recoil"),t.previousTree=null,Ae("recoil_memory_managament_2020")&&null==n&&po(e)}finally{t.commitDepth--}}function Batcher({setNotifyBatcherOfChange:e}){const t=useStoreRef(),[,n]=bo([]);return e((()=>n({}))),go((()=>(e((()=>n({}))),()=>{e((()=>{}))})),[e]),go((()=>{et.enqueueExecution("Batcher",(()=>{endBatch(t.current)}))})),null}function initialStoreState_DEPRECATED(e,t){const n=Qn();return t({set:(t,o)=>{const i=n.currentTree,a=oo(e,i,t.key,o),r=new Set(a.keys()),s=i.nonvalidatedAtoms.clone();for(const e of r)s.delete(e);n.currentTree={...i,dirtyAtoms:Yn(i.dirtyAtoms,r),atomValues:uo(i.atomValues,a),nonvalidatedAtoms:s}},setUnvalidatedAtomValues:e=>{e.forEach(((e,t)=>{n.currentTree=io(n.currentTree,t,e)}))}}),n}function initialStoreState(e){const t=fo(e),n=t.getStore_INTERNAL().getState();return t.retain(),n.nodeCleanupFunctions.forEach((e=>e())),n.nodeCleanupFunctions.clear(),n}"production"!==process.env.NODE_ENV&&("undefined"==typeof window||window.$recoilDebugStates||(window.$recoilDebugStates=[]));let Co=0;function RecoilRoot_INTERNAL({initializeState_DEPRECATED:e,initializeState:t,store_INTERNAL:n,children:o}){let a;const getGraph=e=>{const t=a.current.graphsByVersion;if(t.has(e))return re(t.get(e));const n=ao();return t.set(e,n),n},subscribeToTransactions=(e,t)=>{if(null==t){const{transactionSubscriptions:t}=l.current.getState(),n=Co++;return t.set(n,e),{release:()=>{t.delete(n)}}}{const{nodeTransactionSubscriptions:n}=l.current.getState();n.has(t)||n.set(t,new Map);const o=Co++;return re(n.get(t)).set(o,e),{release:()=>{const e=n.get(t);e&&(e.delete(o),0===e.size&&n.delete(t))}}}},addTransactionMetadata=e=>{startNextTreeIfNeeded(l.current);for(const t of Object.keys(e))re(l.current.getState().nextTree).transactionMetadata[t]=e[t]},replaceState=e=>{startNextTreeIfNeeded(l.current);const t=re(a.current.nextTree);let n;try{wo=!0,n=e(t)}finally{wo=!1}n!==t&&("production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&window.$recoilDebugStates.push(n),a.current.nextTree=n,co().early&¬ifyComponents(l.current,a.current,n),re(r.current)())},r=yo(null),s=ho((e=>{r.current=e}),[r]),l=Xn((()=>null!=n?n:{storeID:so(),getState:()=>a.current,replaceState:replaceState,getGraph:getGraph,subscribeToTransactions:subscribeToTransactions,addTransactionMetadata:addTransactionMetadata}));null!=n&&(l.current=n),a=Xn((()=>null!=e?initialStoreState_DEPRECATED(l.current,e):null!=t?initialStoreState(t):Qn()));const c=vo((()=>null==lo?void 0:lo(a,(()=>a.current.currentTree.version))),[a]);return go((()=>{const e=l.current;for(const t of new Set(e.getState().knownAtoms))no(e,t,"get");return()=>{for(const t of e.getState().knownAtoms)eo(e,t)}}),[l]),i.createElement(_o.Provider,{value:l},i.createElement(Ao.Provider,{value:c},i.createElement(Batcher,{setNotifyBatcherOfChange:s}),o))}function RecoilRoot(e){const{override:t,...n}=e,o=useStoreRef();return!1===t&&o.current!==So?e.children:i.createElement(RecoilRoot_INTERNAL,n)}var Eo={RecoilRoot:RecoilRoot,useStoreRef:useStoreRef,useRecoilMutableSource:useRecoilMutableSource};function shallowArrayEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0,o=e.length;n<o;n++)if(e[n]!==t[n])return!1;return!0}var To=shallowArrayEqual;const{useEffect:ko,useRef:xo}=i;function usePrevious(e){const t=xo();return ko((()=>{t.current=e})),t.current}var No=usePrevious;const{useStoreRef:Ro}=Eo,{SUSPENSE_TIMEOUT_MS:Vo}=an,{updateRetainCount:Po}=an,{RetentionZone:Oo}=_t,{useEffect:Lo,useRef:Io}=i,{isSSR:Mo}=yn;function useRetain(e){if(Ae("recoil_memory_managament_2020"))return useRetain_ACTUAL(e)}function useRetain_ACTUAL(e){const t=undefined,n=(Array.isArray(e)?e:[e]).map((e=>e instanceof Oo?e:e.key)),o=Ro();Lo((()=>{if(!Ae("recoil_memory_managament_2020"))return;const e=o.current;if(i.current&&!Mo)window.clearTimeout(i.current),i.current=null;else for(const t of n)Po(e,t,1);return()=>{for(const t of n)Po(e,t,-1)}}),[o,...n]);const i=Io(),a=No(n);if(!(Mo||void 0!==a&&To(a,n))){const e=o.current;for(const t of n)Po(e,t,1);if(a)for(const t of a)Po(e,t,-1);i.current&&window.clearTimeout(i.current),i.current=window.setTimeout((()=>{i.current=null;for(const t of n)Po(e,t,-1)}),Vo)}}var Do=useRetain;function useComponentName(){return"<component name not available>"}var Bo=useComponentName;const{currentRendererSupportsUseSyncExternalStore:zo,reactMode:Uo,useMutableSource:Fo,useSyncExternalStore:jo}=Oe,{useRecoilMutableSource:Ho,useStoreRef:Wo}=Eo,{isRecoilValue:Go}=je,{getRecoilValueAsLoadable:$o,setRecoilValue:Ko,subscribeToRecoilValue:qo}=Zt,{useCallback:Yo,useEffect:Zo,useMemo:Xo,useRef:Jo,useState:Qo}=i,{isSSR:ei}=yn;function handleLoadable(e,t,n){if("hasValue"===e.state)return e.contents;if("loading"===e.state){const t=undefined;throw new Promise((t=>{const o=n.current.getState().suspendedComponentResolvers;o.add(t),ei&&ae(e.contents)&&e.contents.finally((()=>{o.delete(t)}))}))}throw"hasError"===e.state?e.contents:ie(`Invalid value of loadable atom "${t.key}"`)}function validateRecoilValue(e,t){if(!Go(e))throw ie(`Invalid argument to ${t}: expected an atom or selector but got ${String(e)}`)}function useRecoilValueLoadable_SYNC_EXTERNAL_STORE(e){const t=Wo(),n=Bo(),o=Yo((()=>{var n;process.env.NODE_ENV;const o=t.current,i=o.getState(),a=Uo().early&&null!==(n=i.nextTree)&&void 0!==n?n:i.currentTree,r=undefined;return{loadable:$o(o,e,a),key:e.key}}),[t,e]),i=Yo((e=>{let t;return()=>{var n,o;const i=e();return null!==(n=t)&&void 0!==n&&n.loadable.is(i.loadable)&&(null===(o=t)||void 0===o?void 0:o.key)===i.key?t:(t=i,i)}}),[]),a=Xo((()=>i(o)),[o,i]),r=Yo((o=>{const i=t.current,a=undefined;return qo(i,e,o,n).release}),[t,e,n]);return jo(r,a,a).loadable}function useRecoilValueLoadable_MUTABLE_SOURCE(e){const t=Wo(),n=Yo((()=>{var n;const o=t.current,i=o.getState(),a=Uo().early&&null!==(n=i.nextTree)&&void 0!==n?n:i.currentTree;return $o(o,e,a)}),[t,e]),o=Yo((()=>(process.env.NODE_ENV,n())),[n]),i=Bo(),a=Yo(((o,a)=>{const r=t.current,s=undefined;return qo(r,e,(()=>{if(!Ae("recoil_suppress_rerender_in_callback"))return a();const e=n();l.current.is(e)||a(),l.current=e}),i).release}),[t,e,i,n]),r=Ho();if(null==r)throw ie("Recoil hooks must be used in components contained within a <RecoilRoot> component.");const s=Fo(r,o,a),l=Jo(s);return Zo((()=>{l.current=s})),s}function useRecoilValueLoadable_TRANSITION_SUPPORT(e){const t=Wo(),n=Bo(),o=Yo((()=>{var n;process.env.NODE_ENV;const o=t.current,i=o.getState(),a=Uo().early&&null!==(n=i.nextTree)&&void 0!==n?n:i.currentTree;return $o(o,e,a)}),[t,e]),i=Yo((()=>({loadable:o(),key:e.key})),[o,e.key]),a=Yo((e=>{const t=i();return e.loadable.is(t.loadable)&&e.key===t.key?e:t}),[i]);Zo((()=>{const o=qo(t.current,e,(e=>{s(a)}),n);return s(a),o.release}),[n,e,t,a]);const[r,s]=Qo(i);return r.key!==e.key?i().loadable:r.loadable}function useRecoilValueLoadable_LEGACY(e){const t=Wo(),[,n]=Qo([]),o=Bo(),i=Yo((()=>{var n;process.env.NODE_ENV;const o=t.current,i=o.getState(),a=Uo().early&&null!==(n=i.nextTree)&&void 0!==n?n:i.currentTree;return $o(o,e,a)}),[t,e]),a=i(),r=Jo(a);return Zo((()=>{r.current=a})),Zo((()=>{const a=t.current,s=a.getState(),l=qo(a,e,(e=>{var t;if(!Ae("recoil_suppress_rerender_in_callback"))return n([]);const o=i();null!==(t=r.current)&&void 0!==t&&t.is(o)||n(o),r.current=o}),o);if(s.nextTree)a.getState().queuedComponentCallbacks_DEPRECATED.push((()=>{r.current=null,n([])}));else{var c;if(!Ae("recoil_suppress_rerender_in_callback"))return n([]);const e=i();null!==(c=r.current)&&void 0!==c&&c.is(e)||n(e),r.current=e}return l.release}),[o,i,e,t]),a}function useRecoilValueLoadable(e){return"production"!==process.env.NODE_ENV&&validateRecoilValue(e,"useRecoilValueLoadable"),Ae("recoil_memory_managament_2020")&&Do(e),{TRANSITION_SUPPORT:useRecoilValueLoadable_TRANSITION_SUPPORT,SYNC_EXTERNAL_STORE:zo()?useRecoilValueLoadable_SYNC_EXTERNAL_STORE:useRecoilValueLoadable_TRANSITION_SUPPORT,MUTABLE_SOURCE:useRecoilValueLoadable_MUTABLE_SOURCE,LEGACY:useRecoilValueLoadable_LEGACY}[Uo().mode](e)}function useRecoilValue(e){"production"!==process.env.NODE_ENV&&validateRecoilValue(e,"useRecoilValue");const t=Wo(),n=undefined;return handleLoadable(useRecoilValueLoadable(e),e,t)}function useSetRecoilState(e){"production"!==process.env.NODE_ENV&&validateRecoilValue(e,"useSetRecoilState");const t=Wo();return Yo((n=>{Ko(t.current,e,n)}),[t,e])}function useRecoilState(e){return"production"!==process.env.NODE_ENV&&validateRecoilValue(e,"useRecoilState"),[useRecoilValue(e),useSetRecoilState(e)]}var ti={useRecoilState:useRecoilState,useRecoilValue:useRecoilValue,useRecoilValueLoadable:useRecoilValueLoadable,useSetRecoilState:useSetRecoilState};const{batchUpdates:ni}=hn,{DEFAULT_VALUE:oi,getNode:ii}=Qe,{AbstractRecoilValue:ai,setRecoilValueLoadable:ri}=Zt,{cloneSnapshot:si}=qn,{useCallback:li,useEffect:ci,useRef:ui,useState:di}=i;function gotoSnapshot(e,t){var n;const o=e.getState(),i=null!==(n=o.nextTree)&&void 0!==n?n:o.currentTree,a=t.getStore_INTERNAL().getState().currentTree;ni((()=>{const n=new Set;for(const e of[i.atomValues.keys(),a.atomValues.keys()])for(const t of e){var o,r;(null===(o=i.atomValues.get(t))||void 0===o?void 0:o.contents)!==(null===(r=a.atomValues.get(t))||void 0===r?void 0:r.contents)&&ii(t).shouldRestoreFromSnapshots&&n.add(t)}n.forEach((t=>{ri(e,new ai(t),a.atomValues.has(t)?re(a.atomValues.get(t)):oi)})),e.replaceState((e=>({...e,stateID:t.getID()})))}))}var pi={gotoSnapshot:gotoSnapshot};const{useMemo:fi}=i,{loadableWithValue:hi}=Se,{initializeNode:mi}=Ot,{DEFAULT_VALUE:gi,getNode:vi}=Qe,{copyTreeState:yi,getRecoilValueAsLoadable:bi,invalidateDownstreams:Si,writeLoadableToTreeState:wi}=Zt;function isAtom(e){return"atom"===vi(e.key).nodeType}class _i{constructor(e,t){_defineProperty(this,"_store",void 0),_defineProperty(this,"_treeState",void 0),_defineProperty(this,"_changes",void 0),_defineProperty(this,"get",(e=>{if(this._changes.has(e.key))return this._changes.get(e.key);if(!isAtom(e))throw ie("Reading selectors within atomicUpdate is not supported");const t=bi(this._store,e,this._treeState);if("hasValue"===t.state)return t.contents;throw"hasError"===t.state?t.contents:ie(`Expected Recoil atom ${e.key} to have a value, but it is in a loading state.`)})),_defineProperty(this,"set",((e,t)=>{if(!isAtom(e))throw ie("Setting selectors within atomicUpdate is not supported");if("function"==typeof t){const n=this.get(e);this._changes.set(e.key,t(n))}else mi(this._store,e.key,"set"),this._changes.set(e.key,t)})),_defineProperty(this,"reset",(e=>{this.set(e,gi)})),this._store=e,this._treeState=t,this._changes=new Map}newTreeState_INTERNAL(){if(0===this._changes.size)return this._treeState;const e=yi(this._treeState);for(const[t,n]of this._changes)wi(e,t,hi(n));return Si(this._store,e),e}}function atomicUpdater(e){return t=>{e.replaceState((n=>{const o=new _i(e,n);return t(o),o.newTreeState_INTERNAL()}))}}var Ai,Ci=atomicUpdater,Ei=Object.freeze({__proto__:null,atomicUpdater:Ci});function invariant(e,t){if(!e)throw new Error(t)}var Ti,ki=invariant;const{atomicUpdater:xi}=Ei,{batchUpdates:Ni}=hn,{DEFAULT_VALUE:Ri}=Qe,{useStoreRef:Vi}=Eo,{refreshRecoilValue:Pi,setRecoilValue:Oi}=Zt,{cloneSnapshot:Li}=qn,{gotoSnapshot:Ii}=pi,{useCallback:Mi}=i;class Di{}const Bi=new Di;function recoilCallback(e,t,n,o){let i=Bi,a;var r;(Ni((()=>{const r="useRecoilCallback() expects a function that returns a function: it accepts a function of the type (RecoilInterface) => (Args) => ReturnType and returns a callback function (Args) => ReturnType, where RecoilInterface is an object {snapshot, set, ...} and Args and ReturnType are the argument and return types of the callback you want to create. Please see the docs at recoiljs.org for details.";if("function"!=typeof t)throw ie(r);const s=Et({...null!=o?o:{},set:(t,n)=>Oi(e,t,n),reset:t=>Oi(e,t,Ri),refresh:t=>Pi(e,t),gotoSnapshot:t=>Ii(e,t),transact_UNSTABLE:t=>xi(e)(t)},{snapshot:()=>{const t=Li(e);return a=t.retain(),t}}),l=t(s);if("function"!=typeof l)throw ie(r);i=l(...n)})),i instanceof Di&&("production"!==process.env.NODE_ENV?ki(!1,"batchUpdates should return immediately"):ki(!1)),ae(i))?i=i.finally((()=>{var e;null===(e=a)||void 0===e||e()})):null===(r=a)||void 0===r||r();return i}function useRecoilCallback(e,t){const n=Vi();return Mi(((...t)=>recoilCallback(n.current,e,t)),null!=t?[...t,n]:void 0)}var zi={recoilCallback:recoilCallback,useRecoilCallback:useRecoilCallback};const{useCallback:Ui}=i,{atomicUpdater:Fi}=Ei,{useMemo:ji}=i;class Hi{constructor(e){_defineProperty(this,"value",void 0),this.value=e}}var Wi,Gi=Hi,$i=Object.freeze({__proto__:null,WrappedValue:Gi});class Ki extends Error{}class qi{constructor(e){var t,n,o;_defineProperty(this,"_name",void 0),_defineProperty(this,"_numLeafs",void 0),_defineProperty(this,"_root",void 0),_defineProperty(this,"_onHit",void 0),_defineProperty(this,"_onSet",void 0),_defineProperty(this,"_mapNodeValue",void 0),this._name=null==e?void 0:e.name,this._numLeafs=0,this._root=null,this._onHit=null!==(t=null==e?void 0:e.onHit)&&void 0!==t?t:()=>{},this._onSet=null!==(n=null==e?void 0:e.onSet)&&void 0!==n?n:()=>{},this._mapNodeValue=null!==(o=null==e?void 0:e.mapNodeValue)&&void 0!==o?o:e=>e}size(){return this._numLeafs}root(){return this._root}get(e,t){var n;return null===(n=this.getLeafNode(e,t))||void 0===n?void 0:n.value}getLeafNode(e,t){if(null==this._root)return;let n=this._root;for(;n;){if(null==t||t.onNodeVisit(n),"leaf"===n.type)return this._onHit(n),n;const o=this._mapNodeValue(e(n.nodeKey));n=n.branches.get(o)}}set(e,t,n){const addLeaf=()=>{var o,i,a,r;let s,l;for(const[t,o]of e){var c,u,d;const e=this._root;if("leaf"===(null==e?void 0:e.type))throw this.invalidCacheError();const i=s;if(s=i?i.branches.get(l):e,s=null!==(c=s)&&void 0!==c?c:{type:"branch",nodeKey:t,parent:i,branches:new Map,branchKey:l},"branch"!==s.type||s.nodeKey!==t)throw this.invalidCacheError();null==i||i.branches.set(l,s),null==n||null===(u=n.onNodeVisit)||void 0===u||u.call(n,s),l=this._mapNodeValue(o),this._root=null!==(d=this._root)&&void 0!==d?d:s}const p=s?null===(o=s)||void 0===o?void 0:o.branches.get(l):this._root;if(null!=p&&("leaf"!==p.type||p.branchKey!==l))throw this.invalidCacheError();const f={type:"leaf",value:t,parent:s,branchKey:l};null===(i=s)||void 0===i||i.branches.set(l,f),this._root=null!==(a=this._root)&&void 0!==a?a:f,this._numLeafs++,this._onSet(f),null==n||null===(r=n.onNodeVisit)||void 0===r||r.call(n,f)};try{addLeaf()}catch(e){if(!(e instanceof Ki))throw e;this.clear(),addLeaf()}}delete(e){const t=this.root();if(!t)return!1;if(e===t)return this._root=null,this._numLeafs=0,!0;let n=e.parent,o=e.branchKey;for(;n;){var i;if(n.branches.delete(o),n===t)return 0===n.branches.size?(this._root=null,this._numLeafs=0):this._numLeafs--,!0;if(n.branches.size>0)break;o=null===(i=n)||void 0===i?void 0:i.branchKey,n=n.parent}for(;n!==t;n=n.parent)if(null==n)return!1;return this._numLeafs--,!0}clear(){this._numLeafs=0,this._root=null}invalidCacheError(){const e=undefined;throw Ee("Invalid cache values. This happens when selectors do not return consistent values for the same input dependency values. That may also be caused when using Fast Refresh to change a selector implementation. Resetting cache."+(null!=this._name?` - ${this._name}`:"")),new Ki}}var Yi,Zi=qi,Xi=Object.freeze({__proto__:null,TreeCache:Zi});class Ji{constructor(e){var t;_defineProperty(this,"_maxSize",void 0),_defineProperty(this,"_size",void 0),_defineProperty(this,"_head",void 0),_defineProperty(this,"_tail",void 0),_defineProperty(this,"_map",void 0),_defineProperty(this,"_keyMapper",void 0),this._maxSize=e.maxSize,this._size=0,this._head=null,this._tail=null,this._map=new Map,this._keyMapper=null!==(t=e.mapKey)&&void 0!==t?t:e=>e}head(){return this._head}tail(){return this._tail}size(){return this._size}maxSize(){return this._maxSize}has(e){return this._map.has(this._keyMapper(e))}get(e){const t=this._keyMapper(e),n=this._map.get(t);if(n)return this.set(e,n.value),n.value}set(e,t){const n=this._keyMapper(e),o=undefined;this._map.get(n)&&this.delete(e);const i=this.head(),a={key:e,right:i,left:null,value:t};i?i.left=a:this._tail=a,this._map.set(n,a),this._head=a,this._size++,this._maybeDeleteLRU()}_maybeDeleteLRU(){this.size()>this.maxSize()&&this.deleteLru()}deleteLru(){const e=this.tail();e&&this.delete(e.key)}delete(e){const t=this._keyMapper(e);if(!this._size||!this._map.has(t))return;const n=re(this._map.get(t)),o=n.right,i=n.left;o&&(o.left=n.left),i&&(i.right=n.right),n===this.head()&&(this._head=o),n===this.tail()&&(this._tail=i),this._map.delete(t),this._size--}clear(){this._size=0,this._head=null,this._tail=null,this._map=new Map}}var Qi,ea=Ji,ta=Object.freeze({__proto__:null,LRUCache:ea});const{LRUCache:na}=ta,{TreeCache:oa}=Xi;function treeCacheLRU({name:e,maxSize:t,mapNodeValue:n=e=>e}){const o=new na({maxSize:t}),i=new oa({name:e,mapNodeValue:n,onHit:e=>{o.set(e,!0)},onSet:e=>{const n=o.tail();o.set(e,!0),n&&i.size()>t&&i.delete(n.key)}});return i}var ia=treeCacheLRU;const aa=15;function stringify$1(e,t,n){if("string"==typeof e&&!e.includes('"')&&!e.includes("\\"))return`"${e}"`;switch(typeof e){case"undefined":return"";case"boolean":return e?"true":"false";case"number":case"symbol":return String(e);case"string":return JSON.stringify(e);case"function":if(!0!==(null==t?void 0:t.allowFunctions))throw ie("Attempt to serialize function in a Recoil cache key");return`__FUNCTION(${e.name})__`}if(null===e)return"null";var o;if("object"!=typeof e)return null!==(o=JSON.stringify(e))&&void 0!==o?o:"";if(ae(e))return"__PROMISE__";if(Array.isArray(e))return`[${e.map(((e,n)=>stringify$1(e,t,n.toString())))}]`;if("function"==typeof e.toJSON)return stringify$1(e.toJSON(n),t,n);if(e instanceof Map){const o={};for(const[n,i]of e)o["string"==typeof n?n:stringify$1(n,t)]=i;return stringify$1(o,t,n)}return e instanceof Set?stringify$1(Array.from(e).sort(((e,n)=>stringify$1(e,t).localeCompare(stringify$1(n,t)))),t,n):void 0!==Symbol&&null!=e[Symbol.iterator]&&"function"==typeof e[Symbol.iterator]?stringify$1(Array.from(e),t,n):`{${Object.keys(e).filter((t=>void 0!==e[t])).sort().map((n=>`${stringify$1(n,t)}:${stringify$1(e[n],t,n)}`)).join(",")}}`}function stableStringify(e,t={allowFunctions:!1}){if("production"!==process.env.NODE_ENV&&"undefined"!=typeof window){const n=window.performance?window.performance.now():0,o=stringify$1(e,t),i=window.performance?window.performance.now():0;return i-n>aa&&(console.groupCollapsed(`Recoil: Spent ${i-n}ms computing a cache key`),console.warn(e,o),console.groupEnd()),o}return stringify$1(e,t)}var ra=stableStringify;const{TreeCache:sa}=Xi,la={equality:"reference",eviction:"keep-all",maxSize:1/0};function treeCacheFromPolicy({equality:e=la.equality,eviction:t=la.eviction,maxSize:n=la.maxSize}=la,o){const i=undefined;return getTreeCache(t,n,getValueMapper(e),o)}function getValueMapper(e){switch(e){case"reference":return e=>e;case"value":return e=>ra(e)}throw ie(`Unrecognized equality policy ${e}`)}function getTreeCache(e,t,n,o){switch(e){case"keep-all":return new sa({name:o,mapNodeValue:n});case"lru":return ia({name:o,maxSize:re(t),mapNodeValue:n});case"most-recent":return ia({name:o,maxSize:1,mapNodeValue:n})}throw ie(`Unrecognized eviction policy ${e}`)}var ca=treeCacheFromPolicy;function isNode(e){var t,n;if("undefined"==typeof window)return!1;const o=undefined,i=null!==(n=(null!=e?null!==(t=e.ownerDocument)&&void 0!==t?t:e:document).defaultView)&&void 0!==n?n:window;return!(null==e||!("function"==typeof i.Node?e instanceof i.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}var ua=isNode;const{isReactNative:da,isWindow:pa}=yn;function shouldNotBeFrozen(e){if(null===e||"object"!=typeof e)return!0;switch(typeof e.$$typeof){case"symbol":case"number":return!0}return null!=e["@@__IMMUTABLE_ITERABLE__@@"]||null!=e["@@__IMMUTABLE_KEYED__@@"]||null!=e["@@__IMMUTABLE_INDEXED__@@"]||null!=e["@@__IMMUTABLE_ORDERED__@@"]||null!=e["@@__IMMUTABLE_RECORD__@@"]||(!!ua(e)||(!!ae(e)||(e instanceof Error||(!!ArrayBuffer.isView(e)||!(da||!pa(e))))))}function deepFreezeValue(e){if("object"==typeof e&&!shouldNotBeFrozen(e)){Object.freeze(e);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];"object"!=typeof n||null==n||Object.isFrozen(n)||deepFreezeValue(n)}Object.seal(e)}}var fa=deepFreezeValue;const{isLoadable:ha,loadableWithError:ma,loadableWithPromise:ga,loadableWithValue:va}=Se,{WrappedValue:ya}=$i,{getNodeLoadable:ba,peekNodeLoadable:Sa,setNodeValue:wa}=Ot,{saveDepsToStore:_a}=ct,{DEFAULT_VALUE:Aa,getConfigDeletionHandler:Ca,getNode:Ea,registerNode:Ta}=Qe,{isRecoilValue:ka}=je,{markRecoilValueModified:xa}=Zt,{retainedByOptionWithDefault:Na}=an,{recoilCallback:Ra}=zi;class Va{}const Pa=new Va,Oa=[],La=new Map,Ia=(()=>{let e=0;return()=>e++})();function selector(e){let t=null;const{key:n,get:o,cachePolicy_UNSTABLE:i}=e,a=null!=e.set?e.set:void 0;if("production"!==process.env.NODE_ENV){if("string"!=typeof n)throw ie("A key option with a unique string value must be provided when creating a selector.");if("function"!=typeof o)throw ie("Selectors must specify a get callback option to get the selector value.")}const r=new Set,s=ca(null!=i?i:{equality:"reference",eviction:"keep-all"},n),l=Na(e.retainedBy_UNSTABLE),c=new Map;let u=0;function selectorIsLive(){return!Ae("recoil_memory_managament_2020")||u>0}function selectorInit(e){return e.getState().knownSelectors.add(n),u++,()=>{u--}}function selectorShouldDeleteConfigOnRelease(){return void 0!==Ca(n)&&!selectorIsLive()}function resolveAsync(e,t,n,o,i){setCache(t,o,i),notifyStoresOfResolvedAsync(e,n)}function notifyStoresOfResolvedAsync(e,t){isLatestExecution(e,t)&&clearExecutionInfo(e),notifyWaitingStores(t,!0)}function notifyStoresOfNewAsyncDep(e,t){if(isLatestExecution(e,t)){const n=undefined;re(getExecutionInfo(e)).stateVersions.clear(),notifyWaitingStores(t,!1)}}function notifyWaitingStores(e,n){const o=La.get(e);if(null!=o){for(const e of o)xa(e,re(t));n&&La.delete(e)}}function markStoreWaitingForResolvedAsync(e,t){let n=La.get(t);null==n&&La.set(t,n=new Set),n.add(e)}function wrapResultPromise(e,t,n,o,i,a){return t.then((t=>{if(!selectorIsLive())throw clearExecutionInfo(e),Pa;const a=va(t);return resolveAsync(e,n,i,a,o),t})).catch((t=>{if(!selectorIsLive())throw clearExecutionInfo(e),Pa;if(ae(t))return wrapPendingDependencyPromise(e,t,n,o,i,a);const r=ma(t);throw resolveAsync(e,n,i,r,o),t}))}function wrapPendingDependencyPromise(e,t,n,o,i,a){return t.then((o=>{if(!selectorIsLive())throw clearExecutionInfo(e),Pa;null!=a.loadingDepKey&&a.loadingDepPromise===t?n.atomValues.set(a.loadingDepKey,va(o)):e.getState().knownSelectors.forEach((e=>{n.atomValues.delete(e)}));const r=getLoadableFromCacheAndUpdateDeps(e,n);if(r&&"loading"!==r.state){if((isLatestExecution(e,i)||null==getExecutionInfo(e))&¬ifyStoresOfResolvedAsync(e,i),"hasValue"===r.state)return r.contents;throw r.contents}if(!isLatestExecution(e,i)){const t=getInProgressExecutionInfo(e,n);if(null!=t)return t.loadingLoadable.contents}const[s,l]=evaluateSelectorGetter(e,n,i);if("loading"!==s.state&&resolveAsync(e,n,i,s,l),"hasError"===s.state)throw s.contents;return s.contents})).catch((t=>{if(t instanceof Va)throw Pa;if(!selectorIsLive())throw clearExecutionInfo(e),Pa;const a=ma(t);throw resolveAsync(e,n,i,a,o),t}))}function updateDeps(e,t,o,i){var a,s,l,c,u,d,p;(isLatestExecution(e,i)||t.version===(null===(a=e.getState())||void 0===a||null===(s=a.currentTree)||void 0===s?void 0:s.version)||t.version===(null===(l=e.getState())||void 0===l||null===(c=l.nextTree)||void 0===c?void 0:c.version))&&_a(n,o,e,null!==(u=null===(d=e.getState())||void 0===d||null===(p=d.nextTree)||void 0===p?void 0:p.version)&&void 0!==u?u:e.getState().currentTree.version);for(const e of o)r.add(e)}function evaluateSelectorGetter(e,n,i){let a=!0,r=!0;const finishEvaluation=()=>{r=!1};let s,l=!1,c;const u={loadingDepKey:null,loadingDepPromise:null},d=new Map;function getRecoilValue({key:t}){const o=ba(e,n,t);switch(d.set(t,o),a||(updateDeps(e,n,new Set(d.keys()),i),notifyStoresOfNewAsyncDep(e,i)),o.state){case"hasValue":return o.contents;case"hasError":throw o.contents;case"loading":throw u.loadingDepKey=t,u.loadingDepPromise=o.contents,o.contents}throw ie("Invalid Loadable state")}const getCallback=n=>(...o)=>{if(r)throw ie("Callbacks from getCallback() should only be called asynchronously after the selector is evalutated. It can be used for selectors to return objects with callbacks that can work with Recoil state without a subscription.");return null==t&&("production"!==process.env.NODE_ENV?ki(!1,"Recoil Value can never be null"):ki(!1)),Ra(e,n,o,{node:t})};try{s=o({get:getRecoilValue,getCallback:getCallback}),s=ka(s)?getRecoilValue(s):s,ha(s)&&("hasError"===s.state&&(l=!0),s=s.contents),ae(s)?s=wrapResultPromise(e,s,n,d,i,u).finally(finishEvaluation):finishEvaluation(),s=s instanceof ya?s.value:s}catch(t){s=t,ae(s)?s=wrapPendingDependencyPromise(e,s,n,d,i,u).finally(finishEvaluation):(l=!0,finishEvaluation())}return c=l?ma(s):ae(s)?ga(s):va(s),a=!1,updateExecutionInfoDepValues(e,i,d),updateDeps(e,n,new Set(d.keys()),i),[c,d]}function getLoadableFromCacheAndUpdateDeps(e,t){let o=t.atomValues.get(n);if(null!=o)return o;const i=new Set;try{o=s.get((n=>("string"!=typeof n&&("production"!==process.env.NODE_ENV?ki(!1,"Cache nodeKey is type string"):ki(!1)),ba(e,t,n).contents)),{onNodeVisit:e=>{"branch"===e.type&&e.nodeKey!==n&&i.add(e.nodeKey)}})}catch(e){throw ie(`Problem with cache lookup for selector "${n}": ${e.message}`)}var a;o&&(t.atomValues.set(n,o),updateDeps(e,t,i,null===(a=getExecutionInfo(e))||void 0===a?void 0:a.executionID));return o}function getSelectorLoadableAndUpdateDeps(e,t){const n=getLoadableFromCacheAndUpdateDeps(e,t);if(null!=n)return clearExecutionInfo(e),n;const o=getInProgressExecutionInfo(e,t);var i;if(null!=o)return"loading"===(null===(i=o.loadingLoadable)||void 0===i?void 0:i.state)&&markStoreWaitingForResolvedAsync(e,o.executionID),o.loadingLoadable;const a=Ia(),[r,s]=evaluateSelectorGetter(e,t,a);return"loading"===r.state?(setExecutionInfo(e,a,r,s,t),markStoreWaitingForResolvedAsync(e,a)):(clearExecutionInfo(e),setCache(t,r,s)),r}function getInProgressExecutionInfo(e,t){const n=mn([c.has(e)?[re(c.get(e))]:[],$e(Ct(c,(([t])=>t!==e)),(([,e])=>e))]);function anyDepChanged(n){for(const[o,i]of n)if(!ba(e,t,o).is(i))return!0;return!1}for(const e of n){if(e.stateVersions.get(t.version)||!anyDepChanged(e.depValuesDiscoveredSoFarDuringAsyncWork))return e.stateVersions.set(t.version,!0),e;e.stateVersions.set(t.version,!1)}}function getExecutionInfo(e){return c.get(e)}function setExecutionInfo(e,t,n,o,i){c.set(e,{depValuesDiscoveredSoFarDuringAsyncWork:o,executionID:t,loadingLoadable:n,stateVersions:new Map([[i.version,!0]])})}function updateExecutionInfoDepValues(e,t,n){if(isLatestExecution(e,t)){const t=getExecutionInfo(e);null!=t&&(t.depValuesDiscoveredSoFarDuringAsyncWork=n)}}function clearExecutionInfo(e){c.delete(e)}function isLatestExecution(e,t){var n;return t===(null===(n=getExecutionInfo(e))||void 0===n?void 0:n.executionID)}function depValuesToDepRoute(e){return Array.from(e.entries()).map((([e,t])=>[e,t.contents]))}function setCache(t,o,i){"production"!==process.env.NODE_ENV&&"loading"!==o.state&&!1===Boolean(e.dangerouslyAllowMutability)&&fa(o.contents),t.atomValues.set(n,o);try{s.set(depValuesToDepRoute(i),o)}catch(e){throw ie(`Problem with setting cache for selector "${n}": ${e.message}`)}}function detectCircularDependencies(e){if(Oa.includes(n)){const e=`Recoil selector has circular dependencies: ${Oa.slice(Oa.indexOf(n)).join(" → ")}`;return ma(ie(e))}Oa.push(n);try{return e()}finally{Oa.pop()}}function selectorPeek(e,t){const o=t.atomValues.get(n);return null!=o?o:s.get((n=>{var o;return"string"!=typeof n&&("production"!==process.env.NODE_ENV?ki(!1,"Cache nodeKey is type string"):ki(!1)),null===(o=Sa(e,t,n))||void 0===o?void 0:o.contents}))}function selectorGet(e,t){return detectCircularDependencies((()=>getSelectorLoadableAndUpdateDeps(e,t)))}function invalidateSelector(e){e.atomValues.delete(n)}function clearSelectorCache(e,n){null==t&&("production"!==process.env.NODE_ENV?ki(!1,"Recoil Value can never be null"):ki(!1));for(const t of r){var o;const i=Ea(t);null===(o=i.clearCache)||void 0===o||o.call(i,e,n)}r.clear(),invalidateSelector(n),s.clear(),xa(e,t)}if(null!=a){const o=undefined;return t=Ta({key:n,nodeType:"selector",peek:selectorPeek,get:selectorGet,set:(e,t,o)=>{let i=!1;const r=new Map;function getRecoilValue({key:o}){if(i)throw ie("Recoil: Async selector sets are not currently supported.");const a=ba(e,t,o);if("hasValue"===a.state)return a.contents;if("loading"===a.state){const e=`Getting value of asynchronous atom or selector "${o}" in a pending state while setting selector "${n}" is not yet supported.`;throw Ee(e),ie(e)}throw a.contents}function setRecoilState(n,o){if(i){const e="Recoil: Async selector sets are not currently supported.";throw Ee(e),ie(e)}const a="function"==typeof o?o(getRecoilValue(n)):o,s=undefined;wa(e,t,n.key,a).forEach(((e,t)=>r.set(t,e)))}function resetRecoilState(e){setRecoilState(e,Aa)}const s=a({set:setRecoilState,get:getRecoilValue,reset:resetRecoilState},o);if(void 0!==s)throw ae(s)?ie("Recoil: Async selector sets are not currently supported."):ie("Recoil: selector set should be a void function.");return i=!0,r},init:selectorInit,invalidate:invalidateSelector,clearCache:clearSelectorCache,shouldDeleteConfigOnRelease:selectorShouldDeleteConfigOnRelease,dangerouslyAllowMutability:e.dangerouslyAllowMutability,shouldRestoreFromSnapshots:!1,retainedBy:l})}return t=Ta({key:n,nodeType:"selector",peek:selectorPeek,get:selectorGet,init:selectorInit,invalidate:invalidateSelector,clearCache:clearSelectorCache,shouldDeleteConfigOnRelease:selectorShouldDeleteConfigOnRelease,dangerouslyAllowMutability:e.dangerouslyAllowMutability,shouldRestoreFromSnapshots:!1,retainedBy:l})}selector.value=e=>new ya(e);var Ma=selector;const{isLoadable:Da,loadableWithError:Ba,loadableWithPromise:za,loadableWithValue:Ua}=Se,{WrappedValue:Fa}=$i,{peekNodeInfo:ja}=Ot,{DEFAULT_VALUE:Ha,DefaultValue:Wa,getConfigDeletionHandler:Ga,registerNode:$a,setConfigDeletionHandler:Ka}=Qe,{isRecoilValue:qa}=je,{getRecoilValueAsLoadable:Ya,markRecoilValueModified:Za,setRecoilValue:Xa,setRecoilValueLoadable:Ja}=Zt,{retainedByOptionWithDefault:Qa}=an,unwrap=e=>e instanceof Fa?e.value:e;function baseAtom(e){const{key:t,persistence_UNSTABLE:n}=e,o=Qa(e.retainedBy_UNSTABLE);let i=0;function unwrapPromise(e){return za(e.then((e=>(a=Ua(e),e))).catch((e=>{throw a=Ba(e),e})))}let a=ae(e.default)?unwrapPromise(e.default):Da(e.default)?"loading"===e.default.state?unwrapPromise(e.default.contents):e.default:Ua(unwrap(e.default)),r;maybeFreezeValueOrPromise(a.contents);const s=new Map;function maybeFreezeValueOrPromise(t){return"production"!==process.env.NODE_ENV&&!0!==e.dangerouslyAllowMutability?ae(t)?t.then((e=>(fa(e),e))):(fa(t),t):t}function wrapPendingPromise(e,n){const o=n.then((n=>{var i,a;const r=undefined;return(null===(a=(null!==(i=e.getState().nextTree)&&void 0!==i?i:e.getState().currentTree).atomValues.get(t))||void 0===a?void 0:a.contents)===o&&Xa(e,l,n),n})).catch((n=>{var i,a;const r=undefined;throw(null===(a=(null!==(i=e.getState().nextTree)&&void 0!==i?i:e.getState().currentTree).atomValues.get(t))||void 0===a?void 0:a.contents)===o&&Ja(e,l,Ba(n)),n}));return o}function initAtom(n,o,r){var c;i++;const cleanupAtom=()=>{var e;i--,null===(e=s.get(n))||void 0===e||e.forEach((e=>e())),s.delete(n)};if(n.getState().knownAtoms.add(t),"loading"===a.state){const notifyDefaultSubscribers=()=>{var e;const o=undefined;(null!==(e=n.getState().nextTree)&&void 0!==e?e:n.getState().currentTree).atomValues.has(t)||Za(n,l)};a.contents.finally(notifyDefaultSubscribers)}const u=null!==(c=e.effects)&&void 0!==c?c:e.effects_UNSTABLE;if(null!=u){let f=Ha,h=!0,m=!1,g=null;function getLoadable(e){if(h&&e.key===t){const e=f;return e instanceof Wa?peekAtom(n,o):ae(e)?za(e.then((e=>e instanceof Wa?a.toPromise():e))):Ua(e)}return Ya(n,e)}function getPromise(e){return getLoadable(e).toPromise()}function getInfo_UNSTABLE(e){var o;const i=ja(n,null!==(o=n.getState().nextTree)&&void 0!==o?o:n.getState().currentTree,e.key);return!h||e.key!==t||f instanceof Wa?i:{...i,isSet:!0,loadable:getLoadable(e)}}const setSelf=e=>t=>{if(h){const n=getLoadable(l),o="hasValue"===n.state?n.contents:Ha;f="function"==typeof t?t(o):t,ae(f)&&(f=f.then((t=>(g={effect:e,value:t},t))))}else{if(ae(t))throw ie("Setting atoms to async values is not implemented.");"function"!=typeof t&&(g={effect:e,value:unwrap(t)}),Xa(n,l,"function"==typeof t?n=>{const o=unwrap(t(n));return g={effect:e,value:o},o}:unwrap(t))}},resetSelf=e=>()=>setSelf(e)(Ha),onSet=e=>o=>{var i;const{release:r}=n.subscribeToTransactions((n=>{var i;let{currentTree:r,previousTree:s}=n.getState();s||(Ee("Transaction subscribers notified without a next tree being present -- this is a bug in Recoil"),s=r);const l=null!==(i=r.atomValues.get(t))&&void 0!==i?i:a;if("hasValue"===l.state){var c,u,d,p;const n=l.contents,i=null!==(c=s.atomValues.get(t))&&void 0!==c?c:a,f="hasValue"===i.state?i.contents:Ha;(null===(u=g)||void 0===u?void 0:u.effect)!==e||(null===(d=g)||void 0===d?void 0:d.value)!==n?o(n,f,!r.atomValues.has(t)):(null===(p=g)||void 0===p?void 0:p.effect)===e&&(g=null)}}),t);s.set(n,[...null!==(i=s.get(n))&&void 0!==i?i:[],r])};for(const v of u)try{const b=v({node:l,storeID:n.storeID,parentStoreID_UNSTABLE:n.parentStoreID,trigger:r,setSelf:setSelf(v),resetSelf:resetSelf(v),onSet:onSet(v),getPromise:getPromise,getLoadable:getLoadable,getInfo_UNSTABLE:getInfo_UNSTABLE});var d;if(null!=b)s.set(n,[...null!==(d=s.get(n))&&void 0!==d?d:[],b])}catch(S){f=S,m=!0}if(h=!1,!(f instanceof Wa)){var p;const w=m?Ba(f):ae(f)?za(wrapPendingPromise(n,f)):Ua(unwrap(f));maybeFreezeValueOrPromise(w.contents),o.atomValues.set(t,w),null===(p=n.getState().nextTree)||void 0===p||p.atomValues.set(t,w)}}return cleanupAtom}function peekAtom(e,n){var o,i;return null!==(o=null!==(i=n.atomValues.get(t))&&void 0!==i?i:r)&&void 0!==o?o:a}function getAtom(e,o){if(o.atomValues.has(t))return re(o.atomValues.get(t));if(o.nonvalidatedAtoms.has(t)){if(null!=r)return r;if(null==n)return Ge(`Tried to restore a persisted value for atom ${t} but it has no persistence settings.`),a;const e=o.nonvalidatedAtoms.get(t),i=n.validator(e,Ha),s=i instanceof Wa?a:Ua(i);return r=s,r}return a}function invalidateAtom(){r=void 0}function setAtom(e,n,o){if(n.atomValues.has(t)){const e=re(n.atomValues.get(t));if("hasValue"===e.state&&o===e.contents)return new Map}else if(!n.nonvalidatedAtoms.has(t)&&o instanceof Wa)return new Map;return maybeFreezeValueOrPromise(o),r=void 0,(new Map).set(t,Ua(o))}function shouldDeleteConfigOnReleaseAtom(){return void 0!==Ga(t)&&i<=0}const l=$a({key:t,nodeType:"atom",peek:peekAtom,get:getAtom,set:setAtom,init:initAtom,invalidate:invalidateAtom,shouldDeleteConfigOnRelease:shouldDeleteConfigOnReleaseAtom,dangerouslyAllowMutability:e.dangerouslyAllowMutability,persistence_UNSTABLE:e.persistence_UNSTABLE?{type:e.persistence_UNSTABLE.type,backButton:e.persistence_UNSTABLE.backButton}:void 0,shouldRestoreFromSnapshots:!0,retainedBy:o});return l}function atom(e){if("production"!==process.env.NODE_ENV&&"string"!=typeof e.key)throw ie("A key option with a unique string value must be provided when creating an atom.");const{...t}=e,n="default"in e?e.default:new Promise((()=>{}));return qa(n)?atomWithFallback({...t,default:n}):baseAtom({...t,default:n})}function atomWithFallback(e){const t=atom({...e,default:Ha,persistence_UNSTABLE:void 0===e.persistence_UNSTABLE?void 0:{...e.persistence_UNSTABLE,validator:t=>t instanceof Wa?t:re(e.persistence_UNSTABLE).validator(t,Ha)},effects:e.effects,effects_UNSTABLE:e.effects_UNSTABLE}),n=Ma({key:`${e.key}__withFallback`,get:({get:n})=>{const o=n(t);return o instanceof Wa?e.default:o},set:({set:e},n)=>e(t,n),cachePolicy_UNSTABLE:{eviction:"most-recent"},dangerouslyAllowMutability:e.dangerouslyAllowMutability});return Ka(n.key,Ga(e.key)),n}atom.value=e=>new Fa(e);var er=atom;class tr{constructor(e){var t;_defineProperty(this,"_map",void 0),_defineProperty(this,"_keyMapper",void 0),this._map=new Map,this._keyMapper=null!==(t=null==e?void 0:e.mapKey)&&void 0!==t?t:e=>e}size(){return this._map.size}has(e){return this._map.has(this._keyMapper(e))}get(e){return this._map.get(this._keyMapper(e))}set(e,t){this._map.set(this._keyMapper(e),t)}delete(e){this._map.delete(this._keyMapper(e))}clear(){this._map.clear()}}var nr,or=tr,ir=Object.freeze({__proto__:null,MapCache:or});const{LRUCache:ar}=ta,{MapCache:rr}=ir,sr={equality:"reference",eviction:"none",maxSize:1/0};function cacheFromPolicy({equality:e=sr.equality,eviction:t=sr.eviction,maxSize:n=sr.maxSize}=sr){const o=undefined,i=undefined;return getCache(t,n,getValueMapper$1(e))}function getValueMapper$1(e){switch(e){case"reference":return e=>e;case"value":return e=>ra(e)}throw ie(`Unrecognized equality policy ${e}`)}function getCache(e,t,n){switch(e){case"keep-all":return new rr({mapKey:n});case"lru":return new ar({mapKey:n,maxSize:re(t)});case"most-recent":return new ar({mapKey:n,maxSize:1})}throw ie(`Unrecognized eviction policy ${e}`)}var lr=cacheFromPolicy;const{setConfigDeletionHandler:cr}=Qe;function atomFamily(e){var t,n;const o=lr({equality:null!==(t=null===(n=e.cachePolicyForParams_UNSTABLE)||void 0===n?void 0:n.equality)&&void 0!==t?t:"value",eviction:"keep-all"});return t=>{var n,i;const a=o.get(t);if(null!=a)return a;const{cachePolicyForParams_UNSTABLE:r,...s}=e,l="default"in e?e.default:new Promise((()=>{})),c=er({...s,key:`${e.key}__${null!==(n=ra(t))&&void 0!==n?n:"void"}`,default:"function"==typeof l?l(t):l,retainedBy_UNSTABLE:"function"==typeof e.retainedBy_UNSTABLE?e.retainedBy_UNSTABLE(t):e.retainedBy_UNSTABLE,effects:"function"==typeof e.effects?e.effects(t):"function"==typeof e.effects_UNSTABLE?e.effects_UNSTABLE(t):null!==(i=e.effects)&&void 0!==i?i:e.effects_UNSTABLE});return o.set(t,c),cr(c.key,(()=>{o.delete(t)})),c}}var ur=atomFamily;const{setConfigDeletionHandler:dr}=Qe;let pr=0;function selectorFamily(e){var t,n;const o=lr({equality:null!==(t=null===(n=e.cachePolicyForParams_UNSTABLE)||void 0===n?void 0:n.equality)&&void 0!==t?t:"value",eviction:"keep-all"});return t=>{var n;let i;try{i=o.get(t)}catch(t){throw ie(`Problem with cache lookup for selector ${e.key}: ${t.message}`)}if(null!=i)return i;const a=`${e.key}__selectorFamily/${null!==(n=ra(t,{allowFunctions:!0}))&&void 0!==n?n:"void"}/${pr++}`,myGet=n=>e.get(t)(n),r=e.cachePolicy_UNSTABLE,s="function"==typeof e.retainedBy_UNSTABLE?e.retainedBy_UNSTABLE(t):e.retainedBy_UNSTABLE;let l;if(null!=e.set){const n=e.set,o=undefined;l=Ma({key:a,get:myGet,set:(e,o)=>n(t)(e,o),cachePolicy_UNSTABLE:r,dangerouslyAllowMutability:e.dangerouslyAllowMutability,retainedBy_UNSTABLE:s})}else l=Ma({key:a,get:myGet,cachePolicy_UNSTABLE:r,dangerouslyAllowMutability:e.dangerouslyAllowMutability,retainedBy_UNSTABLE:s});return o.set(t,l),dr(l.key,(()=>{o.delete(t)})),l}}var fr=selectorFamily;fr({key:"__constant",get:e=>()=>e,cachePolicyForParams_UNSTABLE:{equality:"reference"}}),fr({key:"__error",get:e=>()=>{throw ie(e)},cachePolicyForParams_UNSTABLE:{equality:"reference"}});const{loadableWithError:hr,loadableWithPromise:mr,loadableWithValue:gr}=Se;function concurrentRequests(e,t){const n=Array(t.length).fill(void 0),o=Array(t.length).fill(void 0);for(const[i,a]of t.entries())try{n[i]=e(a)}catch(e){o[i]=e}return[n,o]}function isError(e){return null!=e&&!ae(e)}function unwrapDependencies(e){return Array.isArray(e)?e:Object.getOwnPropertyNames(e).map((t=>e[t]))}function wrapResults(e,t){return Array.isArray(e)?t:Object.getOwnPropertyNames(e).reduce(((e,n,o)=>({...e,[n]:t[o]})),{})}function wrapLoadables(e,t,n){const o=undefined;return wrapResults(e,n.map(((e,n)=>null==e?gr(t[n]):ae(e)?mr(e):hr(e))))}function combineAsyncResultsWithSyncResults(e,t){return t.map(((t,n)=>void 0===t?e[n]:t))}fr({key:"__waitForNone",get:e=>({get:t})=>{const n=unwrapDependencies(e),[o,i]=concurrentRequests(t,n);return wrapLoadables(e,o,i)},dangerouslyAllowMutability:!0}),fr({key:"__waitForAny",get:e=>({get:t})=>{const n=unwrapDependencies(e),[o,i]=concurrentRequests(t,n);return i.some((e=>!ae(e)))?wrapLoadables(e,o,i):new Promise((t=>{for(const[n,a]of i.entries())ae(a)&&a.then((a=>{o[n]=a,i[n]=void 0,t(wrapLoadables(e,o,i))})).catch((a=>{i[n]=a,t(wrapLoadables(e,o,i))}))}))},dangerouslyAllowMutability:!0}),fr({key:"__waitForAll",get:e=>({get:t})=>{const n=unwrapDependencies(e),[o,i]=concurrentRequests(t,n);if(i.every((e=>null==e)))return wrapResults(e,o);const a=i.find(isError);if(null!=a)throw a;return Promise.all(i).then((t=>wrapResults(e,combineAsyncResultsWithSyncResults(o,t))))},dangerouslyAllowMutability:!0}),fr({key:"__waitForAllSettled",get:e=>({get:t})=>{const n=unwrapDependencies(e),[o,i]=concurrentRequests(t,n);return i.every((e=>!ae(e)))?wrapLoadables(e,o,i):Promise.all(i.map(((e,t)=>ae(e)?e.then((e=>{o[t]=e,i[t]=void 0})).catch((e=>{o[t]=void 0,i[t]=e})):null))).then((()=>wrapLoadables(e,o,i)))},dangerouslyAllowMutability:!0}),fr({key:"__noWait",get:e=>({get:t})=>{try{return Ma.value(gr(t(e)))}catch(e){return Ma.value(ae(e)?mr(e):hr(e))}},dangerouslyAllowMutability:!0});const{RecoilLoadable:vr}=Se,{RecoilRoot:yr}=Eo,{isRecoilValue:br}=je,{freshSnapshot:Sr}=qn,{useRecoilState:wr,useRecoilValue:_r,useRecoilValueLoadable:Ar,useSetRecoilState:Cr}=ti,{useRecoilCallback:Er}=zi;var Tr={RecoilRoot:yr,atom:er,selector:Ma,atomFamily:ur,useRecoilValue:_r,useRecoilValueLoadable:Ar,useRecoilState:wr,useSetRecoilState:Cr,useRecoilCallback:Er},kr=Tr.RecoilRoot,xr=Tr.atom,Nr=Tr.selector,Rr=Tr.atomFamily,Vr=Tr.useRecoilValue,Pr=Tr.useRecoilValueLoadable,Or=Tr.useRecoilState,Lr=Tr.useSetRecoilState,Ir=Tr.useRecoilCallback;class Mr{}function useActionCallback(e,t=[]){const n=undefined;return Ir((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 Mr?void 0:t)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,o=__rest(t,["snapshot"]);return async(...t)=>{const i=n.retain();try{const i=undefined;return await e(Object.assign(Object.assign({},o),{snapshot:n}))(...t)}finally{i()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const o=await e.getPromise(t);if(null==o)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return o}}function createTryGetPromiseWrapper(e){return async t=>{try{return{value:await e.getPromise(t)}}catch(e){return ne.debug(`Error encountered retrieving Recoil value. [key={${t.key}}]`,e),{error:e}}}}var Dr=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,Br=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,zr=/^(#|0x)?([A-Fa-f0-9]{6})$/,create$2=function(e,t,n,o){return void 0===o&&(o=255),{r:e,g:t,b:n,a:o}},fromNumber=function(e){var t=16777215&e;return create$2(t>>16&255,t>>8&255,255&t)},fromHexString=function(e){var t=zr.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=Dr.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=Br.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):zr.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},Ur=Object.freeze({__proto__:null,create:create$2,fromNumber:fromNumber,fromHexString:fromHexString,fromCss:fromCss,fromArray:fromArray,isInvisible:isInvisible,isOpaque:isOpaque,toHexString:toHexString}),Fr;!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 jr=new Uint8Array(16);function rng(){if(!Fr&&!(Fr="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 Fr(jr)}var Hr=/^(?:[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&&Hr.test(e)}for(var Wr=[],Gr=0;Gr<256;++Gr)Wr.push((Gr+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Wr[e[t+0]]+Wr[e[t+1]]+Wr[e[t+2]]+Wr[e[t+3]]+"-"+Wr[e[t+4]]+Wr[e[t+5]]+"-"+Wr[e[t+6]]+Wr[e[t+7]]+"-"+Wr[e[t+8]]+Wr[e[t+9]]+"-"+Wr[e[t+10]]+Wr[e[t+11]]+Wr[e[t+12]]+Wr[e[t+13]]+Wr[e[t+14]]+Wr[e[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}function v4(e,t,n){var o=(e=e||{}).random||(e.rng||rng)();return o[6]=15&o[6]|64,o[8]=63&o[8]|128,stringify(o)}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,o="string"==typeof t?BigInt(t):t,i=digits(n>>BigInt(32),BigInt(8)),a=digits(n>>BigInt(16),BigInt(4)),r=digits(n,BigInt(4)),s=digits(o>>BigInt(48),BigInt(4)),l=digits(o,BigInt(12));return"".concat(i,"-").concat(a,"-").concat(r,"-").concat(s,"-").concat(l)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],o=t[1],i=t[2],a=t[3],r=t[4];if(null==n||null==o||null==i||null==a||null==r)throw new Error("Invalid UUID string ".concat(e));var s=BigInt.asIntN(64,BigInt("0x".concat(n+o+i))),l=BigInt.asIntN(64,BigInt("0x".concat(a+r)));return{msb:s.toString(),lsb:l.toString()}}var $r=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb});const Kr=xr({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),qr=xr({key:"viewerInitialSceneReady",default:!1}),Yr=xr({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),Zr=xr({key:"viewerPrimaryInteractionType",default:"rotate"}),Xr=Nr({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(Kr))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),Jr=xr({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),Qr=Nr({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(Jr))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...o)=>{const i=await e.getPromise(Xr),a=await i();o.length>0&&await(null==a?void 0:a.items((e=>o.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=i.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=i.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),o=i.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const o=$r.create();await e(t,o,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:o,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(Xr),o=await n(),i=await e.getPromiseRequired(ts);null==o||o.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:i})}))}}const es=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const o=await e.getPromise(Xr),i=await o();await(null==i?void 0:i.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:es}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const o=await e.getPromise(Xr),i=await o();await(null==i?void 0:i.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:es}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(ts,t)}))}}const ts=xr({key:"viewerCameraType",default:"perspective"});class ns{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(r.left(),-e),y=e=>create(r.down(),-e),z=e=>create(r.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},os={x:r.left(),y:r.down(),z:r.forward()},xAxis=e=>e.x,yAxis=e=>e.y||r.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||r.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,o)=>e&&e.normal&&[["x",t],["y",n],["z",o]].filter((t=>0===r.magnitude(r.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>r.dot(r.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return r.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:r.multiply(e.normal,r.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=r.normalize(e.normal),o=r.dot(n,e.position);return towardsCamera(t,create(n,o))},toAxis=(e,t,n,o,i)=>{const a=n.viewAll(),l=getAxis(e,t),c=null!=o&&null!=l?create(l,r.dot(l,i||s.center(o))):forAxis(e,a.lookAt[e]);return towardsCamera(n,c)};function corners(e){return[r.create(e.min.x,e.min.y,e.min.z),r.create(e.min.x,e.min.y,e.max.z),r.create(e.min.x,e.max.y,e.min.z),r.create(e.min.x,e.max.y,e.max.z),r.create(e.max.x,e.max.y,e.max.z),r.create(e.max.x,e.max.y,e.min.z),r.create(e.max.x,e.min.y,e.max.z),r.create(e.max.x,e.min.y,e.min.z)]}function equals(e,t){return e.min.x===t.min.x&&e.min.y===t.min.y&&e.min.z===t.min.z&&e.max.x===t.max.x&&e.max.y===t.max.y&&e.max.z===t.max.z}const is="#999999",as=1,rs={default:5,min:0,max:10},ss=xr({key:"crossSectioningEnabled",default:!1}),ls=xr({key:"crossSectioningHighlightColor",default:is}),cs=xr({key:"crossSectioningBorderWidth",default:1}),us=xr({key:"crossSectioningPlanes",default:[]}),ds=xr({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),ps=Nr({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(Qr)}}),fs=xr({key:"crossSectioningIsInteractive",default:!1}),hs=xr({key:"crossSectioningActiveAxis",default:"x"}),ms=xr({key:"crossSectioningAvailableAxes",default:os}),gs=Nr({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(us);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),vs=Nr({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(us),n=e(ps),o=null!=n?corners(n):[];if(t.length>0){const e=o.map((e=>r.dot(e,isNegativeNormal(t[0])?r.multiply(t[0].normal,r.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return rs}}),ys=Nr({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(us),n=e(gs),o=e(vs);return t.length>0?t[0].offset*n:o.default}}),bs=xr({key:"crossSectioningAdditionalToolsOpen",default:!1}),Ss=xr({key:"crossSectioningAlignmentToolsOpen",default:!1}),ws=xr({key:"crossSectioningAxisToolsOpen",default:!1}),_s=xr({key:"crossSectioningInteractionHandler",default:new ns,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const n=Vr(_s);i.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(n))}),[e,t,n])}const As=xr({key:"hitResultsTapDetails",default:void 0}),Cs=xr({key:"hitResultsLongPressDetails",default:void 0}),Es=xr({key:"previousHitResult",default:void 0}),Ts=xr({key:"currentHitResult",default:void 0}),ks=Nr({key:"hitResult",get:async({get:e})=>{var t,n,o,i,a,s,l,c;const u=e(As),d=e(Cs),p=null!=u?u:d,f=e(Xr),h=await f(),m=null==h?void 0:h.sceneViewId,g=null==h?void 0:h.raycaster();if(null!=p&&null!=g&&null!=m){const e=await g.hitItems(p.position),u=((null==e?void 0:e.hits)||[])[0];if(null!=u)return{id:null===(t=u.itemId)||void 0===t?void 0:t.hex,normal:r.create((null===(n=null==u?void 0:u.hitNormal)||void 0===n?void 0:n.x)||0,(null===(o=null==u?void 0:u.hitNormal)||void 0===o?void 0:o.y)||0,(null===(i=null==u?void 0:u.hitNormal)||void 0===i?void 0:i.z)||0),position:r.create((null===(a=null==u?void 0:u.hitPoint)||void 0===a?void 0:a.x)||0,(null===(s=null==u?void 0:u.hitPoint)||void 0===s?void 0:s.y)||0,(null===(l=null==u?void 0:u.hitPoint)||void 0===l?void 0:l.z)||0),meta:p.metaKey||p.ctrlKey||!1,metadata:[],ancestors:(null===(c=null==u?void 0:u.ancestors)||void 0===c?void 0:c.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[]}}}}),xs=xr({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=r.dot(r.normalize(e.up),t),o=Math.abs(n)>.98?r.normalize(r.scale(-n,e.viewVector)):e.up,i=r.add(r.scale(r.distance(e.position,e.lookAt),r.multiply(t,r.create(-1,-1,-1))),e.lookAt);return e.update({up:o,position:i})}{const o=r.angleTo(r.normalize(e.viewVector),t),i=null!=n?s.center(n):e.lookAt,a=r.normalize(r.cross(r.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(o,i,a)}};function isParallelTo(e,t){const n=l.toDegrees(r.angleTo(e,t));return 0===n||180===n}const Ns=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(cs),n=await e.getPromise(ls),o=await e.getPromise(us),i=await e.getPromise(Xr),a=await i();await(null==a?void 0:a.crossSectioning().update({sectionPlanes:o,highlightColor:n?Ur.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:o})=>async()=>{const i=await o.getPromise(Xr),a=await i();if(null!=a){const o=a.camera().viewAll();n(ms),t(us,[towardsCamera(a.camera(),x(o.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const o=await t.tryGetPromise(ks).then((e=>e.value)),i=await t.getPromise(Xr),a=await i();if(null!=o&&null!=a){const t=fromHit(o,a.camera());n(us,null!=t?[t]:[]),n(ms,null!=t?{x:t.normal}:os),await e()}}))),o=useActionCallback((({set:e,snapshot:n})=>async()=>{const o=await n.getPromise(us),i=undefined;await n.getPromise(ss)||(e(ss,!0),0===o.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const o=undefined;await n.getPromise(ss)&&(t(ss),t(bs),t(Ss),t(ws),t(us),t(ds),t(hs),await e())}));return{enable:o,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ss)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ss)||await o(),e(bs,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(bs)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(ws),e(Ss,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(Ss)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(Ss),e(ws,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(ws)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(_s);e(fs,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(_s);e(fs),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async o=>{const i=await n.getPromise(us);if(i.length>0){const a=await n.getPromise(gs),r=await n.getPromise(vs),s=a<0?-1*r.max:r.min,l=a<0?-1*r.min:r.max,c=i.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(o*a,s),l)})));t(us,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const o=await n.getPromise(us);t(us,o.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(us),n=await e.getPromise(Kr),o=await(null==n?void 0:n.scene());t.length>0&&null!=o&&await alignToNormal(o.camera(),t[0].normal,o.boundingBox()).render({animation:{milliseconds:Ns}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:o})=>async i=>{const a=await o.getPromise(us),s=await o.getPromise(ms),l=await o.getPromise(ps),c=await o.getPromise(ds),u=await o.getPromise(Kr),d=await(null==u?void 0:u.scene()),p=s[i],f=null!=p&&a.length>0&&isParallelTo(a[0].normal,p)&&!isNaN(r.angleTo(a[0].normal,p));if(null!=d&&!f){const e=await o.tryGetPromise(ks).then((e=>e.value));t(hs,i),t(us,[toAxis(i,s,d.camera(),l,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(ws),await e()}))),updateAlignment:useActionCallback((({set:e,reset:i})=>async(a,r)=>{i(Ss),e(ds,{mode:a,hitPending:"global"!==a&&null==r}),"global"===a?(i(hs),i(ms),await t()):"surface"===a&&null!=r&&(await o(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const o=await t.getPromise(ds);o.hitPending&&(e(ds,Object.assign(Object.assign({},o),{hitPending:!1})),"surface"===o.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ds);n.hitPending&&e(ds,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Rs=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Ns,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:is,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:rs,crossSectioningActiveAxis:hs,crossSectioningAdditionalToolsOpen:bs,crossSectioningAlignment:ds,crossSectioningAlignmentToolsOpen:Ss,crossSectioningAvailableAxes:ms,crossSectioningAxisToolsOpen:ws,crossSectioningBorderWidth:cs,crossSectioningEnabled:ss,crossSectioningHighlightColor:ls,crossSectioningInteractionHandler:_s,crossSectioningIsInteractive:fs,crossSectioningOffsetScalar:gs,crossSectioningPlaneDisplayOffset:ys,crossSectioningPlanes:us,crossSectioningSliderRange:vs,crossSectioningTargetBoundingBox:ps,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,o]=i.useState();return i.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),i.useCallback((i=>{const handler=()=>{e(i)};null!=n&&clearTimeout(n),o(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,o=__rest(t,["onInput"]);const a=useDebouncedCallback((e=>{null==n||n(e)}),500),r=i.useCallback((e=>{const t=e.target;a(t.value)}),[a]);return e(u,Object.assign({onInput:r},o))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const n=useCrossSectioningActions(),[o,i]=Or(ls);return e(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{i(e),await n.reapply()}})},VertexSlider=n=>{var{value:o,defaultValue:a,leftLabel:r,rightLabel:s,onChange:l,onValueChange:c,onValueInput:u}=n,p=__rest(n,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[f,h]=i.useState(a);return t("div",{className:"flex w-full items-center gap-2",children:[r&&e("div",{className:"pl-0.5 text-xs text-center",children:r}),e(d,Object.assign({className:N("w-full",{"mt-0.5":null!=r||null!=s}),value:null!=o?o:f,onValueChange:e=>{h(e.detail.value),null==l||l(e.detail.value),null==c||c(e)},onValueInput:e=>{h(e.detail.value),null==l||l(e.detail.value),null==u||u(e)}},p)),s&&e("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:s})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const n=useCrossSectioningActions(),[o,i]=Or(cs);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:o,valueLabelDisplay:"auto",onValueInput:async e=>{i(e.detail.value),await n.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:o,onUpdateCrossSectionLineThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexCrossSectionAppearanceColorPicker,{onUpdate:o}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:i})]})}function PanelSection({header:n,children:o}){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}),o]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const n=useCrossSectioningActions(),[o,i]=Or(ls),[a,r]=Or(cs),s=undefined;return e("div",{className:"ml-auto",children:e(p,{content:"Reset Cross Sectioning Appearance",children:e(f,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(is),r(1),null==t||t(),await n.reapply()},disabled:!(o!==is||1!==a)})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:n,onUpdateCrossSectionColor:o,onUpdateCrossSectionLineThickness:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Cross Sectioning",e(VertexCrossSectionAppearanceReset,{onReset:n})]}),children:e(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:o,onUpdateCrossSectionLineThickness:i})})}const Vs=.5,Ps="#444444",Os=xr({key:"featureEdgesSelectedColor",default:Ps}),Ls=xr({key:"featureEdgesLineThickness",default:Vs}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[n,o]=Or(Os);return e(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>o(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[n,o]=Or(Ls);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=>{o(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:o,onUpdateFeatureEdgesThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexFeatureEdgesColorPicker,{onUpdate:o}),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,o]=Or(Os),[i,a]=Or(Ls),r=undefined;return e("div",{className:"ml-auto",children:e(p,{content:"Reset Feature Edges",children:e(f,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(Ps),a(Vs),null==t||t()},disabled:!(i!==Vs||n!==Ps)})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:n,onUpdateFeatureEdgesColor:o,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:o,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)}const Is=xr({key:"contextMenuActive",default:void 0}),Ms=xr({key:"contextMenuPosition",default:void 0}),Ds=xr({key:"contextMenuTarget",default:void 0}),Bs=xr({key:"contextMenuItem",default:void 0}),zs=xr({key:"contextMenuActions",default:[]}),Us=Nr({key:"contextMenuActivePosition",get:({get:e})=>null!=e(Is)?e(Ms):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,o=null==t?void 0:t.clientY;e(Ms,c.create(n,o)),e(Ds,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,o,i,a)=>{const r=await e.getPromise(Ms),s=await e.getPromise(Is);if(null!=r&&null==s){const e=n.clientX,s=null==n?void 0:n.clientY,l=c.create(e,s),u=null!=r?c.distance(r,l):0,d=null==i||i(n);u<2&&d&&(null==a||a(n,null!=r?r:l),t(Is,o))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,o,i)=>{if(null==o||o(t)){const o=c.create(t.touches[0].clientX,t.touches[0].clientY);e(Ms,o),e(Ds,t.target),e(Is,n),null==i||i(t,o)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(xs,!!n),e(Is),e(zs),e(Ms)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(xs)))}}function targetWithinMenu(e){return e.target instanceof Element&&isChildOf("vertex-menu",e.target)}function targetShouldSkipNextHit(e){return e.target instanceof Element&&isChildOf("vertex-viewer",e.target)}function isChildOf(e,t){return null!=t.closest(e)}const Fs=3e3,js=xr({key:"applicationMessageToast",default:void 0}),Hs=xr({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(Hs,null!=t?Object.assign(Object.assign({},t),{id:$r.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(js,null!=t?Object.assign(Object.assign({},t),{id:$r.create()}):void 0)}))});var Ws;!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"}(Ws||(Ws={}));const Gs=Rr({key:"selectionSelectedItems",default:void 0}),$s=xr({key:"selectionSelectedItemIds",default:[]}),Ks=xr({key:"selectionLastSelected",default:void 0}),qs=xr({key:"selectionLastSelectionFromViewer",default:!1}),Ys=xr({key:"selectionLastSelectWasMultiSelect",default:!1}),Zs=Nr({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const o=e(Ks),i=e($s);return null!==(n=null===(t=null==o?void 0:o.ancestors)||void 0===t?void 0:t.find((e=>i.includes(e))))&&void 0!==n?n:null==o?void 0:o.id}}),Xs=xr({key:"selectionPreviousVisibleSummary",default:void 0}),Js=xr({key:"selectionVisibleSummary",default:void 0}),Qs=Nr({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(Js))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),el=Nr({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(Js);return null!=(null==t?void 0:t.boundingBox)?s.center(t.boundingBox):r.origin()}}),tl=Nr({key:"selectionIsActive",get:({get:e})=>{const t=e($s),n=undefined;return e(Qs)>0||t.length>0}}),nl=xr({key:"transformWidgetEnabled",default:!1}),ol=xr({key:"transformWidgetPosition",default:void 0}),il=xr({key:"transformWidgetOrientationOverride",default:void 0}),al=Nr({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(il);if(null!=t)return t}}),rl=xr({key:"transformWidgetCachedOrientation",default:void 0}),sl=xr({key:"transformWidgetSyncToSelection",default:!1}),ll=xr({key:"transformWidgetIsInteracting",default:!1}),cl=Rr({key:"appliedItemTransform",default:void 0}),ul=xr({key:"appliedItemTransformIds",default:[]}),dl=xr({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(el);e(ol,n)})),o=useActionCallback((({set:e,snapshot:t})=>async()=>{const o=await t.getPromise(ol),i=await t.getPromise(Ys),a=await t.getPromise($s),r=await t.getPromise(Qs);null==o&&(a.length>0||i||r>0)&&await n(),e(sl,!0)})),i=useActionCallback((({set:e})=>async t=>{e(ol,null!=t?t:void 0)})),a=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const o=await e.getPromise(al),i=undefined;(await e.getPromise(ul)).forEach((e=>{n(cl(e))})),null!=o&&t(rl,o)}))),l=useActionCallback((({set:e,reset:t})=>n=>{t(rl),e(il,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(a,r)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Fs}),t(nl,!0),r?await n():null==a?await o():await i(a)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(nl),e(il)})),setTransformWidgetOrientation:l,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(rl),e(il)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(ol))),invalidateTransforms:a,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(ll,t)})),setDefaultWidgetPosition:o,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(sl,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(sl))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Xs),n=await e.getPromise(Js),o=undefined;if(await e.getPromise(sl)){const e=null==n?void 0:n.boundingBox,o=null!=e&&null!=(null==t?void 0:t.boundingBox)&&equals(e,t.boundingBox);null==e||o||await i(s.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(sl),null!=t?(await i(null==t?void 0:t.position),l(r.eulerTo(r.up(),t.normal))):(e(ol),l(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Ws.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(ol,void 0),e(nl,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Ws.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(ol,void 0),e(nl,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useTransformActions(),n=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{await e.tryGetPromise(ks).then((e=>e.value))}))),o=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(ks).then((e=>e.value));await t.orientToHitResult(n)}))),i=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(ks).then((e=>e.value));e(Bs,n)}))),a=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Ts,await e.tryGetPromise(ks).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:r})=>async({detail:s},...l)=>{const c=await t.getPromise(ds),u=2!==(null==s?void 0:s.buttons)&&!(null==s?void 0:s.altKey);s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;const d=u&&!c.hitPending,p=await t.tryGetPromise(ks).then((e=>e.value));r(Es,p),r(As,s),await n(),d&&(l.forEach((e=>e())),await o()),await i(),e.sectionCurrentHit(),await a()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async o=>{n(As),t(Cs,o.detail),await e.tryGetPromise(ks),await i(),await a()})))}},pl=Nr({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,o=undefined,i=undefined,a=undefined;return{tapDetails:e(As),longPressDetails:e(Cs),previousHitResult:e(Es),currentHitResult:e(Ts)}}});var fl=Object.freeze({__proto__:null,currentHitResult:Ts,hitResult:ks,hitResultsLongPressDetails:Cs,hitResultsSkipNextTap:xs,hitResultsTapDetails:As,hitState:pl,previousHitResult:Es,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise($s)).forEach((e=>t(Gs(e))))})),o=useActionCallback((({snapshot:e,reset:n,set:o})=>async(i,a)=>{var r,s;const l=await e.getPromise(Gs(i.id)),c=await e.getPromise($s),d=null===(s=[...null!==(r=i.ancestors)&&void 0!==r?r:[]])||void 0===s?void 0:s.reverse().find((e=>!c.includes(e)));null!=l&&null!=d?(o(Gs(d),{id:d}),o($s,(e=>[...e,d])),t.execute(Ws.SELECTING_ANCESTOR,t.selectItemsTransform(d))):(null==a?void 0:a.clear)?(o(Gs(i.id),i),o($s,[i.id]),t.execute(Ws.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(i.id))):(o(Gs(i.id),i),o($s,(e=>[...e,i.id])),t.execute(Ws.SELECTING_ITEMS,t.selectItemsTransform(i.id))),u(i),o(Ks,i),o(qs,!0),n(Ys)})),i=useActionCallback((({reset:e,set:n})=>async o=>{e(Gs(o)),e(Ys),n($s,(e=>e.filter((e=>e!==o)))),t.execute(Ws.DESELECTING_ITEMS,t.deselectItemsTransform(o))})),a=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Gs(t.id));null!=n?await i(n.id):await o(t)})),r=useActionCallback((({snapshot:t,reset:n,set:i})=>async(a,r={})=>{const s=await t.getPromise(Gs(a.id)),l=await t.getPromise($s);if(l.filter((e=>{var t;return e!==a.id&&!(null===(t=a.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>n(Gs(e)))),n(Ys),s)if(r.ignoreAncestorSelection)n($s),n(Gs(s.id));else{const e=l.filter((e=>{var t;return e===a.id||(null===(t=a.ancestors)||void 0===t?void 0:t.includes(e))}));i($s,e)}else n($s);e.clearTransformWidgetOrientation(),await o(a,{clear:!0})})),s=useActionCallback((({reset:t})=>async()=>{await n(),t($s),t(Ks),t(qs),t(Ys),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),l=useActionCallback((()=>async()=>{await s(),t.execute(Ws.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(Ys,t)})),u=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:o,toggleSelection:a,clearAndSelect:r,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(ks).then((e=>e.value)),n=await e.getPromise(As),o=(null==n?void 0:n.metaKey)||(null==n?void 0:n.ctrlKey)||(null==n?void 0:n.shiftKey);null==t||o?null!=t&&o?await a(t):await l():await r(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(o,i)=>{i.selected?(await n(),e(Gs(o.id),o),i.multiSelect?e($s,(e=>[...e.filter((e=>e!==o.id)),o.id])):e($s,[o.id]),u(o),e(Ks,o),e(qs,!1),e(Ys,!!i.multiSelect)):(t(Gs(o.id)),t(Ys),e($s,(e=>e.filter((e=>e!==o.id)))))})),deselect:i,clearSelection:l,resetSelectionState:s,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:u}}const hl=Nr({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,o=undefined,i=undefined;return{selectedItemIds:e($s),lastSelected:e(Ks),highestSelectedAncestorId:e(Zs)}}});var ml=Object.freeze({__proto__:null,selectionBoundingBoxCenter:el,selectionHighestSelectedAncestor:Zs,selectionIsActive:tl,selectionLastSelectWasMultiSelect:Ys,selectionLastSelected:Ks,selectionLastSelectionFromViewer:qs,selectionPreviousVisibleSummary:Xs,selectionSelectedItemIds:$s,selectionSelectedItems:Gs,selectionState:hl,selectionVisibleCount:Qs,selectionVisibleSummary:Js,useSelectionActions:useSelectionActions});const gl=255,vl=xr({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),yl=xr({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),bl=Rr({key:"appliedItemMaterialOverride",default:void 0}),Sl=xr({key:"appliedItemMaterialOverrideIds",default:[]}),wl=Nr({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Ks);if(null!=t)return e(bl(t.id))}}),_l=xr({key:"applyMaterialToAllUserAction",default:void 0}),Al=xr({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),Cl=xr({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Sl);t(vl),n.forEach((e=>t(bl(e)))),t(Sl)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(vl,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(vl)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(yl)})),clear:useActionCallback((({snapshot:t,set:n,reset:o})=>async()=>{const i=await t.getPromise($s);o(vl),i.forEach((e=>o(bl(e)))),n(Sl,(e=>e.filter((e=>!i.includes(e))))),await e.execute(Ws.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(Ws.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(yl,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const o=await t.getPromise(vl),i=await t.getPromise(yl),a=await t.getPromise($s),r=await t.getPromise(wl),s=null!=o?o:r,l=null!=i?i:null==r?void 0:r.opacity;if(null!=s){const t=Object.assign(Object.assign({},s),{opacity:null!=l?l:s.opacity});await e.execute(Ws.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),a.forEach((e=>n(bl(e),t))),n(Sl,(e=>[...e,...a]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(Cl,!0),e(_l,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(Cl),e(_l)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const o=await t.getPromise(vl),i=await t.getPromise(yl);if(null!=o){const a=await t.getPromise(Sl),r=Object.assign(Object.assign({},o),{opacity:null!=i?i:o.opacity});await e.execute(Ws.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(r))),a.forEach((e=>n(bl(e))));const s=await t.getPromise(_l);null==s||s(r),n(Cl),n(_l)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Al,!1)}))}},El="#FFFFFF",Tl=xr({key:"viewerBackgroundSelectedColor",default:El}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const n=useSceneItemMaterialActions(),i=Pr(wl),a=Vr(vl),r=Vr(Al),s=o.useMemo((()=>"hasValue"===i.state?null!=a?a:i.contents:a),[i,a]);return e(p,{content:"Apply to All",children:e(f,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==s,onClick:async()=>{r?n.confirmApplyAll(t):(await n.applyAll(),null==t||t(s))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const o=useSceneItemMaterialActions(),a=Vr(Cl),[r,s]=i.useState(!1),onCloseDialog=()=>{o.cancelApplyAll(),s(!1)};return a?t(h,{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(m,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:r,onValueChanged:e=>{s(e.detail)}}),"Don't show again this session"]}),t("div",{className:"flex ml-auto gap-2",children:[e(g,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e(g,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await o.applyAll(),r&&o.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e(n,{})}function createColorMaterialWithId(e,t=$r.create()){return Object.assign({id:t},R.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const n=useSceneItemMaterialActions(),i=Pr(wl),a=Vr(vl),r=o.useMemo((()=>"hasValue"===i.state?null!=a?a:i.contents:a),[i,a]);return e(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=r?Ur.toHexString(r.diffuse):void 0,onValueChanged:()=>{n.apply(),null==t||t(r)},onInput:async e=>{n.updateColor(createColorMaterialWithId(e)),await n.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const n=useSceneItemMaterialActions(),i=Vr(yl),a=Pr(wl),r=o.useMemo((()=>{var e,t;return"hasValue"===a.state?null!==(t=null!=i?i:null===(e=a.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:gl:null!=i?i:gl}),[i,a]),s=useDebouncedCallback((()=>{n.apply()}),500),l=o.useCallback((e=>{n.updateOpacity(e.detail.value),s(e.detail.value)}),[s,n]),c=o.useMemo((()=>"hasValue"!==a.state||null==a.contents),[a]);return e(p,{className:"flex w-full",content:c?"Select a part and apply a color to enable opacity":`${Math.floor(r/gl*100)}%`,placement:"top",children:e(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:c,value:null!=r?r:gl,step:5,min:0,max:gl,onValueChange:e=>{n.updateOpacity(e.detail.value),n.apply(),null==t||t(e.detail.value)},onValueInput:l})})};function VertexMaterialControls({onApplyMaterial:o,onApplyMaterialToAll:a,onApplyOpacity:r}){const s=useSceneItemMaterialActions(),l=Vr(Ks);return i.useEffect((()=>{s.clearCurrentColor(),s.clearCurrentOpacity()}),[null==l?void 0:l.id]),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:o}),e(VertexSceneItemMaterialApplyAll,{onApplyAll:a})]})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSceneItemMaterialOpacitySlider,{onApply:r}),e(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:n,tooltip:o,children:a})=>{const[r,s]=i.useState(!1);return e("div",{className:"ml-auto",children:t(v,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${n}`,placement:"bottom-end",onMenuOpened:()=>s(!0),onMenuClosed:()=>s(!1),children:[e("div",{slot:"anchor",className:"flex items-center h-full",children:e(p,{content:o,disabled:r,placement:"bottom",children:t(g,{className:N("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":r}),"data-testid":`reset-button-${n}`,variant:"plaintext",children:[e(b,{className:"px-0.5",name:"reset",size:"sm"}),e(b,{name:"chevron-down",size:"sm"})]})})}),e("div",{className:"whitespace-nowrap",children:a})]})})},VertexSceneItemMaterialClear=({onClear:n,onClearAll:o})=>{const i=useSceneItemMaterialActions(),a=Vr(tl);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e("div",{className:"pt-1"}),e(S,{"data-testid":"clear-selected-materials",onClick:()=>{i.clear(),null==n||n()},disabled:!a,children:"Clear selected materials"}),e(S,{"data-testid":"clear-all-materials",onClick:()=>{i.clearAll(),null==o||o()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({onClearMaterial:n,onClearAllMaterials:o,onApplyMaterial:i,onApplyMaterialToAll:a,onApplyOpacity:r}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Material",e(VertexSceneItemMaterialClear,{onClear:n,onClearAll:o})]}),children:e(VertexMaterialControls,{onApplyMaterial:i,onApplyMaterialToAll:a,onApplyOpacity:r})})}const kl="#ffff00",xl=35,Nl=1,Rl=xr({key:"selectionHighlightingSelectedColor",default:kl}),Vl=xr({key:"selectionHighlightingSelectedOpacity",default:xl}),Pl=xr({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[n,o]=Or(Rl);return e(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>o(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[n,o]=Or(Pl);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=>{o(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[n,o]=Or(Vl);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=>{o(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:o,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:a}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexSelectionHighlightingColorPicker,{onUpdate:o}),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:a})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[n,o]=Or(Rl),[i,a]=Or(Vl),[r,s]=Or(Pl),l=undefined;return e("div",{className:"ml-auto",children:e(p,{content:"Reset Selection Highlighting",children:e(f,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(kl),a(xl),s(1),null==t||t()},disabled:!(n!==kl||i!==xl||1!==r)})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:n,onUpdateSelectionHighlightColor:o,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:a}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Selection Highlighting",e(VertexSelectionHighlightingReset,{onReset:n})]}),children:e(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:o,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:a})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[n,o]=Or(Tl);return e(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>o(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:o}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexViewerBackgroundColorPicker,{onUpdate:o})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[n,o]=Or(Tl),i=undefined;return e("div",{className:"ml-auto",children:e(p,{content:"Reset Background Color",children:e(f,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(El),null==t||t()},disabled:!(n!==El)})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:n,onUpdateViewerBackgroundColor:o}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Viewer Background",e(VertexViewerBackgroundReset,{onReset:n})]}),children:e(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:o})})}const Ol=xr({key:"boxSelectionEnabled",default:!1}),Ll=xr({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(Ol,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(Ol),e(Ll)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Ll,t)}))}),isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,o=e instanceof HTMLElement&&"true"===e.contentEditable,i=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,a=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,r=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,s=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||o||i||a||r||s},useRecoilReducer=({reducer:e,atom:t})=>{const n=undefined,o=undefined;return[Vr(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const n=Ir((({set:n})=>async o=>{n(t,(t=>e(t,o)))}),[]);return n},Il=xr({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,o,i,a;switch(t.type){case"push-key-binding":const r=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!==(o=e.bindings[t.binding.keyBind])&&void 0!==o?o:[],t.binding]})});case"remove-key-binding":const s=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!==(a=e.bindings[t.binding.keyBind])&&void 0!==a?a:[]).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:Il});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 o;return null!=e.keyBind&&null!=n&&(null===(o=e.keyBind)||void 0===o?void 0:o.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();i.useEffect((()=>{const o=$r.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:o,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:o})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();i.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),o=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),o&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,o]=useKeyBindingState(),a=i.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(),o({type:"remove-key-binding",binding:i}))}))}),[n]);i.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){o({type:"set-key-pressed",key:e.key,pressed:!0}),a(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),i=matchingSingleFnBindings(n.applyBindings,t,e.key),r=matchingOffBindings(n.applyBindings,t,e.key);(i.length>0||r.length>0)&&e.preventDefault()}},handleKeyUp=e=>{o({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)}}),[a,n.applyBindings,n.pressed]),i.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]),i.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=Vr(Ol);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>n,cancelPredicate:()=>!n},[n]),e(p,{content:"Box Selection",children:e(f,{iconName:"box-cursor",iconColor:n?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:n?t.disable:t.enable})})},Ml=1,VertexResizableContent=n=>{var{className:o,style:i,displayShadow:a,heading:r,id:s,initialScale:l,placement:c="left",children:u,onResize:d}=n,p=__rest(n,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const f="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 m=null!=l?l:1;return e(w,Object.assign({id:s,"data-testid":`resizable-content-position-${c}`,className:N(o,"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&&a,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&a,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},i),initialHorizontalScale:f?l:void 0,initialVerticalScale:h?m:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==d?void 0:d()},p,{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"})}),r,e("div",{className:N("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:u})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromiseRequired(Xr),n={milliseconds:500},o=await t();await(null==o?void 0:o.camera().viewAll().render({animation:n}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:i}){const[a,r]=o.useState(),[s,l]=o.useState();o.useEffect((()=>{const handleTouchStart=e=>{const o=e;null!=o.touches&&1===o.touches.length&&(null!=a&&clearTimeout(a),l(c.create(o.touches[0].clientX,o.touches[0].clientY)),r(setTimeout((()=>null==t?void 0:t(o)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=a&&null!=s&&c.distance(s,c.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(a),null==i||i())},handleTouchEnd=()=>{null!=a&&clearTimeout(a)};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,a,s])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:n,disableBackdrop:o,openPredicate:a,onOpen:r,onClose:s,children:l})=>{const c=useContextMenuActions(),u=Vr(Is),d=Vr(Us),p=i.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=u===n;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:c.clearActiveContextMenu,addPredicate:()=>null!=u&&u===n,cancelPredicate:()=>null==u},[u]);const h=i.useMemo((()=>null!=t?t:null!=a?window:void 0),[t,a]);return useLongPress({target:h,callback:e=>c.longPress(e,n,a,r),onMovement:()=>c.clearActiveContextMenu()}),i.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&u===n){const t=targetShouldSkipNextHit(e);c.clearActiveContextMenu(t)}};if(o)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[o,n,u]),i.useEffect((()=>{const handlePointerDown=e=>{c.pointerDown(e)},handlePointerUp=e=>{c.pointerUp(e,n,a,r)},handleContextMenu=e=>c.contextMenu(e,a);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,a]),e("div",{className:N({hidden:!f}),children:e(_,{"data-testid":`${n}-context-menu`,open:asBooleanAttribute(f),position:d,fallbackPlacements:p,backdrop:!o,onMenuClosed:()=>{c.clearActiveContextMenu(),null==s||s()},children:e("div",{className:"pt-1",children:l})})})},VertexFitSelectedMenuItem=()=>{const n=Vr($s),o=Vr(Js),i=useViewerCameraActions();return t(S,{"data-testid":"fit-selected-menu-option",onClick:()=>{null!=(null==o?void 0:o.boundingBox)&&i.flyToByBoundingBox(o.boundingBox)},disabled:asBooleanAttribute(0===n.length),children:[e(b,{slot:"icon",name:"fit-selected",size:"sm"}),e("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const n=useViewerCameraActions(),o=Vr(Bs);return t(S,{"data-testid":"fly-to-part-menu-option",onClick:()=>{var e;const t=undefined,i=contextMenuItemIsRow(o)?null===(e=null==o?void 0:o.node.id)||void 0===e?void 0:e.hex:null==o?void 0:o.id;null!=i&&n.flyToById(i)},disabled:asBooleanAttribute(null==o),children:[e(b,{slot:"icon",name:"paper-airplane",size:"sm"}),e("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=Vr(Kr),t=undefined,n=undefined,o=undefined,a=undefined,r=undefined,s=undefined;return{sceneItemsOperation:i.useCallback((async(t,n)=>{const o=await(null==e?void 0:e.scene());null==n?await(null==o?void 0:o.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==o?void 0:o.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:i.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:i.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:i.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:i.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:i.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 t(S,{"data-testid":"hide-all-menu-option",onClick:()=>{n.sceneItemsOperation((e=>e.hide()))},children:[e(b,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const n=Vr(Bs),o=useSceneItemsOperations();return t(S,{"data-testid":"hide-menu-option",onClick:()=>{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&&o.sceneItemsOperation((e=>e.hide()),[i])},disabled:asBooleanAttribute(null==n),children:[e(b,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const n=Vr($s),o=useSceneItemsOperations();return t(S,{"data-testid":"hide-selected-menu-option",onClick:()=>o.hideSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(b,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const n=useSceneItemsOperations();return t(S,{"data-testid":"show-all-menu-option",onClick:()=>{n.sceneItemsOperation((e=>e.show()))},children:[e(b,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const n=Vr(Bs),o=useSceneItemsOperations();return t(S,{"data-testid":"show-only-menu-option",onClick:()=>{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&&o.showOnlyItem(i)},disabled:asBooleanAttribute(null==n),children:[e(b,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const n=Vr($s),o=useSceneItemsOperations();return t(S,{"data-testid":"show-only-selected-menu-option",onClick:()=>o.showOnlySelected(),disabled:asBooleanAttribute(0===n.length),children:[e(b,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show Only Selected"})]})};xr({key:"sceneTreeLoaderVisible",default:!1});const Dl=xr({key:"sceneTreeElement",default:void 0}),Bl=xr({key:"sceneTreeWidth",default:void 0});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,o,i)=>{var a,r;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&o.selected?i.deselectItem(o):o.selected?i.selectItem(o,{recurseParent:!0}):o.selected||i.selectItem(o,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=o.id)){const i=await t.getPromise(Ks);e.syncSelection({id:null===(a=o.id)||void 0===a?void 0:a.hex,ancestors:null!==(r=null==i?void 0:i.ancestors)&&void 0!==r?r:[]},{selected:!n.metaKey&&!n.ctrlKey||!o.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 o;const i=await e.getPromise(Dl),a=await(null==i?void 0:i.getRowAtClientY(n));null!=(null===(o=null==a?void 0:a.node.id)||void 0===o?void 0:o.hex)&&await t.flyToById(a.node.id.hex)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=await t.getPromise(Dl),i=await(null==o?void 0:o.getRowAtClientY(n));e(Bs,i)}))}}Nr({key:"sceneTreeController",get:({get:e})=>{var t;return null===(t=e(Dl))||void 0===t?void 0:t.controller},dangerouslyAllowMutability:!0});const VertexGhostSelectedMenuItem=()=>{const n=Vr($s),o=useSceneItemsOperations();return t(S,{"data-testid":"ghost-selected-menu-option",onClick:()=>o.ghostSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(b,{slot:"icon",name:"visibility-partial",size:"sm"}),e("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const n=Vr($s),o=useSceneItemsOperations();return t(S,{"data-testid":"unghost-selected-menu-option",onClick:()=>o.unGhostSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(b,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Unghost Selected"})]})},DefaultSceneTreeContextMenu=()=>t("div",{className:"w-56",children:[e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e(A,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const n=useSceneTreeActions(),o=Vr(Dl),i=undefined;return e(VertexContextMenu,{menuType:"scene-tree",targetElement:o,onOpen:async(e,t)=>{const o=e;await n.setContextMenuItem(o.clientY)},disableBackdrop:!0,children:null!=t&&!1!==t?t:e(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>t("div",{className:"w-56",children:[e(VertexHidePartMenuItem,{}),e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e(A,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=Vr(Kr),o=undefined;return e(VertexContextMenu,{menuType:"viewer",targetElement:n,disableBackdrop:!0,children:null!=t&&!1!==t?t:e(DefaultViewerContextMenu,{})})},zl=undefined,Ul=xr({key:"sceneItemGhostingSelectedOpacity",default:35}),Fl=Rr({key:"appliedItemPhantomState",default:void 0}),jl=xr({key:"appliedItemPhantomStateIds",default:[]}),Hl=Nr({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Ks);return null!=n&&(null!==(t=e(Fl(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[n,o]=Or(Ul);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=>{o(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(jl)).forEach((e=>t(Fl(e)))),t(jl)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async o=>{const i=await t.getPromise($s);i.forEach((e=>n(Fl(e),o))),n(jl,(e=>[...e,...i])),await e.execute(Ws.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(o)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:o})=>async()=>{const i=await t.getPromise($s);i.forEach((e=>o(Fl(e)))),n(jl,(e=>e.filter((e=>!i.includes(e))))),await e.execute(Ws.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(Ws.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}},VertexSceneItemGhostingToggle=({onApply:t})=>{const n=useSceneItemPhantomActions(),o=Vr(tl),i=Pr(Hl);return e(p,{content:"Select a part to display as ghost",disabled:o,children:e(m,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!o,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await n.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:o,onApplyOpacity:i}){return t(n,{children:[t("div",{className:"flex items-center py-3",children:[e(VertexSceneItemGhostingToggle,{onApply:o}),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:o})=>{const i=useSceneItemPhantomActions(),a=Vr(Hl);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e("div",{className:"pt-1"}),e(S,{"data-testid":"reset-selected-phantom",onClick:async()=>{await i.clearPhantomState(),null==n||n()},disabled:!a,children:"Clear ghosting for selected"}),e(S,{"data-testid":"reset-all-phantom",onClick:async()=>{await i.clearAllPhantomState(),null==o||o()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:n,onClearAllGhostState:o,onApplyGhostingChange:i,onApplyOpacity:a}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Ghosting",e(VertexSceneItemGhostingClear,{onClear:n,onClearAll:o})]}),children:e(VertexGhostingControls,{onApplyGhostingChange:i,onApplyOpacity:a})})}function VertexApplicationMessages(){const o=Vr(Hs),i=Vr(js);return t(n,{children:[null!=o&&e(C,{className:"z-[16000]",duration:o.duration,open:!0,content:o.message,type:o.type},o.id),null!=i&&e(E,{placement:"bottom-left",className:"z-[16000]",duration:i.duration,open:!0,content:i.message,type:i.type},i.id)]})}const Wl=xr({key:"viewerToolkitSdkConfig",default:void 0}),targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=Ir((({set:t})=>n=>{t(e,n)}),[]);return t}var Gl;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===Gl.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Gl||(Gl={}));const VertexSceneTreeCollapseAll=()=>{const t=Vr(Dl);return e(p,{className:"w-auto",content:"Collapse All",placement:"top",children:e(b,{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=Vr(Dl);return e(p,{className:"w-auto",content:"Expand All",placement:"top",children:e(b,{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()}})})};function VertexSceneTreeToolbar(){return e(V,{className:"h-10 border-b border-neutral-300 box-border",children:t("div",{className:"flex flex-shrink-0 w-full text-neutral-700 items-center gap mx-2",children:[e(VertexSceneTreeExpandAll,{}),e(VertexSceneTreeCollapseAll,{})]})})}const VertexSceneTreeHeader=({children:o})=>{const i=undefined;return e("div",{slot:"header",className:"flex flex-col",children:null!=o&&!1!==o?o:t(n,{children:[e(P,{className:"border-b border-neutral-300"}),e(VertexSceneTreeToolbar,{})]})})},$l={binding:"{{row.node.name}}",label:"Name",metadataKeyName:"VERTEX_SCENE_ITEM_NAME"},Kl=Nr({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=[],n=e(Bl);if(null!=n&&n>0){const e=1/(t.length+1)*n,o=(n-e)/t.length;return{Name:Object.assign(Object.assign({},$l),{initialWidth:e,minWidth:o})}}return{Name:$l}}}),ql=Nr({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Kl))}),VertexSceneTreeTableLayout=n=>{const o=Vr(Kl),i=Vr(ql),a=[];return e(O,Object.assign({"data-testid":"scene-tree-table-layout"},n,{children:i.map(((n,r)=>{var s;const l=o[n],c=null!==(s=a[r])&&void 0!==s?s:l.initialWidth;return t(L,{"data-testid":`scene-tree-table-column-${r}`,initialWidth:c,minWidth:l.minWidth,children:[e("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${N("truncate",{"pl-2":0===r,"pr-2":r===i.length-1})}">\n ${l.label}\n </div>\n </div>\n `}}),e("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${l.binding}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${0===r?"expand-toggle":""}\n ${r===i.length-1?"isolate-button visibility-toggle":""}>\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=l.binding?l.binding:"--"}" \n placement="${r!==i.length-1?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${l.binding}</div>\n </div>\n </vertex-tooltip>\n </div>\n \n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},l.label)}))}))},VertexSceneTree=o=>{var{id:i,font:a,backgroundColors:r,children:s,style:l,onPointerDown:c,onClick:u,onToggleSelection:d,onToggleExpansion:p,onToggleVisibility:f,className:h,rowData:m}=o,g=__rest(o,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const v=Vr(Wl),b=useSelectionActions(),S=useSceneTreeActions(),w=Vr(Kr),_=useRecoilRef({state:Dl}),A=null!=s&&!1!==s,wrappedExpansionHandler=(e,t,n)=>{S.toggleExpansion(e,t,n),null==p||p(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{S.toggleSelection(e,t,n),null==d||d(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{S.toggleVisibility(e,t,n),null==f||f(e,t,n)},handleClick=e=>{e.altKey&&S.flyToRow(e.clientY),null==u||u(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&b.clearSelection(),null==c||c(e)};return e("div",{className:N("flex flex-col w-full h-full",h),children:e("div",{className:"flex group h-full",children:e(I,Object.assign({id:null!=i?i:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:v,ref:_,className:"flex-1",style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(a)),styleFromOptionalBackgroundColors(r)),l),onConnectionError:e=>{ne.error("Scene Tree Connection Error: ",e.detail)},viewer:w,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==m?void 0:m(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)}},g,{children:A?s:t(n,{children:[e(VertexSceneTreeHeader,{}),e(VertexSceneTreeTableLayout,{}),e(VertexSceneTreeContextMenu,{})]})}))})})},Yl=xr({key:"openedPanelActivePrimaryLeft",default:void 0}),Zl=xr({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Yl:Zl,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Yl:Zl,void 0)}))}}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,{})]})}const VertexTransformClear=({onClear:n,onClearAll:o})=>{const i=useTransformActions(),a=Vr(tl);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e("div",{className:"pt-1"}),e(S,{"data-testid":"reset-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==n||n()},disabled:!a,children:"Clear selected transforms"}),e(S,{"data-testid":"reset-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==o||o()},children:"Clear all transforms"})]})})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const n=useTransformActions(),o=Vr(nl),i=Lr(dl);return e(m,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:o,onValueChanged:async()=>{o?(n.disableTransformWidget(),null==t||t(!1)):(i("world"),await n.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:o}){return e(n,{children:t("div",{className:"flex items-center py-3",children:[e(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:o}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Enable manipulator"})]})})}function VertexTransformPanelSection({onClearTransforms:n,onClearAllTransforms:o,onToggleTransformsManipulator:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e(VertexTransformClear,{onClear:n,onClearAll:o})]}),children:e(VertexTransformControls,{onToggleTransformsManipulator:i})})}function DefaultTransformsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexTransformPanelSection,{})})}const Xl="Appearance",Jl="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,n=getHeading(Vr(Zl));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:e("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:n})})};function getHeading(e){switch(e){case"appearance":return Xl;case"transforms":return Jl;default:return"None"}}function VertexViewerRightOpenedPanel(){const o=Vr(Zl),a=i.useMemo((()=>["appearance","transforms"]),[]);return e(n,{children:null!=o&&a.includes(o)&&t(VertexResizableContent,{displayShadow:!0,heading:e(ViewerRightPanelHeader,{}),placement:"right",children:["appearance"===o&&e(DefaultAppearancePanel,{}),"transforms"===o&&e(DefaultTransformsPanel,{})]})})}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:o,active:a,responsive:r,disabled:s,content:l,tooltipPlacement:c,children:u,onSelect:d,onDeselect:f}){return e("div",{className:N({"text-[var(--vertex-ui-blue-700)]":a===n&&!s,"text-neutral-700 hover:text-neutral-800":a!==n&&!s,"cursor-pointer hover:bg-neutral-200":!s,"text-neutral-400":s,"rounded-full md:p-3":r,"p-3":!r&&null==u,"px-3 py-1":null!=u}),"data-testid":`${n}-sidebar-panel`,onClick:()=>{s||(a===n?f():d())},children:t(p,{placement:null!=c?c:void 0,content:i.isValidElement(l)?void 0:l,children:[e("div",{slot:"content",children:l}),t("div",{className:"flex flex-col",children:[e(b,{name:o}),u]})]})})}function VertexViewerRightSidebar(){const n=usePanelActions(),o=Vr(Zl);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:[e(SidebarIcon,{name:"appearance",active:o,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{n.openPrimary("appearance","right")},onDeselect:()=>n.closePrimary("right")}),e(SidebarIcon,{name:"transforms",active:o,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:()=>{n.openPrimary("transforms","right")},onDeselect:()=>n.closePrimary("right")})]})})}const VertexPopupButton=o=>{var{open:i,children:a}=o,r=__rest(o,["open","children"]);const s=a.find((e=>e.type===Anchor)),l=a.filter((e=>e.type!==Anchor));return null==s?e(n,{}):t(T,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(i)},r,{children:[s,e("div",{className:N("flex mb-1.5",{hidden:!i}),"data-testid":"align-plane-popover-menu",children:l})]}))},Anchor=({tooltipContent:t,children:n})=>e("div",{slot:"anchor",children:e(p,{className:"cursor-pointer",content:t,children:n})});function VertexViewerToolbarDivider(){return e("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1 items-center mt-1"})}function VertexViewerCrossSectionAlignmentPopoverMenu(){const n=useCrossSectioningActions(),o=Vr(Ss),i=Vr(ds),getBaseIcon=()=>`align-to-${null==i?void 0:i.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:n.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==i?void 0:i.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==i?void 0:i.hitPending)},[null==i?void 0:i.hitPending]),t(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(o),onDismissed:n.closeAlignmentTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e(f,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:o?n.closeAlignmentTools:n.openAlignmentTools,children:e(b,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),t(M,{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(f,{iconColor:"secondary",onClick:()=>n.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(f,{iconColor:"secondary",onClick:()=>n.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(){const n=useCrossSectioningActions(),o=Vr(ws),a=Vr(us),r=Pr(ms),s=i.useMemo((()=>{const e=a.length>0&&"hasValue"===r.state?axis(a[0],xAxis(r.contents),yAxis(r.contents),zAxis(r.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[r.state,r.contents,a]);return t(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(o),onDismissed:n.closeAxisTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e(f,{onClick:o?n.closeAxisTools:n.openAxisTools,iconName:s,"data-testid":"align-plane-icon",iconColor:"secondary",children:e(b,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),t(M,{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(f,{"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:()=>n.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e(f,{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:()=>n.updateAxis("y"),children:e("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e(f,{"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:()=>n.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}var Ql,ec;VertexPopupButton.Anchor=Anchor,function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Ql||(Ql={})),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"}(ec||(ec={}));const convertFrom=(e,t)=>{const n=undefined;return e/ec[t]},convertTo=(e,t)=>{const n=undefined;return e*ec[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 VertexViewerCrossSectionOffsetStepper({offset:n,measurementUnit:o,decimalPlaces:a,onOffsetChange:r}){const[s,l]=i.useState(convertTo(n,o));i.useEffect((()=>{l(convertTo(n,o))}),[o,n]);const c=createDistanceFormatter(o,a),handleIncrementalUpdate=e=>{const t=convertFrom(s+e,o);r(t)},u=undefined,handleBlur=()=>{r(convertFrom(s,o))};return e(p,{content:"Plane Offset",children:e("form",{"data-testid":"cross-section-stepper-form",onSubmit:e=>{e.preventDefault(),r(convertFrom(s,o))},children:t(k,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:c(parseFloat(n.toFixed(3))),onInputInput:e=>{l(null!=e.detail.value?parseFloat(e.detail.value):n)},onBlur:handleBlur,children:[e("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>handleIncrementalUpdate(-1),children:e(b,{name:"chevron-left",size:"sm"})}),e("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>handleIncrementalUpdate(1),children:e(b,{name:"chevron-right",size:"sm"})})]})})})}const tc=400;function VertexViewerCrossSectionPopupMenu({decimalPlaces:n,measurementUnit:o}){const a=useCrossSectioningActions(),r=Vr(bs),s=Pr(vs),l=Pr(ys),c=i.useRef(),u=i.useMemo((()=>"hasValue"===s.state?s.contents:rs),[s.state,s.contents]),d=i.useMemo((()=>"hasValue"===l.state?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(c.current),c.current=window.setTimeout((()=>{a.endInteraction()}),tc),a.beginInteraction(),a.updatePlanes(e)};return t(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(r),onDismissed:a.closeAdditionalTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e("div",{className:"-ml-px py-1.5",children:e(b,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:r?a.closeAdditionalTools:a.openAdditionalTools})})}),t(M,{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,{}),e(p,{className:"w-auto",content:"Reverse",children:e(f,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:a.flipPlanes,iconColor:"secondary"})}),e(p,{className:"w-auto",content:"Align View to Plane",children:e(f,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:a.alignViewToPlane,iconColor:"secondary"})}),e(VertexViewerToolbarDivider,{}),e(VertexViewerCrossSectionAxisPopoverMenu,{}),e("div",{className:"w-52 mx-2",children:e(VertexSlider,{value:d,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==s.state),min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e("div",{className:"px-4",children:e(VertexViewerCrossSectionOffsetStepper,{decimalPlaces:n,measurementUnit:o,offset:"hasValue"===l.state?l.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=({decimalPlaces:o,measurementUnit:i})=>{const a=useCrossSectioningActions(),r=Vr(ss);return t(n,{children:[e(p,{content:r?"Hide Section":"Show Section",children:e(f,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:r?"primary":"secondary",onClick:()=>r?a.disable():a.enable()})}),e(VertexViewerCrossSectionPopupMenu,{decimalPlaces:null!=o?o:2,measurementUnit:null!=i?i:"mm"})]})},VertexFitAllButton=()=>{const t=Vr(Kr);return e(p,{content:"Fit All",children:e(f,{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=Vr(Kr),n=Vr(qr),[o,a]=Or(Zr),[r,s]=Or(Yr);return i.useEffect((()=>{null!=t&&n&&s(t.getBaseInteractionHandler())}),[t,n,s]),e(p,{content:"Pan",children:e(f,{iconName:"pan",iconColor:"pan"===o?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(a("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=Vr(Kr),n=Vr(qr),[o,a]=Or(Zr),[r,s]=Or(Yr);return i.useEffect((()=>{null!=t&&n&&s(t.getBaseInteractionHandler())}),[t,n,s]),e(p,{content:"Rotate",children:e(f,{iconName:"rotate",iconColor:"rotate"===o?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(a("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=Vr(Kr),n=Vr(qr),[o,a]=Or(Zr),[r,s]=Or(Yr);return i.useEffect((()=>{null!=t&&n&&s(t.getBaseInteractionHandler())}),[t,n,s]),e(p,{content:"Zoom",children:e(f,{iconName:"zoom",iconColor:"zoom"===o?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(a("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e(D,{placement:"bottom-center",children:t(M,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexRotateButton,{}),e(VertexPanButton,{}),e(VertexZoomButton,{}),e(VertexFitAllButton,{}),e(VertexViewerToolbarDivider,{}),e(VertexBoxSelectionButton,{}),e(VertexViewerToolbarDivider,{}),e(VertexViewerCrossSectionButton,{})]})}),VertexToolbar=({children:t})=>{const n=undefined;return e(D,{placement:"bottom-center",children:null!=t&&!1!==t?e(M,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:o,decimalPlaces:a,distanceUnit:r,onPositionChange:s,onRotationChange:l}){const c=useTransformActions(),u=Vr(sl),d=Vr(nl),p=Vr(ol),f=Vr(rl),h=Pr(al),m=i.useMemo((()=>"hasValue"===h.state?h.contents:f),[h,f]),g=i.useMemo((()=>{const e=undefined;return d&&(null!=m||u)}),[d,m,u]);return e(n,{children:g&&e(B,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:p,rotation:null!=p?m:void 0,decimalPlaces:null!=a?a:2,distanceUnit:null!=r?r:"centimeters",EXPERIMENTAL_undoKeybindings:null==o||o,onInteractionStarted:()=>{c.disableSelectionSync(),c.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{c.invalidateTransforms(),c.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await c.setTransformWidgetPosition(e.detail),null==s||s(e.detail)},onRotationChanged:e=>{c.setTransformWidgetOrientation(e.detail),null==l||l(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),o=useSelectionActions(),i=useTransformActions(),a=useViewerSceneActions(),r=undefined;return e(p,{content:"Reset View",children:e(f,{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 o.resetSelectionState(),i.clearTransformWidgetPosition(),null==t||t(),await a.reset()},variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async o=>{const i=await n.getPromise(Js);t(Jr,o.detail.scene),t(Js,o.detail.scene.sceneViewSummary.selectedVisibleSummary),t(Xs,i);const a=undefined;await n.getPromise(nl)&&await e.syncToSelection()}))}}function useCallbackRef(e){var t;const[n,o]=i.useState((t=void 0,null)),a=undefined;return{element:n,callback:i.useCallback((e=>o(e)),[])}}async function whenComponentReady(e,t){return null!=e&&null!=e.nodeName&&await customElements.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):void 0}const VertexBoxSelectionTool=()=>{const{element:t,callback:n}=useCallbackRef(),i=useBoxSelectionActions(),a=useTransformActions(),r=Vr(Ll);return o.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===r&&(a.clearTransformWidgetOrientation(),a.clearTransformWidgetPosition(),a.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,r]),useApplyKeyBinding({keyBind:"Shift",fn:o.useCallback((()=>i.setOperationType("select")),[]),off:o.useCallback((()=>i.setOperationType("clearAndSelect")),[])}),e(U,{ref:n,"data-testid":"viewer-box-query-tool",operationType:r})};function VertexViewerCameraTypeMenu({open:n,onOpen:o,onDismiss:i,onCameraTypeChange:a}){const r=useViewerCameraActions(),s=Vr(ts);return t(_,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(n),onMenuClosed:i,children:[e("div",{slot:"anchor",children:e("div",{className:N("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(p,{content:"Change View",children:e(f,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:o,iconName:"orthographic"===s?"cube-orthographic":"cube-perspective",children:e(b,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),t("div",{className:"w-36",children:[e("div",{className:"pt-1"}),t(S,{"data-testid":"set-perspective-view",onClick:()=>{r.updateCameraType("perspective"),null==a||a("perspective")},children:[e(b,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:N({"text-[var(--vertex-ui-blue-700)]":"perspective"===s})}),e("div",{className:N("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===s}),children:"Perspective"})]}),t(S,{"data-testid":"set-orthographic-view",onClick:()=>{r.updateCameraType("orthographic"),null==a||a("orthographic")},children:[e(b,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:N({"text-[var(--vertex-ui-blue-700)]":"orthographic"===s})}),e("div",{className:N("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===s}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=n=>{var{placement:o,children:a}=n,r=__rest(n,["placement","children"]);const s=Array.isArray(a)?a:[a],l=s.filter((e=>!i.isValidElement(e)||e.type!==F)).filter((e=>null!=e&&!1!==e)),c=s.find((e=>i.isValidElement(e)&&e.type===F)),[u,d]=i.useState(!1);return t(D,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=o?o:"top-right",children:[null!=c?c:e(F,Object.assign({className:"m-7"},r)),0===l.length?t("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e(VertexViewerSceneReset,{}),e(VertexViewerCameraTypeMenu,{open:u,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e("div",{className:"mt-3",children:l})]})},VertexViewer=o=>{var{id:a,className:r,disableSelection:s,onTap:l,onLongpress:c,onFrameDrawn:u,onSceneReady:d,viewerRefCallback:p,children:f}=o,h=__rest(o,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const m=Vr(Wl),g=useRecoilRef({state:Kr}),v=useViewerCameraActions(),b=useHitActions(),S=useSelectionActions(),w=useViewerFrameActions(),[_,A]=Or(qr),C=Vr(ts),E=Vr(ds),T=Vr(Ol),k=Vr(Ul),R=i.useMemo((()=>({opacity:k/100})),[k]),V=Vr(Os),P=Vr(Ls),O=i.useMemo((()=>({color:V,width:P})),[V,P]),L=Vr(Tl),I=Vr(Rl),M=Vr(Vl),D=Vr(Pl),B=i.useMemo((()=>({color:I,opacity:M/100,lineWidth:D})),[I,M,D]),U=null!=f&&!1!==f;return useKeyBindings(),useDefaultKeybindings(),t(j,Object.assign({id:null!=a?a:"vertex-viewer","data-testid":"vertex-viewer",ref:null!=p?p:g,className:N("flex w-full h-full",r,{"cursor-crosshair":E.hitPending}),style:{"--viewer-background":L},config:m,cameraType:_?C:void 0,onCameraTypeChanged:e=>{_&&v.updateCameraType(e.detail)},phantom:R,featureLines:O,selectionHighlighting:B,onTap:e=>{const t=[...s?[]:[S.selectCurrentHit]];b.tap(e,...t),null==l||l(e)},onLongpress:e=>{b.longPress(e),null==c||c(e)},onFrameDrawn:e=>{w.frameDrawn(e),null==u||u(e)},onSceneReady:e=>{_||A(!0),null==d||d(e)}},h,{children:[T&&e(VertexBoxSelectionTool,{}),U?f: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:o})=>{const a=Vr(pl),r=Vr(hl);return i.useEffect((()=>{null==t||t(a)}),[a,t]),i.useEffect((()=>{null==o||o(r)}),[r,o]),e(n,{})},VertexViewerToolkitRoot=o=>{var{override:a,autoDefineCustomElements:r,children:s,config:l}=o,c=__rest(o,["override","autoDefineCustomElements","children","config"]);return i.useEffect((()=>{(null==r||r)&&(W(),H())}),[r]),e(kr,{override:a,children:t(n,{children:[e(VertexViewerToolkitEventListener,Object.assign({},c)),e(VertexViewerToolkitRootConfig,{config:l,children:s})]})})},VertexViewerToolkitRootConfig=({config:t,children:o})=>{const a=Lr(Wl);return i.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;a(e)}),[t,a]),e(n,{children:o})};var nc=Object.freeze({__proto__:null,get AssemblyFontFace(){return Gl}});export{Rs as CrossSection,fl as Hits,nc as SceneTree,ml as Selection,VertexApplicationMessages,VertexBoxSelectionButton,VertexContextMenu,VertexCrossSectionAppearanceColorPicker,VertexCrossSectionAppearanceControls,VertexCrossSectionAppearanceLineThicknessSlider,VertexCrossSectionAppearancePanelSection,VertexCrossSectionAppearanceReset,VertexFeatureEdgesColorPicker,VertexFeatureEdgesControls,VertexFeatureEdgesPanelSection,VertexFeatureEdgesReset,VertexFeatureEdgesThicknessSlider,VertexFitAllButton,VertexFitSelectedMenuItem,VertexFlyToMenuItem,VertexGhostingControls,VertexGhostingPanelSection,VertexHideAllMenuItem,VertexHidePartMenuItem,VertexHideSelectedMenuItem,VertexMaterialControls,VertexMaterialPanelSection,VertexPanButton,VertexResizableContent,VertexRotateButton,VertexSceneItemGhostingClear,VertexSceneItemGhostingOpacitySlider,VertexSceneItemGhostingToggle,VertexSceneItemMaterialClear,VertexSceneItemMaterialColorPicker,VertexSceneItemMaterialOpacitySlider,VertexSceneTree,VertexSceneTreeContextMenu,VertexSceneTreeHeader,VertexSceneTreeTableLayout,VertexSelectionHighlightingColorPicker,VertexSelectionHighlightingControls,VertexSelectionHighlightingLineThicknessSlider,VertexSelectionHighlightingOpacitySlider,VertexSelectionHighlightingPanelSection,VertexSelectionHighlightingReset,VertexShowAllMenuItem,VertexShowOnlyMenuItem,VertexShowOnlySelectedMenuItem,VertexToolbar,VertexTransformClear,VertexTransformControls,VertexTransformManipulatorToggle,VertexTransformPanelSection,VertexTransformWidget,VertexViewer,VertexViewerBackgroundColorPicker,VertexViewerBackgroundControls,VertexViewerBackgroundPanelSection,VertexViewerBackgroundReset,VertexViewerContextMenu,VertexViewerCrossSectionButton,VertexViewerRightOpenedPanel,VertexViewerRightSidebar,VertexViewerSceneReset,VertexViewerToolbarDivider,VertexViewerToolkitRoot,VertexViewerViewCube,VertexZoomButton};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import a from"pino";import{useRecoilCallback as i,atom as l,selector as o,useRecoilValue as s,useRecoilState as r,useSetRecoilState as c,atomFamily as d,useRecoilValueLoadable as u,RecoilRoot as m}from"recoil";import{UUID as p,Color as h}from"@vertexvis/utils";import*as g from"react";import f,{useEffect as v,useCallback as b}from"react";import{Vector3 as C,BoundingBox as w,Angle as S,Point as k}from"@vertexvis/geometry";import{VertexColorPicker as A,VertexSlider as T,VertexTooltip as P,VertexIconButton as E,VertexDialog as N,VertexToggle as O,VertexButton as M,VertexDropdownMenu as I,VertexIcon as V,VertexMenuItem as R,VertexResizable as L,VertexMenu as _,VertexMenuDivider as D,VertexDraggablePopover as B,VertexBanner as H,VertexToast as j,VertexPopover as F,VertexTextfield as U,VertexSelect as W}from"@vertexvis/ui-react";import G from"classnames";import{ColorMaterial as K}from"@vertexvis/viewer";import{VertexViewerMeasurementDetails as $,VertexViewerMeasurementDistance as Y,VertexViewerMeasurementPrecise as X,VertexSceneTreeSearch as q,VertexSceneTreeToolbar as Z,VertexSceneTreeTableLayout as J,VertexSceneTreeTableColumn as Q,VertexSceneTree as ee,VertexViewerToolbarGroup as te,VertexViewerToolbar as ne,VertexViewerTransformWidget as ae,VertexViewerBoxQueryTool as ie,VertexViewerViewCube as le,VertexViewer as oe}from"@vertexvis/viewer-react";import{defineCustomElements as se}from"@vertexvis/ui/loader";import{defineCustomElements as re}from"@vertexvis/viewer/loader";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"==typeof SuppressedError&&SuppressedError;const ce=a({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?ce.error(t,e):ce.error(e)},logger_info=(e,t)=>{null!=t?ce.info(t,e):ce.info(e)},logger_warn=(e,t)=>{null!=t?ce.warn(t,e):ce.warn(e)},logger_debug=(e,t)=>{null!=t?ce.debug(t,e):ce.debug(e)};class de{}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 de?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 ue=l({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),me=l({key:"viewerElementId",default:"vertex-viewer"}),pe=l({key:"viewerInitialSceneReady",default:!1}),he=l({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),ge=l({key:"viewerPrimaryInteractionType",default:"rotate"}),fe=o({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(ue))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),ve=l({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),ye=o({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(ve))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const i=await e.getPromise(fe),l=await i();a.length>0&&await(null==l?void 0:l.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=f.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=f.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),a=f.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=p.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:a,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(fe),a=await n(),i=await e.getPromiseRequired(Ce);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:i})}))}}const be=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(fe),i=await a();await(null==i?void 0:i.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:be}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(fe),i=await a();await(null==i?void 0:i.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:be}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(Ce,t)}))}}const Ce=l({key:"viewerCameraType",default:"perspective"});class we{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(C.left(),-e),y=e=>create(C.down(),-e),z=e=>create(C.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},Se={x:C.left(),y:C.down(),z:C.forward()},xAxis=e=>e.x,yAxis=e=>e.y||C.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||C.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===C.magnitude(C.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>C.dot(C.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return C.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:C.multiply(e.normal,C.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=C.normalize(e.normal),a=C.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,i)=>{const l=n.viewAll(),o=getAxis(e,t),s=null!=a&&null!=o?create(o,C.dot(o,i||w.center(a))):forAxis(e,l.lookAt[e]);return towardsCamera(n,s)};function corners(e){return[C.create(e.min.x,e.min.y,e.min.z),C.create(e.min.x,e.min.y,e.max.z),C.create(e.min.x,e.max.y,e.min.z),C.create(e.min.x,e.max.y,e.max.z),C.create(e.max.x,e.max.y,e.max.z),C.create(e.max.x,e.max.y,e.min.z),C.create(e.max.x,e.min.y,e.max.z),C.create(e.max.x,e.min.y,e.min.z)]}function equals(e,t){return e.min.x===t.min.x&&e.min.y===t.min.y&&e.min.z===t.min.z&&e.max.x===t.max.x&&e.max.y===t.max.y&&e.max.z===t.max.z}const xe="#999999",ke=1,Ae={default:5,min:0,max:10},Te=l({key:"crossSectioningEnabled",default:!1}),Pe=l({key:"crossSectioningHighlightColor",default:xe}),Ee=l({key:"crossSectioningBorderWidth",default:1}),Ne=l({key:"crossSectioningPlanes",default:[]}),Oe=l({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),Me=o({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(ye)}}),Ie=l({key:"crossSectioningIsInteractive",default:!1}),Ve=l({key:"crossSectioningActiveAxis",default:"x"}),Re=l({key:"crossSectioningAvailableAxes",default:Se}),Le=o({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(Ne);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),_e=o({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(Ne),n=e(Me),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>C.dot(e,isNegativeNormal(t[0])?C.multiply(t[0].normal,C.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return Ae}}),De=o({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(Ne),n=e(Le),a=e(_e);return t.length>0?t[0].offset*n:a.default}}),Be=l({key:"crossSectioningAdditionalToolsOpen",default:!1}),He=l({key:"crossSectioningAlignmentToolsOpen",default:!1}),ze=l({key:"crossSectioningAxisToolsOpen",default:!1}),je=l({key:"crossSectioningInteractionHandler",default:new we,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const n=s(je);f.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(n))}),[e,t,n])}const Fe=l({key:"hitResultsTapDetails",default:void 0}),Ue=l({key:"hitResultsLongPressDetails",default:void 0}),We=l({key:"previousHitResult",default:void 0}),Ge=l({key:"currentHitResult",default:void 0}),Ke=o({key:"hitResult",get:async({get:e})=>{var t,n,a,i,l,o,s,r;const c=e(Fe),d=e(Ue),u=null!=c?c:d,m=e(fe),p=await m(),h=null==p?void 0:p.sceneViewId,g=null==p?void 0:p.raycaster();if(null!=u&&null!=g&&null!=h){const e=await g.hitItems(u.position),c=((null==e?void 0:e.hits)||[])[0];if(null!=c)return{id:null===(t=c.itemId)||void 0===t?void 0:t.hex,normal:C.create((null===(n=null==c?void 0:c.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==c?void 0:c.hitNormal)||void 0===a?void 0:a.y)||0,(null===(i=null==c?void 0:c.hitNormal)||void 0===i?void 0:i.z)||0),position:C.create((null===(l=null==c?void 0:c.hitPoint)||void 0===l?void 0:l.x)||0,(null===(o=null==c?void 0:c.hitPoint)||void 0===o?void 0:o.y)||0,(null===(s=null==c?void 0:c.hitPoint)||void 0===s?void 0:s.z)||0),meta:u.metaKey||u.ctrlKey||!1,metadata:[],ancestors:(null===(r=null==c?void 0:c.ancestors)||void 0===r?void 0:r.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})))||[]}}}}),$e=l({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=C.dot(C.normalize(e.up),t),a=Math.abs(n)>.98?C.normalize(C.scale(-n,e.viewVector)):e.up,i=C.add(C.scale(C.distance(e.position,e.lookAt),C.multiply(t,C.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:i})}{const a=C.angleTo(C.normalize(e.viewVector),t),i=null!=n?w.center(n):e.lookAt,l=C.normalize(C.cross(C.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,i,l)}};function isParallelTo(e,t){const n=S.toDegrees(C.angleTo(e,t));return 0===n||180===n}const Ye=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ee),n=await e.getPromise(Pe),a=await e.getPromise(Ne),i=await e.getPromise(fe),l=await i();await(null==l?void 0:l.crossSectioning().update({sectionPlanes:a,highlightColor:n?h.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const i=await a.getPromise(fe),l=await i();if(null!=l){const a=l.camera().viewAll();n(Re),t(Ne,[towardsCamera(l.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(Ke).then((e=>e.value)),i=await t.getPromise(fe),l=await i();if(null!=a&&null!=l){const t=fromHit(a,l.camera());n(Ne,null!=t?[t]:[]),n(Re,null!=t?{x:t.normal}:Se),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(Ne),i=undefined;await n.getPromise(Te)||(e(Te,!0),0===a.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(Te)&&(t(Te),t(Be),t(He),t(ze),t(Ne),t(Oe),t(Ve),await e())}));return{enable:a,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Te)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Te)||await a(),e(Be,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(Be)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(ze),e(He,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(He)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(He),e(ze,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(ze)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(je);e(Ie,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(je);e(Ie),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(Ne);if(i.length>0){const l=await n.getPromise(Le),o=await n.getPromise(_e),s=l<0?-1*o.max:o.min,r=l<0?-1*o.min:o.max,c=i.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*l,s),r)})));t(Ne,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(Ne);t(Ne,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ne),n=await e.getPromise(ue),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:Ye}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async i=>{const l=await a.getPromise(Ne),o=await a.getPromise(Re),s=await a.getPromise(Me),r=await a.getPromise(Oe),c=await a.getPromise(ue),d=await(null==c?void 0:c.scene()),u=o[i],m=null!=u&&l.length>0&&isParallelTo(l[0].normal,u)&&!isNaN(C.angleTo(l[0].normal,u));if(null!=d&&!m){const e=await a.tryGetPromise(Ke).then((e=>e.value));t(Ve,i),t(Ne,[toAxis(i,o,d.camera(),s,"global"!==r.mode?null==e?void 0:e.position:void 0)])}n(ze),await e()}))),updateAlignment:useActionCallback((({set:e,reset:i})=>async(l,o)=>{i(He),e(Oe,{mode:l,hitPending:"global"!==l&&null==o}),"global"===l?(i(Ve),i(Re),await t()):"surface"===l&&null!=o&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Oe);a.hitPending&&(e(Oe,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Oe);n.hitPending&&e(Oe,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Xe=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Ye,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:xe,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:Ae,crossSectioningActiveAxis:Ve,crossSectioningAdditionalToolsOpen:Be,crossSectioningAlignment:Oe,crossSectioningAlignmentToolsOpen:He,crossSectioningAvailableAxes:Re,crossSectioningAxisToolsOpen:ze,crossSectioningBorderWidth:Ee,crossSectioningEnabled:Te,crossSectioningHighlightColor:Pe,crossSectioningInteractionHandler:je,crossSectioningIsInteractive:Ie,crossSectioningOffsetScalar:Le,crossSectioningPlaneDisplayOffset:De,crossSectioningPlanes:Ne,crossSectioningSliderRange:_e,crossSectioningTargetBoundingBox:Me,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=f.useState();return f.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),f.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=f.useCallback((e=>{const t=e.target;i(t.value)}),[i]);return e(A,Object.assign({onInput:l},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=r(Pe);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()}})},VertexSlider=n=>{var{value:a,defaultValue:i,leftLabel:l,rightLabel:o,onChange:s,onValueChange:r,onValueInput:c}=n,d=__rest(n,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[u,m]=f.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(T,Object.assign({className:G("w-full",{"mt-0.5":null!=l||null!=o}),value:null!=a?a:u,onValueChange:e=>{m(e.detail.value),null==s||s(e.detail.value),null==r||r(e)},onValueInput:e=>{m(e.detail.value),null==s||s(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]=r(Ee);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)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexCrossSectionAppearanceColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:i})]})}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]=r(Pe),[l,o]=r(Ee),s=undefined;return e("div",{className:"ml-auto",children:e(P,{content:"Reset Cross Sectioning Appearance",children:e(E,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(xe),o(1),null==t||t(),await n.reapply()},disabled:!(a!==xe||1!==l)})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:n,onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i}){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})})}const qe=.5,Ze="#444444",Je=l({key:"featureEdgesSelectedColor",default:Ze}),Qe=l({key:"featureEdgesLineThickness",default:qe}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[n,a]=r(Je);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]=r(Qe);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]=r(Je),[i,l]=r(Qe),o=undefined;return e("div",{className:"ml-auto",children:e(P,{content:"Reset Feature Edges",children:e(E,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(Ze),l(qe),null==t||t()},disabled:!(i!==qe||n!==Ze)})})})};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)}const et=l({key:"contextMenuActive",default:void 0}),tt=l({key:"contextMenuPosition",default:void 0}),nt=l({key:"contextMenuTarget",default:void 0}),at=l({key:"contextMenuItem",default:void 0}),it=l({key:"contextMenuActions",default:[]}),lt=o({key:"contextMenuActivePosition",get:({get:e})=>null!=e(et)?e(tt):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(tt,k.create(n,a)),e(nt,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,i,l)=>{const o=await e.getPromise(tt),s=await e.getPromise(et);if(null!=o&&null==s){const e=n.clientX,s=null==n?void 0:n.clientY,r=k.create(e,s),c=null!=o?k.distance(o,r):0,d=null==i||i(n);c<2&&d&&(null==l||l(n,null!=o?o:r),t(et,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=k.create(t.touches[0].clientX,t.touches[0].clientY);e(tt,a),e(nt,t.target),e(et,n),null==i||i(t,a)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t($e,!!n),e(et),e(it),e(tt)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e($e)))}}function targetWithinMenu(e){return e.target instanceof Element&&isChildOf("vertex-menu",e.target)}function targetShouldSkipNextHit(e){return e.target instanceof Element&&isChildOf("vertex-viewer",e.target)}function isChildOf(e,t){return null!=t.closest(e)}const ot=l({key:"boxSelectionEnabled",default:!1}),st=l({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(ot,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(ot),e(st)})),setOperationType:useActionCallback((({set:e})=>t=>{e(st,t)}))});async function whenComponentReady(e,t){return null!=e&&null!=e.nodeName&&await customElements.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):void 0}const rt=l({key:"isEditingPointToPointMeasurement",default:!1}),ct=l({key:"pointToPointMeasurementOutcome",default:void 0}),dt=l({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=c(ct);v((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const ut=2,mt=l({key:"isEditingPreciseMeasurement",default:!1}),pt=l({key:"preciseMeasurementOutcome",default:void 0}),ht=l({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),gt=l({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),ft=l({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),vt=o({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(ft).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,n){const a=c(ft),i=c(pt),l=c(ht),o=c(gt),r=s(ht);v((()=>{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]),v((()=>{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]),v((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==r||r.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,r]),v((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),v((()=>{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(ht);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(pt),n(ft),e(mt,!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(mt),a=await e.getPromise(rt);n?await i():a&&(t(ct),t(dt))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(dt)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(dt,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(rt)?await l():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(mt)?await l():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(rt,!0),n.keepExistingMeasurement||e(ct)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(rt),t.keepExistingMeasurement||(e(dt),e(ct))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(mt),e(pt),e(ft)}))}const yt=o({key:"isEditingMeasurement",get:({get:e})=>e(rt)||e(mt)}),bt=o({key:"measurementPanelModel",get:({get:e})=>e(ct)||e(pt)}),Ct=o({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(gt)}),wt=o({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(mt)?e(vt):void 0}}),St=o({key:"measurementPanelIsResettable",get:({get:e})=>e(yt)&&null!=e(bt)}),xt=3e3,kt=l({key:"applicationMessageToast",default:void 0}),At=l({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(At,null!=t?Object.assign(Object.assign({},t),{id:p.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(kt,null!=t?Object.assign(Object.assign({},t),{id:p.create()}):void 0)}))});var Tt;!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"}(Tt||(Tt={}));const Pt=d({key:"selectionSelectedItems",default:void 0}),Et=l({key:"selectionSelectedItemIds",default:[]}),Nt=l({key:"selectionLastSelected",default:void 0}),Ot=l({key:"selectionLastSelectionFromViewer",default:!1}),Mt=l({key:"selectionLastSelectWasMultiSelect",default:!1}),It=o({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(Nt),i=e(Et);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}}),Vt=l({key:"selectionPreviousVisibleSummary",default:void 0}),Rt=l({key:"selectionVisibleSummary",default:void 0}),Lt=o({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(Rt))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),_t=o({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(Rt);return null!=(null==t?void 0:t.boundingBox)?w.center(t.boundingBox):C.origin()}}),Dt=o({key:"selectionIsActive",get:({get:e})=>{const t=e(Et),n=undefined;return e(Lt)>0||t.length>0}}),Bt=l({key:"transformWidgetEnabled",default:!1}),Ht=l({key:"transformWidgetPosition",default:void 0}),zt=l({key:"transformWidgetOrientationOverride",default:void 0}),jt=o({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(zt);if(null!=t)return t}}),Ft=l({key:"transformWidgetCachedOrientation",default:void 0}),Ut=l({key:"transformWidgetSyncToSelection",default:!1}),Wt=l({key:"transformWidgetIsInteracting",default:!1}),Gt=d({key:"appliedItemTransform",default:void 0}),Kt=l({key:"appliedItemTransformIds",default:[]}),$t=l({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(_t);e(Ht,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Ht),i=await t.getPromise(Mt),l=await t.getPromise(Et),o=await t.getPromise(Lt);null==a&&(l.length>0||i||o>0)&&await n(),e(Ut,!0)})),i=useActionCallback((({set:e})=>async t=>{e(Ht,null!=t?t:void 0)})),l=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(jt),i=undefined;(await e.getPromise(Kt)).forEach((e=>{n(Gt(e))})),null!=a&&t(Ft,a)}))),o=useActionCallback((({set:e,reset:t})=>n=>{t(Ft),e(zt,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(l,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:xt}),t(Bt,!0),o?await n():null==l?await a():await i(l)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Bt),e(zt)})),setTransformWidgetOrientation:o,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Ft),e(zt)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ht))),invalidateTransforms:l,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(Wt,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Ut,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Ut))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Vt),n=await e.getPromise(Rt),a=undefined;if(await e.getPromise(Ut)){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(w.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Ut),null!=t?(await i(null==t?void 0:t.position),o(C.eulerTo(C.up(),t.normal))):(e(Ht),o(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Tt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(Ht,void 0),e(Bt,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Tt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(Ht,void 0),e(Bt,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Ke).then((e=>e.value)),a=await e.getPromise(dt);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(Ke).then((e=>e.value));await n.orientToHitResult(t)}))),l=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Ke).then((e=>e.value));e(at,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Ge,await e.tryGetPromise(Ke).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:s},...r)=>{const c=await t.getPromise(yt),d=await t.getPromise(Oe),u=2!==(null==s?void 0:s.buttons)&&!(null==s?void 0:s.altKey);s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(Ke).then((e=>e.value));n(We,p),n(Fe,s),await a(),m&&(r.forEach((e=>e())),await i()),await l(),await e.sectionCurrentHit(),await o()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Fe),t(Ue,a.detail),await e.tryGetPromise(Ke),await l(),await o()})))}},Yt=o({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined,l=undefined;return{tapDetails:e(Fe),longPressDetails:e(Ue),previousHitResult:e(We),currentHitResult:e(Ge)}}});var Xt=Object.freeze({__proto__:null,currentHitResult:Ge,hitResult:Ke,hitResultsLongPressDetails:Ue,hitResultsSkipNextTap:$e,hitResultsTapDetails:Fe,hitState:Yt,previousHitResult:We,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Et)).forEach((e=>t(Pt(e))))})),a=useActionCallback((({snapshot:e,reset:n,set:a})=>async(i,l)=>{var o,s;const r=await e.getPromise(Pt(i.id)),c=await e.getPromise(Et),u=null===(s=[...null!==(o=i.ancestors)&&void 0!==o?o:[]])||void 0===s?void 0:s.reverse().find((e=>!c.includes(e)));null!=r&&null!=u?(a(Pt(u),{id:u}),a(Et,(e=>[...e,u])),t.execute(Tt.SELECTING_ANCESTOR,t.selectItemsTransform(u))):(null==l?void 0:l.clear)?(a(Pt(i.id),i),a(Et,[i.id]),t.execute(Tt.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(i.id))):(a(Pt(i.id),i),a(Et,(e=>[...e,i.id])),t.execute(Tt.SELECTING_ITEMS,t.selectItemsTransform(i.id))),d(i),a(Nt,i),a(Ot,!0),n(Mt)})),i=useActionCallback((({reset:e,set:n})=>async a=>{e(Pt(a)),e(Mt),n(Et,(e=>e.filter((e=>e!==a)))),t.execute(Tt.DESELECTING_ITEMS,t.deselectItemsTransform(a))})),l=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Pt(t.id));null!=n?await i(n.id):await a(t)})),o=useActionCallback((({snapshot:t,reset:n,set:i})=>async(l,o={})=>{const s=await t.getPromise(Pt(l.id)),r=await t.getPromise(Et);if(r.filter((e=>{var t;return e!==l.id&&!(null===(t=l.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>n(Pt(e)))),n(Mt),s)if(o.ignoreAncestorSelection)n(Et),n(Pt(s.id));else{const e=r.filter((e=>{var t;return e===l.id||(null===(t=l.ancestors)||void 0===t?void 0:t.includes(e))}));i(Et,e)}else n(Et);e.clearTransformWidgetOrientation(),await a(l,{clear:!0})})),s=useActionCallback((({reset:t})=>async()=>{await n(),t(Et),t(Nt),t(Ot),t(Mt),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),r=useActionCallback((()=>async()=>{await s(),t.execute(Tt.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(Mt,t)})),d=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:a,toggleSelection:l,clearAndSelect:o,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Ke).then((e=>e.value)),n=await e.getPromise(Fe),a=(null==n?void 0:n.metaKey)||(null==n?void 0:n.ctrlKey)||(null==n?void 0:n.shiftKey);null==t||a?null!=t&&a?await l(t):await r():await o(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(a,i)=>{i.selected?(await n(),e(Pt(a.id),a),i.multiSelect?e(Et,(e=>[...e.filter((e=>e!==a.id)),a.id])):e(Et,[a.id]),d(a),e(Nt,a),e(Ot,!1),e(Mt,!!i.multiSelect)):(t(Pt(a.id)),t(Mt),e(Et,(e=>e.filter((e=>e!==a.id)))))})),deselect:i,clearSelection:r,resetSelectionState:s,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:d}}const qt=o({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined;return{selectedItemIds:e(Et),lastSelected:e(Nt),highestSelectedAncestorId:e(It)}}});var Zt=Object.freeze({__proto__:null,selectionBoundingBoxCenter:_t,selectionHighestSelectedAncestor:It,selectionIsActive:Dt,selectionLastSelectWasMultiSelect:Mt,selectionLastSelected:Nt,selectionLastSelectionFromViewer:Ot,selectionPreviousVisibleSummary:Vt,selectionSelectedItemIds:Et,selectionSelectedItems:Pt,selectionState:qt,selectionVisibleCount:Lt,selectionVisibleSummary:Rt,useSelectionActions:useSelectionActions});const Jt=255,Qt=l({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),en=l({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),tn=d({key:"appliedItemMaterialOverride",default:void 0}),nn=l({key:"appliedItemMaterialOverrideIds",default:[]}),an=o({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Nt);if(null!=t)return e(tn(t.id))}}),ln=l({key:"applyMaterialToAllUserAction",default:void 0}),on=l({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),sn=l({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(nn);t(Qt),n.forEach((e=>t(tn(e)))),t(nn)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(Qt,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(Qt)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(en)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(Et);a(Qt),i.forEach((e=>a(tn(e)))),n(nn,(e=>e.filter((e=>!i.includes(e))))),await e.execute(Tt.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(Tt.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(en,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(Qt),i=await t.getPromise(en),l=await t.getPromise(Et),o=await t.getPromise(an),s=null!=a?a:o,r=null!=i?i:null==o?void 0:o.opacity;if(null!=s){const t=Object.assign(Object.assign({},s),{opacity:null!=r?r:s.opacity});await e.execute(Tt.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),l.forEach((e=>n(tn(e),t))),n(nn,(e=>[...e,...l]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(sn,!0),e(ln,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(sn),e(ln)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(Qt),i=await t.getPromise(en);if(null!=a){const l=await t.getPromise(nn),o=Object.assign(Object.assign({},a),{opacity:null!=i?i:a.opacity});await e.execute(Tt.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),l.forEach((e=>n(tn(e))));const s=await t.getPromise(ln);null==s||s(o),n(sn),n(ln)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(on,!1)}))}},rn="#FFFFFF",cn=l({key:"viewerBackgroundSelectedColor",default:rn}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const n=useSceneItemMaterialActions(),a=u(an),i=s(Qt),l=s(on),o=g.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(P,{content:"Apply to All",children:e(E,{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=s(sn),[l,o]=f.useState(!1),onCloseDialog=()=>{a.cancelApplyAll(),o(!1)};return i?t(N,{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(O,{"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(M,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e(M,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await a.applyAll(),l&&a.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e(n,{})}function createColorMaterialWithId(e,t=p.create()){return Object.assign({id:t},K.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=u(an),i=s(Qt),l=g.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=l?h.toHexString(l.diffuse):void 0,onValueChanged:()=>{n.apply(),null==t||t(l)},onInput:async e=>{n.updateColor(createColorMaterialWithId(e)),await n.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=s(en),i=u(an),l=g.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:Jt:null!=a?a:Jt}),[a,i]),o=useDebouncedCallback((()=>{n.apply()}),500),r=g.useCallback((e=>{n.updateOpacity(e.detail.value),o(e.detail.value)}),[o,n]),c=g.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e(P,{className:"flex w-full",content:c?"Select a part and apply a color to enable opacity":`${Math.floor(l/Jt*100)}%`,placement:"top",children:e(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:c,value:null!=l?l:Jt,step:5,min:0,max:Jt,onValueChange:e=>{n.updateOpacity(e.detail.value),n.apply(),null==t||t(e.detail.value)},onValueInput:r})})};function VertexMaterialControls({onApplyMaterial:a,onApplyMaterialToAll:i,onApplyOpacity:l}){const o=useSceneItemMaterialActions(),r=s(Nt);return f.useEffect((()=>{o.clearCurrentColor(),o.clearCurrentOpacity()}),[null==r?void 0:r.id]),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:a}),e(VertexSceneItemMaterialApplyAll,{onApplyAll:i})]})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSceneItemMaterialOpacitySlider,{onApply:l}),e(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:n,tooltip:a,children:i})=>{const[l,o]=f.useState(!1);return e("div",{className:"ml-auto",children:t(I,{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(P,{content:a,disabled:l,placement:"bottom",children:t(M,{className:G("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(V,{className:"px-0.5",name:"reset",size:"sm"}),e(V,{name:"chevron-down",size:"sm"})]})})}),e("div",{className:"whitespace-nowrap",children:i})]})})},VertexSceneItemMaterialClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemMaterialActions(),l=s(Dt);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e("div",{className:"pt-1"}),e(R,{"data-testid":"clear-selected-materials",onClick:()=>{i.clear(),null==n||n()},disabled:!l,children:"Clear selected materials"}),e(R,{"data-testid":"clear-all-materials",onClick:()=>{i.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({onClearMaterial:n,onClearAllMaterials:a,onApplyMaterial:i,onApplyMaterialToAll:l,onApplyOpacity:o}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Material",e(VertexSceneItemMaterialClear,{onClear:n,onClearAll:a})]}),children:e(VertexMaterialControls,{onApplyMaterial:i,onApplyMaterialToAll:l,onApplyOpacity:o})})}const dn="#ffff00",un=35,mn=1,pn=l({key:"selectionHighlightingSelectedColor",default:dn}),hn=l({key:"selectionHighlightingSelectedOpacity",default:un}),gn=l({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[n,a]=r(pn);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]=r(gn);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]=r(hn);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]=r(pn),[i,l]=r(hn),[o,s]=r(gn),c=undefined;return e("div",{className:"ml-auto",children:e(P,{content:"Reset Selection Highlighting",children:e(E,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(dn),l(un),s(1),null==t||t()},disabled:!(n!==dn||i!==un||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]=r(cn);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]=r(cn),i=undefined;return e("div",{className:"ml-auto",children:e(P,{content:"Reset Background Color",children:e(E,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(rn),null==t||t()},disabled:!(n!==rn)})})})};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,s=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||i||l||o||s},useRecoilReducer=({reducer:e,atom:t})=>{const n=undefined,a=undefined;return[s(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const n=undefined;return i((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[])},fn=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 s=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:fn});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();f.useEffect((()=>{const a=p.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();f.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=f.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]);f.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]),f.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]),f.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=s(ot);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>n,cancelPredicate:()=>!n},[n]),e(P,{content:"Box Selection",children:e(E,{iconName:"box-cursor",iconColor:n?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:n?t.disable:t.enable})})},vn=1,VertexResizableContent=n=>{var{className:a,style:i,displayShadow:l,heading:o,id:s,initialScale:r,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 g=null!=r?r:1;return e(L,Object.assign({id:s,"data-testid":`resizable-content-position-${c}`,className:G(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?r:void 0,initialVerticalScale:h?g: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:G("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.getPromiseRequired(fe),n={milliseconds:500},a=await t();await(null==a?void 0:a.camera().viewAll().render({animation:n}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[i,l]=g.useState(),[o,s]=g.useState();g.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=i&&clearTimeout(i),s(k.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&&k.distance(o,k.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])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:n,disableBackdrop:a,openPredicate:i,onOpen:l,onClose:o,children:r})=>{const c=useContextMenuActions(),d=s(et),u=s(lt),m=f.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=f.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()}),f.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]),f.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:G({hidden:!p}),children:e(_,{"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:r})})})},VertexFitSelectedMenuItem=()=>{const n=s(Et),a=s(Rt),i=useViewerCameraActions();return t(R,{"data-testid":"fit-selected-menu-option",onClick:()=>{null!=(null==a?void 0:a.boundingBox)&&i.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===n.length),children:[e(V,{slot:"icon",name:"fit-selected",size:"sm"}),e("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const n=useViewerCameraActions(),a=s(at);return t(R,{"data-testid":"fly-to-part-menu-option",onClick:()=>{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&&n.flyToById(i)},disabled:asBooleanAttribute(null==a),children:[e(V,{slot:"icon",name:"paper-airplane",size:"sm"}),e("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=s(ue),t=undefined,n=undefined,a=undefined,i=undefined,l=undefined,o=undefined;return{sceneItemsOperation:f.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:f.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:f.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:f.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:f.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:f.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 t(R,{"data-testid":"hide-all-menu-option",onClick:()=>{n.sceneItemsOperation((e=>e.hide()))},children:[e(V,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const n=s(at),a=useSceneItemsOperations();return t(R,{"data-testid":"hide-menu-option",onClick:()=>{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&&a.sceneItemsOperation((e=>e.hide()),[i])},disabled:asBooleanAttribute(null==n),children:[e(V,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const n=s(Et),a=useSceneItemsOperations();return t(R,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(V,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const n=useSceneItemsOperations();return t(R,{"data-testid":"show-all-menu-option",onClick:()=>{n.sceneItemsOperation((e=>e.show()))},children:[e(V,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const n=s(at),a=useSceneItemsOperations();return t(R,{"data-testid":"show-only-menu-option",onClick:()=>{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&&a.showOnlyItem(i)},disabled:asBooleanAttribute(null==n),children:[e(V,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const n=s(Et),a=useSceneItemsOperations();return t(R,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===n.length),children:[e(V,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show Only Selected"})]})};l({key:"sceneTreeLoaderVisible",default:!1});const yn=l({key:"sceneTreeElement",default:void 0}),bn=l({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0});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(Nt);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(yn),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)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(yn),i=await(null==a?void 0:a.getRowAtClientY(n));e(at,i)}))}}const VertexGhostSelectedMenuItem=()=>{const n=s(Et),a=useSceneItemsOperations();return t(R,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(V,{slot:"icon",name:"visibility-partial",size:"sm"}),e("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const n=s(Et),a=useSceneItemsOperations();return t(R,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(V,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Unghost Selected"})]})},DefaultSceneTreeContextMenu=()=>t("div",{className:"w-56",children:[e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e(D,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const n=useSceneTreeActions(),a=s(yn),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=()=>t("div",{className:"w-56",children:[e(VertexHidePartMenuItem,{}),e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e(D,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=f.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,{})})},Cn=undefined,wn=l({key:"sceneItemGhostingSelectedOpacity",default:35}),Sn=d({key:"appliedItemPhantomState",default:void 0}),xn=l({key:"appliedItemPhantomStateIds",default:[]}),kn=o({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Nt);return null!=n&&(null!==(t=e(Sn(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[n,a]=r(wn);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(xn)).forEach((e=>t(Sn(e)))),t(xn)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const i=await t.getPromise(Et);i.forEach((e=>n(Sn(e),a))),n(xn,(e=>[...e,...i])),await e.execute(Tt.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(Et);i.forEach((e=>a(Sn(e)))),n(xn,(e=>e.filter((e=>!i.includes(e))))),await e.execute(Tt.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(Tt.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}},VertexSceneItemGhostingToggle=({onApply:t})=>{const n=useSceneItemPhantomActions(),a=s(Dt),i=u(kn);return e(P,{content:"Select a part to display as ghost",disabled:a,children:e(O,{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=s(kn);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e("div",{className:"pt-1"}),e(R,{"data-testid":"reset-selected-phantom",onClick:async()=>{await i.clearPhantomState(),null==n||n()},disabled:!l,children:"Clear ghosting for selected"}),e(R,{"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=s(nt);return e(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:t(R,{"data-testid":"measurement-delete",onClick:()=>null!=a&&n(a.id),children:[e(V,{slot:"icon",name:"delete",size:"sm"}),e("div",{className:"pl-2",children:"Delete"})]})})}const An=l({key:"lengthUnit",default:"cm"}),Tn=l({key:"decimalPlace",default:"2"});var Pn,En;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Pn||(Pn={})),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"}(En||(En={}));const convertFrom=(e,t)=>{const n=undefined;return e/En[t]},convertTo=(e,t)=>{const n=undefined;return e*En[t]},formatWithUnit=(e,t,n)=>`${e.toFixed(n)} ${t}`,formatDistance=(e,t,n)=>formatWithUnit(convertTo(e,t),t,n),createDistanceFormatter=(e,t)=>n=>formatDistance(n,e,t);function toUnitType(e){switch(e){case"cm":return"centimeters";case"m":return"meters";case"in":return"inches";case"ft":return"feet";default:return"millimeters"}}function useDockedPlacement(e,t){const[n,a]=g.useState(k.create(0,0));return g.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),i=k.create(n.left,n.bottom),l=k.create(n.right,n.bottom);a("left"===t?i:l)}}),[e,t]),n}function VertexMeasurementDetails({placement:n}){const a=useMeasurementActions(),i=s(ue),l=s(me),o=useDockedPlacement(null!=i?i:null,n),r=s(bt),c=s(Ct),d=s(wt),u=s(St),m=s(An),p=s(Tn);return e(B,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${l}`,position:o,children:t("div",{className:"flex flex-col leading-4 min-w-40",children:[t("div",{className:"pb-2 flex justify-between",children:[e("div",{className:"w-full",children:"Measurement"}),e("div",{className:G("-mt-1 relative",{hidden:!u}),children:e(P,{content:"Reset",placement:"left-start",children:e(E,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:a.resetMeasurement})})})]}),e($,{"data-testid":"measurement-details-viewer-measurement-details",className:G("gap-y-1.5 text-xs",{hidden:null==r}),measurementOutcome:r,measurementOverlays:c,distanceUnits:toUnitType(m),fractionalDigits:parseInt(p,10)}),e("div",{"data-testid":"measurement-details-message",className:G("text-xs",{hidden:null==d}),children:d})]})})}function useCallbackRef(e){var t;const[n,a]=f.useState((t=void 0,null)),i=undefined;return{element:n,callback:f.useCallback((e=>a(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:a,onPointToPointMeasurementChange:i}){const l=useMeasurementActions(),o=s(ue),r=s(rt),c=s(dt),d=s(An),u=s(Tn),{callback:m,element:p}=useCallbackRef();usePointToPointMeasurement(p);const h=b((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};l.setEditedPointToPointMeasurement(t),null==i||i(t)}),[l]);return r?t(n,{children:[e(Y,{"data-testid":"point-to-point-measurement",ref:m,viewer:null!=o?o:void 0,mode:"replace",start:null==c?void 0:c.start,end:null==c?void 0:c.end,invalid:null==c?void 0:c.invalid,units:toUnitType(d),fractionalDigits:parseInt(u,10),showAxisReferenceLines:!0,onEditEnd:h}),e(VertexMeasurementDetails,{placement:a}),e(VertexMeasurementContextMenu,{onDelete:l.resetMeasurement})]}):e(n,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),n=s(rt);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>n,cancelPredicate:()=>!n},[n,t]),e(P,{content:"Point to Point Measurement",children:e(E,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Nn=l({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:a,onEntitiesChanged:i,onOutcomeChanged:l})=>{var o,r,c,d;const u=s(ue),m=s(Nn),p=s(mt),{callback:h,element:g}=useCallbackRef();return usePreciseMeasurementModel(g,i,l),p?t(n,{children:[e(X,{"data-testid":"precise-measurement-viewer-tool",ref:h,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(o=null==m?void 0:m.network)||void 0===o?void 0:o.apiHost,renderingHost:null===(r=null==m?void 0:m.network)||void 0===r?void 0:r.renderingHost,sceneTreeHost:null===(c=null==m?void 0:m.network)||void 0===c?void 0:c.sceneTreeHost,sceneViewHost:null===(d=null==m?void 0:m.network)||void 0===d?void 0:d.sceneViewHost}})}),e(VertexMeasurementDetails,{placement:a})]}):e(n,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),n=s(mt);return e(P,{content:"Precise Measurement",children:e(E,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const a=s(At),i=s(kt);return t(n,{children:[null!=a&&e(H,{className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id),null!=i&&e(j,{placement:"bottom-left",className:"z-[16000]",duration:i.duration,open:!0,content:i.message,type:i.type},i.id)]})}const On={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 Mn=o({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(bn);return null!=t?await t.fetchMetadataKeys():[]}}),In=o({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Mn).filter((e=>e!==On.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),Vn=l({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),Rn=o({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(Vn),n=e(yn),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({},On),{initialWidth:e,minWidth:n})})}return{Name:On}}}),Ln=o({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Rn))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e,snapshot:t})=>async n=>{e(Vn,n);const a=await t.getPromise(bn);null==a||a.setMetadataKeys(n)}))}}const _n=16,Dn=-8;var Bn;function useOpenColumnPopover({buttonElement:e,horizontalOffset:t,verticalOffset:n}){const[a,i]=g.useState(!1),[l,o]=g.useState(),[s,r]=g.useState(),c=g.useCallback((()=>{if(a)i(!1);else{const a=null==e?void 0:e.getBoundingClientRect();if(null!=a){const e=null!=t?t:_n,l=null!=n?n:Dn,s=a.x>window.innerWidth/2?Bn.LEFT:Bn.RIGHT;o({x:s===Bn.LEFT?a.left-e:a.right+e,y:a.top+l}),r(s),i(!0)}}}),[a,e]),d=g.useCallback((()=>{i(!1)}),[]);return{open:a,position:l,direction:s,handleOpen:c,handleClose:d}}!function(e){e.LEFT="left",e.RIGHT="right"}(Bn||(Bn={}));const Hn=l({key:"sceneTreeSearchActive",default:!1}),zn=l({key:"sceneTreeSearchValue",default:void 0}),jn=l({key:"sceneTreeSearchExactMatch",default:!1}),Fn=l({key:"sceneTreeSearchResultCount",default:0}),Un=l({key:"sceneTreeSearchActiveColumns",default:[]}),Wn=o({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(Un);return 0===t.length||t.includes(On.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=c(Fn);f.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var a;n=null===(a=null==e?void 0:e.controller)||void 0===a?void 0:a.stateChanged((e=>{void 0!==(null==e?void 0:e.totalFilteredRows)&&t(null==e?void 0:e.totalFilteredRows)}))})),()=>{null==n||n.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(Un,t)})),t=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(yn),a=await e.getPromise(jn),i=await e.getPromise(Un),l=a?[On.metadataKeyName]:[],o=i.length>0?i:l;null==n||n.filterItems(t,{columns:o,exactMatch:a})})),n=useActionCallback((({snapshot:t})=>async(n,a)=>{const i=await t.getPromise(Un);if(a)e(0===i.length?[On.metadataKeyName,n]:[...i,n]);else{const t=i.filter((e=>e!==n));e(t.every((e=>e===On.metadataKeyName))?[]:t)}})),a=useActionCallback((({set:e})=>t=>{e(jn,t)}));return{setMetadataSearchKeys:e,updateSearchForActiveColumns:t,updateMetadataSearchAfterSearchKeysChange:n,setMetadataSearchExactMatch:a}},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(O,{"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})]})},VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:a})=>{const i=useSceneTreeColumnActions(),l=useSceneTreeSearchActions(),o=s(zn),r=u(In),c=s(Vn),d=s(Un),[m,p]=g.useState(c),[h,f]=g.useState(""),{element:v,callback:b}=useCallbackRef(),{open:C,position:w,direction:S,handleOpen:k,handleClose:A}=useOpenColumnPopover({buttonElement:v}),T=S===Bn.LEFT?"left-end":"right-start",N=g.useMemo((()=>{if("hasValue"===r.state){const e=r.contents.filter((e=>m.indexOf(e)<0)),t=undefined;return[...[...m].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[m,r.state,r.contents]),O=g.useMemo((()=>N),[C]);return t(n,{children:[e(P,{content:"Configure Columns",placement:"top",children:e(E,{"data-testid":"scene-tree-column-popover-button",ref:b,iconName:"columns-add",iconSize:"sm",onClick:()=>{k()}})}),C&&e(F,{"data-testid":"scene-tree-column-popover",open:C,backdrop:!1,position:w,resizeBehavior:"fixed",placement:T,className:"z-popover",children:t("div",{className:G("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!C}),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(E,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{f(""),A()}})]}),e(U,{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&&f(t.toLowerCase())}}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:On.label}),"hasValue"===r.state&&O.filter((e=>""===h||e.toLowerCase().includes(h))).map((t=>e(VertexSceneTreeMetadataCheck,{checked:m.includes(t),disabled:m.length>=6&&!m.includes(t),onChange:e=>{p(e?[...m,t]:m.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:()=>p([]),children:"Clear selection"}),e("div",{className:"flex-grow"}),t("div",{className:"flex space-x-2",children:[e(M,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{f(""),A()},children:"Cancel"}),e(M,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await i.setActive(m),null==a||a(m),f(""),A();const e=[On.metadataKeyName,...m],t=d.filter((t=>!e.includes(t)));t.length>0&&(await Promise.all(t.map((e=>l.updateMetadataSearchAfterSearchKeysChange(e,!1)))),null!=o&&await l.updateSearchForActiveColumns(o))},children:"Apply"})]})]})]})})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:a,onSearchForExactMatchChange:i})=>{const l=useSceneTreeSearchActions(),o=s(Wn),r=s(Un),c=s(zn),d=s(jn),u=s(Vn),{element:m,callback:p}=useCallbackRef(),{open:h,position:g,direction:f,handleOpen:v,handleClose:b}=useOpenColumnPopover({buttonElement:m,horizontalOffset:40}),C=f===Bn.LEFT?"left-end":"right-start";return t(n,{children:[e(P,{content:"Search Options",placement:"top",children:e(E,{"data-testid":"scene-tree-search-options-popover-button",ref:p,iconName:"gear",iconSize:"sm",onClick:()=>{v()}})}),e(F,{"data-testid":"scene-tree-search-options-popover",open:h,backdrop:!1,position:g,resizeBehavior:"fixed",placement:C,className:"z-popover",children:t("div",{className:G("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!h}),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(E,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{b()}})]}),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:o,disabled:0===r.length||r.every((e=>e===On.metadataKeyName)),onChange:async e=>{await l.updateMetadataSearchAfterSearchKeysChange(On.metadataKeyName,e),null==a||a(),null!=c&&await l.updateSearchForActiveColumns(c)},children:On.label},On.metadataKeyName),u.map((t=>e(VertexSceneTreeMetadataCheck,{checked:r.includes(t),disabled:r.length>0&&r.every((e=>e===t)),onChange:async e=>{await l.updateMetadataSearchAfterSearchKeysChange(t,e),null==a||a(),null!=c&&await l.updateSearchForActiveColumns(c)},children:t},t)))]}),t("div",{className:"flex p-3 border-t border-neutral-300",children:[e(O,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:d,onValueChanged:async e=>{l.setMetadataSearchExactMatch(e.detail),null==i||i(),null!=c&&await l.updateSearchForActiveColumns(c)}}),e("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:n,onClearSearch:a,onExitSearchMode:i,onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o,children:c})=>{const d=s(yn),[u,m]=r(Hn),[p,h]=r(zn);useSceneTreeSearch({sceneTreeElement:null!=d?d:null});const{element:f,callback:v}=useCallbackRef(),b=null==p||""===p,C=b?"Exit Search":"Clear Search";return g.useEffect((()=>{u&&(null==f||f.setFocus())}),[f,u]),t("div",{className:"flex w-full py-3 px-2",children:[e(q,{"data-testid":"scene-tree-search-bar",ref:v,controller:null==d?void 0:d.controller,onBlur:()=>{b&&(m(!1),null==i||i())},onSearch:()=>{h(null==f?void 0:f.value),null==n||n(null==f?void 0:f.value)},children:c}),e("div",{className:"self-center px-1",onPointerDown:e=>{e.preventDefault()},children:e(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o})}),e(P,{className:"self-center pr-1",content:C,children:e(E,{"data-testid":"scene-tree-search-close-button",iconName:"close-circle-fill",iconSize:"sm",variant:"plain",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{b?(m(!1),null==i||i()):(await(null==f?void 0:f.clear()),await(null==f?void 0:f.setFocus()),h(void 0),null==a||a())}})})]})};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=s(yn),l=s(zn),o=s(Fn),r=undefined,c=undefined,d=`${o>=1e3?`${o}+`:`${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:`${d}`}),e(P,{className:"w-auto",content:"Select Results",placement:"top",children:e(M,{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(V,{size:"sm",name:"check-circle"}),e("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=undefined;return i((({set:t})=>n=>{t(e,n)}),[])}var Gn;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===Gn.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Gn||(Gn={}));const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const n=c(Hn);return e(P,{className:"flex ml-auto",content:"Scene Tree Search",children:e(E,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{n(!0),null==t||t()}})})},VertexSceneTreeSearch=({onEnterSearchMode:n,onExitSearchMode:a,onSearch:i,onClearSearch:l,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:r,children:c})=>{const d=s(Hn);return t(Z,{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:r,children:c}),!d&&e("div",{className:"ml-auto mr-2",children:e(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:n})})]})},VertexSceneTreeCollapseAll=()=>{const t=s(yn);return e(P,{className:"w-auto",content:"Collapse All",placement:"top",children:e(V,{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=s(yn);return e(P,{className:"w-auto",content:"Expand All",placement:"top",children:e(V,{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=s(zn),i=null==a||""===a;return e(Z,{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:s,children:r})=>{const c=undefined;return e("div",{slot:"header",className:"flex flex-col",children:null!=r&&!1!==r?r:t(n,{children:[e(VertexSceneTreeSearch,{onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,children:e("div",{slot:"clear-icon"})}),e(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:s})]})})},VertexSceneTreeTableLayout=n=>{const a=s(Rn),i=s(Ln),l=[];return e(J,Object.assign({"data-testid":"scene-tree-table-layout"},n,{children:i.map(((n,o)=>{var s;const r=a[n],c=null!==(s=l[o])&&void 0!==s?s:r.initialWidth;return t(Q,{"data-testid":`scene-tree-table-column-${o}`,initialWidth:c,minWidth:r.minWidth,children:[e("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${G("truncate",{"pl-2":0===o,"pr-2":o===i.length-1})}">\n ${r.label}\n </div>\n </div>\n `}}),e("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${r.binding}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${0===o?"expand-toggle":""}\n ${o===i.length-1?"isolate-button visibility-toggle":""}>\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=r.binding?r.binding:"--"}" \n placement="${o!==i.length-1?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${r.binding}</div>\n </div>\n </vertex-tooltip>\n </div>\n \n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},r.label)}))}))},VertexSceneTree=a=>{var{id:i,font:l,backgroundColors:o,children:r,style:d,onPointerDown:u,onClick:m,onToggleSelection:p,onToggleExpansion:h,onToggleVisibility:g,className:v,rowData:b}=a,C=__rest(a,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const w=useSceneTreeActions(),S=useSelectionActions(),k=s(Nn),A=s(ue),T=s(Un),P=s(jn),E=s(zn),N=null==E||""===E,O=useRecoilRef({state:yn}),M=null!=r&&!1!==r,wrappedExpansionHandler=(e,t,n)=>{w.toggleExpansion(e,t,n),null==h||h(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{w.toggleSelection(e,t,n),null==p||p(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{w.toggleVisibility(e,t,n),null==g||g(e,t,n)},handleClick=e=>{e.altKey&&w.flyToRow(e.clientY),null==m||m(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&S.clearSelection(),null==u||u(e)},I=c(bn),handleFirstRowRendered=e=>{var t;I(e.target.controller),null===(t=null==C?void 0:C.onFirstRowRendered)||void 0===t||t.call(C,e)},V=f.useMemo((()=>({metadataSearchKeys:T,exactMatch:P})),[T,P]);return e("div",{className:G("flex flex-col w-full h-full",v),children:e("div",{className:"flex group h-full",children:e(ee,Object.assign({id:null!=i?i:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:k,ref:O,className:G("flex-1",{filtered:!N}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(l)),styleFromOptionalBackgroundColors(o)),d),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:A,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==b?void 0:b(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)},searchOptions:V},C,{onFirstRowRendered:handleFirstRowRendered,children:M?r:t(n,{children:[e(VertexSceneTreeHeader,{}),e(VertexSceneTreeTableLayout,{}),e(VertexSceneTreeContextMenu,{})]})}))})})},VertexDecimalPlaceSelector=({onApply:n})=>{const[a,i]=r(Tn);return t(W,{"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]=r(An);return t(W,{"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})})}const Kn=l({key:"openedPanelActivePrimaryLeft",default:void 0}),$n=l({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Kn:$n,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Kn:$n,void 0)}))}}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,{})]})}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=s(Dt);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e("div",{className:"pt-1"}),e(R,{"data-testid":"reset-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==n||n()},disabled:!l,children:"Clear selected transforms"}),e(R,{"data-testid":"reset-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const n=useTransformActions(),a=s(Bt),i=c($t);return e(O,{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}){return e(n,{children:t("div",{className:"flex items-center py-3",children:[e(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:a}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Enable manipulator"})]})})}function VertexTransformPanelSection({onClearTransforms:n,onClearAllTransforms:a,onToggleTransformsManipulator:i}){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})})}function DefaultTransformsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexTransformPanelSection,{})})}const Yn="Appearance",Xn="Settings",qn="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,n=getHeading(s($n));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:e("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:n})})};function getHeading(e){switch(e){case"appearance":return Yn;case"settings":return Xn;case"transforms":return qn;default:return"None"}}function VertexViewerRightOpenedPanel(){const a=s($n),i=f.useMemo((()=>["appearance","settings","transforms"]),[]);return e(n,{children:null!=a&&i.includes(a)&&t(VertexResizableContent,{displayShadow:!0,heading:e(ViewerRightPanelHeader,{}),placement:"right",children:["appearance"===a&&e(DefaultAppearancePanel,{}),"transforms"===a&&e(DefaultTransformsPanel,{}),"settings"===a&&e(DefaultSettingsPanel,{})]})})}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:s,tooltipPlacement:r,children:c,onSelect:d,onDeselect:u}){return e("div",{className:G({"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(P,{placement:null!=r?r:void 0,content:f.isValidElement(s)?void 0:s,children:[e("div",{slot:"content",children:s}),t("div",{className:"flex flex-col",children:[e(V,{name:a}),c]})]})})}function VertexViewerRightSidebar(){const n=usePanelActions(),a=s($n);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:[e(SidebarIcon,{name:"appearance",active:a,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{n.openPrimary("appearance","right")},onDeselect:()=>n.closePrimary("right")}),e(SidebarIcon,{name:"transforms",active:a,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:()=>{n.openPrimary("transforms","right")},onDeselect:()=>n.closePrimary("right")}),e(SidebarIcon,{name:"settings",active:a,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{n.openPrimary("settings","right")},onDeselect:()=>n.closePrimary("right")})]})})}const VertexPopupButton=a=>{var{open:i,children:l}=a,o=__rest(a,["open","children"]);const s=l.find((e=>e.type===Anchor)),r=l.filter((e=>e.type!==Anchor));return null==s?e(n,{}):t(F,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(i)},o,{children:[s,e("div",{className:G("flex mb-1.5",{hidden:!i}),"data-testid":"align-plane-popover-menu",children:r})]}))},Anchor=({tooltipContent:t,children:n})=>e("div",{slot:"anchor",children:e(P,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu(){const n=useCrossSectioningActions(),a=s(He),i=s(Oe),getBaseIcon=()=>`align-to-${null==i?void 0:i.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:n.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==i?void 0:i.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==i?void 0:i.hitPending)},[null==i?void 0:i.hitPending]),t(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:n.closeAlignmentTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e(E,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:a?n.closeAlignmentTools:n.openAlignmentTools,children:e(V,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),t(te,{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(E,{iconColor:"secondary",onClick:()=>n.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(E,{iconColor:"secondary",onClick:()=>n.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(){const n=useCrossSectioningActions(),a=s(ze),i=s(Ne),l=u(Re),o=f.useMemo((()=>{const e=i.length>0&&"hasValue"===l.state?axis(i[0],xAxis(l.contents),yAxis(l.contents),zAxis(l.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[l.state,l.contents,i]);return t(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:n.closeAxisTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e(E,{onClick:a?n.closeAxisTools:n.openAxisTools,iconName:o,"data-testid":"align-plane-icon",iconColor:"secondary",children:e(V,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),t(te,{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(E,{"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:()=>n.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e(E,{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:()=>n.updateAxis("y"),children:e("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e(E,{"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:()=>n.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,onOffsetChange:a}){const i=s(An),l=s(Tn),[o,r]=f.useState(convertTo(n,i));f.useEffect((()=>{r(convertTo(n,i))}),[i,n]);const c=createDistanceFormatter(i,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(o+e,i);a(t)},d=undefined,handleBlur=()=>{a(convertFrom(o,i))};return e(P,{content:"Plane Offset",children:e("form",{"data-testid":"cross-section-stepper-form",onSubmit:e=>{e.preventDefault(),a(convertFrom(o,i))},children:t(U,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:c(parseFloat(n.toFixed(3))),onInputInput:e=>{r(null!=e.detail.value?parseFloat(e.detail.value):n)},onBlur:handleBlur,children:[e("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>handleIncrementalUpdate(-1),children:e(V,{name:"chevron-left",size:"sm"})}),e("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>handleIncrementalUpdate(1),children:e(V,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Zn=400;function VertexViewerCrossSectionPopupMenu(){const n=useCrossSectioningActions(),a=s(Be),i=u(_e),l=u(De),o=f.useRef(),r=f.useMemo((()=>"hasValue"===i.state?i.contents:Ae),[i.state,i.contents]),c=f.useMemo((()=>"hasValue"===l.state?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(o.current),o.current=window.setTimeout((()=>{n.endInteraction()}),Zn),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(V,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?n.closeAdditionalTools:n.openAdditionalTools})})}),t(te,{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,{}),e(P,{className:"w-auto",content:"Reverse",children:e(E,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:n.flipPlanes,iconColor:"secondary"})}),e(P,{className:"w-auto",content:"Align View to Plane",children:e(E,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:n.alignViewToPlane,iconColor:"secondary"})}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionAxisPopoverMenu,{}),e("div",{className:"w-52 mx-2",children:e(VertexSlider,{value:c,defaultValue:r.default,disabled:asBooleanAttribute("hasValue"!==i.state),min:r.min,max:r.max,step:.01,onChange:handleCrossSectionValueChange})}),e("div",{className:"px-4",children:e(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state?l.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const a=useCrossSectioningActions(),i=s(Te);return t(n,{children:[e(P,{content:i?"Hide Section":"Show Section",children:e(E,{"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=s(ue);return e(P,{content:"Fit All",children:e(E,{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=s(ue),n=s(pe),[a,i]=r(ge),[l,o]=r(he);return f.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(P,{content:"Pan",children:e(E,{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=s(ue),n=s(pe),[a,i]=r(ge),[l,o]=r(he);return f.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(P,{content:"Rotate",children:e(E,{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=s(ue),n=s(pe),[a,i]=r(ge),[l,o]=r(he);return f.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(P,{content:"Zoom",children:e(E,{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(ne,{placement:"bottom-center",children:t(te,{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=({children:t})=>{const n=undefined;return e(ne,{placement:"bottom-center",children:null!=t&&!1!==t?e(te,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:i,onRotationChange:l}){const o=useTransformActions(),r=s(Ut),c=s(Bt),d=s(Ht),m=s(Ft),p=u(jt),h=s(An),g=s(Tn),v=f.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),b=f.useMemo((()=>{const e=undefined;return c&&(null!=v||r)}),[c,v,r]);return e(n,{children:b&&e(ae,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?v:void 0,decimalPlaces:parseInt(g,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:null==a||a,onInteractionStarted:()=>{o.disableSelectionSync(),o.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{o.invalidateTransforms(),o.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await o.setTransformWidgetPosition(e.detail),null==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(P,{content:"Reset View",children:e(E,{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(),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(Rt);t(ve,a.detail.scene),t(Rt,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(Vt,i);const l=undefined;await n.getPromise(Bt)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:n}=useCallbackRef(),a=useBoxSelectionActions(),i=useTransformActions(),l=s(st);return g.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:g.useCallback((()=>a.setOperationType("select")),[]),off:g.useCallback((()=>a.setOperationType("clearAndSelect")),[])}),e(ie,{ref:n,"data-testid":"viewer-box-query-tool",operationType:l})};function VertexViewerCameraTypeMenu({open:n,onOpen:a,onDismiss:i,onCameraTypeChange:l}){const o=useViewerCameraActions(),r=s(Ce);return t(_,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(n),onMenuClosed:i,children:[e("div",{slot:"anchor",children:e("div",{className:G("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(P,{content:"Change View",children:e(E,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===r?"cube-orthographic":"cube-perspective",children:e(V,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),t("div",{className:"w-36",children:[e("div",{className:"pt-1"}),t(R,{"data-testid":"set-perspective-view",onClick:()=>{o.updateCameraType("perspective"),null==l||l("perspective")},children:[e(V,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:G({"text-[var(--vertex-ui-blue-700)]":"perspective"===r})}),e("div",{className:G("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===r}),children:"Perspective"})]}),t(R,{"data-testid":"set-orthographic-view",onClick:()=>{o.updateCameraType("orthographic"),null==l||l("orthographic")},children:[e(V,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:G({"text-[var(--vertex-ui-blue-700)]":"orthographic"===r})}),e("div",{className:G("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===r}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=n=>{var{placement:a,children:i}=n,l=__rest(n,["placement","children"]);const o=Array.isArray(i)?i:[i],s=o.filter((e=>!f.isValidElement(e)||e.type!==le)).filter((e=>null!=e&&!1!==e)),r=o.find((e=>f.isValidElement(e)&&e.type===le)),[c,d]=f.useState(!1);return t(ne,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=a?a:"top-right",children:[null!=r?r:e(le,Object.assign({className:"m-7"},l)),0===s.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:s})]})},VertexViewer=a=>{var{id:i,className:l,disableSelection:o,onTap:c,onLongpress:d,onFrameDrawn:u,onSceneReady:m,viewerRefCallback:p,children:h}=a,g=__rest(a,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const v=s(Nn),b=useRecoilRef({state:ue}),C=useViewerCameraActions(),w=useHitActions(),S=useSelectionActions(),k=useViewerFrameActions(),[A,T]=r(pe),P=s(Ce),E=s(Oe),N=s(ot),[O,M]=r(me);f.useEffect((()=>{null!=i&&M(i)}),[i]);const I=s(wn),V=f.useMemo((()=>({opacity:I/100})),[I]),R=s(Je),L=s(Qe),_=f.useMemo((()=>({color:R,width:L})),[R,L]),D=s(cn),B=s(pn),H=s(hn),j=s(gn),F=f.useMemo((()=>({color:B,opacity:H/100,lineWidth:j})),[B,H,j]),U=s(mt),W=null!=h&&!1!==h;return useKeyBindings(),useDefaultKeybindings(),t(oe,Object.assign({id:O,"data-testid":"vertex-viewer",ref:null!=p?p:b,className:G("flex w-full h-full",l,{"cursor-crosshair":E.hitPending}),style:{"--viewer-background":D},config:v,cameraType:A?P:void 0,onCameraTypeChanged:e=>{A&&C.updateCameraType(e.detail)},phantom:V,featureLines:_,selectionHighlighting:F,featureMaps:U?"final":void 0,onTap:e=>{const t=[...o?[]:[S.selectCurrentHit]];w.tap(e,...t),null==c||c(e)},onLongpress:e=>{w.longPress(e),null==d||d(e)},onFrameDrawn:e=>{k.frameDrawn(e),null==u||u(e)},onSceneReady:e=>{A||T(!0),null==m||m(e)}},g,{children:[N&&e(VertexBoxSelectionTool,{}),W?h: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=s(Yt),l=s(qt);return f.useEffect((()=>{null==t||t(i)}),[i,t]),f.useEffect((()=>{null==a||a(l)}),[l,a]),e(n,{})},VertexViewerToolkitRoot=a=>{var{override:i,autoDefineCustomElements:l,children:o,config:s}=a,r=__rest(a,["override","autoDefineCustomElements","children","config"]);return f.useEffect((()=>{(null==l||l)&&(re(),se())}),[l]),e(m,{override:i,children:t(n,{children:[e(VertexViewerToolkitEventListener,Object.assign({},r)),e(VertexViewerToolkitRootConfig,{config:s,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const i=c(Nn);return f.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;i(e)}),[t,i]),e(n,{children:a})};var Jn=Object.freeze({__proto__:null,get AssemblyFontFace(){return Gn}});export{Xe as CrossSection,Xt as Hits,Jn as SceneTree,Zt as Selection,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,VertexPanButton,VertexPointToPointMeasurement,VertexPointToPointMeasurementTool,VertexPreciseMeasurement,VertexPreciseMeasurementTool,VertexResizableContent,VertexRotateButton,VertexSceneItemGhostingClear,VertexSceneItemGhostingOpacitySlider,VertexSceneItemGhostingToggle,VertexSceneItemMaterialClear,VertexSceneItemMaterialColorPicker,VertexSceneItemMaterialOpacitySlider,VertexSceneTree,VertexSceneTreeColumnPopover,VertexSceneTreeContextMenu,VertexSceneTreeHeader,VertexSceneTreeSearchBar,VertexSceneTreeSearchInformationForToolbar,VertexSceneTreeSearchOptionsPopover,VertexSceneTreeTableLayout,VertexSelectionHighlightingColorPicker,VertexSelectionHighlightingControls,VertexSelectionHighlightingLineThicknessSlider,VertexSelectionHighlightingOpacitySlider,VertexSelectionHighlightingPanelSection,VertexSelectionHighlightingReset,VertexShowAllMenuItem,VertexShowOnlyMenuItem,VertexShowOnlySelectedMenuItem,VertexToolbar,VertexToolbarDivider,VertexTransformClear,VertexTransformControls,VertexTransformManipulatorToggle,VertexTransformPanelSection,VertexTransformWidget,VertexUnitsControls,VertexUnitsPanelSection,VertexViewer,VertexViewerBackgroundColorPicker,VertexViewerBackgroundControls,VertexViewerBackgroundPanelSection,VertexViewerBackgroundReset,VertexViewerContextMenu,VertexViewerCrossSectionButton,VertexViewerRightOpenedPanel,VertexViewerRightSidebar,VertexViewerSceneReset,VertexViewerToolkitRoot,VertexViewerViewCube,VertexZoomButton};
|
|
2
2
|
//# sourceMappingURL=bundle.esm.js.map
|