@vertexvis/viewer-toolkit-react 0.0.3-canary.10 → 0.0.3-canary.11
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/index-D2hdasNC.js +103 -0
- package/dist/index-D2hdasNC.js.map +1 -0
- package/dist/index-lZfUtHRg.js +103 -0
- package/dist/index-lZfUtHRg.js.map +1 -0
- package/dist/png-decoder-Dp2q2n3J.js +5 -0
- package/dist/png-decoder-Dp2q2n3J.js.map +1 -0
- package/dist/png-decoder-qYvK7yEB.js +6 -0
- package/dist/png-decoder-qYvK7yEB.js.map +1 -0
- package/dist/shadow-css-008a49f5-B4spmWZX.js +13 -0
- package/dist/shadow-css-008a49f5-B4spmWZX.js.map +1 -0
- package/dist/shadow-css-008a49f5-JLlISfDE.js +13 -0
- package/dist/shadow-css-008a49f5-JLlISfDE.js.map +1 -0
- package/dist/shadow-css-78885382-C7hFYObd.js +16 -0
- package/dist/shadow-css-78885382-C7hFYObd.js.map +1 -0
- package/dist/shadow-css-78885382-lSysRry8.js +16 -0
- package/dist/shadow-css-78885382-lSysRry8.js.map +1 -0
- package/package.json +8 -4
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,{useEffect as a,useCallback as r}from"react";import s from"react-dom";import{Vector3 as l,BoundingBox as c,Angle as u,Point as d}from"@vertexvis/geometry";import{VertexColorPicker as p,VertexSlider as f,VertexTooltip as h,VertexIconButton as m,VertexDialog as g,VertexToggle as v,VertexButton as b,VertexDropdownMenu as S,VertexIcon as w,VertexMenuItem as _,VertexResizable as A,VertexMenu as C,VertexMenuDivider as E,VertexDraggablePopover as T,VertexBanner as k,VertexToast as N,VertexPopover as R,VertexTextfield as P}from"@vertexvis/ui-react";import V from"classnames";import{ColorMaterial as O}from"@vertexvis/viewer";import{VertexViewerMeasurementDetails as L,VertexViewerMeasurementDistance as M,VertexViewerMeasurementPrecise as I,VertexSceneTreeToolbar as D,VertexSceneTreeSearch as B,VertexSceneTreeTableLayout as U,VertexSceneTreeTableColumn as F,VertexSceneTree as j,VertexViewerToolbarGroup as H,VertexViewerToolbar as W,VertexViewerTransformWidget as G,VertexViewerBoxQueryTool as $,VertexViewerViewCube as K,VertexViewer as q}from"@vertexvis/viewer-react";import{defineCustomElements as Y}from"@vertexvis/ui/loader";import{defineCustomElements as Z}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 X={exports:{}},J;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 Q=format$1;X.exports=pino;const ee=pfGlobalThisOrFallback().console||{},te={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 ne=Symbol("pino.logFuncs"),oe=Symbol("pino.hierarchy"),ie={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[oe]};t[oe]=n}function setupBaseLogFunctions(e,t,n){const o={};t.forEach((e=>{o[e]=n[e]?n[e]:ee[e]||ee[ie[e]||"log"]||noop})),e[ne]=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||ee;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[oe];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[ne][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[ne][o],function LOG(){const a=t.timestamp(),r=new Array(arguments.length),s=Object.getPrototypeOf&&Object.getPrototypeOf(this)===ee?ee: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?Q(s.shift(),s):void 0}else"string"==typeof l&&(l=Q(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 ae;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=te,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),X.exports.default=pino,X.exports.pino=pino;const re=(0,X.exports)({formatters:{level:e=>({level:e})}}),se={error:(e,t)=>{null!=t?re.error(t,e):re.error(e)},info:(e,t)=>{null!=t?re.info(t,e):re.info(e)},warn:(e,t)=>{null!=t?re.warn(t,e):re.warn(e)},debug:(e,t)=>{null!=t?re.debug(t,e):re.debug(e)}};var le=se;function err(e){const t=new Error(e);if(void 0===t.stack)try{throw t}catch(e){}return t}var ce,ue=err;function isPromise(e){return!!e&&"function"==typeof e.then}var de=isPromise;function nullthrows(e,t){if(null!=e)return e;throw ue(null!=t?t:"Got unexpected null or undefined")}var pe=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 fe{getValue(){throw ue("BaseLoadable")}toPromise(){throw ue("BaseLoadable")}valueMaybe(){throw ue("BaseLoadable")}valueOrThrow(){throw ue(`Loadable expected value, but in "${this.state}" state`)}promiseMaybe(){throw ue("BaseLoadable")}promiseOrThrow(){throw ue(`Loadable expected promise, but in "${this.state}" state`)}errorMaybe(){throw ue("BaseLoadable")}errorOrThrow(){throw ue(`Loadable expected error, but in "${this.state}" state`)}is(e){return e.state===this.state&&e.contents===this.contents}map(e){throw ue("BaseLoadable")}}class he extends fe{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 de(t)?loadableWithPromise(t):isLoadable(t)?t:loadableWithValue(t)}catch(t){return de(t)?loadableWithPromise(t.next((()=>this.map(e)))):loadableWithError(t)}}}class me extends fe{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 ge extends fe{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(de(t))return t.then((()=>this.map(e).contents));throw t})))}}function loadableWithValue(e){return Object.freeze(new he(e))}function loadableWithError(e){return Object.freeze(new me(e))}function loadableWithPromise(e){return Object.freeze(new ge(e))}function loadableLoading(){return Object.freeze(new ge(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(pe(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:de(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 fe}const ve={of:e=>de(e)?loadableWithPromise(e):isLoadable(e)?e:loadableWithValue(e),error:e=>loadableWithError(e),loading:()=>loadableLoading(),all:loadableAll,isLoadable:isLoadable};var ye={loadableWithValue:loadableWithValue,loadableWithError:loadableWithError,loadableWithPromise:loadableWithPromise,loadableLoading:loadableLoading,loadableAll:loadableAll,isLoadable:isLoadable,RecoilLoadable:ve},be=ye.loadableWithValue,Se=ye.loadableWithError,we=ye.loadableWithPromise,_e=ye.loadableLoading,Ae=ye.loadableAll,Ce=ye.isLoadable,Ee=ye.RecoilLoadable,Te=Object.freeze({__proto__:null,loadableWithValue:be,loadableWithError:Se,loadableWithPromise:we,loadableLoading:_e,loadableAll:Ae,isLoadable:Ce,RecoilLoadable:Ee});const ke={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 ue(`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=>{ke.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=e})),readProcessEnvStringArrayFlag("RECOIL_GKS_ENABLED",(e=>{e.forEach((e=>{ke.RECOIL_GKS_ENABLED.add(e)}))})))}applyProcessEnvFlagOverrides();var xe=ke;function Recoil_gkx_OSS(e){return xe.RECOIL_GKS_ENABLED.has(e)}Recoil_gkx_OSS.setPass=e=>{xe.RECOIL_GKS_ENABLED.add(e)},Recoil_gkx_OSS.setFail=e=>{xe.RECOIL_GKS_ENABLED.delete(e)},Recoil_gkx_OSS.clear=()=>{xe.RECOIL_GKS_ENABLED.clear()};var Ne=Recoil_gkx_OSS;function recoverableViolation(e,t,{error:n}={}){return"production"!==process.env.NODE_ENV&&console.error(e,n),null}var Re,Pe=recoverableViolation,Ve,Oe,Le;const Me=null!==(Ve=i.createMutableSource)&&void 0!==Ve?Ve:i.unstable_createMutableSource,Ie=null!==(Oe=i.useMutableSource)&&void 0!==Oe?Oe:i.unstable_useMutableSource,De=null!==(Le=i.useSyncExternalStore)&&void 0!==Le?Le:i.unstable_useSyncExternalStore;let Be=!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!De||a||Be||(Be=!0,Pe("A React renderer without React 18+ API support is being used with React 18+.")),a}function reactMode(){return Ne("recoil_transition_support")?{mode:"TRANSITION_SUPPORT",early:!0,concurrent:!0}:Ne("recoil_sync_external_store")&&null!=De?{mode:"SYNC_EXTERNAL_STORE",early:!0,concurrent:!1}:Ne("recoil_mutable_source")&&null!=Ie&&"undefined"!=typeof window&&!window.$disableRecoilValueMutableSource_TEMP_HACK_DO_NOT_USE?Ne("recoil_suppress_rerender_in_callback")?{mode:"MUTABLE_SOURCE",early:!0,concurrent:!0}:{mode:"MUTABLE_SOURCE",early:!1,concurrent:!1}:Ne("recoil_suppress_rerender_in_callback")?{mode:"LEGACY",early:!0,concurrent:!1}:{mode:"LEGACY",early:!1,concurrent:!1}}var ze={createMutableSource:Me,useMutableSource:Ie,useSyncExternalStore:De,currentRendererSupportsUseSyncExternalStore:currentRendererSupportsUseSyncExternalStore,reactMode:reactMode};class Ue{constructor(e){_defineProperty(this,"key",void 0),this.key=e}toJSON(){return{key:this.key}}}class Fe extends Ue{}class je extends Ue{}function isRecoilValue(e){return e instanceof Fe||e instanceof je}var He={AbstractRecoilValue:Ue,RecoilState:Fe,RecoilValueReadOnly:je,isRecoilValue:isRecoilValue},We=He.AbstractRecoilValue,Ge=He.RecoilState,$e=He.RecoilValueReadOnly,Ke=He.isRecoilValue,qe=Object.freeze({__proto__:null,AbstractRecoilValue:We,RecoilState:Ge,RecoilValueReadOnly:$e,isRecoilValue:Ke});function sprintf(e,...t){let n=0;return e.replace(/%s/g,(()=>String(t[n++])))}var Ye=sprintf;function expectationViolation(e,...t){if("production"!==process.env.NODE_ENV){const n=Ye.call(null,e,...t),o=new Error(n);o.name="Expectation Violation",console.error(o)}}var Ze,Xe=expectationViolation;function mapIterable(e,t){return function*(){let n=0;for(const o of e)yield t(o,n++)}()}var Je=mapIterable;class Qe{}const et=new Qe,tt=new Map,nt=new Map;function recoilValuesForKeys(e){return Je(e,(e=>pe(nt.get(e))))}function checkForDuplicateAtomKey(e){if(tt.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?Xe(t,"recoil"):console.warn(t)}}function registerNode(e){xe.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED&&checkForDuplicateAtomKey(e.key),tt.set(e.key,e);const t=null==e.set?new qe.RecoilValueReadOnly(e.key):new qe.RecoilState(e.key);return nt.set(e.key,t),t}class ot extends Error{}function getNode(e){const t=tt.get(e);if(null==t)throw new ot(`Missing definition for RecoilValue: "${e}""`);return t}function getNodeMaybe(e){return tt.get(e)}const it=new Map;function deleteNodeConfigIfPossible(e){var t;if(!Ne("recoil_memory_managament_2020"))return;const n=tt.get(e);var o;null!=n&&null!==(t=n.shouldDeleteConfigOnRelease)&&void 0!==t&&t.call(n)&&(tt.delete(e),null===(o=getConfigDeletionHandler(e))||void 0===o||o(),it.delete(e))}function setConfigDeletionHandler(e,t){Ne("recoil_memory_managament_2020")&&(void 0===t?it.delete(e):it.set(e,t))}function getConfigDeletionHandler(e){return it.get(e)}var at={recoilValues:nt,registerNode:registerNode,getNode:getNode,getNodeMaybe:getNodeMaybe,deleteNodeConfigIfPossible:deleteNodeConfigIfPossible,setConfigDeletionHandler:setConfigDeletionHandler,getConfigDeletionHandler:getConfigDeletionHandler,recoilValuesForKeys:recoilValuesForKeys,DefaultValue:Qe,DEFAULT_VALUE:et};function enqueueExecution(e,t){t()}var rt={enqueueExecution:enqueueExecution};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var st=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:I}},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},P=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)},V=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))},M=function canEditNode(e,t){return e===t.edit},I=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):M(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=M(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=M(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 P(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=M(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 V(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 lt{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 ct{constructor(e){if(_defineProperty(this,"_hamt",st.empty.beginMutation()),e instanceof ct){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 Ne("recoil_hamt_2020")?new ct(e):new lt(e)}var ut,dt=persistentMap,pt=Object.freeze({__proto__:null,persistentMap:dt});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 ft=differenceSets;function mapMap(e,t){const n=new Map;return e.forEach(((e,o)=>{n.set(o,t(e,o))})),n}var ht=mapMap;function makeGraph(){return{nodeDeps:new Map,nodeToNodeSubscriptions:new Map}}function cloneGraph(e){return{nodeDeps:ht(e.nodeDeps,(e=>new Set(e))),nodeToNodeSubscriptions:ht(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:ft(t,r);for(const t of s){a.has(t)||a.set(t,new Set);const n=undefined;pe(a.get(t)).add(e)}if(r){const n=ft(r,t);for(const t of n){if(!a.has(t))return;const n=pe(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)&&Pe("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 mt={cloneGraph:cloneGraph,graph:makeGraph,saveDepsToStore:saveDepsToStore};let gt=0;const vt=undefined;let yt=0;const bt=undefined;let St=0;const wt=undefined;var _t={getNextTreeStateVersion:()=>gt++,getNextStoreID:()=>yt++,getNextComponentID:()=>St++};const{persistentMap:At}=pt,{graph:Ct}=mt,{getNextTreeStateVersion:Et}=_t;function makeEmptyTreeState(){const e=Et();return{version:e,stateID:e,transactionMetadata:{},dirtyAtoms:new Set,atomValues:At(),nonvalidatedAtoms:At()}}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,Ct()),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map}}var Tt={makeEmptyStoreState:makeEmptyStoreState,getNextTreeStateVersion:Et};class kt{}var xt={RetentionZone:kt};function setByAddingToSet(e,t){const n=new Set(e);return n.add(t),n}var Nt={setByAddingToSet:setByAddingToSet};function*filterIterable(e,t){let n=0;for(const o of e)t(o,n++)&&(yield o)}var Rt=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 Pt=lazyProxy;const{getNode:Vt,getNodeMaybe:Ot,recoilValuesForKeys:Lt}=at,{RetentionZone:Mt}=xt,{setByAddingToSet:It}=Nt,Dt=Object.freeze(new Set);class Bt extends Error{}function initializeRetentionForNode(e,t,n){if(!Ne("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 Mt)addToZone(n);else if(Array.isArray(n))for(const e of n)addToZone(e);return()=>{if(!Ne("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 Mt)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=Vt(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"),Vt(n).get(e,t)}function peekNodeLoadable(e,t,n){return Vt(n).peek(e,t)}function setUnvalidatedAtomValue_DEPRECATED(e,t,n){var o;const i=Ot(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:It(e.dirtyAtoms,t)}}function setNodeValue(e,t,n,o){const i=Vt(n);if(null==i.set)throw new Bt(`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=Vt(n).nodeType;return Pt({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 Lt(null!==(e=i.nodeDeps.get(n))&&void 0!==e?e:[])},subscribers:()=>{var i,a;return{nodes:Lt(Rt(getDownstreamNodes(e,t,new Set([n])),(e=>e!==n))),components:Je(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:Dt;for(const e of t)o.has(e)||i.push(e)}return o}var zt={getNodeLoadable:getNodeLoadable,peekNodeLoadable:peekNodeLoadable,setNodeValue:setNodeValue,initializeNode:initializeNode,cleanUpNode:cleanUpNode,setUnvalidatedAtomValue_DEPRECATED:setUnvalidatedAtomValue_DEPRECATED,peekNodeInfo:peekNodeInfo,getDownstreamNodes:getDownstreamNodes};let Ut=null;function setInvalidateMemoizedSnapshot(e){Ut=e}function invalidateMemoizedSnapshot(){var e;null===(e=Ut)||void 0===e||e()}var Ft={setInvalidateMemoizedSnapshot:setInvalidateMemoizedSnapshot,invalidateMemoizedSnapshot:invalidateMemoizedSnapshot};const{getDownstreamNodes:jt,getNodeLoadable:Ht,setNodeValue:Wt}=zt,{getNextComponentID:Gt}=_t,{getNode:$t,getNodeMaybe:Kt}=at,{DefaultValue:qt}=at,{reactMode:Yt}=ze,{AbstractRecoilValue:Zt,RecoilState:Xt,RecoilValueReadOnly:Jt,isRecoilValue:Qt}=qe,{invalidateMemoizedSnapshot:en}=Ft;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)&&Pe("Tried to read from a discarded tree");const r=Ht(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 qt?n.delete(t):n.set(t,e)})),n}function valueFromValueOrUpdater(e,t,{key:n},o){if("function"==typeof o){const i=Ht(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 Pe(e),ue(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=Wt(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=Kt(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 Pe(`Unknown action ${n.type}`)}function writeLoadableToTreeState(e,t,n){"hasValue"===n.state&&n.contents instanceof qt?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),en(),o}))}function queueOrPerformStateUpdate(e,t){if(tn.length){const n=tn[tn.length-1];let o=n.get(e);o||n.set(e,o=[]),o.push(t)}else applyActionsToStore(e,[t])}const tn=[];function batchStart(){const e=new Map;return tn.push(e),()=>{for(const[t,n]of e)applyActionsToStore(t,n);const t=undefined;tn.pop()!==e&&Pe("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=jt(e,t,t.dirtyAtoms);for(const e of n){var o,i;null===(o=Kt(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 qt)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=Gt(),a=e.getState();a.nodeToComponentSubscriptions.has(t)||a.nodeToComponentSubscriptions.set(t,new Map),pe(a.nodeToComponentSubscriptions.get(t)).set(i,[null!=o?o:"<not captured>",n]);const r=Yt();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)):Pe(`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=$t(t.key);null===(n=i.clearCache)||void 0===n||n.call(i,e,o)}var nn={AbstractRecoilValue:Zt,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 on=someSet;const{cleanUpNode:an}=zt,{deleteNodeConfigIfPossible:rn,getNode:sn}=at,{RetentionZone:ln}=xt,cn=12e4,un=new Set;function releaseRetainablesNowOnCurrentTree(e,t){const n=e.getState(),o=n.currentTree;if(n.nextTree)return void Pe("releaseNodesNowOnCurrentTree should only be called at the end of a batch");const i=new Set;for(const e of t)if(e instanceof ln)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"===sn(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&&on(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:un){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(pe(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(!Ne("recoil_memory_managament_2020"))return;an(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)}rn(n)}function nodesRetainedByZone(e,t){var n;return null!==(n=e.retention.nodesRetainedByZone.get(t))&&void 0!==n?n:un}function zonesThatCouldRetainNode(e){const t=sn(e).retainedBy;return void 0===t||"components"===t||"recoilRoot"===t?[]:t instanceof ln?[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(!Ne("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(!Ne("recoil_memory_managament_2020"))return;const n=undefined;e.getState().retention.referenceCounts.delete(t),scheduleOrPerformPossibleReleaseOfRetainable(e,t)}function releaseScheduledRetainablesNow(e){if(!Ne("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 dn={SUSPENSE_TIMEOUT_MS:cn,updateRetainCount:updateRetainCount,releaseScheduledRetainablesNow:releaseScheduledRetainablesNow,retainedByOptionWithDefault:retainedByOptionWithDefault};const{unstable_batchedUpdates:pn}=s;var fn={unstable_batchedUpdates:pn};const{unstable_batchedUpdates:hn}=fn;var mn={unstable_batchedUpdates:hn};const{batchStart:gn}=nn,{unstable_batchedUpdates:vn}=mn;let yn=vn||(e=>e());const bn=undefined;var Sn={batchUpdates:e=>{yn((()=>{let batchEnd=()=>{};try{batchEnd=gn(),e()}finally{batchEnd()}}))}};function*concatIterables(e){for(const t of e)for(const e of t)yield e}var wn=concatIterables;const _n="undefined"==typeof Window||"undefined"==typeof window,isWindow=e=>!_n&&(e===window||e instanceof Window),An="undefined"!=typeof navigator&&"ReactNative"===navigator.product;var Cn={isSSR:_n,isReactNative:An,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 En={memoizeOneWithArgsHashAndInvalidation:memoizeOneWithArgsHashAndInvalidation};const{batchUpdates:Tn}=Sn,{initializeNode:kn,peekNodeInfo:xn}=zt,{graph:Nn}=mt,{getNextStoreID:Rn}=_t,{DEFAULT_VALUE:Pn,recoilValues:Vn,recoilValuesForKeys:On}=at,{AbstractRecoilValue:Ln,getRecoilValueAsLoadable:Mn,setRecoilValue:In,setUnvalidatedRecoilValue:Dn}=nn,{updateRetainCount:Bn}=dn,{setInvalidateMemoizedSnapshot:zn}=Ft,{getNextTreeStateVersion:Un,makeEmptyStoreState:Fn}=Tt,{isSSR:jn}=Cn,{memoizeOneWithArgsHashAndInvalidation:Hn}=En,Wn="\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 Gn{constructor(e,t){_defineProperty(this,"_store",void 0),_defineProperty(this,"_refCount",1),_defineProperty(this,"getLoadable",(e=>(this.checkRefCount_INTERNAL(),Mn(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 On(t.dirtyAtoms)}const t=this._store.getState().knownAtoms,n=this._store.getState().knownSelectors;return null==(null==e?void 0:e.isInitialized)?Vn.values():!0===e.isInitialized?On(wn([t,n])):Rt(Vn.values(),(({key:e})=>!t.has(e)&&!n.has(e)))})),_defineProperty(this,"getInfo_UNSTABLE",(({key:e})=>(this.checkRefCount_INTERNAL(),xn(this._store,this._store.getState().currentTree,e)))),_defineProperty(this,"map",(e=>{this.checkRefCount_INTERNAL();const t=new qn(this,Tn);return e(t),t})),_defineProperty(this,"asyncMap",(async e=>{this.checkRefCount_INTERNAL();const t=new qn(this,Tn);return t.retain(),await e(t),t.autoRelease_INTERNAL(),t})),this._store={storeID:Rn(),parentStoreID:t,getState:()=>e,replaceState:t=>{e.currentTree=t(e.currentTree)},getGraph:t=>{const n=e.graphsByVersion;if(n.has(t))return pe(n.get(t));const o=Nn();return n.set(t,o),o},subscribeToTransactions:()=>({release:()=>{}}),addTransactionMetadata:()=>{throw ue("Cannot subscribe to Snapshots")}};for(const e of this._store.getState().knownAtoms)kn(this._store,e,"get"),Bn(this._store,e,1);this.autoRelease_INTERNAL()}retain(){if(this._refCount<=0){if("production"!==process.env.NODE_ENV)throw ue("Snapshot has already been released.");Pe("Attempt to retain() Snapshot that was already released.")}this._refCount++;let e=!1;return()=>{e||(e=!0,this._release())}}autoRelease_INTERNAL(){jn||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(),!Ne("recoil_memory_managament_2020"))return}else this._refCount<0&&"production"!==process.env.NODE_ENV&&Pe("Snapshot released an extra time.")}isRetained(){return this._refCount>0}checkRefCount_INTERNAL(){Ne("recoil_memory_managament_2020")&&this._refCount<=0&&"production"!==process.env.NODE_ENV&&Pe(Wn)}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?Un():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(Je(o.nodeCleanupFunctions.entries(),(([e])=>[e,()=>{}])))}}function freshSnapshot(e){const t=new Gn(Fn());return null!=e?t.map(e):t}const[$n,Kn]=Hn(((e,t)=>{var n;const o=e.getState(),i="latest"===t?null!==(n=o.nextTree)&&void 0!==n?n:o.currentTree:pe(o.previousTree);return new Gn(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=$n(e,t);return n.isRetained()?n:(Kn(),$n(e,t))}zn(Kn);class qn extends Gn{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((()=>{Bn(n,e.key,1),In(this.getStore_INTERNAL(),e,t)}))})),_defineProperty(this,"reset",(e=>{this.checkRefCount_INTERNAL();const t=this.getStore_INTERNAL();this._batch((()=>{Bn(t,e.key,1),In(this.getStore_INTERNAL(),e,Pn)}))})),_defineProperty(this,"setUnvalidatedAtomValues_DEPRECATED",(e=>{this.checkRefCount_INTERNAL();const t=this.getStore_INTERNAL();Tn((()=>{for(const[n,o]of e.entries())Bn(t,n,1),Dn(t,new Ln(n),o)}))})),this._batch=t}}var Yn={Snapshot:Gn,MutableSnapshot:qn,freshSnapshot:freshSnapshot,cloneSnapshot:cloneSnapshot},Zn=Yn.Snapshot,Xn=Yn.MutableSnapshot,Jn=Yn.freshSnapshot,Qn=Yn.cloneSnapshot,eo=Object.freeze({__proto__:null,Snapshot:Zn,MutableSnapshot:Xn,freshSnapshot:Jn,cloneSnapshot:Qn});function unionSets(...e){const t=new Set;for(const n of e)for(const e of n)t.add(e);return t}var to=unionSets;const{useRef:no}=i;function useRefInitOnce(e){const t=no(e);return t.current===e&&"function"==typeof e&&(t.current=e()),t}var oo=useRefInitOnce;const{getNextTreeStateVersion:io,makeEmptyStoreState:ao}=Tt,{cleanUpNode:ro,getDownstreamNodes:so,initializeNode:lo,setNodeValue:co,setUnvalidatedAtomValue_DEPRECATED:uo}=zt,{graph:po}=mt,{cloneGraph:fo}=mt,{getNextStoreID:ho}=_t,{createMutableSource:mo,reactMode:go}=ze,{applyAtomValueWrites:vo}=nn,{releaseScheduledRetainablesNow:yo}=dn,{freshSnapshot:bo}=eo,{useCallback:So,useContext:wo,useEffect:_o,useMemo:Ao,useRef:Co,useState:Eo}=i;function notInAContext(){throw ue("This component must be used inside a <RecoilRoot> component.")}const To=Object.freeze({storeID:ho(),getState:notInAContext,replaceState:notInAContext,getGraph:notInAContext,subscribeToTransactions:notInAContext,addTransactionMetadata:notInAContext});let ko=!1;function startNextTreeIfNeeded(e){if(ko)throw ue("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){Ne("recoil_memory_managament_2020")&&Ne("recoil_release_on_cascading_update_killswitch_2021")&&t.commitDepth>0&&yo(e);const n=t.currentTree.version,o=io();t.nextTree={...t.currentTree,version:o,stateID:o,dirtyAtoms:new Set,transactionMetadata:{}},t.graphsByVersion.set(o,fo(pe(t.graphsByVersion.get(n))))}}const xo=i.createContext({current:To}),useStoreRef=()=>wo(xo),No=i.createContext(null);function useRecoilMutableSource(){const e=wo(No);return null==e&&Xe("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=so(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);(!go().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):Pe("Ended batch with no previous state, which is unexpected","recoil"),t.previousTree=null,Ne("recoil_memory_managament_2020")&&null==n&&yo(e)}finally{t.commitDepth--}}function Batcher({setNotifyBatcherOfChange:e}){const t=useStoreRef(),[,n]=Eo([]);return e((()=>n({}))),_o((()=>(e((()=>n({}))),()=>{e((()=>{}))})),[e]),_o((()=>{rt.enqueueExecution("Batcher",(()=>{endBatch(t.current)}))})),null}function initialStoreState_DEPRECATED(e,t){const n=ao();return t({set:(t,o)=>{const i=n.currentTree,a=co(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:to(i.dirtyAtoms,r),atomValues:vo(i.atomValues,a),nonvalidatedAtoms:s}},setUnvalidatedAtomValues:e=>{e.forEach(((e,t)=>{n.currentTree=uo(n.currentTree,t,e)}))}}),n}function initialStoreState(e){const t=bo(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 Ro=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 pe(t.get(e));const n=po();return t.set(e,n),n},subscribeToTransactions=(e,t)=>{if(null==t){const{transactionSubscriptions:t}=l.current.getState(),n=Ro++;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=Ro++;return pe(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))pe(l.current.getState().nextTree).transactionMetadata[t]=e[t]},replaceState=e=>{startNextTreeIfNeeded(l.current);const t=pe(a.current.nextTree);let n;try{ko=!0,n=e(t)}finally{ko=!1}n!==t&&("production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&window.$recoilDebugStates.push(n),a.current.nextTree=n,go().early&¬ifyComponents(l.current,a.current,n),pe(r.current)())},r=Co(null),s=So((e=>{r.current=e}),[r]),l=oo((()=>null!=n?n:{storeID:ho(),getState:()=>a.current,replaceState:replaceState,getGraph:getGraph,subscribeToTransactions:subscribeToTransactions,addTransactionMetadata:addTransactionMetadata}));null!=n&&(l.current=n),a=oo((()=>null!=e?initialStoreState_DEPRECATED(l.current,e):null!=t?initialStoreState(t):ao()));const c=Ao((()=>null==mo?void 0:mo(a,(()=>a.current.currentTree.version))),[a]);return _o((()=>{const e=l.current;for(const t of new Set(e.getState().knownAtoms))lo(e,t,"get");return()=>{for(const t of e.getState().knownAtoms)ro(e,t)}}),[l]),i.createElement(xo.Provider,{value:l},i.createElement(No.Provider,{value:c},i.createElement(Batcher,{setNotifyBatcherOfChange:s}),o))}function RecoilRoot(e){const{override:t,...n}=e,o=useStoreRef();return!1===t&&o.current!==To?e.children:i.createElement(RecoilRoot_INTERNAL,n)}var Po={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 Vo=shallowArrayEqual;const{useEffect:Oo,useRef:Lo}=i;function usePrevious(e){const t=Lo();return Oo((()=>{t.current=e})),t.current}var Mo=usePrevious;const{useStoreRef:Io}=Po,{SUSPENSE_TIMEOUT_MS:Do}=dn,{updateRetainCount:Bo}=dn,{RetentionZone:zo}=xt,{useEffect:Uo,useRef:Fo}=i,{isSSR:jo}=Cn;function useRetain(e){if(Ne("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 zo?e:e.key)),o=Io();Uo((()=>{if(!Ne("recoil_memory_managament_2020"))return;const e=o.current;if(i.current&&!jo)window.clearTimeout(i.current),i.current=null;else for(const t of n)Bo(e,t,1);return()=>{for(const t of n)Bo(e,t,-1)}}),[o,...n]);const i=Fo(),a=Mo(n);if(!(jo||void 0!==a&&Vo(a,n))){const e=o.current;for(const t of n)Bo(e,t,1);if(a)for(const t of a)Bo(e,t,-1);i.current&&window.clearTimeout(i.current),i.current=window.setTimeout((()=>{i.current=null;for(const t of n)Bo(e,t,-1)}),Do)}}var Ho=useRetain;function useComponentName(){return"<component name not available>"}var Wo=useComponentName;const{currentRendererSupportsUseSyncExternalStore:Go,reactMode:$o,useMutableSource:Ko,useSyncExternalStore:qo}=ze,{useRecoilMutableSource:Yo,useStoreRef:Zo}=Po,{isRecoilValue:Xo}=qe,{getRecoilValueAsLoadable:Jo,setRecoilValue:Qo,subscribeToRecoilValue:ei}=nn,{useCallback:ti,useEffect:ni,useMemo:oi,useRef:ii,useState:ai}=i,{isSSR:ri}=Cn;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),ri&&de(e.contents)&&e.contents.finally((()=>{o.delete(t)}))}))}throw"hasError"===e.state?e.contents:ue(`Invalid value of loadable atom "${t.key}"`)}function validateRecoilValue(e,t){if(!Xo(e))throw ue(`Invalid argument to ${t}: expected an atom or selector but got ${String(e)}`)}function useRecoilValueLoadable_SYNC_EXTERNAL_STORE(e){const t=Zo(),n=Wo(),o=ti((()=>{var n;process.env.NODE_ENV;const o=t.current,i=o.getState(),a=$o().early&&null!==(n=i.nextTree)&&void 0!==n?n:i.currentTree,r=undefined;return{loadable:Jo(o,e,a),key:e.key}}),[t,e]),i=ti((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=oi((()=>i(o)),[o,i]),r=ti((o=>{const i=t.current,a=undefined;return ei(i,e,o,n).release}),[t,e,n]);return qo(r,a,a).loadable}function useRecoilValueLoadable_MUTABLE_SOURCE(e){const t=Zo(),n=ti((()=>{var n;const o=t.current,i=o.getState(),a=$o().early&&null!==(n=i.nextTree)&&void 0!==n?n:i.currentTree;return Jo(o,e,a)}),[t,e]),o=ti((()=>(process.env.NODE_ENV,n())),[n]),i=Wo(),a=ti(((o,a)=>{const r=t.current,s=undefined;return ei(r,e,(()=>{if(!Ne("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=Yo();if(null==r)throw ue("Recoil hooks must be used in components contained within a <RecoilRoot> component.");const s=Ko(r,o,a),l=ii(s);return ni((()=>{l.current=s})),s}function useRecoilValueLoadable_TRANSITION_SUPPORT(e){const t=Zo(),n=Wo(),o=ti((()=>{var n;process.env.NODE_ENV;const o=t.current,i=o.getState(),a=$o().early&&null!==(n=i.nextTree)&&void 0!==n?n:i.currentTree;return Jo(o,e,a)}),[t,e]),i=ti((()=>({loadable:o(),key:e.key})),[o,e.key]),a=ti((e=>{const t=i();return e.loadable.is(t.loadable)&&e.key===t.key?e:t}),[i]);ni((()=>{const o=ei(t.current,e,(e=>{s(a)}),n);return s(a),o.release}),[n,e,t,a]);const[r,s]=ai(i);return r.key!==e.key?i().loadable:r.loadable}function useRecoilValueLoadable_LEGACY(e){const t=Zo(),[,n]=ai([]),o=Wo(),i=ti((()=>{var n;process.env.NODE_ENV;const o=t.current,i=o.getState(),a=$o().early&&null!==(n=i.nextTree)&&void 0!==n?n:i.currentTree;return Jo(o,e,a)}),[t,e]),a=i(),r=ii(a);return ni((()=>{r.current=a})),ni((()=>{const a=t.current,s=a.getState(),l=ei(a,e,(e=>{var t;if(!Ne("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(!Ne("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"),Ne("recoil_memory_managament_2020")&&Ho(e),{TRANSITION_SUPPORT:useRecoilValueLoadable_TRANSITION_SUPPORT,SYNC_EXTERNAL_STORE:Go()?useRecoilValueLoadable_SYNC_EXTERNAL_STORE:useRecoilValueLoadable_TRANSITION_SUPPORT,MUTABLE_SOURCE:useRecoilValueLoadable_MUTABLE_SOURCE,LEGACY:useRecoilValueLoadable_LEGACY}[$o().mode](e)}function useRecoilValue(e){"production"!==process.env.NODE_ENV&&validateRecoilValue(e,"useRecoilValue");const t=Zo(),n=undefined;return handleLoadable(useRecoilValueLoadable(e),e,t)}function useSetRecoilState(e){"production"!==process.env.NODE_ENV&&validateRecoilValue(e,"useSetRecoilState");const t=Zo();return ti((n=>{Qo(t.current,e,n)}),[t,e])}function useRecoilState(e){return"production"!==process.env.NODE_ENV&&validateRecoilValue(e,"useRecoilState"),[useRecoilValue(e),useSetRecoilState(e)]}var si={useRecoilState:useRecoilState,useRecoilValue:useRecoilValue,useRecoilValueLoadable:useRecoilValueLoadable,useSetRecoilState:useSetRecoilState};const{batchUpdates:li}=Sn,{DEFAULT_VALUE:ci,getNode:ui}=at,{AbstractRecoilValue:di,setRecoilValueLoadable:pi}=nn,{cloneSnapshot:fi}=eo,{useCallback:hi,useEffect:mi,useRef:gi,useState:vi}=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;li((()=>{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)&&ui(t).shouldRestoreFromSnapshots&&n.add(t)}n.forEach((t=>{pi(e,new di(t),a.atomValues.has(t)?pe(a.atomValues.get(t)):ci)})),e.replaceState((e=>({...e,stateID:t.getID()})))}))}var yi={gotoSnapshot:gotoSnapshot};const{useMemo:bi}=i,{loadableWithValue:Si}=Te,{initializeNode:wi}=zt,{DEFAULT_VALUE:_i,getNode:Ai}=at,{copyTreeState:Ci,getRecoilValueAsLoadable:Ei,invalidateDownstreams:Ti,writeLoadableToTreeState:ki}=nn;function isAtom(e){return"atom"===Ai(e.key).nodeType}class xi{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 ue("Reading selectors within atomicUpdate is not supported");const t=Ei(this._store,e,this._treeState);if("hasValue"===t.state)return t.contents;throw"hasError"===t.state?t.contents:ue(`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 ue("Setting selectors within atomicUpdate is not supported");if("function"==typeof t){const n=this.get(e);this._changes.set(e.key,t(n))}else wi(this._store,e.key,"set"),this._changes.set(e.key,t)})),_defineProperty(this,"reset",(e=>{this.set(e,_i)})),this._store=e,this._treeState=t,this._changes=new Map}newTreeState_INTERNAL(){if(0===this._changes.size)return this._treeState;const e=Ci(this._treeState);for(const[t,n]of this._changes)ki(e,t,Si(n));return Ti(this._store,e),e}}function atomicUpdater(e){return t=>{e.replaceState((n=>{const o=new xi(e,n);return t(o),o.newTreeState_INTERNAL()}))}}var Ni,Ri=atomicUpdater,Pi=Object.freeze({__proto__:null,atomicUpdater:Ri});function invariant(e,t){if(!e)throw new Error(t)}var Vi,Oi=invariant;const{atomicUpdater:Li}=Pi,{batchUpdates:Mi}=Sn,{DEFAULT_VALUE:Ii}=at,{useStoreRef:Di}=Po,{refreshRecoilValue:Bi,setRecoilValue:zi}=nn,{cloneSnapshot:Ui}=eo,{gotoSnapshot:Fi}=yi,{useCallback:ji}=i;class Hi{}const Wi=new Hi;function recoilCallback(e,t,n,o){let i=Wi,a;var r;(Mi((()=>{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 ue(r);const s=Pt({...null!=o?o:{},set:(t,n)=>zi(e,t,n),reset:t=>zi(e,t,Ii),refresh:t=>Bi(e,t),gotoSnapshot:t=>Fi(e,t),transact_UNSTABLE:t=>Li(e)(t)},{snapshot:()=>{const t=Ui(e);return a=t.retain(),t}}),l=t(s);if("function"!=typeof l)throw ue(r);i=l(...n)})),i instanceof Hi&&("production"!==process.env.NODE_ENV?Oi(!1,"batchUpdates should return immediately"):Oi(!1)),de(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=Di();return ji(((...t)=>recoilCallback(n.current,e,t)),null!=t?[...t,n]:void 0)}var Gi={recoilCallback:recoilCallback,useRecoilCallback:useRecoilCallback};const{useCallback:$i}=i,{atomicUpdater:Ki}=Pi,{useMemo:qi}=i;class Yi{constructor(e){_defineProperty(this,"value",void 0),this.value=e}}var Zi,Xi=Yi,Ji=Object.freeze({__proto__:null,WrappedValue:Xi});class Qi extends Error{}class ea{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 Qi))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 Pe("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 Qi}}var ta,na=ea,oa=Object.freeze({__proto__:null,TreeCache:na});class ia{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=pe(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 aa,ra=ia,sa=Object.freeze({__proto__:null,LRUCache:ra});const{LRUCache:la}=sa,{TreeCache:ca}=oa;function treeCacheLRU({name:e,maxSize:t,mapNodeValue:n=e=>e}){const o=new la({maxSize:t}),i=new ca({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 ua=treeCacheLRU;const da=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 ue("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(de(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>da&&(console.groupCollapsed(`Recoil: Spent ${i-n}ms computing a cache key`),console.warn(e,o),console.groupEnd()),o}return stringify$1(e,t)}var pa=stableStringify;const{TreeCache:fa}=oa,ha={equality:"reference",eviction:"keep-all",maxSize:1/0};function treeCacheFromPolicy({equality:e=ha.equality,eviction:t=ha.eviction,maxSize:n=ha.maxSize}=ha,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=>pa(e)}throw ue(`Unrecognized equality policy ${e}`)}function getTreeCache(e,t,n,o){switch(e){case"keep-all":return new fa({name:o,mapNodeValue:n});case"lru":return ua({name:o,maxSize:pe(t),mapNodeValue:n});case"most-recent":return ua({name:o,maxSize:1,mapNodeValue:n})}throw ue(`Unrecognized eviction policy ${e}`)}var ma=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 ga=isNode;const{isReactNative:va,isWindow:ya}=Cn;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__@@"]||(!!ga(e)||(!!de(e)||(e instanceof Error||(!!ArrayBuffer.isView(e)||!(va||!ya(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 ba=deepFreezeValue;const{isLoadable:Sa,loadableWithError:wa,loadableWithPromise:_a,loadableWithValue:Aa}=Te,{WrappedValue:Ca}=Ji,{getNodeLoadable:Ea,peekNodeLoadable:Ta,setNodeValue:ka}=zt,{saveDepsToStore:xa}=mt,{DEFAULT_VALUE:Na,getConfigDeletionHandler:Ra,getNode:Pa,registerNode:Va}=at,{isRecoilValue:Oa}=qe,{markRecoilValueModified:La}=nn,{retainedByOptionWithDefault:Ma}=dn,{recoilCallback:Ia}=Gi;class Da{}const Ba=new Da,za=[],Ua=new Map,Fa=(()=>{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 ue("A key option with a unique string value must be provided when creating a selector.");if("function"!=typeof o)throw ue("Selectors must specify a get callback option to get the selector value.")}const r=new Set,s=ma(null!=i?i:{equality:"reference",eviction:"keep-all"},n),l=Ma(e.retainedBy_UNSTABLE),c=new Map;let u=0;function selectorIsLive(){return!Ne("recoil_memory_managament_2020")||u>0}function selectorInit(e){return e.getState().knownSelectors.add(n),u++,()=>{u--}}function selectorShouldDeleteConfigOnRelease(){return void 0!==Ra(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;pe(getExecutionInfo(e)).stateVersions.clear(),notifyWaitingStores(t,!1)}}function notifyWaitingStores(e,n){const o=Ua.get(e);if(null!=o){for(const e of o)La(e,pe(t));n&&Ua.delete(e)}}function markStoreWaitingForResolvedAsync(e,t){let n=Ua.get(t);null==n&&Ua.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),Ba;const a=Aa(t);return resolveAsync(e,n,i,a,o),t})).catch((t=>{if(!selectorIsLive())throw clearExecutionInfo(e),Ba;if(de(t))return wrapPendingDependencyPromise(e,t,n,o,i,a);const r=wa(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),Ba;null!=a.loadingDepKey&&a.loadingDepPromise===t?n.atomValues.set(a.loadingDepKey,Aa(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 Da)throw Ba;if(!selectorIsLive())throw clearExecutionInfo(e),Ba;const a=wa(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))&&xa(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=Ea(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 ue("Invalid Loadable state")}const getCallback=n=>(...o)=>{if(r)throw ue("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?Oi(!1,"Recoil Value can never be null"):Oi(!1)),Ia(e,n,o,{node:t})};try{s=o({get:getRecoilValue,getCallback:getCallback}),s=Oa(s)?getRecoilValue(s):s,Sa(s)&&("hasError"===s.state&&(l=!0),s=s.contents),de(s)?s=wrapResultPromise(e,s,n,d,i,u).finally(finishEvaluation):finishEvaluation(),s=s instanceof Ca?s.value:s}catch(t){s=t,de(s)?s=wrapPendingDependencyPromise(e,s,n,d,i,u).finally(finishEvaluation):(l=!0,finishEvaluation())}return c=l?wa(s):de(s)?_a(s):Aa(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?Oi(!1,"Cache nodeKey is type string"):Oi(!1)),Ea(e,t,n).contents)),{onNodeVisit:e=>{"branch"===e.type&&e.nodeKey!==n&&i.add(e.nodeKey)}})}catch(e){throw ue(`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=Fa(),[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=wn([c.has(e)?[pe(c.get(e))]:[],Je(Rt(c,(([t])=>t!==e)),(([,e])=>e))]);function anyDepChanged(n){for(const[o,i]of n)if(!Ea(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)&&ba(o.contents),t.atomValues.set(n,o);try{s.set(depValuesToDepRoute(i),o)}catch(e){throw ue(`Problem with setting cache for selector "${n}": ${e.message}`)}}function detectCircularDependencies(e){if(za.includes(n)){const e=`Recoil selector has circular dependencies: ${za.slice(za.indexOf(n)).join(" → ")}`;return wa(ue(e))}za.push(n);try{return e()}finally{za.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?Oi(!1,"Cache nodeKey is type string"):Oi(!1)),null===(o=Ta(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?Oi(!1,"Recoil Value can never be null"):Oi(!1));for(const t of r){var o;const i=Pa(t);null===(o=i.clearCache)||void 0===o||o.call(i,e,n)}r.clear(),invalidateSelector(n),s.clear(),La(e,t)}if(null!=a){const o=undefined;return t=Va({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 ue("Recoil: Async selector sets are not currently supported.");const a=Ea(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 Pe(e),ue(e)}throw a.contents}function setRecoilState(n,o){if(i){const e="Recoil: Async selector sets are not currently supported.";throw Pe(e),ue(e)}const a="function"==typeof o?o(getRecoilValue(n)):o,s=undefined;ka(e,t,n.key,a).forEach(((e,t)=>r.set(t,e)))}function resetRecoilState(e){setRecoilState(e,Na)}const s=a({set:setRecoilState,get:getRecoilValue,reset:resetRecoilState},o);if(void 0!==s)throw de(s)?ue("Recoil: Async selector sets are not currently supported."):ue("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=Va({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 Ca(e);var ja=selector;const{isLoadable:Ha,loadableWithError:Wa,loadableWithPromise:Ga,loadableWithValue:$a}=Te,{WrappedValue:Ka}=Ji,{peekNodeInfo:qa}=zt,{DEFAULT_VALUE:Ya,DefaultValue:Za,getConfigDeletionHandler:Xa,registerNode:Ja,setConfigDeletionHandler:Qa}=at,{isRecoilValue:er}=qe,{getRecoilValueAsLoadable:tr,markRecoilValueModified:nr,setRecoilValue:or,setRecoilValueLoadable:ir}=nn,{retainedByOptionWithDefault:ar}=dn,unwrap=e=>e instanceof Ka?e.value:e;function baseAtom(e){const{key:t,persistence_UNSTABLE:n}=e,o=ar(e.retainedBy_UNSTABLE);let i=0;function unwrapPromise(e){return Ga(e.then((e=>(a=$a(e),e))).catch((e=>{throw a=Wa(e),e})))}let a=de(e.default)?unwrapPromise(e.default):Ha(e.default)?"loading"===e.default.state?unwrapPromise(e.default.contents):e.default:$a(unwrap(e.default)),r;maybeFreezeValueOrPromise(a.contents);const s=new Map;function maybeFreezeValueOrPromise(t){return"production"!==process.env.NODE_ENV&&!0!==e.dangerouslyAllowMutability?de(t)?t.then((e=>(ba(e),e))):(ba(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&&or(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&&ir(e,l,Wa(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)||nr(n,l)};a.contents.finally(notifyDefaultSubscribers)}const u=null!==(c=e.effects)&&void 0!==c?c:e.effects_UNSTABLE;if(null!=u){let f=Ya,h=!0,m=!1,g=null;function getLoadable(e){if(h&&e.key===t){const e=f;return e instanceof Za?peekAtom(n,o):de(e)?Ga(e.then((e=>e instanceof Za?a.toPromise():e))):$a(e)}return tr(n,e)}function getPromise(e){return getLoadable(e).toPromise()}function getInfo_UNSTABLE(e){var o;const i=qa(n,null!==(o=n.getState().nextTree)&&void 0!==o?o:n.getState().currentTree,e.key);return!h||e.key!==t||f instanceof Za?i:{...i,isSet:!0,loadable:getLoadable(e)}}const setSelf=e=>t=>{if(h){const n=getLoadable(l),o="hasValue"===n.state?n.contents:Ya;f="function"==typeof t?t(o):t,de(f)&&(f=f.then((t=>(g={effect:e,value:t},t))))}else{if(de(t))throw ue("Setting atoms to async values is not implemented.");"function"!=typeof t&&(g={effect:e,value:unwrap(t)}),or(n,l,"function"==typeof t?n=>{const o=unwrap(t(n));return g={effect:e,value:o},o}:unwrap(t))}},resetSelf=e=>()=>setSelf(e)(Ya),onSet=e=>o=>{var i;const{release:r}=n.subscribeToTransactions((n=>{var i;let{currentTree:r,previousTree:s}=n.getState();s||(Pe("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:Ya;(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 Za)){var p;const w=m?Wa(f):de(f)?Ga(wrapPendingPromise(n,f)):$a(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 pe(o.atomValues.get(t));if(o.nonvalidatedAtoms.has(t)){if(null!=r)return r;if(null==n)return Xe(`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,Ya),s=i instanceof Za?a:$a(i);return r=s,r}return a}function invalidateAtom(){r=void 0}function setAtom(e,n,o){if(n.atomValues.has(t)){const e=pe(n.atomValues.get(t));if("hasValue"===e.state&&o===e.contents)return new Map}else if(!n.nonvalidatedAtoms.has(t)&&o instanceof Za)return new Map;return maybeFreezeValueOrPromise(o),r=void 0,(new Map).set(t,$a(o))}function shouldDeleteConfigOnReleaseAtom(){return void 0!==Xa(t)&&i<=0}const l=Ja({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 ue("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 er(n)?atomWithFallback({...t,default:n}):baseAtom({...t,default:n})}function atomWithFallback(e){const t=atom({...e,default:Ya,persistence_UNSTABLE:void 0===e.persistence_UNSTABLE?void 0:{...e.persistence_UNSTABLE,validator:t=>t instanceof Za?t:pe(e.persistence_UNSTABLE).validator(t,Ya)},effects:e.effects,effects_UNSTABLE:e.effects_UNSTABLE}),n=ja({key:`${e.key}__withFallback`,get:({get:n})=>{const o=n(t);return o instanceof Za?e.default:o},set:({set:e},n)=>e(t,n),cachePolicy_UNSTABLE:{eviction:"most-recent"},dangerouslyAllowMutability:e.dangerouslyAllowMutability});return Qa(n.key,Xa(e.key)),n}atom.value=e=>new Ka(e);var rr=atom;class sr{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 lr,cr=sr,ur=Object.freeze({__proto__:null,MapCache:cr});const{LRUCache:dr}=sa,{MapCache:pr}=ur,fr={equality:"reference",eviction:"none",maxSize:1/0};function cacheFromPolicy({equality:e=fr.equality,eviction:t=fr.eviction,maxSize:n=fr.maxSize}=fr){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=>pa(e)}throw ue(`Unrecognized equality policy ${e}`)}function getCache(e,t,n){switch(e){case"keep-all":return new pr({mapKey:n});case"lru":return new dr({mapKey:n,maxSize:pe(t)});case"most-recent":return new dr({mapKey:n,maxSize:1})}throw ue(`Unrecognized eviction policy ${e}`)}var hr=cacheFromPolicy;const{setConfigDeletionHandler:mr}=at;function atomFamily(e){var t,n;const o=hr({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=rr({...s,key:`${e.key}__${null!==(n=pa(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),mr(c.key,(()=>{o.delete(t)})),c}}var gr=atomFamily;const{setConfigDeletionHandler:vr}=at;let yr=0;function selectorFamily(e){var t,n;const o=hr({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 ue(`Problem with cache lookup for selector ${e.key}: ${t.message}`)}if(null!=i)return i;const a=`${e.key}__selectorFamily/${null!==(n=pa(t,{allowFunctions:!0}))&&void 0!==n?n:"void"}/${yr++}`,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=ja({key:a,get:myGet,set:(e,o)=>n(t)(e,o),cachePolicy_UNSTABLE:r,dangerouslyAllowMutability:e.dangerouslyAllowMutability,retainedBy_UNSTABLE:s})}else l=ja({key:a,get:myGet,cachePolicy_UNSTABLE:r,dangerouslyAllowMutability:e.dangerouslyAllowMutability,retainedBy_UNSTABLE:s});return o.set(t,l),vr(l.key,(()=>{o.delete(t)})),l}}var br=selectorFamily;br({key:"__constant",get:e=>()=>e,cachePolicyForParams_UNSTABLE:{equality:"reference"}}),br({key:"__error",get:e=>()=>{throw ue(e)},cachePolicyForParams_UNSTABLE:{equality:"reference"}});const{loadableWithError:Sr,loadableWithPromise:wr,loadableWithValue:_r}=Te;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&&!de(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?_r(t[n]):de(e)?wr(e):Sr(e))))}function combineAsyncResultsWithSyncResults(e,t){return t.map(((t,n)=>void 0===t?e[n]:t))}br({key:"__waitForNone",get:e=>({get:t})=>{const n=unwrapDependencies(e),[o,i]=concurrentRequests(t,n);return wrapLoadables(e,o,i)},dangerouslyAllowMutability:!0}),br({key:"__waitForAny",get:e=>({get:t})=>{const n=unwrapDependencies(e),[o,i]=concurrentRequests(t,n);return i.some((e=>!de(e)))?wrapLoadables(e,o,i):new Promise((t=>{for(const[n,a]of i.entries())de(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}),br({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}),br({key:"__waitForAllSettled",get:e=>({get:t})=>{const n=unwrapDependencies(e),[o,i]=concurrentRequests(t,n);return i.every((e=>!de(e)))?wrapLoadables(e,o,i):Promise.all(i.map(((e,t)=>de(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}),br({key:"__noWait",get:e=>({get:t})=>{try{return ja.value(_r(t(e)))}catch(e){return ja.value(de(e)?wr(e):Sr(e))}},dangerouslyAllowMutability:!0});const{RecoilLoadable:Ar}=Te,{RecoilRoot:Cr}=Po,{isRecoilValue:Er}=qe,{freshSnapshot:Tr}=eo,{useRecoilState:kr,useRecoilValue:xr,useRecoilValueLoadable:Nr,useSetRecoilState:Rr}=si,{useRecoilCallback:Pr}=Gi;var Vr={RecoilRoot:Cr,atom:rr,selector:ja,atomFamily:gr,useRecoilValue:xr,useRecoilValueLoadable:Nr,useRecoilState:kr,useSetRecoilState:Rr,useRecoilCallback:Pr},Or=Vr.RecoilRoot,Lr=Vr.atom,Mr=Vr.selector,Ir=Vr.atomFamily,Dr=Vr.useRecoilValue,Br=Vr.useRecoilValueLoadable,zr=Vr.useRecoilState,Ur=Vr.useSetRecoilState,Fr=Vr.useRecoilCallback;class jr{}function useActionCallback(e,t=[]){const n=undefined;return Fr((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 jr?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 le.debug(`Error encountered retrieving Recoil value. [key={${t.key}}]`,e),{error:e}}}}var Hr=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,Wr=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,Gr=/^(#|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=Gr.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=Hr.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=Wr.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):Gr.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},$r=Object.freeze({__proto__:null,create:create$2,fromNumber:fromNumber,fromHexString:fromHexString,fromCss:fromCss,fromArray:fromArray,isInvisible:isInvisible,isOpaque:isOpaque,toHexString:toHexString}),Kr;!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 qr=new Uint8Array(16);function rng(){if(!Kr&&!(Kr="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 Kr(qr)}var Yr=/^(?:[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&&Yr.test(e)}for(var Zr=[],Xr=0;Xr<256;++Xr)Zr.push((Xr+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Zr[e[t+0]]+Zr[e[t+1]]+Zr[e[t+2]]+Zr[e[t+3]]+"-"+Zr[e[t+4]]+Zr[e[t+5]]+"-"+Zr[e[t+6]]+Zr[e[t+7]]+"-"+Zr[e[t+8]]+Zr[e[t+9]]+"-"+Zr[e[t+10]]+Zr[e[t+11]]+Zr[e[t+12]]+Zr[e[t+13]]+Zr[e[t+14]]+Zr[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 Jr=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb});const Qr=Lr({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),es=Lr({key:"viewerElementId",default:"vertex-viewer"}),ts=Lr({key:"viewerInitialSceneReady",default:!1}),ns=Lr({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),os=Lr({key:"viewerPrimaryInteractionType",default:"rotate"}),is=Mr({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(Qr))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),as=Lr({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),rs=Mr({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(as))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...o)=>{const i=await e.getPromise(is),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=Jr.create();await e(t,o,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:o,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(is),o=await n(),i=await e.getPromiseRequired(ls);null==o||o.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:i})}))}}const ss=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const o=await e.getPromise(is),i=await o();await(null==i?void 0:i.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:ss}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const o=await e.getPromise(is),i=await o();await(null==i?void 0:i.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:ss}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(ls,t)}))}}const ls=Lr({key:"viewerCameraType",default:"perspective"});class cs{constructor(){this.interactionStarted=!1}initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){var e;this.interactionStarted||(await(null===(e=this.api)||void 0===e?void 0:e.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){var e;await(null===(e=this.api)||void 0===e?void 0:e.endInteraction()),this.interactionStarted=!1}}const create=(e,t=0)=>({normal:e,offset:t}),forAxis=(e,t)=>{switch(e){case"x":return x(t);case"y":return y(t);case"z":return z(t)}},x=e=>create(l.left(),-e),y=e=>create(l.down(),-e),z=e=>create(l.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},us={x:l.left(),y:l.down(),z:l.forward()},xAxis=e=>e.x,yAxis=e=>e.y||l.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||l.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===l.magnitude(l.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>l.dot(l.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return l.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:l.multiply(e.normal,l.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=l.normalize(e.normal),o=l.dot(n,e.position);return towardsCamera(t,create(n,o))},toAxis=(e,t,n,o,i)=>{const a=n.viewAll(),r=getAxis(e,t),s=null!=o&&null!=r?create(r,l.dot(r,i||c.center(o))):forAxis(e,a.lookAt[e]);return towardsCamera(n,s)};function corners(e){return[l.create(e.min.x,e.min.y,e.min.z),l.create(e.min.x,e.min.y,e.max.z),l.create(e.min.x,e.max.y,e.min.z),l.create(e.min.x,e.max.y,e.max.z),l.create(e.max.x,e.max.y,e.max.z),l.create(e.max.x,e.max.y,e.min.z),l.create(e.max.x,e.min.y,e.max.z),l.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 ds="#999999",ps=1,fs={default:5,min:0,max:10},hs=Lr({key:"crossSectioningEnabled",default:!1}),ms=Lr({key:"crossSectioningHighlightColor",default:ds}),gs=Lr({key:"crossSectioningBorderWidth",default:1}),vs=Lr({key:"crossSectioningPlanes",default:[]}),ys=Lr({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),bs=Mr({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(rs)}}),Ss=Lr({key:"crossSectioningIsInteractive",default:!1}),ws=Lr({key:"crossSectioningActiveAxis",default:"x"}),_s=Lr({key:"crossSectioningAvailableAxes",default:us}),As=Mr({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(vs);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),Cs=Mr({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(vs),n=e(bs),o=null!=n?corners(n):[];if(t.length>0){const e=o.map((e=>l.dot(e,isNegativeNormal(t[0])?l.multiply(t[0].normal,l.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return fs}}),Es=Mr({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(vs),n=e(As),o=e(Cs);return t.length>0?t[0].offset*n:o.default}}),Ts=Lr({key:"crossSectioningAdditionalToolsOpen",default:!1}),ks=Lr({key:"crossSectioningAlignmentToolsOpen",default:!1}),xs=Lr({key:"crossSectioningAxisToolsOpen",default:!1}),Ns=Lr({key:"crossSectioningInteractionHandler",default:new cs,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const n=Dr(Ns);i.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(n))}),[e,t,n])}const Rs=Lr({key:"hitResultsTapDetails",default:void 0}),Ps=Lr({key:"hitResultsLongPressDetails",default:void 0}),Vs=Lr({key:"previousHitResult",default:void 0}),Os=Lr({key:"currentHitResult",default:void 0}),Ls=Mr({key:"hitResult",get:async({get:e})=>{var t,n,o,i,a,r,s,c;const u=e(Rs),d=e(Ps),p=null!=u?u:d,f=e(is),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:l.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:l.create((null===(a=null==u?void 0:u.hitPoint)||void 0===a?void 0:a.x)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.y)||0,(null===(s=null==u?void 0:u.hitPoint)||void 0===s?void 0:s.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})))||[]}}}}),Ms=Lr({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=l.dot(l.normalize(e.up),t),o=Math.abs(n)>.98?l.normalize(l.scale(-n,e.viewVector)):e.up,i=l.add(l.scale(l.distance(e.position,e.lookAt),l.multiply(t,l.create(-1,-1,-1))),e.lookAt);return e.update({up:o,position:i})}{const o=l.angleTo(l.normalize(e.viewVector),t),i=null!=n?c.center(n):e.lookAt,a=l.normalize(l.cross(l.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(o,i,a)}};function isParallelTo(e,t){const n=u.toDegrees(l.angleTo(e,t));return 0===n||180===n}const Is=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(gs),n=await e.getPromise(ms),o=await e.getPromise(vs),i=await e.getPromise(is),a=await i();await(null==a?void 0:a.crossSectioning().update({sectionPlanes:o,highlightColor:n?$r.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:o})=>async()=>{const i=await o.getPromise(is),a=await i();if(null!=a){const o=a.camera().viewAll();n(_s),t(vs,[towardsCamera(a.camera(),x(o.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const o=await t.tryGetPromise(Ls).then((e=>e.value)),i=await t.getPromise(is),a=await i();if(null!=o&&null!=a){const t=fromHit(o,a.camera());n(vs,null!=t?[t]:[]),n(_s,null!=t?{x:t.normal}:us),await e()}}))),o=useActionCallback((({set:e,snapshot:n})=>async()=>{const o=await n.getPromise(vs),i=undefined;await n.getPromise(hs)||(e(hs,!0),0===o.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const o=undefined;await n.getPromise(hs)&&(t(hs),t(Ts),t(ks),t(xs),t(vs),t(ys),t(ws),await e())}));return{enable:o,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(hs)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(hs)||await o(),e(Ts,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(Ts)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(xs),e(ks,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(ks)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(ks),e(xs,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(xs)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Ns);e(Ss,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(Ns);e(Ss),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async o=>{const i=await n.getPromise(vs);if(i.length>0){const a=await n.getPromise(As),r=await n.getPromise(Cs),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(vs,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const o=await n.getPromise(vs);t(vs,o.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(vs),n=await e.getPromise(Qr),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:Is}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:o})=>async i=>{const a=await o.getPromise(vs),r=await o.getPromise(_s),s=await o.getPromise(bs),c=await o.getPromise(ys),u=await o.getPromise(Qr),d=await(null==u?void 0:u.scene()),p=r[i],f=null!=p&&a.length>0&&isParallelTo(a[0].normal,p)&&!isNaN(l.angleTo(a[0].normal,p));if(null!=d&&!f){const e=await o.tryGetPromise(Ls).then((e=>e.value));t(ws,i),t(vs,[toAxis(i,r,d.camera(),s,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(xs),await e()}))),updateAlignment:useActionCallback((({set:e,reset:i})=>async(a,r)=>{i(ks),e(ys,{mode:a,hitPending:"global"!==a&&null==r}),"global"===a?(i(ws),i(_s),await t()):"surface"===a&&null!=r&&(await o(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const o=await t.getPromise(ys);o.hitPending&&(e(ys,Object.assign(Object.assign({},o),{hitPending:!1})),"surface"===o.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ys);n.hitPending&&e(ys,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Ds=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Is,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:ds,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:fs,crossSectioningActiveAxis:ws,crossSectioningAdditionalToolsOpen:Ts,crossSectioningAlignment:ys,crossSectioningAlignmentToolsOpen:ks,crossSectioningAvailableAxes:_s,crossSectioningAxisToolsOpen:xs,crossSectioningBorderWidth:gs,crossSectioningEnabled:hs,crossSectioningHighlightColor:ms,crossSectioningInteractionHandler:Ns,crossSectioningIsInteractive:Ss,crossSectioningOffsetScalar:As,crossSectioningPlaneDisplayOffset:Es,crossSectioningPlanes:vs,crossSectioningSliderRange:Cs,crossSectioningTargetBoundingBox:bs,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(p,Object.assign({onInput:r},o))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const n=useCrossSectioningActions(),[o,i]=zr(ms);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,d=__rest(n,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[p,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(f,Object.assign({className:V("w-full",{"mt-0.5":null!=r||null!=s}),value:null!=o?o:p,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)}},d)),s&&e("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:s})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const n=useCrossSectioningActions(),[o,i]=zr(gs);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]=zr(ms),[a,r]=zr(gs),s=undefined;return e("div",{className:"ml-auto",children:e(h,{content:"Reset Cross Sectioning Appearance",children:e(m,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(ds),r(1),null==t||t(),await n.reapply()},disabled:!(o!==ds||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 Bs=.5,zs="#444444",Us=Lr({key:"featureEdgesSelectedColor",default:zs}),Fs=Lr({key:"featureEdgesLineThickness",default:Bs}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[n,o]=zr(Us);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]=zr(Fs);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]=zr(Us),[i,a]=zr(Fs),r=undefined;return e("div",{className:"ml-auto",children:e(h,{content:"Reset Feature Edges",children:e(m,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(zs),a(Bs),null==t||t()},disabled:!(i!==Bs||n!==zs)})})})};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 js=Lr({key:"contextMenuActive",default:void 0}),Hs=Lr({key:"contextMenuPosition",default:void 0}),Ws=Lr({key:"contextMenuTarget",default:void 0}),Gs=Lr({key:"contextMenuItem",default:void 0}),$s=Lr({key:"contextMenuActions",default:[]}),Ks=Mr({key:"contextMenuActivePosition",get:({get:e})=>null!=e(js)?e(Hs):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(Hs,d.create(n,o)),e(Ws,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,o,i,a)=>{const r=await e.getPromise(Hs),s=await e.getPromise(js);if(null!=r&&null==s){const e=n.clientX,s=null==n?void 0:n.clientY,l=d.create(e,s),c=null!=r?d.distance(r,l):0,u=null==i||i(n);c<2&&u&&(null==a||a(n,null!=r?r:l),t(js,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=d.create(t.touches[0].clientX,t.touches[0].clientY);e(Hs,o),e(Ws,t.target),e(js,n),null==i||i(t,o)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Ms,!!n),e(js),e($s),e(Hs)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Ms)))}}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 qs=Lr({key:"boxSelectionEnabled",default:!1}),Ys=Lr({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(qs,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(qs),e(Ys)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Ys,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 Zs=Lr({key:"isEditingPointToPointMeasurement",default:!1}),Xs=Lr({key:"pointToPointMeasurementOutcome",default:void 0}),Js=Lr({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=Ur(Xs);a((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const Qs=2,el=Lr({key:"isEditingPreciseMeasurement",default:!1}),tl=Lr({key:"preciseMeasurementOutcome",default:void 0}),nl=Lr({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),ol=Lr({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),il=Lr({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),al=Mr({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(il).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,n){const o=Ur(il),i=Ur(tl),r=Ur(nl),s=Ur(ol),l=Dr(nl);a((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{o(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,o]),a((()=>{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]),a((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==l||l.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,l]),a((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementController)}))}),[e,r]),a((()=>{whenComponentReady(e,(()=>{s(null==e?void 0:e.measurementOverlays)}))}),[e,s])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),o=useDisablePreciseMeasurement(),i=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(nl);null==t||t.clearEntities()})),a=useActionCallback((()=>async(e={})=>{await i(),n(e),o()})),r=useActionCallback((({set:e,reset:n})=>async o=>{await a(),"point-to-point"===o?t():(n(tl),n(il),e(el,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await a(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await r(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(el),o=await e.getPromise(Zs);n?await i():o&&(t(Xs),t(Js))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(Js)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(Js,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Zs)?await a():await r("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(el)?await a():await r("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Zs,!0),n.keepExistingMeasurement||e(Xs)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Zs),t.keepExistingMeasurement||(e(Js),e(Xs))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(el),e(tl),e(il)}))}const rl=Mr({key:"isEditingMeasurement",get:({get:e})=>e(Zs)||e(el)}),sl=Mr({key:"measurementPanelModel",get:({get:e})=>e(Xs)||e(tl)}),ll=Mr({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(ol)}),cl=Mr({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(el)?e(al):void 0}}),ul=Mr({key:"measurementPanelIsResettable",get:({get:e})=>e(rl)&&null!=e(sl)}),dl=3e3,pl=Lr({key:"applicationMessageToast",default:void 0}),fl=Lr({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(fl,null!=t?Object.assign(Object.assign({},t),{id:Jr.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(pl,null!=t?Object.assign(Object.assign({},t),{id:Jr.create()}):void 0)}))});var hl;!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"}(hl||(hl={}));const ml=Ir({key:"selectionSelectedItems",default:void 0}),gl=Lr({key:"selectionSelectedItemIds",default:[]}),vl=Lr({key:"selectionLastSelected",default:void 0}),yl=Lr({key:"selectionLastSelectionFromViewer",default:!1}),bl=Lr({key:"selectionLastSelectWasMultiSelect",default:!1}),Sl=Mr({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const o=e(vl),i=e(gl);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}}),wl=Lr({key:"selectionPreviousVisibleSummary",default:void 0}),_l=Lr({key:"selectionVisibleSummary",default:void 0}),Al=Mr({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(_l))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),Cl=Mr({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(_l);return null!=(null==t?void 0:t.boundingBox)?c.center(t.boundingBox):l.origin()}}),El=Mr({key:"selectionIsActive",get:({get:e})=>{const t=e(gl),n=undefined;return e(Al)>0||t.length>0}}),Tl=Lr({key:"transformWidgetEnabled",default:!1}),kl=Lr({key:"transformWidgetPosition",default:void 0}),xl=Lr({key:"transformWidgetOrientationOverride",default:void 0}),Nl=Mr({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(xl);if(null!=t)return t}}),Rl=Lr({key:"transformWidgetCachedOrientation",default:void 0}),Pl=Lr({key:"transformWidgetSyncToSelection",default:!1}),Vl=Lr({key:"transformWidgetIsInteracting",default:!1}),Ol=Ir({key:"appliedItemTransform",default:void 0}),Ll=Lr({key:"appliedItemTransformIds",default:[]}),Ml=Lr({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Cl);e(kl,n)})),o=useActionCallback((({set:e,snapshot:t})=>async()=>{const o=await t.getPromise(kl),i=await t.getPromise(bl),a=await t.getPromise(gl),r=await t.getPromise(Al);null==o&&(a.length>0||i||r>0)&&await n(),e(Pl,!0)})),i=useActionCallback((({set:e})=>async t=>{e(kl,null!=t?t:void 0)})),a=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const o=await e.getPromise(Nl),i=undefined;(await e.getPromise(Ll)).forEach((e=>{n(Ol(e))})),null!=o&&t(Rl,o)}))),r=useActionCallback((({set:e,reset:t})=>n=>{t(Rl),e(xl,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(a,r)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:dl}),t(Tl,!0),r?await n():null==a?await o():await i(a)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Tl),e(xl)})),setTransformWidgetOrientation:r,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Rl),e(xl)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(kl))),invalidateTransforms:a,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(Vl,t)})),setDefaultWidgetPosition:o,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Pl,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Pl))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(wl),n=await e.getPromise(_l),o=undefined;if(await e.getPromise(Pl)){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(c.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Pl),null!=t?(await i(null==t?void 0:t.position),r(l.eulerTo(l.up(),t.normal))):(e(kl),r(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(hl.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(kl,void 0),e(Tl,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(hl.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(kl,void 0),e(Tl,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),o=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Ls).then((e=>e.value)),o=await e.getPromise(Js);null==n&&null!=(null==o?void 0:o.start)&&null!=o.end&&await t.resetMeasurement()}))),i=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Ls).then((e=>e.value));await n.orientToHitResult(t)}))),a=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Ls).then((e=>e.value));e(Gs,n)}))),r=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Os,await e.tryGetPromise(Ls).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:s},...l)=>{const c=await t.getPromise(rl),u=await t.getPromise(ys),d=2!==(null==s?void 0:s.buttons)&&!(null==s?void 0:s.altKey);s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;const p=d&&!u.hitPending&&!c,f=await t.tryGetPromise(Ls).then((e=>e.value));n(Vs,f),n(Rs,s),await o(),p&&(l.forEach((e=>e())),await i()),await a(),await e.sectionCurrentHit(),await r()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async o=>{n(Rs),t(Ps,o.detail),await e.tryGetPromise(Ls),await a(),await r()})))}},Il=Mr({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,o=undefined,i=undefined,a=undefined;return{tapDetails:e(Rs),longPressDetails:e(Ps),previousHitResult:e(Vs),currentHitResult:e(Os)}}});var Dl=Object.freeze({__proto__:null,currentHitResult:Os,hitResult:Ls,hitResultsLongPressDetails:Ps,hitResultsSkipNextTap:Ms,hitResultsTapDetails:Rs,hitState:Il,previousHitResult:Vs,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(gl)).forEach((e=>t(ml(e))))})),o=useActionCallback((({snapshot:e,reset:n,set:o})=>async(i,a)=>{var r,s;const l=await e.getPromise(ml(i.id)),c=await e.getPromise(gl),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(ml(d),{id:d}),o(gl,(e=>[...e,d])),t.execute(hl.SELECTING_ANCESTOR,t.selectItemsTransform(d))):(null==a?void 0:a.clear)?(o(ml(i.id),i),o(gl,[i.id]),t.execute(hl.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(i.id))):(o(ml(i.id),i),o(gl,(e=>[...e,i.id])),t.execute(hl.SELECTING_ITEMS,t.selectItemsTransform(i.id))),u(i),o(vl,i),o(yl,!0),n(bl)})),i=useActionCallback((({reset:e,set:n})=>async o=>{e(ml(o)),e(bl),n(gl,(e=>e.filter((e=>e!==o)))),t.execute(hl.DESELECTING_ITEMS,t.deselectItemsTransform(o))})),a=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(ml(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(ml(a.id)),l=await t.getPromise(gl);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(ml(e)))),n(bl),s)if(r.ignoreAncestorSelection)n(gl),n(ml(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(gl,e)}else n(gl);e.clearTransformWidgetOrientation(),await o(a,{clear:!0})})),s=useActionCallback((({reset:t})=>async()=>{await n(),t(gl),t(vl),t(yl),t(bl),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),l=useActionCallback((()=>async()=>{await s(),t.execute(hl.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(bl,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(Ls).then((e=>e.value)),n=await e.getPromise(Rs),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(ml(o.id),o),i.multiSelect?e(gl,(e=>[...e.filter((e=>e!==o.id)),o.id])):e(gl,[o.id]),u(o),e(vl,o),e(yl,!1),e(bl,!!i.multiSelect)):(t(ml(o.id)),t(bl),e(gl,(e=>e.filter((e=>e!==o.id)))))})),deselect:i,clearSelection:l,resetSelectionState:s,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:u}}const Bl=Mr({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,o=undefined,i=undefined;return{selectedItemIds:e(gl),lastSelected:e(vl),highestSelectedAncestorId:e(Sl)}}});var zl=Object.freeze({__proto__:null,selectionBoundingBoxCenter:Cl,selectionHighestSelectedAncestor:Sl,selectionIsActive:El,selectionLastSelectWasMultiSelect:bl,selectionLastSelected:vl,selectionLastSelectionFromViewer:yl,selectionPreviousVisibleSummary:wl,selectionSelectedItemIds:gl,selectionSelectedItems:ml,selectionState:Bl,selectionVisibleCount:Al,selectionVisibleSummary:_l,useSelectionActions:useSelectionActions});const Ul=255,Fl=Lr({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),jl=Lr({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),Hl=Ir({key:"appliedItemMaterialOverride",default:void 0}),Wl=Lr({key:"appliedItemMaterialOverrideIds",default:[]}),Gl=Mr({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(vl);if(null!=t)return e(Hl(t.id))}}),$l=Lr({key:"applyMaterialToAllUserAction",default:void 0}),Kl=Lr({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),ql=Lr({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Wl);t(Fl),n.forEach((e=>t(Hl(e)))),t(Wl)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(Fl,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(Fl)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(jl)})),clear:useActionCallback((({snapshot:t,set:n,reset:o})=>async()=>{const i=await t.getPromise(gl);o(Fl),i.forEach((e=>o(Hl(e)))),n(Wl,(e=>e.filter((e=>!i.includes(e))))),await e.execute(hl.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(hl.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(jl,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const o=await t.getPromise(Fl),i=await t.getPromise(jl),a=await t.getPromise(gl),r=await t.getPromise(Gl),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(hl.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),a.forEach((e=>n(Hl(e),t))),n(Wl,(e=>[...e,...a]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(ql,!0),e($l,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(ql),e($l)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const o=await t.getPromise(Fl),i=await t.getPromise(jl);if(null!=o){const a=await t.getPromise(Wl),r=Object.assign(Object.assign({},o),{opacity:null!=i?i:o.opacity});await e.execute(hl.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(r))),a.forEach((e=>n(Hl(e))));const s=await t.getPromise($l);null==s||s(r),n(ql),n($l)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Kl,!1)}))}},Yl="#FFFFFF",Zl=Lr({key:"viewerBackgroundSelectedColor",default:Yl}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const n=useSceneItemMaterialActions(),i=Br(Gl),a=Dr(Fl),r=Dr(Kl),s=o.useMemo((()=>"hasValue"===i.state?null!=a?a:i.contents:a),[i,a]);return e(h,{content:"Apply to All",children:e(m,{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=Dr(ql),[r,s]=i.useState(!1),onCloseDialog=()=>{o.cancelApplyAll(),s(!1)};return a?t(g,{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(v,{"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(b,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e(b,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await o.applyAll(),r&&o.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e(n,{})}function createColorMaterialWithId(e,t=Jr.create()){return Object.assign({id:t},O.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const n=useSceneItemMaterialActions(),i=Br(Gl),a=Dr(Fl),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?$r.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=Dr(jl),a=Br(Gl),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:Ul:null!=i?i:Ul}),[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(h,{className:"flex w-full",content:c?"Select a part and apply a color to enable opacity":`${Math.floor(r/Ul*100)}%`,placement:"top",children:e(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:c,value:null!=r?r:Ul,step:5,min:0,max:Ul,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=Dr(vl);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(S,{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(h,{content:o,disabled:r,placement:"bottom",children:t(b,{className:V("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(w,{className:"px-0.5",name:"reset",size:"sm"}),e(w,{name:"chevron-down",size:"sm"})]})})}),e("div",{className:"whitespace-nowrap",children:a})]})})},VertexSceneItemMaterialClear=({onClear:n,onClearAll:o})=>{const i=useSceneItemMaterialActions(),a=Dr(El);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e("div",{className:"pt-1"}),e(_,{"data-testid":"clear-selected-materials",onClick:()=>{i.clear(),null==n||n()},disabled:!a,children:"Clear selected materials"}),e(_,{"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 Xl="#ffff00",Jl=35,Ql=1,ec=Lr({key:"selectionHighlightingSelectedColor",default:Xl}),tc=Lr({key:"selectionHighlightingSelectedOpacity",default:Jl}),nc=Lr({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[n,o]=zr(ec);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]=zr(nc);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]=zr(tc);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]=zr(ec),[i,a]=zr(tc),[r,s]=zr(nc),l=undefined;return e("div",{className:"ml-auto",children:e(h,{content:"Reset Selection Highlighting",children:e(m,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(Xl),a(Jl),s(1),null==t||t()},disabled:!(n!==Xl||i!==Jl||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]=zr(Zl);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]=zr(Zl),i=undefined;return e("div",{className:"ml-auto",children:e(h,{content:"Reset Background Color",children:e(m,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(Yl),null==t||t()},disabled:!(n!==Yl)})})})};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 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[Dr(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const n=Fr((({set:n})=>async o=>{n(t,(t=>e(t,o)))}),[]);return n},oc=Lr({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:oc});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=Jr.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=Dr(qs);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>n,cancelPredicate:()=>!n},[n]),e(h,{content:"Box Selection",children:e(m,{iconName:"box-cursor",iconColor:n?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:n?t.disable:t.enable})})},ic=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(A,Object.assign({id:s,"data-testid":`resizable-content-position-${c}`,className:V(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:V("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(is),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(d.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&&d.distance(s,d.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=Dr(js),d=Dr(Ks),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:V({hidden:!f}),children:e(C,{"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=Dr(gl),o=Dr(_l),i=useViewerCameraActions();return t(_,{"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(w,{slot:"icon",name:"fit-selected",size:"sm"}),e("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const n=useViewerCameraActions(),o=Dr(Gs);return t(_,{"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(w,{slot:"icon",name:"paper-airplane",size:"sm"}),e("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=Dr(Qr),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(_,{"data-testid":"hide-all-menu-option",onClick:()=>{n.sceneItemsOperation((e=>e.hide()))},children:[e(w,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const n=Dr(Gs),o=useSceneItemsOperations();return t(_,{"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(w,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const n=Dr(gl),o=useSceneItemsOperations();return t(_,{"data-testid":"hide-selected-menu-option",onClick:()=>o.hideSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(w,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const n=useSceneItemsOperations();return t(_,{"data-testid":"show-all-menu-option",onClick:()=>{n.sceneItemsOperation((e=>e.show()))},children:[e(w,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const n=Dr(Gs),o=useSceneItemsOperations();return t(_,{"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(w,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const n=Dr(gl),o=useSceneItemsOperations();return t(_,{"data-testid":"show-only-selected-menu-option",onClick:()=>o.showOnlySelected(),disabled:asBooleanAttribute(0===n.length),children:[e(w,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show Only Selected"})]})};Lr({key:"sceneTreeLoaderVisible",default:!1});const ac=Lr({key:"sceneTreeElement",default:void 0}),rc=Lr({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(vl);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(ac),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(ac),i=await(null==o?void 0:o.getRowAtClientY(n));e(Gs,i)}))}}Mr({key:"sceneTreeController",get:({get:e})=>{var t;return null===(t=e(ac))||void 0===t?void 0:t.controller},dangerouslyAllowMutability:!0});const VertexGhostSelectedMenuItem=()=>{const n=Dr(gl),o=useSceneItemsOperations();return t(_,{"data-testid":"ghost-selected-menu-option",onClick:()=>o.ghostSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(w,{slot:"icon",name:"visibility-partial",size:"sm"}),e("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const n=Dr(gl),o=useSceneItemsOperations();return t(_,{"data-testid":"unghost-selected-menu-option",onClick:()=>o.unGhostSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(w,{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(E,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const n=useSceneTreeActions(),o=Dr(ac),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(E,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,o=i.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:o,children:n?t:e(DefaultViewerContextMenu,{})})},sc=undefined,lc=Lr({key:"sceneItemGhostingSelectedOpacity",default:35}),cc=Ir({key:"appliedItemPhantomState",default:void 0}),uc=Lr({key:"appliedItemPhantomStateIds",default:[]}),dc=Mr({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(vl);return null!=n&&(null!==(t=e(cc(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[n,o]=zr(lc);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(uc)).forEach((e=>t(cc(e)))),t(uc)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async o=>{const i=await t.getPromise(gl);i.forEach((e=>n(cc(e),o))),n(uc,(e=>[...e,...i])),await e.execute(hl.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(gl);i.forEach((e=>o(cc(e)))),n(uc,(e=>e.filter((e=>!i.includes(e))))),await e.execute(hl.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(hl.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=Dr(El),i=Br(dc);return e(h,{content:"Select a part to display as ghost",disabled:o,children:e(v,{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=Dr(dc);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e("div",{className:"pt-1"}),e(_,{"data-testid":"reset-selected-phantom",onClick:async()=>{await i.clearPhantomState(),null==n||n()},disabled:!a,children:"Clear ghosting for selected"}),e(_,{"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 VertexMeasurementContextMenu({onDelete:n}){const o=Dr(Ws);return e(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:t(_,{"data-testid":"measurement-delete",onClick:()=>null!=o&&n(o.id),children:[e(w,{slot:"icon",name:"delete",size:"sm"}),e("div",{className:"pl-2",children:"Delete"})]})})}var pc,fc;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(pc||(pc={})),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"}(fc||(fc={}));const convertFrom=(e,t)=>{const n=undefined;return e/fc[t]},convertTo=(e,t)=>{const n=undefined;return e*fc[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,i]=o.useState(d.create(0,0));return o.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),o=d.create(n.left,n.bottom),a=d.create(n.right,n.bottom);i("left"===t?o:a)}}),[e,t]),n}function VertexMeasurementDetails({placement:n}){const o=useMeasurementActions(),i=Dr(Qr),a=Dr(es),r=useDockedPlacement(null!=i?i:null,n),s=Dr(sl),l=Dr(ll),c=Dr(cl),u=Dr(ul);return e(T,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${a}`,position:r,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:V("-mt-1 relative",{hidden:!u}),children:e(h,{content:"Reset",placement:"left-start",children:e(m,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:o.resetMeasurement})})})]}),e(L,{"data-testid":"measurement-details-viewer-measurement-details",className:V("gap-y-1.5 text-xs",{hidden:null==s}),measurementOutcome:s,measurementOverlays:l,fractionalDigits:parseInt("2",10),distanceUnits:toUnitType("m")}),e("div",{"data-testid":"measurement-details-message",className:V("text-xs",{hidden:null==c}),children:c})]})})}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)),[])}}function VertexPointToPointMeasurement({detailsPlacement:o,onPointToPointMeasurementChange:i}){const a=useMeasurementActions(),s=Dr(Qr),l=Dr(Zs),c=Dr(Js),{callback:u,element:d}=useCallbackRef();usePointToPointMeasurement(d);const p=r((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};a.setEditedPointToPointMeasurement(t),null==i||i(t)}),[a]);return l?t(n,{children:[e(M,{"data-testid":"point-to-point-measurement",ref:u,viewer:null!=s?s: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("m"),fractionalDigits:parseInt("2",10),showAxisReferenceLines:!0,onEditEnd:p}),e(VertexMeasurementDetails,{placement:o}),e(VertexMeasurementContextMenu,{onDelete:a.resetMeasurement})]}):e(n,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),n=Dr(Zs);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>n,cancelPredicate:()=>!n},[n,t]),e(h,{content:"Point to Point Measurement",children:e(m,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const hc=Lr({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:o,onEntitiesChanged:i,onOutcomeChanged:a})=>{var r,s,l,c;const u=Dr(Qr),d=Dr(hc),p=Dr(el),{callback:f,element:h}=useCallbackRef();return usePreciseMeasurementModel(h,i,a),p?t(n,{children:[e(I,{"data-testid":"precise-measurement-viewer-tool",ref:f,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(r=null==d?void 0:d.network)||void 0===r?void 0:r.apiHost,renderingHost:null===(s=null==d?void 0:d.network)||void 0===s?void 0:s.renderingHost,sceneTreeHost:null===(l=null==d?void 0:d.network)||void 0===l?void 0:l.sceneTreeHost,sceneViewHost:null===(c=null==d?void 0:d.network)||void 0===c?void 0:c.sceneViewHost}})}),e(VertexMeasurementDetails,{placement:o})]}):e(n,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),n=Dr(el);return e(h,{content:"Precise Measurement",children:e(m,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const o=Dr(fl),i=Dr(pl);return t(n,{children:[null!=o&&e(k,{className:"z-[16000]",duration:o.duration,open:!0,content:o.message,type:o.type},o.id),null!=i&&e(N,{placement:"bottom-left",className:"z-[16000]",duration:i.duration,open:!0,content:i.message,type:i.type},i.id)]})}const targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=Fr((({set:t})=>n=>{t(e,n)}),[]);return t}var mc;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===mc.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(mc||(mc={}));const VertexSceneTreeCollapseAll=()=>{const t=Dr(ac);return e(h,{className:"w-auto",content:"Collapse All",placement:"top",children:e(w,{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=Dr(ac);return e(h,{className:"w-auto",content:"Expand All",placement:"top",children:e(w,{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(D,{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(B,{className:"border-b border-neutral-300"}),e(VertexSceneTreeToolbar,{})]})})},gc={binding:"{{row.node.name}}",label:"Name",metadataKeyName:"VERTEX_SCENE_ITEM_NAME"},vc=Mr({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=[],n=e(rc);if(null!=n&&n>0){const e=1/(t.length+1)*n,o=(n-e)/t.length;return{Name:Object.assign(Object.assign({},gc),{initialWidth:e,minWidth:o})}}return{Name:gc}}}),yc=Mr({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(vc))}),VertexSceneTreeTableLayout=n=>{const o=Dr(vc),i=Dr(yc),a=[];return e(U,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(F,{"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="${V("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=Dr(hc),b=useSelectionActions(),S=useSceneTreeActions(),w=Dr(Qr),_=useRecoilRef({state:ac}),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:V("flex flex-col w-full h-full",h),children:e("div",{className:"flex group h-full",children:e(j,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=>{le.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,{})]})}))})})},bc=Lr({key:"openedPanelActivePrimaryLeft",default:void 0}),Sc=Lr({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?bc:Sc,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?bc:Sc,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=Dr(El);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e("div",{className:"pt-1"}),e(_,{"data-testid":"reset-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==n||n()},disabled:!a,children:"Clear selected transforms"}),e(_,{"data-testid":"reset-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==o||o()},children:"Clear all transforms"})]})})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const n=useTransformActions(),o=Dr(Tl),i=Ur(Ml);return e(v,{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 wc="Appearance",_c="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,n=getHeading(Dr(Sc));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 wc;case"transforms":return _c;default:return"None"}}function VertexViewerRightOpenedPanel(){const o=Dr(Sc),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:p}){return e("div",{className:V({"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?p():d())},children:t(h,{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(w,{name:o}),u]})]})})}function VertexViewerRightSidebar(){const n=usePanelActions(),o=Dr(Sc);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(R,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(i)},r,{children:[s,e("div",{className:V("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(h,{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=Dr(ks),i=Dr(ys),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(m,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:o?n.closeAlignmentTools:n.openAlignmentTools,children:e(w,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),t(H,{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(m,{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(m,{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=Dr(xs),a=Dr(vs),r=Br(_s),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(m,{onClick:o?n.closeAxisTools:n.openAxisTools,iconName:s,"data-testid":"align-plane-icon",iconColor:"secondary",children:e(w,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),t(H,{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(m,{"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(m,{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(m,{"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,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(h,{content:"Plane Offset",children:e("form",{"data-testid":"cross-section-stepper-form",onSubmit:e=>{e.preventDefault(),r(convertFrom(s,o))},children:t(P,{"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(w,{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(w,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Ac=400;function VertexViewerCrossSectionPopupMenu({decimalPlaces:n,measurementUnit:o}){const a=useCrossSectioningActions(),r=Dr(Ts),s=Br(Cs),l=Br(Es),c=i.useRef(),u=i.useMemo((()=>"hasValue"===s.state?s.contents:fs),[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()}),Ac),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(w,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:r?a.closeAdditionalTools:a.openAdditionalTools})})}),t(H,{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(h,{className:"w-auto",content:"Reverse",children:e(m,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:a.flipPlanes,iconColor:"secondary"})}),e(h,{className:"w-auto",content:"Align View to Plane",children:e(m,{"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=Dr(hs);return t(n,{children:[e(h,{content:r?"Hide Section":"Show Section",children:e(m,{"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=Dr(Qr);return e(h,{content:"Fit All",children:e(m,{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=Dr(Qr),n=Dr(ts),[o,a]=zr(os),[r,s]=zr(ns);return i.useEffect((()=>{null!=t&&n&&s(t.getBaseInteractionHandler())}),[t,n,s]),e(h,{content:"Pan",children:e(m,{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=Dr(Qr),n=Dr(ts),[o,a]=zr(os),[r,s]=zr(ns);return i.useEffect((()=>{null!=t&&n&&s(t.getBaseInteractionHandler())}),[t,n,s]),e(h,{content:"Rotate",children:e(m,{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=Dr(Qr),n=Dr(ts),[o,a]=zr(os),[r,s]=zr(ns);return i.useEffect((()=>{null!=t&&n&&s(t.getBaseInteractionHandler())}),[t,n,s]),e(h,{content:"Zoom",children:e(m,{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(W,{placement:"bottom-center",children:t(H,{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,{}),e(VertexViewerToolbarDivider,{}),e(VertexPointToPointMeasurementTool,{}),e(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=undefined;return e(W,{placement:"bottom-center",children:null!=t&&!1!==t?e(H,{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=Dr(Pl),d=Dr(Tl),p=Dr(kl),f=Dr(Rl),h=Br(Nl),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(G,{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(h,{content:"Reset View",children:e(m,{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(_l);t(as,o.detail.scene),t(_l,o.detail.scene.sceneViewSummary.selectedVisibleSummary),t(wl,i);const a=undefined;await n.getPromise(Tl)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:n}=useCallbackRef(),i=useBoxSelectionActions(),a=useTransformActions(),r=Dr(Ys);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($,{ref:n,"data-testid":"viewer-box-query-tool",operationType:r})};function VertexViewerCameraTypeMenu({open:n,onOpen:o,onDismiss:i,onCameraTypeChange:a}){const r=useViewerCameraActions(),s=Dr(ls);return t(C,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(n),onMenuClosed:i,children:[e("div",{slot:"anchor",children:e("div",{className:V("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(h,{content:"Change View",children:e(m,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:o,iconName:"orthographic"===s?"cube-orthographic":"cube-perspective",children:e(w,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),t("div",{className:"w-36",children:[e("div",{className:"pt-1"}),t(_,{"data-testid":"set-perspective-view",onClick:()=>{r.updateCameraType("perspective"),null==a||a("perspective")},children:[e(w,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:V({"text-[var(--vertex-ui-blue-700)]":"perspective"===s})}),e("div",{className:V("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===s}),children:"Perspective"})]}),t(_,{"data-testid":"set-orthographic-view",onClick:()=>{r.updateCameraType("orthographic"),null==a||a("orthographic")},children:[e(w,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:V({"text-[var(--vertex-ui-blue-700)]":"orthographic"===s})}),e("div",{className:V("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!==K)).filter((e=>null!=e&&!1!==e)),c=s.find((e=>i.isValidElement(e)&&e.type===K)),[u,d]=i.useState(!1);return t(W,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=o?o:"top-right",children:[null!=c?c:e(K,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=Dr(hc),g=useRecoilRef({state:Qr}),v=useViewerCameraActions(),b=useHitActions(),S=useSelectionActions(),w=useViewerFrameActions(),[_,A]=zr(ts),C=Dr(ls),E=Dr(ys),T=Dr(qs),[k,N]=zr(es);i.useEffect((()=>{null!=a&&N(a)}),[a]);const R=Dr(lc),P=i.useMemo((()=>({opacity:R/100})),[R]),O=Dr(Us),L=Dr(Fs),M=i.useMemo((()=>({color:O,width:L})),[O,L]),I=Dr(Zl),D=Dr(ec),B=Dr(tc),U=Dr(nc),F=i.useMemo((()=>({color:D,opacity:B/100,lineWidth:U})),[D,B,U]),j=Dr(el),H=null!=f&&!1!==f;return useKeyBindings(),useDefaultKeybindings(),t(q,Object.assign({id:k,"data-testid":"vertex-viewer",ref:null!=p?p:g,className:V("flex w-full h-full",r,{"cursor-crosshair":E.hitPending}),style:{"--viewer-background":I},config:m,cameraType:_?C:void 0,onCameraTypeChanged:e=>{_&&v.updateCameraType(e.detail)},phantom:P,featureLines:M,selectionHighlighting:F,featureMaps:j?"final":void 0,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,{}),H?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=Dr(Il),r=Dr(Bl);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)&&(Z(),Y())}),[r]),e(Or,{override:a,children:t(n,{children:[e(VertexViewerToolkitEventListener,Object.assign({},c)),e(VertexViewerToolkitRootConfig,{config:l,children:s})]})})},VertexViewerToolkitRootConfig=({config:t,children:o})=>{const a=Ur(hc);return i.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;a(e)}),[t,a]),e(n,{children:o})};var Cc=Object.freeze({__proto__:null,get AssemblyFontFace(){return mc}});export{Ds as CrossSection,Dl as Hits,Cc as SceneTree,zl 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,VertexMeasurementContextMenu,VertexMeasurementDetails,VertexPanButton,VertexPointToPointMeasurement,VertexPointToPointMeasurementTool,VertexPreciseMeasurement,VertexPreciseMeasurementTool,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
|
+
export{i as CrossSection,d as Hits,e as SceneTree,f as Selection,V as VertexApplicationMessages,g as VertexBoxSelectionButton,h as VertexContextMenu,j as VertexCrossSectionAppearanceColorPicker,k as VertexCrossSectionAppearanceControls,l as VertexCrossSectionAppearanceLineThicknessSlider,m as VertexCrossSectionAppearancePanelSection,n as VertexCrossSectionAppearanceReset,o as VertexFeatureEdgesColorPicker,p as VertexFeatureEdgesControls,q as VertexFeatureEdgesPanelSection,r as VertexFeatureEdgesReset,s as VertexFeatureEdgesThicknessSlider,t as VertexFitAllButton,u as VertexFitSelectedMenuItem,v as VertexFlyToMenuItem,w as VertexGhostingControls,x as VertexGhostingPanelSection,y as VertexHideAllMenuItem,z as VertexHidePartMenuItem,A as VertexHideSelectedMenuItem,B as VertexMaterialControls,C as VertexMaterialPanelSection,D as VertexMeasurementContextMenu,E as VertexMeasurementDetails,F as VertexPanButton,G as VertexPointToPointMeasurement,H as VertexPointToPointMeasurementTool,I as VertexPreciseMeasurement,J as VertexPreciseMeasurementTool,K as VertexResizableContent,L as VertexRotateButton,M as VertexSceneItemGhostingClear,N as VertexSceneItemGhostingOpacitySlider,O as VertexSceneItemGhostingToggle,P as VertexSceneItemMaterialClear,Q as VertexSceneItemMaterialColorPicker,R as VertexSceneItemMaterialOpacitySlider,S as VertexSceneTree,T as VertexSceneTreeContextMenu,U as VertexSceneTreeHeader,W as VertexSceneTreeTableLayout,X as VertexSelectionHighlightingColorPicker,Y as VertexSelectionHighlightingControls,Z as VertexSelectionHighlightingLineThicknessSlider,$ as VertexSelectionHighlightingOpacitySlider,a0 as VertexSelectionHighlightingPanelSection,a1 as VertexSelectionHighlightingReset,a2 as VertexShowAllMenuItem,a3 as VertexShowOnlyMenuItem,a4 as VertexShowOnlySelectedMenuItem,a5 as VertexToolbar,a6 as VertexTransformClear,a7 as VertexTransformControls,a8 as VertexTransformManipulatorToggle,a9 as VertexTransformPanelSection,aa as VertexTransformWidget,ab as VertexViewer,ac as VertexViewerBackgroundColorPicker,ad as VertexViewerBackgroundControls,ae as VertexViewerBackgroundPanelSection,af as VertexViewerBackgroundReset,ag as VertexViewerContextMenu,ah as VertexViewerCrossSectionButton,ai as VertexViewerRightOpenedPanel,aj as VertexViewerRightSidebar,ak as VertexViewerSceneReset,al as VertexViewerToolbarDivider,am as VertexViewerToolkitRoot,an as VertexViewerViewCube,ao as VertexZoomButton}from"./index-D2hdasNC.js";import"react/jsx-runtime";import"recoil";import"react";import"@vertexvis/ui-react";import"@vertexvis/viewer-react";
|
|
2
2
|
//# sourceMappingURL=bundle.esm.js.map
|