{"version":3,"sources":["../src/react/index.tsx","../src/react/hooks.ts","../src/shared/sdk-bundle.ts","../src/shared/constants.ts","../src/shared/sdk-loader.ts","../src/shared/hooks.ts","../src/shared/utils.ts","../src/shared/styles.ts"],"sourcesContent":["import { useRef, useState, useEffect } from \"react\";\nimport type { UnicornSceneProps } from \"../shared/types\";\nimport { useUnicornStudioScript, useUnicornScene } from \"./hooks\";\nimport { DEFAULT_VALUES } from \"../shared/constants\";\nimport { unicornStyles } from \"../shared/styles\";\nimport { isWebGLSupported } from \"../shared/utils\";\n\n/**\n * React component for rendering Unicorn Studio WebGL animations.\n *\n * @remarks\n * This component wraps Unicorn Studio's WebGL animation system for use in React applications.\n * It handles SDK loading, scene initialization, placeholder display, and error\n * states. The bundled Unicorn Studio SDK is used by default, while `sdkUrl`\n * can override it with a custom script URL.\n *\n * The component requires either a `projectId` (to load from Unicorn Studio's servers)\n * or a `jsonFilePath` (to load from a local JSON file).\n *\n * @param props - The component props\n *\n * @example\n * Basic usage with project ID:\n * ```tsx\n * <UnicornScene\n *   projectId=\"your-project-id\"\n *   width={800}\n *   height={600}\n * />\n * ```\n *\n * @example\n * With placeholder and callbacks:\n * ```tsx\n * <UnicornScene\n *   projectId=\"your-project-id\"\n *   placeholder=\"/images/loading.png\"\n *   onLoad={() => console.log(\"Scene loaded!\")}\n *   onError={(err) => console.error(err)}\n * />\n * ```\n *\n * @example\n * Using local JSON file:\n * ```tsx\n * <UnicornScene\n *   jsonFilePath=\"/scenes/animation.json\"\n *   scale={0.5}\n *   fps={30}\n * />\n * ```\n *\n * @example\n * Driving authored variables and a preset:\n * ```tsx\n * <UnicornScene\n *   projectId=\"your-project-id\"\n *   preset=\"Dark Theme\"\n *   variables={{ brandColor: \"#7c3aed\", intensity: 0.65 }}\n * />\n * ```\n */\nfunction UnicornScene({\n  projectId,\n  jsonFilePath,\n  sdkUrl,\n  width = DEFAULT_VALUES.width,\n  height = DEFAULT_VALUES.height,\n  scale = DEFAULT_VALUES.scale,\n  dpi = DEFAULT_VALUES.dpi,\n  fps = DEFAULT_VALUES.fps,\n  altText = DEFAULT_VALUES.altText,\n  ariaLabel,\n  className = DEFAULT_VALUES.className,\n  lazyLoad = DEFAULT_VALUES.lazyLoad,\n  production = DEFAULT_VALUES.production,\n  paused = DEFAULT_VALUES.paused,\n  variables,\n  preset,\n  onVariableChange,\n  placeholder,\n  placeholderClassName,\n  showPlaceholderOnError = DEFAULT_VALUES.showPlaceholderOnError,\n  showPlaceholderWhileLoading = DEFAULT_VALUES.showPlaceholderWhileLoading,\n  onLoad,\n  onError,\n  sceneRef,\n}: UnicornSceneProps) {\n  const elementRef = useRef<HTMLDivElement>(null);\n  const [isSceneLoaded, setIsSceneLoaded] = useState(false);\n  const [webGLSupported, setWebGLSupported] = useState(true);\n\n  const { isLoaded, error: scriptError } = useUnicornStudioScript(sdkUrl);\n\n  const { error: sceneError } = useUnicornScene({\n    elementRef,\n    projectId,\n    jsonFilePath,\n    production,\n    scale,\n    dpi,\n    fps,\n    lazyLoad,\n    altText,\n    ariaLabel: ariaLabel || altText,\n    isScriptLoaded: isLoaded,\n    paused,\n    variables,\n    preset,\n    onVariableChange,\n    sceneRef,\n    onLoad: () => {\n      setIsSceneLoaded(true);\n      onLoad?.();\n    },\n    onError,\n  });\n\n  const error = scriptError || sceneError;\n\n  // Check WebGL support on mount\n  useEffect(() => {\n    setWebGLSupported(isWebGLSupported());\n  }, []);\n\n  // Determine if placeholder should be shown\n  const showPlaceholder =\n    (placeholder || placeholderClassName) &&\n    (!webGLSupported ||\n      (showPlaceholderWhileLoading && !isSceneLoaded) ||\n      (showPlaceholderOnError && error));\n\n  // Calculate dimensions for both container and image\n  const numericWidth = typeof width === \"number\" ? width : 0;\n  const numericHeight = typeof height === \"number\" ? height : 0;\n  const useNumericDimensions =\n    typeof width === \"number\" && typeof height === \"number\";\n\n  // Build CSS custom properties for dynamic dimensions\n  const customProperties = {\n    \"--unicorn-width\": typeof width === \"number\" ? `${width}px` : width,\n    \"--unicorn-height\": typeof height === \"number\" ? `${height}px` : height,\n  } as React.CSSProperties;\n\n  return (\n    <div\n      ref={elementRef}\n      style={{ ...unicornStyles.container, ...customProperties }}\n      className={className}\n    >\n      {showPlaceholder && (placeholder || placeholderClassName) && (\n        <div style={{ position: \"absolute\", inset: 0 }}>\n          {typeof placeholder === \"string\" ? (\n            <img\n              src={placeholder}\n              alt={altText}\n              style={{\n                width: useNumericDimensions ? `${numericWidth}px` : \"100%\",\n                height: useNumericDimensions ? `${numericHeight}px` : \"100%\",\n                objectFit: \"cover\",\n              }}\n            />\n          ) : placeholder ? (\n            placeholder\n          ) : placeholderClassName ? (\n            <div\n              className={placeholderClassName}\n              style={{ width: \"100%\", height: \"100%\" }}\n              aria-label={altText}\n            />\n          ) : null}\n        </div>\n      )}\n      {error && !showPlaceholder && (\n        <div style={unicornStyles.errorWrapper}>\n          <div style={unicornStyles.errorBox}>\n            <p style={unicornStyles.errorTitle}>Error loading scene</p>\n            <p style={unicornStyles.errorMessage}>{error.message}</p>\n          </div>\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport default UnicornScene;\nexport { UnicornScene };\n\n// Re-export types for convenience\nexport type {\n  UnicornSceneProps,\n  UnicornStudioScene,\n  UnicornVariables,\n  UnicornVariableValue,\n  UnicornVariableChangeCallback,\n  UnicornVariableDefinition,\n  UnicornVariableManifestEntry,\n  UnicornPreset,\n  UnicornVec2,\n  UnicornVec3,\n} from \"../shared/types\";\n","import { useEffect, useState, useCallback } from \"react\";\nimport { loadUnicornStudioSdk } from \"../shared/sdk-loader\";\n\n/**\n * Hook for loading the Unicorn Studio SDK in React applications.\n *\n * @remarks\n * This hook loads the bundled Unicorn Studio SDK by default. When `scriptUrl`\n * is provided, it loads that URL instead. Duplicate loads are deduplicated so\n * remounts or multiple scene instances reuse the same SDK instance.\n *\n * @param scriptUrl - Optional custom URL for the Unicorn Studio SDK script\n * @returns An object containing loading state, error state, and event handlers\n *\n * @example\n * ```tsx\n * const { isLoaded, error } = useUnicornStudioScript();\n *\n * if (error) {\n *   return <div>Failed to load SDK</div>;\n * }\n *\n * if (!isLoaded) {\n *   return <div>Loading...</div>;\n * }\n * ```\n */\nexport function useUnicornStudioScript(scriptUrl?: string): {\n  /** Whether the script has finished loading successfully */\n  isLoaded: boolean;\n  /** Error that occurred during script loading, if any */\n  error: Error | null;\n  /** Callback to handle successful script load */\n  handleScriptLoad: () => void;\n  /** Callback to handle script loading error */\n  handleScriptError: () => void;\n} {\n  const [isLoaded, setIsLoaded] = useState(\n    typeof window !== \"undefined\" && Boolean(window.UnicornStudio?.addScene),\n  );\n  const [error, setError] = useState<Error | null>(null);\n\n  const handleScriptLoad = useCallback(() => {\n    if (typeof window !== \"undefined\" && window.UnicornStudio?.addScene) {\n      setIsLoaded(true);\n      setError(null);\n    }\n  }, []);\n\n  const handleScriptError = useCallback(() => {\n    setError(new Error(\"Failed to load UnicornStudio script\"));\n  }, []);\n\n  useEffect(() => {\n    let ignore = false;\n\n    if (typeof window !== \"undefined\" && window.UnicornStudio?.addScene) {\n      setIsLoaded(true);\n      setError(null);\n      return;\n    }\n\n    void loadUnicornStudioSdk(scriptUrl)\n      .then(() => {\n        if (ignore) return;\n        setIsLoaded(true);\n        setError(null);\n      })\n      .catch((loadError) => {\n        if (ignore) return;\n        setIsLoaded(false);\n        setError(\n          loadError instanceof Error\n            ? loadError\n            : new Error(\"Failed to load UnicornStudio script\"),\n        );\n      });\n\n    return () => {\n      ignore = true;\n    };\n  }, [scriptUrl]);\n\n  return { isLoaded, error, handleScriptLoad, handleScriptError };\n}\n\n// Re-export shared hooks\nexport { useUnicornScene } from \"../shared/hooks\";\nexport type { UseUnicornSceneParams } from \"../shared/hooks\";\n","/**\n * Generated by `npm run sync-sdk`.\n * Do not edit this file manually.\n */\nexport interface BundledUnicornStudioScript {\n  id: string;\n  relativePath: string;\n  content: string;\n}\n\nexport interface BundledUnicornStudioSdk {\n  available: boolean;\n  scripts: BundledUnicornStudioScript[];\n}\n\nexport const BUNDLED_UNICORN_SDK: BundledUnicornStudioSdk = {\n  \"available\": true,\n  \"scripts\": [\n    {\n      \"id\": \"core\",\n      \"relativePath\": \"unicornStudio.umd.js\",\n      \"content\": \"!function(e,t){\\\"object\\\"==typeof exports&&\\\"undefined\\\"!=typeof module?t(exports):\\\"function\\\"==typeof define&&define.amd?define([\\\"exports\\\"],t):t((e=\\\"undefined\\\"!=typeof globalThis?globalThis:e||self).UnicornStudio={})}(this,function(e){\\\"use strict\\\";var t=Object.defineProperty,i=(e,i,r)=>((e,i,r)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r)(e,\\\"symbol\\\"!=typeof i?i+\\\"\\\":i,r);function r(e,t,i){return r=\\\"undefined\\\"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=s(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(i):n.value}},r(e,t,i||e)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=function(){if(\\\"undefined\\\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\\\"function\\\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var i,r=s(e);if(t){var n=s(this).constructor;i=Reflect.construct(r,arguments,n)}else i=r.apply(this,arguments);return function(e,t){if(t&&(\\\"object\\\"===m(t)||\\\"function\\\"==typeof t))return t;if(void 0!==t)throw new TypeError(\\\"Derived constructors may only return object or undefined\\\");return function(e){if(void 0===e)throw new ReferenceError(\\\"this hasn't been initialised - super() hasn't been called\\\");return e}(e)}(this,i)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if(\\\"undefined\\\"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e[\\\"@@iterator\\\"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError(\\\"Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\\\")}()}function o(e,t){if(e){if(\\\"string\\\"==typeof e)return u(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return\\\"Object\\\"===i&&e.constructor&&(i=e.constructor.name),\\\"Map\\\"===i||\\\"Set\\\"===i?Array.from(e):\\\"Arguments\\\"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function d(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function c(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?d(Object(i),!0).forEach(function(t){h(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):d(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function h(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function f(e,t){if(!(e instanceof t))throw new TypeError(\\\"Cannot call a class as a function\\\")}function p(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,\\\"value\\\"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function m(e){return(m=\\\"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})(e)}const v={};!function(e){var t=new Uint8Array([0,0,0,0]),i=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);var u=function(){function e(t){var i,r,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f(this,e),this.curtains=t,this.gl=null==t?void 0:t.gl,this.type=\\\"Texture\\\",this.userData={},this.shouldUpdate=!1,this._samplerName=a.sampler||\\\"uTexture\\\",this._source=a.source||null,this.source=this._source,this.sourceType=this._source?\\\"source\\\":a.fromTexture?\\\"copy\\\":\\\"empty\\\",this._copiedFrom=null,this._videoFrameCallbackID=null,this._videoFrameCallback=null,this._videoFallbackRAF=null,this._sourceLoaded=!1,this._uploaded=!1,this._canDraw=!1,this._size={width:1,height:1},this._globalParameters=this.gl?(r=this.gl,n=a.floatingPoint,r instanceof WebGL2RenderingContext?\\\"half-float\\\"===n?{internalFormat:r.RGBA16F,format:r.RGBA,type:r.HALF_FLOAT}:\\\"float\\\"===n?{internalFormat:r.RGBA32F,format:r.RGBA,type:r.FLOAT}:{internalFormat:r.RGBA8,format:r.RGBA,type:r.UNSIGNED_BYTE}:{internalFormat:r.RGBA,format:r.RGBA,type:r.UNSIGNED_BYTE}):{internalFormat:0,format:0,type:0},this._sampler={texture:this.gl?this.gl.createTexture():null},this._premultiplyAlpha=null!==(i=a.premultiplyAlpha)&&void 0!==i&&i,this.gl&&this._sampler.texture&&this._initState(),a.fromTexture?this.copy(a.fromTexture):this._source?this.setSource(this._source):this._uploadFallback()}return p(e,[{key:\\\"_bind\\\",value:function(){this.gl.bindTexture(this.gl.TEXTURE_2D,this._sampler.texture)}},{key:\\\"_initState\\\",value:function(){var e=this.gl,t=this._globalParameters.type!==e.FLOAT||e.getExtension(\\\"OES_texture_float_linear\\\")?e.LINEAR:e.NEAREST;this._bind(),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha?1:0),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),e.bindTexture(e.TEXTURE_2D,null)}},{key:\\\"_uploadFallback\\\",value:function(){if(this.gl&&this._sampler.texture&&!this._copiedFrom){var e=this.gl;this._bind(),this._globalParameters.type===e.UNSIGNED_BYTE?e.texImage2D(e.TEXTURE_2D,0,this._globalParameters.internalFormat,1,1,0,this._globalParameters.format,this._globalParameters.type,t):e.texImage2D(e.TEXTURE_2D,0,this._globalParameters.internalFormat,1,1,0,this._globalParameters.format,this._globalParameters.type,null),this._uploaded=!0,this._canDraw=!0,e.bindTexture(e.TEXTURE_2D,null)}}},{key:\\\"_onVideoFrame\\\",value:function(){this.curtains&&!this._copiedFrom&&(this.shouldUpdate=!0)}},{key:\\\"_stopVideoFrameUpdates\\\",value:function(){var e=this._source;e&&e instanceof HTMLVideoElement&&(null!==this._videoFrameCallbackID&&\\\"function\\\"==typeof e.cancelVideoFrameCallback&&e.cancelVideoFrameCallback(this._videoFrameCallbackID),this._videoFrameCallbackID=null,this._videoFrameCallback=null,null!==this._videoFallbackRAF&&(cancelAnimationFrame(this._videoFallbackRAF),this._videoFallbackRAF=null))}},{key:\\\"_startVideoFrameUpdates\\\",value:function(){var e=this,t=this._source;if(t&&t instanceof HTMLVideoElement&&!this._copiedFrom)if(this._stopVideoFrameUpdates(),\\\"function\\\"==typeof t.requestVideoFrameCallback)this._videoFrameCallback=function(){e._onVideoFrame(),e._videoFrameCallbackID=t.requestVideoFrameCallback(e._videoFrameCallback)},this._videoFrameCallbackID=t.requestVideoFrameCallback(this._videoFrameCallback);else{this._videoFallbackRAF=requestAnimationFrame(function i(){e._source===t?(!t.paused&&!t.ended&&t.readyState>=t.HAVE_CURRENT_DATA&&e._onVideoFrame(),e._videoFallbackRAF=requestAnimationFrame(i)):e._videoFallbackRAF=null})}}},{key:\\\"_uploadSource\\\",value:function(e){if(this.gl&&this._sampler.texture&&!this._copiedFrom){var t=this.gl,i=e.videoWidth||e.naturalWidth||e.width||1,r=e.videoHeight||e.naturalHeight||e.height||1;this._size={width:i,height:r},this._bind(),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha?1:0),t instanceof WebGL2RenderingContext?t.texImage2D(t.TEXTURE_2D,0,this._globalParameters.internalFormat,this._globalParameters.format,this._globalParameters.type,e):t.texImage2D(t.TEXTURE_2D,0,this._globalParameters.format,this._globalParameters.format,this._globalParameters.type,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,0),this._sourceLoaded=!0,this._uploaded=!0,this._canDraw=!0,this.sourceType=e instanceof HTMLVideoElement?\\\"video\\\":e instanceof HTMLCanvasElement?\\\"canvas\\\":\\\"image\\\",t.bindTexture(t.TEXTURE_2D,null)}}},{key:\\\"setSource\\\",value:function(e){return this._stopVideoFrameUpdates(),this._source=e,this.source=e,this._copiedFrom=null,this._uploadSource(e),e instanceof HTMLVideoElement&&this._startVideoFrameUpdates(),this}},{key:\\\"copy\\\",value:function(e){return e?(this._stopVideoFrameUpdates(),this._source=e._source||null,this.source=this._source,this._copiedFrom=e,this.sourceType=e.sourceType||\\\"copy\\\",this._sourceLoaded=!!e._sourceLoaded,this._uploaded=!!e._uploaded,this._canDraw=!1!==e._canDraw,this._sampler.texture=e._sampler.texture,this._size=c({},e._size),this._globalParameters=c({},e._globalParameters),this.shouldUpdate=!!e.shouldUpdate,this):this}},{key:\\\"update\\\",value:function(){this._source&&!this._copiedFrom&&this._uploadSource(this._source)}},{key:\\\"needUpdate\\\",value:function(){this._copiedFrom||(this.update(),this.curtains&&\\\"function\\\"==typeof this.curtains.requestRender?this.curtains.requestRender():this.curtains&&\\\"function\\\"==typeof this.curtains.render&&this.curtains.render())}},{key:\\\"remove\\\",value:function(){this._stopVideoFrameUpdates(),this.gl&&this._sampler.texture&&!this._copiedFrom&&this.gl.deleteTexture(this._sampler.texture)}}]),e}(),d=function(){function e(t){var i,r,n,a,s,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f(this,e),this.curtains=t,this.gl=null==t?void 0:t.gl,this.type=\\\"RenderTarget\\\",this.userData={},this._depth=!!l.depth,this._clear=void 0===l.clear||!!l.clear;var o=(null==t||null===(i=t.canvas)||void 0===i?void 0:i.width)||1,d=(null==t||null===(r=t.canvas)||void 0===r?void 0:r.height)||1;this._scaleWithCanvas=void 0===l.scaleWithCanvas||!!l.scaleWithCanvas,this._widthScale=void 0!==l.maxWidth&&o>0?l.maxWidth/o:null,this._heightScale=void 0!==l.maxHeight&&d>0?l.maxHeight/d:null,this._baseMaxSize={width:Math.max(1,Math.round(l.maxWidth||o)),height:Math.max(1,Math.round(l.maxHeight||d))},this._minSize={width:Math.max(1,Math.round(l.minWidth||1)),height:Math.max(1,Math.round(l.minHeight||1))},this._maxSize={width:this._baseMaxSize.width,height:this._baseMaxSize.height},this._size={width:this._baseMaxSize.width,height:this._baseMaxSize.height},this._setSize(),this.index=-1,this._frameBuffer=null,this._depthBuffer=null;var c=(null===(n=l.texturesOptions)||void 0===n?void 0:n.sampler)||\\\"uTexture\\\",h=l.texturesOptions&&l.texturesOptions.floatingPoint;this.textures=[new u(t,{sampler:c,premultiplyAlpha:null!==(a=null===(s=l.texturesOptions)||void 0===s?void 0:s.premultiplyAlpha)&&void 0!==a&&a,floatingPoint:h})],null!=t&&t.renderTargets&&!t.renderTargets.includes(this)&&(t.renderTargets.push(this),t.renderTargets.forEach(function(e,t){e.index=t})),this._initRenderTarget()}return p(e,[{key:\\\"_setSize\\\",value:function(){var e,t,i=1*((null===this.curtains||void 0===this.curtains||null===(e=this.curtains.canvas)||void 0===e?void 0:e.width)||1),r=1*((null===this.curtains||void 0===this.curtains||null===(t=this.curtains.canvas)||void 0===t?void 0:t.height)||1),n=this._baseMaxSize.width,a=this._baseMaxSize.height;this._scaleWithCanvas&&(null!==this._widthScale&&(n=Math.max(1,Math.round(i*this._widthScale))),null!==this._heightScale&&(a=Math.max(1,Math.round(r*this._heightScale)))),this._maxSize={width:n,height:a},this._size=this._scaleWithCanvas?{width:Math.min(this._maxSize.width,Math.max(this._minSize.width,i)),height:Math.min(this._maxSize.height,Math.max(this._minSize.height,r))}:{width:n,height:a}}},{key:\\\"_initRenderTarget\\\",value:function(){if(this.gl){var e=this.gl;this._setSize(),this._frameBuffer||(this._frameBuffer=e.createFramebuffer());var t=this.getTexture();t&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.bindTexture(e.TEXTURE_2D,t._sampler.texture),e.texImage2D(e.TEXTURE_2D,0,t._globalParameters.internalFormat,this._size.width,this._size.height,0,t._globalParameters.format,t._globalParameters.type,null),t._size=c({},this._size),t._sourceLoaded=!0,t._uploaded=!0,t._canDraw=!0,t.sourceType=\\\"fbo\\\",e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t._sampler.texture,0),this._depth&&(this._depthBuffer||(this._depthBuffer=e.createRenderbuffer()),e.bindRenderbuffer(e.RENDERBUFFER,this._depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,this._size.width,this._size.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this._depthBuffer),e.bindRenderbuffer(e.RENDERBUFFER,null)),e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null))}}},{key:\\\"resize\\\",value:function(){if(this.gl){var e=this._size.width,t=this._size.height;if(this._setSize(),e!==this._size.width||t!==this._size.height||!this._frameBuffer)if(this._frameBuffer){var i=this.getTexture();if(i){var r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,this._frameBuffer),r.bindTexture(r.TEXTURE_2D,i._sampler.texture),r.texImage2D(r.TEXTURE_2D,0,i._globalParameters.internalFormat,this._size.width,this._size.height,0,i._globalParameters.format,i._globalParameters.type,null),i._size=c({},this._size),i._sourceLoaded=!0,i._uploaded=!0,i._canDraw=!0,i.sourceType=\\\"fbo\\\",r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,i._sampler.texture,0),this._depth&&(this._depthBuffer||(this._depthBuffer=r.createRenderbuffer()),r.bindRenderbuffer(r.RENDERBUFFER,this._depthBuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,this._size.width,this._size.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,this._depthBuffer),r.bindRenderbuffer(r.RENDERBUFFER,null)),r.bindTexture(r.TEXTURE_2D,null),this.curtains&&this.curtains.renderer?this.curtains.renderer.bindFrameBuffer(null):r.bindFramebuffer(r.FRAMEBUFFER,null)}}else this._initRenderTarget()}}},{key:\\\"getTexture\\\",value:function(){return this.textures[0]||null}},{key:\\\"remove\\\",value:function(){var e,t=this;this.gl&&(this._depthBuffer&&(this.gl.deleteRenderbuffer(this._depthBuffer),this._depthBuffer=null),this._frameBuffer&&(this.gl.deleteFramebuffer(this._frameBuffer),this._frameBuffer=null),this.textures.forEach(function(e){return e.remove()}),null!==(e=this.curtains)&&void 0!==e&&e.planes&&this.curtains.planes.forEach(function(e){e.target===t&&(e.target=null)}),null!==(e=this.curtains)&&void 0!==e&&e.renderTargets&&(this.curtains.renderTargets=this.curtains.renderTargets.filter(function(e){return e!==t}),this.curtains.renderTargets.forEach(function(e,t){e.index=t})))}}]),e}();var h=function(){function e(){var t,i,r,n=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f(this,e),this.type=\\\"Curtains\\\",this.options=c({},a),this.container=(r=a.container)?\\\"string\\\"==typeof r?document.querySelector(r):r:null,this.canvas=document.createElement(\\\"canvas\\\"),this.canvas.style.display=\\\"block\\\",this.canvas.style.width=\\\"100%\\\",this.canvas.style.height=\\\"100%\\\",this.container&&!this.container.contains(this.canvas)&&this.container.appendChild(this.canvas);var s={alpha:!0,antialias:null!==(t=a.antialias)&&void 0!==t&&t,premultipliedAlpha:null===(i=a.premultipliedAlpha)||void 0===i||i,preserveDrawingBuffer:!1};this.gl=this.canvas.getContext(\\\"webgl2\\\",s)||this.canvas.getContext(\\\"webgl\\\",s),this.gl instanceof WebGL2RenderingContext?(this.gl.getExtension(\\\"EXT_color_buffer_float\\\"),this.gl.getExtension(\\\"OES_texture_float_linear\\\")):(this.gl.getExtension(\\\"OES_texture_half_float\\\"),this.gl.getExtension(\\\"OES_texture_half_float_linear\\\"),this.gl.getExtension(\\\"OES_texture_float\\\"),this.gl.getExtension(\\\"OES_texture_float_linear\\\")),this.planes=[],this.renderTargets=[],this.pixelRatio=a.pixelRatio||1,this.renderingScale=a.renderingScale||1,this._renderRequestID=null,this._errorCallbacks=[],this._contextLostCallbacks=[],this._contextRestoredCallbacks=[];var l={currentProgramID:null,currentGeometryID:null,forceBufferUpdate:!1,depthTest:null,blending:null,cullFace:null,frameBufferID:null,activeTexture:null,flipY:null,premultiplyAlpha:null};this.renderer={gl:this.gl,premultipliedAlpha:s.premultipliedAlpha,state:l,nextRender:{queue:[],add:function(e){return\\\"function\\\"==typeof e&&this.queue.push(e),e},execute:function(){this.queue.splice(0,this.queue.length).forEach(function(e){e()})}},setDepthTest:function(e){n.gl&&(e&&!l.depthTest?(l.depthTest=e,n.gl.enable(n.gl.DEPTH_TEST)):!e&&l.depthTest&&(l.depthTest=e,n.gl.disable(n.gl.DEPTH_TEST)))},setDepthFunc:function(){n.gl&&n.gl.depthFunc(n.gl.LEQUAL)},setBlending:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];n.gl&&(e&&!l.blending?(l.blending=e,n.gl.enable(n.gl.BLEND)):!e&&l.blending&&(l.blending=e,n.gl.disable(n.gl.BLEND)))},setBlendFunc:function(){n.gl&&(n.gl.enable(n.gl.BLEND),this.premultipliedAlpha?n.gl.blendFuncSeparate(n.gl.ONE,n.gl.ONE_MINUS_SRC_ALPHA,n.gl.ONE,n.gl.ONE_MINUS_SRC_ALPHA):n.gl.blendFuncSeparate(n.gl.SRC_ALPHA,n.gl.ONE_MINUS_SRC_ALPHA,n.gl.ONE,n.gl.ONE_MINUS_SRC_ALPHA))},setFaceCulling:function(e){if(n.gl&&l.cullFace!==e)if(l.cullFace=e,\\\"none\\\"===e)n.gl.disable(n.gl.CULL_FACE);else{var t=\\\"front\\\"===e?n.gl.FRONT:n.gl.BACK;n.gl.enable(n.gl.CULL_FACE),n.gl.cullFace(t)}},useProgram:function(e){if(n.gl&&e){var t=void 0!==e.id?e.id:e,i=e.program||e;null!==l.currentProgramID&&l.currentProgramID===t||(n.gl.useProgram(i),l.currentProgramID=t)}},bindFrameBuffer:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n.gl){e&&t&&!e._frameBuffer&&e._initRenderTarget();var i=e?void 0!==e.index?e.index:e._frameBuffer:null;i!==l.frameBufferID&&(n.gl.bindFramebuffer(n.gl.FRAMEBUFFER,e?e._frameBuffer:null),l.frameBufferID=i)}}},this.renderer.setBlendFunc(),this.renderer.setDepthFunc(),this.renderer.setDepthTest(!1),this._onContextLost=function(e){e.preventDefault(),n._contextLostCallbacks.forEach(function(t){return t(e)})},this._onContextRestored=function(){n._contextRestoredCallbacks.forEach(function(e){return e()})},this.canvas.addEventListener(\\\"webglcontextlost\\\",this._onContextLost,!1),this.canvas.addEventListener(\\\"webglcontextrestored\\\",this._onContextRestored,!1),this.resize()}return p(e,[{key:\\\"_emitError\\\",value:function(e){this._errorCallbacks.forEach(function(t){return t(e)})}},{key:\\\"onError\\\",value:function(e){return\\\"function\\\"==typeof e&&this._errorCallbacks.push(e),this}},{key:\\\"onContextLost\\\",value:function(e){return\\\"function\\\"==typeof e&&this._contextLostCallbacks.push(e),this}},{key:\\\"onContextRestored\\\",value:function(e){return\\\"function\\\"==typeof e&&this._contextRestoredCallbacks.push(e),this}},{key:\\\"restoreContext\\\",value:function(){return this}},{key:\\\"createRenderTarget\\\",value:function(){return new d(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}},{key:\\\"requestRender\\\",value:function(){var e=this;this.gl&&null===this._renderRequestID&&(this._renderRequestID=requestAnimationFrame(function(){e._renderRequestID=null,e.render()}))}},{key:\\\"setPixelRatio\\\",value:function(e){var t=parseFloat(e);return this.pixelRatio=Number.isFinite(t)&&t>0?t:1,this.resize(),this}},{key:\\\"resize\\\",value:function(){if(this.container){var e=Math.max(1,Math.round(this.container.clientWidth*this.pixelRatio*this.renderingScale)),t=Math.max(1,Math.round(this.container.clientHeight*this.pixelRatio*this.renderingScale));this.canvas.width=e,this.canvas.height=t,this.gl&&this.gl.viewport(0,0,e,t),this.renderTargets.slice().forEach(function(e){e&&\\\"function\\\"==typeof e.resize&&e.resize()})}}},{key:\\\"render\\\",value:function(){if(this.gl){this.renderer.nextRender.execute();var e=this.gl;e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);var t=l(this.planes).filter(function(e){return!1!==e.visible}).sort(function(e,t){return(e.renderOrder||0)-(t.renderOrder||0)}),i=t.filter(function(e){return\\\"PingPongPlane\\\"===e.type}),r=t.filter(function(e){return\\\"PingPongPlane\\\"!==e.type}),n=r.filter(function(e){return!!e.target}).sort(function(e,t){var i=e.target&&void 0!==e.target.index?e.target.index:Number.MAX_SAFE_INTEGER,r=t.target&&void 0!==t.target.index?t.target.index:Number.MAX_SAFE_INTEGER;return i!==r?i-r:(e.renderOrder||0)-(t.renderOrder||0)}),a=r.filter(function(e){return!e.target});e.disable(e.DEPTH_TEST),this.renderer.state.depthTest=!1,e.disable(e.BLEND),this.renderer.state.blending=!1,i.forEach(function(e){!1!==e._canDraw&&e._render()}),e.enable(e.BLEND),this.renderer.state.blending=!0,e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),n.forEach(function(e){!1!==e._canDraw&&e._render()}),a.forEach(function(e){!1!==e._canDraw&&e._render()})}}},{key:\\\"dispose\\\",value:function(){null!==this._renderRequestID&&(cancelAnimationFrame(this._renderRequestID),this._renderRequestID=null),this.planes.slice().forEach(function(e){return e.remove()}),this.renderTargets.slice().forEach(function(e){return e.remove()}),this.canvas&&(this.canvas.removeEventListener(\\\"webglcontextlost\\\",this._onContextLost),this.canvas.removeEventListener(\\\"webglcontextrestored\\\",this._onContextRestored)),this.planes=[],this.renderTargets=[]}}]),e}();function v(e,t,i){var r=e.createShader(t);if(!r)throw new Error(\\\"Unable to create WebGL shader, the context may be lost\\\");return e.shaderSource(r,i),e.compileShader(r),r}var g=function(){function e(t,i){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};f(this,e),this.type=\\\"Plane\\\",this.curtains=t,this.gl=null==t?void 0:t.gl,this.htmlElement=i||(null==t?void 0:t.container)||null,this.userData={},this.visible=!0,this.renderOrder=0,this.target=null,this._depthTest=!0===n.depthTest,this._canDraw=!0,this._removed=!1,this.textures=[],this.videos=[],this.uniforms=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return Object.keys(e).forEach(function(i){var r=e[i],n=r.value&&\\\"function\\\"==typeof r.value.clone?r.value.clone():r.value;t[i]=c({},r,{value:n})}),t}(n.uniforms),this._readyCallbacks=[],this._renderCallbacks=[],this._afterRenderCallbacks=[],this._uniformLocations=new Map,this._samplerLocations=new Map,this._vertexShader=n.vertexShader||\\\"\\\\nattribute vec3 aVertexPosition;\\\\nattribute vec2 aTextureCoord;\\\\n\\\\nvarying vec2 vTextureCoord;\\\\n\\\\nvoid main() {\\\\n    gl_Position = vec4(aVertexPosition, 1.0);\\\\n    vTextureCoord = aTextureCoord;\\\\n}\\\\n\\\",this._fragmentShader=n.fragmentShader||\\\"\\\\nprecision mediump float;\\\\n\\\\nuniform sampler2D uTexture;\\\\nvarying vec2 vTextureCoord;\\\\n\\\\nvoid main() {\\\\n    gl_FragColor = texture2D(uTexture, vTextureCoord);\\\\n}\\\\n\\\",this._geometry=null,this._program=null,this._positionLocation=-1,this._uvLocation=-1,this._mvMatrixLocation=null,this._pMatrixLocation=null,this._init(n),null==t||t.planes.push(this);var a=function(){r._removed||r._readyCallbacks.forEach(function(e){return e(r)})};if(\\\"undefined\\\"!=typeof document&&document.hidden&&\\\"function\\\"==typeof MessageChannel){var s=new MessageChannel;s.port1.onmessage=a,s.port2.postMessage(null)}else requestAnimationFrame(a)}return p(e,[{key:\\\"_init\\\",value:function(e){if(this.gl)try{this._program=function(e,t,i){var r,n=v(e,e.VERTEX_SHADER,t);try{r=v(e,e.FRAGMENT_SHADER,i)}catch(l){throw e.deleteShader(n),l}var a=e.createProgram();if(!a)throw e.deleteShader(n),e.deleteShader(r),new Error(\\\"Unable to create WebGL program, the context may be lost\\\");e.attachShader(a,n),e.attachShader(a,r),e.linkProgram(a);var s=null;if(e.getProgramParameter(a,e.LINK_STATUS)||(s=e.getShaderParameter(n,e.COMPILE_STATUS)?e.getShaderParameter(r,e.COMPILE_STATUS)?e.getProgramInfoLog(a)||\\\"Unknown program link error\\\":e.getShaderInfoLog(r)||\\\"Unknown shader compile error\\\":e.getShaderInfoLog(n)||\\\"Unknown shader compile error\\\"),e.deleteShader(n),e.deleteShader(r),s)throw e.deleteProgram(a),new Error(s);return a}(this.gl,this._vertexShader,this._fragmentShader),this._positionLocation=this.gl.getAttribLocation(this._program,\\\"aVertexPosition\\\"),this._uvLocation=this.gl.getAttribLocation(this._program,\\\"aTextureCoord\\\"),this._geometry=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=Math.max(1,Math.floor(t)),a=Math.max(1,Math.floor(i));if(r){for(var s=[],l=[],o=0;o<a;o++)for(var u=o/a,d=(o+1)/a,c=0;c<n;c++){var h=c/n,f=(c+1)/n;s.push(2*(h-.5),2*(u-.5),0,2*(f-.5),2*(u-.5),0,2*(h-.5),2*(d-.5),0,2*(h-.5),2*(d-.5),0,2*(f-.5),2*(u-.5),0,2*(f-.5),2*(d-.5),0),l.push(h,u,f,u,h,d,h,d,f,u,f,d)}var p=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,p),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW);var m=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,m),e.bufferData(e.ARRAY_BUFFER,new Float32Array(l),e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),{positionBuffer:p,uvBuffer:m,indexBuffer:null,vertexCount:n*a*6}}for(var v=(n+1)*(a+1),g=new Float32Array(3*v),y=new Float32Array(2*v),x=0,b=0,_=0;_<=a;_++)for(var T=_/a,P=1-2*T,E=0;E<=n;E++){var w=E/n,M=2*w-1;g[x++]=M,g[x++]=P,g[x++]=0,y[b++]=w,y[b++]=1-T}for(var R=n*a*6,S=v>65535,k=S?new Uint32Array(R):new Uint16Array(R),F=0,I=0;I<a;I++)for(var A=0;A<n;A++){var L=I*(n+1)+A,V=L+1,C=(I+1)*(n+1)+A,O=C+1;k[F++]=L,k[F++]=C,k[F++]=V,k[F++]=V,k[F++]=C,k[F++]=O}var D=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,D),e.bufferData(e.ARRAY_BUFFER,g,e.STATIC_DRAW);var B=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,B),e.bufferData(e.ARRAY_BUFFER,y,e.STATIC_DRAW);var U=e.createBuffer();return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,U),e.bufferData(e.ELEMENT_ARRAY_BUFFER,k,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),{positionBuffer:D,uvBuffer:B,indexBuffer:U,indexCount:R,indexType:S?e.UNSIGNED_INT:e.UNSIGNED_SHORT}}(this.gl,e.widthSegments,e.heightSegments,e.independentGeometry),this._mvMatrixLocation=this.gl.getUniformLocation(this._program,\\\"uMVMatrix\\\"),this._pMatrixLocation=this.gl.getUniformLocation(this._program,\\\"uPMatrix\\\"),this._texMatrixLocation=this.gl.getUniformLocation(this._program,\\\"uTextureMatrix\\\")}catch(r){var t,i;null===(t=this.curtains)||void 0===t||null===(i=t._emitError)||void 0===i||i.call(t,r),this._canDraw=!1}}},{key:\\\"_bindAttributes\\\",value:function(){var e=this.gl,t=this._geometry;t&&(this._positionLocation>=0&&(e.bindBuffer(e.ARRAY_BUFFER,t.positionBuffer),e.enableVertexAttribArray(this._positionLocation),e.vertexAttribPointer(this._positionLocation,3,e.FLOAT,!1,0,0)),this._uvLocation>=0&&(e.bindBuffer(e.ARRAY_BUFFER,t.uvBuffer),e.enableVertexAttribArray(this._uvLocation),e.vertexAttribPointer(this._uvLocation,2,e.FLOAT,!1,0,0)),t.indexBuffer&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indexBuffer))}},{key:\\\"_bindUniforms\\\",value:function(){var e=this;if(this._program){var t=this.gl;t.useProgram(this._program),Object.keys(this.uniforms).forEach(function(i){var r=e.uniforms[i];if(r){var n=e._uniformLocations.get(i);void 0===n&&(n=t.getUniformLocation(e._program,r.name||i),e._uniformLocations.set(i,n)),function(e,t,i,r){if(null!=t&&null!=r){var n=r&&\\\"object\\\"===m(r)&&\\\"x\\\"in r&&\\\"y\\\"in r,a=n&&\\\"z\\\"in r;switch(i){case\\\"1f\\\":e.uniform1f(t,Number(r));break;case\\\"2f\\\":e.uniform2f(t,n?r.x:r[0],n?r.y:r[1]);break;case\\\"3f\\\":e.uniform3f(t,a?r.x:r[0],a?r.y:r[1],a?r.z:r[2]);break;case\\\"4f\\\":e.uniform4f(t,r[0],r[1],r[2],r[3]);break;case\\\"1i\\\":e.uniform1i(t,Number(r));break;case\\\"2i\\\":e.uniform2i(t,r[0],r[1]);break;case\\\"3i\\\":e.uniform3i(t,r[0],r[1],r[2]);break;case\\\"4i\\\":e.uniform4i(t,r[0],r[1],r[2],r[3]);break;case\\\"1fv\\\":e.uniform1fv(t,r);break;case\\\"2fv\\\":e.uniform2fv(t,r);break;case\\\"3fv\\\":e.uniform3fv(t,r);break;case\\\"4fv\\\":e.uniform4fv(t,r);break;case\\\"mat3\\\":e.uniformMatrix3fv(t,!1,r);break;case\\\"mat4\\\":e.uniformMatrix4fv(t,!1,r);break;default:a?e.uniform3f(t,r.x,r.y,r.z):n?e.uniform2f(t,r.x,r.y):Array.isArray(r)||ArrayBuffer.isView(r)?16===r.length?e.uniformMatrix4fv(t,!1,r):9===r.length?e.uniformMatrix3fv(t,!1,r):4===r.length?e.uniform4fv(t,r):3===r.length?e.uniform3fv(t,r):2===r.length?e.uniform2fv(t,r):1===r.length&&e.uniform1f(t,r[0]):e.uniform1f(t,Number(r))}}}(t,n,r.type,r.value)}})}}},{key:\\\"_bindTextures\\\",value:function(){var e,t=this.gl,i=0,r=function(e,t){var i=\\\"undefined\\\"!=typeof Symbol&&e[Symbol.iterator]||e[\\\"@@iterator\\\"];if(!i){if(Array.isArray(e)||(i=o(e))||t){i&&(e=i);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw new TypeError(\\\"Invalid attempt to iterate non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\\\")}var a,s=!0,l=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==i.return||i.return()}finally{if(l)throw a}}}}(this.textures);try{for(r.s();!(e=r.n()).done;){var n,a=e.value;if(null!=a&&null!==(n=a._sampler)&&void 0!==n&&n.texture){t.activeTexture(t.TEXTURE0+i),a._copiedFrom&&a.copy(a._copiedFrom),a.shouldUpdate&&a.update();var s=this._samplerLocations.get(a._samplerName);void 0===s&&(s=t.getUniformLocation(this._program,a._samplerName),this._samplerLocations.set(a._samplerName,s)),null!=s&&(t.bindTexture(t.TEXTURE_2D,a._sampler.texture),t.uniform1i(s,i),i++)}}}catch(l){r.e(l)}finally{r.f()}}},{key:\\\"_prepareRenderTarget\\\",value:function(e){var t,i;if(!e||!this.gl)return this.curtains.renderer.bindFrameBuffer(null),void this.gl.viewport(0,0,this.curtains.canvas.width,this.curtains.canvas.height);this.curtains.renderer.bindFrameBuffer(e,!0);var r=(null===(t=e._size)||void 0===t?void 0:t.width)||this.curtains.canvas.width,n=(null===(i=e._size)||void 0===i?void 0:i.height)||this.curtains.canvas.height;this.gl.viewport(0,0,r,n),!1!==e._clear&&(this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT|(e._depth?this.gl.DEPTH_BUFFER_BIT:0)))}},{key:\\\"_render\\\",value:function(){var e=this;this.gl&&this._program&&this._geometry&&(this._renderCallbacks.forEach(function(t){return t(e)}),this._prepareRenderTarget(this.target),this.curtains.renderer.setDepthTest(this._depthTest),this.gl.useProgram(this._program),this._mvMatrixLocation&&this.gl.uniformMatrix4fv(this._mvMatrixLocation,!1,i),this._pMatrixLocation&&this.gl.uniformMatrix4fv(this._pMatrixLocation,!1,i),this._texMatrixLocation&&this.gl.uniformMatrix4fv(this._texMatrixLocation,!1,i),this._bindAttributes(),this._bindUniforms(),this._bindTextures(),this._geometry.indexBuffer?this.gl.drawElements(this.gl.TRIANGLES,this._geometry.indexCount,this._geometry.indexType,0):this.gl.drawArrays(this.gl.TRIANGLES,0,this._geometry.vertexCount),this.curtains.renderer.bindFrameBuffer(null),this.gl.viewport(0,0,this.curtains.canvas.width,this.curtains.canvas.height),this._afterRenderCallbacks.forEach(function(t){return t(e)}))}},{key:\\\"onReady\\\",value:function(e){return\\\"function\\\"==typeof e&&this._readyCallbacks.push(e),this}},{key:\\\"onRender\\\",value:function(e){return\\\"function\\\"==typeof e&&this._renderCallbacks.push(e),this}},{key:\\\"onAfterRender\\\",value:function(e){return\\\"function\\\"==typeof e&&this._afterRenderCallbacks.push(e),this}},{key:\\\"setRenderOrder\\\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.renderOrder=e,this}},{key:\\\"setRenderTarget\\\",value:function(e){var t;return this.target=e,e&&null!==(t=this.curtains)&&void 0!==t&&t.renderTargets&&!this.curtains.renderTargets.includes(e)&&(this.curtains.renderTargets.push(e),this.curtains.renderTargets.forEach(function(e,t){e.index=t})),this}},{key:\\\"createTexture\\\",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.sampler||\\\"uTexture\\\",r=this.textures.find(function(e){return e._samplerName===i});if(r&&t.fromTexture)return r.copy(t.fromTexture),r;var n=new u(this.curtains,{sampler:i,premultiplyAlpha:null!==(e=t.premultiplyAlpha)&&void 0!==e&&e,fromTexture:t.fromTexture});if(r){var a=this.textures.indexOf(r);return this.textures[a]=n,n}return this.textures.push(n),n}},{key:\\\"addTexture\\\",value:function(e){if(!e)return null;var t=e._samplerName||\\\"uTexture\\\",i=this.textures.findIndex(function(e){return e._samplerName===t});return i>=0?this.textures[i]=e:this.textures.push(e),e}},{key:\\\"loadCanvas\\\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;try{var n,a=new u(this.curtains,{sampler:t.sampler||\\\"uTexture\\\",source:e,premultiplyAlpha:null!==(n=t.premultiplyAlpha)&&void 0!==n&&n});return a.shouldUpdate=!0,this.addTexture(a),\\\"function\\\"==typeof i&&i(a),a}catch(s){return\\\"function\\\"==typeof r&&r(s),null}}},{key:\\\"loadVideo\\\",value:function(e){var t,i,r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;e instanceof HTMLVideoElement?t=e:((t=document.createElement(\\\"video\\\")).crossOrigin=\\\"anonymous\\\",t.src=e),t.preload=\\\"auto\\\",t.muted=!0,t.loop=!0,t.setAttribute(\\\"playsinline\\\",\\\"\\\"),t.crossOrigin||(t.crossOrigin=\\\"anonymous\\\");var l=new u(r.curtains,{sampler:n.sampler||\\\"uVideoTexture\\\",premultiplyAlpha:null!==(i=n.premultiplyAlpha)&&void 0!==i&&i});l.shouldUpdate=!0,r.addTexture(l);var o=function(){try{l.setSource(t),l.shouldUpdate=!0,r.videos.push(t),\\\"function\\\"==typeof a&&a(l)}catch(e){\\\"function\\\"==typeof s&&s(e)}};return t.readyState>=t.HAVE_CURRENT_DATA?o():(t.addEventListener(\\\"loadeddata\\\",o,{once:!0}),t.addEventListener(\\\"error\\\",function(e){\\\"function\\\"==typeof s&&s(e)},{once:!0}),e instanceof HTMLVideoElement||t.load()),t}},{key:\\\"remove\\\",value:function(){var e,t=this;this._removed=!0,this.gl&&(this.textures.forEach(function(e){return e.remove()}),this._geometry&&(this.gl.deleteBuffer(this._geometry.positionBuffer),this.gl.deleteBuffer(this._geometry.uvBuffer),this.gl.deleteBuffer(this._geometry.indexBuffer)),this._program&&this.gl.deleteProgram(this._program),null!==(e=this.curtains)&&void 0!==e&&e.planes&&(this.curtains.planes=this.curtains.planes.filter(function(e){return e!==t})))}}]),e}(),y=function(){function e(t){f(this,e),this.curtains=t,this.cache=new Map}return p(e,[{key:\\\"loadImage\\\",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;if(!e)return\\\"function\\\"==typeof n&&n(new Error(\\\"Missing image src\\\")),null;var a=this.cache.get(e),s=function(e){var n,a=new u(t.curtains,{sampler:i.sampler||\\\"uTexture\\\",source:e,premultiplyAlpha:null!==(n=i.premultiplyAlpha)&&void 0!==n&&n});\\\"function\\\"==typeof r&&r(a)};if(null!=a&&a.loaded&&a.image)return s(a.image),a.image;var l=(null==a?void 0:a.image)||new Image;l.crossOrigin=\\\"anonymous\\\";var o=a||{image:l,loaded:!1};this.cache.set(e,o);var d=function(){o.loaded=!0,s(l)};return l.complete&&l.naturalWidth>0?(d(),l):(l.addEventListener(\\\"load\\\",d,{once:!0}),l.addEventListener(\\\"error\\\",function(e){\\\"function\\\"==typeof n&&n(e)},{once:!0}),l.src||(l.src=e),l)}},{key:\\\"loadCanvas\\\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;try{var n,a=new u(this.curtains,{sampler:t.sampler||\\\"uTexture\\\",source:e,premultiplyAlpha:null!==(n=t.premultiplyAlpha)&&void 0!==n&&n});return a.shouldUpdate=!0,\\\"function\\\"==typeof i&&i(a),a}catch(s){return\\\"function\\\"==typeof r&&r(s),null}}}]),e}(),x=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;f(this,e),this.type=\\\"Vec2\\\",this._x=Number.isFinite(t)?t:0,this._y=Number.isFinite(i)?i:0}return p(e,[{key:\\\"x\\\",get:function(){return this._x},set:function(e){this._x=Number.isFinite(e)?e:this._x}},{key:\\\"y\\\",get:function(){return this._y},set:function(e){this._y=Number.isFinite(e)?e:this._y}},{key:\\\"equals\\\",value:function(e){return!!e&&(this._x===e.x&&this._y===e.y)}},{key:\\\"set\\\",value:function(e,t){return this.x=e,this.y=t,this}},{key:\\\"copy\\\",value:function(e){return e?(this.x=e.x,this.y=e.y,this):this}},{key:\\\"clone\\\",value:function(){return new e(this._x,this._y)}}]),e}(),b=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;f(this,e),this.type=\\\"Vec3\\\",this._x=Number.isFinite(t)?t:0,this._y=Number.isFinite(i)?i:0,this._z=Number.isFinite(r)?r:0}return p(e,[{key:\\\"x\\\",get:function(){return this._x},set:function(e){this._x=Number.isFinite(e)?e:this._x}},{key:\\\"y\\\",get:function(){return this._y},set:function(e){this._y=Number.isFinite(e)?e:this._y}},{key:\\\"z\\\",get:function(){return this._z},set:function(e){this._z=Number.isFinite(e)?e:this._z}},{key:\\\"equals\\\",value:function(e){return!!e&&(this._x===e.x&&this._y===e.y&&this._z===e.z)}},{key:\\\"set\\\",value:function(e,t,i){return this.x=e,this.y=t,this.z=i,this}},{key:\\\"copy\\\",value:function(e){return e?(this.x=e.x,this.y=e.y,this.z=e.z,this):this}},{key:\\\"clone\\\",value:function(){return new e(this._x,this._y,this._z)}}]),e}(),_=function(e){!function(e,t){if(\\\"function\\\"!=typeof t&&null!==t)throw new TypeError(\\\"Super expression must either be null or a function\\\");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}(i,e);var t=a(i);function i(e,r){var n,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};f(this,i),(n=t.call(this,e,r,a)).type=\\\"PingPongPlane\\\";var s=a.targetSize||{},l=Object.assign({},a.texturesOptions,{sampler:a.sampler||\\\"uPingPongTexture\\\"});return void 0===l.premultiplyAlpha&&(l.premultiplyAlpha=!1),n._targets=[new d(e,{clear:!1,scaleWithCanvas:!s.width,maxWidth:s.width||e.canvas.width,maxHeight:s.height||e.canvas.height,texturesOptions:l}),new d(e,{clear:!1,scaleWithCanvas:!s.width,maxWidth:s.width||e.canvas.width,maxHeight:s.height||e.canvas.height,texturesOptions:l})],n._readIndex=0,n._sampler=a.sampler||\\\"uPingPongTexture\\\",n.createTexture({sampler:n._sampler,fromTexture:n._targets[n._readIndex].getTexture()}),n.setRenderTarget(n._targets[n._readIndex]),n}return p(i,[{key:\\\"getTexture\\\",value:function(){return this.textures.find(function(e){return e._samplerName===this._sampler},this)||this._targets[this._readIndex].getTexture()}},{key:\\\"_render\\\",value:function(){var e=0===this._readIndex?1:0;this.setRenderTarget(this._targets[e]),r(s(i.prototype),\\\"_render\\\",this).call(this),this._readIndex=e;var t=this._targets[this._readIndex].getTexture(),n=this.textures.find(function(e){return e._samplerName===this._sampler},this);n&&t&&n.copy(t)}},{key:\\\"remove\\\",value:function(){this._targets.forEach(function(e){return e.remove()}),r(s(i.prototype),\\\"remove\\\",this).call(this)}}]),i}(g);e.Curtains=h,e.PingPongPlane=_,e.Plane=g,e.RenderTarget=d,e.TextureLoader=y,e.Vec2=x,e.Vec3=b}(v);const{Curtains:g,PingPongPlane:y,Plane:x,RenderTarget:b,TextureLoader:_,Vec2:T,Vec3:P}=v;function E(e,t,i={}){return function(e,{includeRuntimeLocalId:t=!1,includeNames:i=!0}={}){var r;const n=[null==e?void 0:e.id,null==e?void 0:e.publicId];return i&&n.push(null==e?void 0:e.layerName,null==e?void 0:e.name),t&&n.push(null==(r=null==e?void 0:e.local)?void 0:r.id),n.filter(e=>null!=e&&\\\"\\\"!==e)}(e,i).includes(t)}const w=\\\"uFontAtlas\\\",M=\\\"uFontMetrics\\\",R=\\\"uTextLayout\\\",S=[\\\"revealOrder\\\",\\\"revealMotion\\\",\\\"revealStyle\\\",\\\"revealSpread\\\",\\\"revealIntensity\\\",\\\"revealGlow\\\",\\\"revealGlowColor\\\"],k=(e,t)=>`${e}_${t}`,F=(e,t)=>Object.fromEntries(S.map(i=>[i,e[k(i,t)]]));const I=e=>String(e||\\\"\\\").replace(/atlas\\\\.(?:png|webp)(\\\\?|#|$)/,\\\"metrics.png$1\\\"),A=new Map;function L(e){const t=I(e);if(!t)return Promise.resolve(null);let i=A.get(e);return i||(i={value:null},i.promise=new Promise(e=>{const r=new Image;r.crossOrigin=\\\"anonymous\\\",r.onload=()=>{try{const e=r.naturalWidth;if(!e||11!==r.naturalHeight)throw new Error(`unexpected metrics size ${e}x${r.naturalHeight}`);const t=document.createElement(\\\"canvas\\\");t.width=e,t.height=11;const n=t.getContext(\\\"2d\\\");n.drawImage(r,0,0),i.value=function(e,t){const i=(e,i)=>4*((10-i)*t+e),r=(t,r)=>256*e[i(t,r)]+e[i(t,r)+1],n=(t,n)=>e[i(t,n)+2]<128?null:r(t,n)/65535*4-2,a=new Map,s=new Map;let l=1/0,o=-1/0,u=null;for(let c=0;c<t;c++){const t=n(c,2);if(null===t)continue;const r=i(c,1),d=e[r]<<16|e[r+1]<<8|e[r+2];a.set(d,c),s.set(d,t);const h=n(c,4),f=n(c,6);null!==h&&null!==f&&(l=Math.min(l,h),o=Math.max(o,f),72===d&&(u=h))}if(!a.size||0!==a.get(32))return null;const d=r(2,0);return{slots:a,advances:s,ascender:Number.isFinite(l)?l:-1,descender:Number.isFinite(o)?o:.25,capTop:u??(Number.isFinite(l)?l:-1),emPx:r(0,0)||120,pxRange:r(1,0)||10,trueSdf:!!(1&d)}}(n.getImageData(0,0,e,11).data,e)}catch(n){console.warn(\\\"Failed to decode font atlas metrics:\\\",t,n)}e(i.value)},r.onerror=()=>{console.warn(\\\"Failed to load font atlas metrics:\\\",t),e(null)},r.src=t}),A.set(e,i)),i.value?Promise.resolve(i.value):i.promise}function V(e,t){return e.advances.get(t)??.5}function C(e,t,i,r){let n=0,a=0;for(const s of e)n+=V(t,s.codePointAt(0))*i,a++;return n+Math.max(a-1,0)*r}function O({textContent:e,width:t,fontSize:i,lineHeight:r,letterSpacing:n,textAlign:a},s){const l=Math.max(Number(t)||0,1e-6),o=Number(n)||0,u=function(e,t,i,r,n){const a=e=>C(e,i,r,n),s=e?e.split(\\\"\\\\n\\\"):[\\\"\\\"];let l=s.length;for(let o=0;o<l;o++){let e=\\\"\\\";const i=s[o].split(/(\\\\s)/);for(let r=0;r<i.length;r++){const n=i[r],u=e+n;if(a(u)<=t){e=u,r===i.length-1&&(s[o]=e.trim());continue}if(\\\"\\\"!==e){s[o]=e.trim(),s.splice(o+1,0,i.slice(r).join(\\\"\\\")),l++;break}let d=n,c=o;for(;d.length>0;){let e=\\\"\\\";for(const i of d){if(e&&a(e+i)>t)break;e+=i}d=d.slice(e.length),s[c]=e.trim(),d.length>0&&(s.splice(c+1,0,d),c++,l++)}const h=i.slice(r+1).join(\\\"\\\");c!==o?s[c]+=h:h.trimStart()&&(s.splice(o+1,0,h.trimStart()),l++);break}}return s}(String(e??\\\"\\\"),l,s,i,o),d=[],c=[];return u.forEach(e=>{c.push(d.length);const t=C(e,s,i,o);let r=\\\"center\\\"===a?.5*(l-t):\\\"right\\\"===a?l-t:0;const n=[];for(const a of e){const e=a.codePointAt(0),t=s.slots.get(e);t&&n.push({code:e,slot:t,x:r}),r+=V(s,e)*i+o}n.sort((e,t)=>e.x-t.x),d.push(...n.slice(0,2048-d.length))}),c.push(d.length),{lines:u,glyphs:d,lineStarts:c,width:l,height:r*u.length}}function D(e){return e&&\\\"function\\\"==typeof e.clone?e.clone():e&&\\\"object\\\"==typeof e?JSON.parse(JSON.stringify(e)):e}function B(e){return String(e||\\\"\\\").trim()}function U(e=\\\"var\\\"){return`${e}_${Math.random().toString(36).slice(2,10)}`}function z(){return(new Date).toISOString()}function N(e,t,i,r){null==r||r(`Invalid value for Unicorn Studio variable \\\"${e.name}\\\". Expected ${t}; received ${function(e){if(null===e)return\\\"null\\\";if(void 0===e)return\\\"undefined\\\";if(\\\"object\\\"==typeof e)try{return JSON.stringify(e)}catch(t){return Object.prototype.toString.call(e)}return`${typeof e} ${JSON.stringify(e)}`}(i)}.`)}function H(e){return e&&\\\"object\\\"==typeof e?e.src:e}function j(e){const t=Number(e);return Number.isFinite(t)?t:null}function W(e,t={}){const i=Number.isFinite(Number(t.min))?Number(t.min):-1/0,r=Number.isFinite(Number(t.max))?Number(t.max):1/0;return Math.min(r,Math.max(i,e))}function $(e,t){if(!e||\\\"object\\\"!=typeof e)return null;const i=2===t?\\\"Vec2\\\":\\\"Vec3\\\";if(e.type&&e.type!==i)return null;const r=j(e.x??e._x),n=j(e.y??e._y),a=3===t?j(e.z??e._z):0;return null===r||null===n||3===t&&null===a?null:{type:i,x:r,y:n,...3===t?{z:a}:{}}}function G(e){return\\\"string\\\"==typeof e&&/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)}function q(e){return Array.isArray(e)&&e.length>0&&e.every(e=>G(e))}function Y(e,t,i){const r=e.validation||{},n=Array.isArray(r.options)?r.options:null;if(n&&!n.includes(t))return N(e,`one of: ${n.join(\\\", \\\")}`,t,i),{valid:!1,value:t};if(\\\"number\\\"===e.type){const n=j(t);if(null===n)return N(e,\\\"a finite number\\\",t,i),{valid:!1,value:t};return{valid:!0,value:W(\\\"integer\\\"===r.output?Math.round(n):n,r)}}if(\\\"boolean\\\"===e.type)return\\\"boolean\\\"==typeof t?{valid:!0,value:t}:\\\"true\\\"===t||\\\"false\\\"===t?{valid:!0,value:\\\"true\\\"===t}:(N(e,\\\"a boolean\\\",t,i),{valid:!1,value:t});if(\\\"string\\\"===e.type)return\\\"string\\\"==typeof t?{valid:!0,value:t}:\\\"number\\\"==typeof t&&Number.isFinite(t)||\\\"boolean\\\"==typeof t?{valid:!0,value:String(t)}:(N(e,\\\"a string\\\",t,i),{valid:!1,value:t});if(\\\"color\\\"===e.type){if(G(t))return{valid:!0,value:t};const r=$(t,3);return r?{valid:!0,value:r}:(N(e,\\\"a hex color or Vec3 color object\\\",t,i),{valid:!1,value:t})}if(\\\"vec2\\\"===e.type||\\\"vec3\\\"===e.type){const r=\\\"vec2\\\"===e.type?2:3,n=$(t,r);return n?{valid:!0,value:n}:(N(e,`{ type: 'Vec${r}', x, y${3===r?\\\", z\\\":\\\"\\\"} }`,t,i),{valid:!1,value:t})}return\\\"texture\\\"===e.type?\\\"string\\\"==typeof t&&t.trim()?{valid:!0,value:t}:t&&\\\"object\\\"==typeof t&&\\\"string\\\"==typeof t.src&&t.src.trim()?{valid:!0,value:D(t)}:(N(e,\\\"a texture URL string or object with a src\\\",t,i),{valid:!1,value:t}):{valid:!0,value:t}}function X(e={}){return Object.entries(e||{}).reduce((e,[t,i])=>{const r=B(t);return r?(e[r]=D(i),e):e},{})}function J(e){const t=B(null==e?void 0:e.name);return t?{id:e.id||U(\\\"preset\\\"),name:t,description:e.description||\\\"\\\",values:X(e.values),createdAt:e.createdAt||\\\"\\\",updatedAt:e.updatedAt||e.createdAt||\\\"\\\"}:null}function Q(e){return e?{...e,values:X(e.values)}:null}function K(e=[],t=new Set,{keepEmpty:i=!1}={}){return(e||[]).map(e=>{const r=function(e={},t=new Set){return Object.entries(e||{}).reduce((e,[i,r])=>(t.has(i)&&(e[i]=D(r)),e),{})}(e.values,t);return i||Object.keys(r).length?{...e,values:r}:null}).filter(Boolean)}function Z(e){return\\\"Vec2\\\"===(null==e?void 0:e.type)?\\\"vec2\\\":\\\"Vec3\\\"===(null==e?void 0:e.type)?\\\"vec3\\\":\\\"number\\\"==typeof e?\\\"number\\\":\\\"boolean\\\"==typeof e?\\\"boolean\\\":\\\"string\\\"==typeof e&&/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||q(e)?\\\"color\\\":\\\"string\\\"==typeof e?\\\"string\\\":e&&\\\"object\\\"==typeof e&&(e.src||e.sampler)?\\\"texture\\\":\\\"value\\\"}const ee=new Set([\\\"number\\\",\\\"boolean\\\",\\\"string\\\",\\\"color\\\",\\\"vec2\\\",\\\"vec3\\\",\\\"texture\\\"]);function te(e,t=140){const i=B(e);return i?i.slice(0,t):\\\"\\\"}function ie(e={}){const t=te(e.layerId),i=te(e.target||e.property||e.prop),r=te(e.layerName),n=void 0!==e.defaultValue?D(e.defaultValue):0,a=function(e,t){if(ee.has(e))return e;const i=Z(t);return ee.has(i)?i:\\\"number\\\"}(e.type,n),s=te(e.name)||function(e,t){const i=`${t||\\\"Value\\\"}`.replace(/([a-z0-9])([A-Z])/g,\\\"$1 $2\\\").replace(/[^a-zA-Z0-9]+/g,\\\" \\\").trim().split(/\\\\s+/).filter(Boolean);return i.length?i.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(\\\" \\\"):\\\"Value\\\"}(0,i),l=te(e.description,500);return{version:1,action:\\\"createVariable\\\",name:s,type:a,defaultValue:n,...l?{description:l}:{},...t?{layerId:t}:{},...r?{layerName:r}:{},...i?{target:i}:{},...e.kind?{kind:te(e.kind,24)}:{},...e.canvasId?{canvasId:te(e.canvasId)}:{}}}function re(e){return function(e){if(\\\"undefined\\\"!=typeof Buffer)return Buffer.from(e,\\\"utf8\\\").toString(\\\"base64url\\\");const t=(new TextEncoder).encode(e),i=Array.from(t,e=>String.fromCharCode(e)).join(\\\"\\\");return btoa(i).replace(/\\\\+/g,\\\"-\\\").replace(/\\\\//g,\\\"_\\\").replace(/=+$/g,\\\"\\\")}(JSON.stringify(ie(e)))}function ne(e){var t,i,r;return(null==e?void 0:e.isModel)?null==(t=null==e?void 0:e.default)?void 0:t.call(e,e):null==(r=null==(i=null==e?void 0:e.getParams)?void 0:i.call(e))?void 0:r.properties}function ae(e,t){var i,r,n,a,s,l,o,u,d,c,h;const f=null==(i=null==e?void 0:e[t])?void 0:i.sampler;if(f)return f;const p=null==(r=ne(e))?void 0:r[t];if(null==p?void 0:p.textureSampler)return p.textureSampler;if(null==(n=null==p?void 0:p.value)?void 0:n.sampler)return p.value.sampler;if(\\\"video\\\"===(null==p?void 0:p.type))return\\\"uVideoTexture\\\";const m=(null==(l=null==(s=null==(a=null==e?void 0:e.getParams)?void 0:a.call(e))?void 0:s.texture)?void 0:l.sampler)||(null==(u=null==(o=null==e?void 0:e.data)?void 0:o.texture)?void 0:u.sampler);return m||(\\\"texture\\\"===(null==p?void 0:p.output)||\\\"media\\\"===(null==p?void 0:p.type)||\\\"image\\\"===(null==p?void 0:p.type)||\\\"svg\\\"===(null==p?void 0:p.type)||\\\"texture\\\"===t&&((null==(d=null==e?void 0:e[t])?void 0:d.src)||(null==(h=null==(c=null==e?void 0:e.data)?void 0:c.texture)?void 0:h.src))?\\\"uCustomTexture\\\":null)}function se(e,t){var i;const r=null==(i=ne(e))?void 0:i[t];return!function(e=null){return!!e&&(!0===e.variableDisabled||\\\"texture\\\"===e.output&&\\\"svg\\\"===e.type||!!e.options&&!e.radio&&!e.classic)}(r)&&(\\\"texture\\\"!==(null==r?void 0:r.output)||\\\"videoSequence\\\"!==(null==e?void 0:e.type)&&\\\"videoSequence\\\"!==(null==e?void 0:e.createdFrom))}const le=[\\\"relative\\\",\\\"fixed\\\",\\\"auto\\\"];function oe(e,t){const i=null==t?void 0:t.mode;if(!i)return null==t?void 0:t.output;const r=(n=null==e?void 0:e[i],le.includes(n)?n:le[n]||n);var n;return\\\"fixed\\\"===r?\\\"px\\\":\\\"relative\\\"===r?\\\"percent\\\":null==t?void 0:t.output}function ue(e){return\\\"pixels\\\"===e?\\\"px\\\":e}function de(e,t){var i;const r=null==(i=ne(e))?void 0:i[t];if(!r)return;const n=ue(oe(e,r));return n?{output:n}:void 0}function ce(e,t){var i;const r=null==(i=ne(e))?void 0:i[t];return\\\"color\\\"===(null==r?void 0:r.type)||\\\"color\\\"===(null==r?void 0:r.output)||G(null==e?void 0:e[t])||q(null==e?void 0:e[t])?\\\"color\\\":void 0}function he(e,t,i,r){var n,a,s;if(\\\"texture\\\"===(null==e?void 0:e.type)&&\\\"string\\\"==typeof(null==t?void 0:t[i]))return H(r);if(\\\"color\\\"!==(null==e?void 0:e.type))return r;const l=null==t?void 0:t[i];if(Array.isArray(l)){const e=Array.isArray(r)?r[0]:function(e){const t=$(e,3);return t?`#${[t.x,t.y,t.z].map(e=>Math.max(0,Math.min(255,Math.round(255*e))).toString(16).padStart(2,\\\"0\\\")).join(\\\"\\\")}`:null}(r)||r;return void 0===e?r:[e]}if(\\\"Vec3\\\"===(null==l?void 0:l.type)||\\\"3f\\\"===(null==(s=null==(a=null==(n=null==t?void 0:t.data)?void 0:n.uniforms)?void 0:a[i])?void 0:s.type)){if(\\\"Vec3\\\"===(null==r?void 0:r.type))return r;return function(e){if(\\\"string\\\"!=typeof e)return null;const t=/^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(e);if(!t)return null;let i=t[1];return 3===i.length?i=i.split(\\\"\\\").map(e=>e+e).join(\\\"\\\"):8===i.length&&(i=i.slice(0,6)),{type:\\\"Vec3\\\",x:parseInt(i.slice(0,2),16)/255,y:parseInt(i.slice(2,4),16)/255,z:parseInt(i.slice(4,6),16)/255}}(Array.isArray(r)?r[0]:r)||r}return Array.isArray(r)?r[0]:r}function fe(e,t,i=\\\"\\\"){if(e)return\\\"Vec2\\\"===(null==t?void 0:t.type)||\\\"Vec3\\\"===(null==t?void 0:t.type)?(e.value=e.value||{},e.value.x=t.x??t._x??0,e.value.y=\\\"pos\\\"===i||i.endsWith(\\\"_pos\\\")?1-(t.y??t._y??0):t.y??t._y??0,void(\\\"Vec3\\\"===t.type&&(e.value.z=t.z??t._z??0))):void(e.value=t)}function pe(e,t,i){var r,n,a,s,l,o,u,d,c,h,f,p,m,v,g,y,x;const b=null==(r=null==e?void 0:e.state)?void 0:r.call(e),_=null==i?void 0:i.texture,T=(null==i?void 0:i.target)||t.target,P=(null==i?void 0:i.src)||H(null==i?void 0:i.value),E=function(e){var t,i;const r=(null==e?void 0:e.source)||(null==e?void 0:e._source),n=(null==(t=null==e?void 0:e._size)?void 0:t.width)||(null==r?void 0:r.naturalWidth)||(null==r?void 0:r.width)||(null==r?void 0:r.videoWidth)||0,a=(null==(i=null==e?void 0:e._size)?void 0:i.height)||(null==r?void 0:r.naturalHeight)||(null==r?void 0:r.height)||(null==r?void 0:r.videoHeight)||0;return n&&a?{width:n,height:a}:null}(_);if(E&&\\\"image\\\"===(null==e?void 0:e.layerType)){const t={type:\\\"Vec2\\\",x:E.width,y:E.height,_x:E.width,_y:E.height},r=E.width/E.height;e.naturalWidth=E.width,e.naturalHeight=E.height,e.imageNaturalSize=t,e.aspectRatio=r,fe(null==(a=null==(n=null==i?void 0:i.plane)?void 0:n.uniforms)?void 0:a.imageNaturalSize,t,\\\"imageNaturalSize\\\"),fe(null==(l=null==(s=null==i?void 0:i.plane)?void 0:s.uniforms)?void 0:l.aspectRatio,r,\\\"aspectRatio\\\")}if(null==e?void 0:e.isFlattened){const t=null==(u=null==(o=e.data)?void 0:o.textures)?void 0:u.find(e=>(null==e?void 0:e.sampler)===T);t&&(t.src=P,Number.isInteger(t.sublayerIndex)&&(e.local.sourceTextures=e.local.sourceTextures||{},e.local.sourceTextures[t.sublayerIndex]=_));const r=\\\"image\\\"===(null==t?void 0:t.type)&&Number.isInteger(t.sublayerIndex)?null==(d=e.sublayers)?void 0:d.find(e=>e.sublayerIndex===t.sublayerIndex):null;if(E&&\\\"image\\\"===(null==r?void 0:r.layerType)){const n={type:\\\"Vec2\\\",x:E.width,y:E.height,_x:E.width,_y:E.height},a=E.width/E.height,s=`L${t.sublayerIndex}_imageNaturalSize`,l=`L${t.sublayerIndex}_aspectRatio`;r.src=P,r.imageNaturalSize=n,r.aspectRatio=a,(null==(h=null==(c=e.data)?void 0:c.uniforms)?void 0:h[s])&&(e.data.uniforms[s].value=n),(null==(p=null==(f=e.data)?void 0:f.uniforms)?void 0:p[l])&&(e.data.uniforms[l].value=a),fe(null==(v=null==(m=null==i?void 0:i.plane)?void 0:m.uniforms)?void 0:v[s],n,s),fe(null==(y=null==(g=null==i?void 0:i.plane)?void 0:g.uniforms)?void 0:y[l],a,l)}}\\\"function\\\"==typeof(null==b?void 0:b.requestLayerRender)?b.requestLayerRender(e):null==(x=null==b?void 0:b.requestSceneRender)||x.call(b)}function me(e={}){e=e||{};const t=Array.isArray(e.definitions)?e.definitions.map(e=>{const t=B(e.name);return t?{id:e.id||U(\\\"var\\\"),name:t,type:e.type||Z(e.defaultValue),defaultValue:D(e.defaultValue),description:e.description||\\\"\\\",validation:e.validation||{}}:null}).filter(Boolean):[],i=Array.isArray(e.bindings)?e.bindings.map(e=>{var i;const r=B(e.layerId),n=B(e.target||e.prop||e.property),a=e.variableId||(null==(i=t.find(t=>t.name===e.variableName))?void 0:i.id);return r&&n&&a?{id:e.id||U(\\\"bind\\\"),layerId:r,kind:[\\\"source\\\",\\\"texture\\\"].includes(e.kind)?e.kind:\\\"prop\\\",target:n,variableId:a,enabled:!1!==e.enabled}:null}).filter(Boolean):[],r=new Set(t.map(e=>e.id)),n=Array.isArray(e.presets)?K(e.presets.map(J).filter(Boolean),r,{keepEmpty:!0}):[];return{definitions:t,bindings:i,presets:n}}class ve{constructor({variables:e={},getLayer:t,onChange:i,warn:r=console.warn}={}){this.getLayer=t||(()=>null),this.onChange=i||(()=>{}),this.warn=r,this.state=me(e),this.values={},this.state.definitions.forEach(e=>{this.values[e.name]=D(e.defaultValue)})}serialize(){return me({definitions:this.getDefinitions(),bindings:this.state.bindings,presets:this.state.presets})}getDefinitions(){return this.state.definitions.map(e=>({...e,defaultValue:D(e.defaultValue),validation:{...this.getInferredValidation(e),...e.validation}}))}getBindings(){return this.state.bindings.map(e=>({...e}))}getPresets(){return this.state.presets.map(Q)}has(e){return!!this.getDefinition(e)}getDefinition(e){return this.state.definitions.find(t=>t.id===e||t.name===e)||null}getPreset(e){return Q(this.state.presets.find(t=>t.id===e||t.name===e)||null)}getInferredValidation(e){return e&&this.state.bindings.filter(t=>!1!==t.enabled&&t.variableId===e.id).map(e=>de(this.getLayer(e.layerId,e),e.target)).find(e=>null==e?void 0:e.output)||{}}getValue(e){const t=this.getDefinition(e);if(t)return D(this.values[t.name])}getValues(){return this.state.definitions.reduce((e,t)=>(e[t.name]=D(this.values[t.name]),e),{})}add(e,t,i,r=\\\"prop\\\",n=void 0,a={}){const s={kind:r,target:i},l=t&&i?this.getLayer(t,s):null,o=s.target,u=this.createVariable(e,{defaultValue:n,type:a.type||ce(l,o),description:a.description,validation:a.validation||de(l,o),notify:!1});return this.bind(u.id,t,i,r,{notify:!1}),this.notify(),u}createVariable(e,t={}){const i=B(e);if(!i)throw new Error(\\\"Variable name is required.\\\");if(this.state.definitions.some(e=>e.name===i))throw new Error(`Variable \\\"${i}\\\" already exists.`);const r={id:t.id||U(\\\"var\\\"),name:i,type:t.type||Z(t.defaultValue),defaultValue:D(t.defaultValue),description:t.description||\\\"\\\",validation:t.validation||{}};return this.state.definitions.push(r),this.values[r.name]=D(r.defaultValue),!1!==t.notify&&this.notify(),r}getCurrentPresetValues(){return this.state.definitions.reduce((e,t)=>(e[t.id]=D(this.values[t.name]),e),{})}createPreset(e,t={}){const i=B(e);if(!i)throw new Error(\\\"Preset name is required.\\\");if(this.state.presets.some(e=>e.name===i))throw new Error(`Preset \\\"${i}\\\" already exists.`);const r=z(),n={id:t.id||U(\\\"preset\\\"),name:i,description:t.description||\\\"\\\",values:X(t.values||this.getCurrentPresetValues()),createdAt:t.createdAt||r,updatedAt:t.updatedAt||r};return this.state.presets.push(n),!1!==t.notify&&this.notify(),Q(n)}updatePreset(e,t={}){const i=this.state.presets.find(t=>t.id===e||t.name===e);if(!i)return!1;if(void 0!==t.name){const e=B(t.name);if(!e)throw new Error(\\\"Preset name is required.\\\");if(this.state.presets.some(t=>t.id!==i.id&&t.name===e))throw new Error(`Preset \\\"${e}\\\" already exists.`);i.name=e}return void 0!==t.description&&(i.description=t.description||\\\"\\\"),Object.prototype.hasOwnProperty.call(t,\\\"values\\\")&&(i.values=X(t.values)),i.updatedAt=t.updatedAt||z(),!1!==t.notify&&this.notify(),Q(i)}deletePreset(e,t={}){const i=this.state.presets.findIndex(t=>t.id===e||t.name===e);return-1!==i&&(this.state.presets.splice(i,1),!1!==t.notify&&this.notify(),!0)}applyPreset(e,t={}){var i;const r=this.state.presets.find(t=>t.id===e||t.name===e);if(!r)return null==(i=this.warn)||i.call(this,`Unknown Unicorn Studio preset \\\"${e}\\\".`),[];const n=[];return Object.entries(r.values||{}).forEach(([e,i])=>{var a;const s=this.getDefinition(e);s?this.setValue(s.name,i,{persistDefault:!!t.persistDefault,notify:!1})&&n.push(s.name):null==(a=this.warn)||a.call(this,`Preset \\\"${r.name}\\\" references missing variable \\\"${e}\\\".`)}),t.persistDefault&&n.length&&this.notify(),n}bind(e,t,i,r=\\\"prop\\\",n={}){var a,s,l;const o=this.getDefinition(e);if(!o)throw new Error(`Variable \\\"${e}\\\" does not exist.`);const u=[\\\"source\\\",\\\"texture\\\"].includes(r)?r:\\\"prop\\\",d={kind:u,target:i},c=t&&i?this.getLayer(t,d):null,h=d.target;if(\\\"prop\\\"===u&&!se(c,h))return null==(a=this.warn)||a.call(this,`Variable binding is disabled for \\\"${i}\\\".`),null;const f={...o,validation:{...this.getInferredValidation(o),...o.validation}};if(\\\"prop\\\"===u&&!function(e,t,i){var r,n;const a=ue(null==(r=null==e?void 0:e.validation)?void 0:r.output);if(!a)return!0;const s=ue(null==(n=de(t,i))?void 0:n.output);return!s||a===s||\\\"integer\\\"===a&&\\\"number\\\"===s}(f,c,h)){const e=null==(s=de(c,h))?void 0:s.output;return null==(l=this.warn)||l.call(this,`Unable to bind variable \\\"${o.name}\\\" to \\\"${i}\\\". Expected ${f.validation.output}, target uses ${e}.`),null}const p=this.state.bindings.find(e=>e.variableId===o.id&&e.layerId===t&&e.kind===u&&e.target===i);if(p)return p;const m={id:n.id||U(\\\"bind\\\"),variableId:o.id,layerId:t,kind:u,target:i,enabled:!1!==n.enabled};return this.state.bindings.push(m),this.applyBinding(m,this.values[o.name]),!1!==n.notify&&this.notify(),m}unbind(e,t={}){const i=this.state.bindings.findIndex(t=>t.id===e);if(-1===i)return!1;const[r]=this.state.bindings.splice(i,1);return this.clearBinding(r),!1!==t.notify&&this.notify(),!0}deleteVariable(e){const t=this.getDefinition(e);return!!t&&(this.state.bindings.filter(e=>e.variableId===t.id).forEach(e=>this.clearBinding(e)),this.state.definitions=this.state.definitions.filter(e=>e.id!==t.id),this.state.bindings=this.state.bindings.filter(e=>e.variableId!==t.id),this.state.presets=K(this.state.presets,new Set(this.state.definitions.map(e=>e.id)),{keepEmpty:!0}),delete this.values[t.name],this.notify(),!0)}renameVariable(e,t){const i=this.getDefinition(e),r=B(t);if(!i||!r||i.name===r)return!1;if(this.state.definitions.some(e=>e.id!==i.id&&e.name===r))throw new Error(`Variable \\\"${r}\\\" already exists.`);const n=this.values[i.name];return delete this.values[i.name],i.name=r,this.values[i.name]=n,this.notify(),!0}updateVariable(e,t={}){const i=this.getDefinition(e);if(!i)return!1;const r=void 0!==t.name?B(t.name):i.name;if(!r)throw new Error(\\\"Variable name is required.\\\");if(this.state.definitions.some(e=>e.id!==i.id&&e.name===r))throw new Error(`Variable \\\"${r}\\\" already exists.`);const n={...i,name:r,type:void 0!==t.type?t.type:i.type,description:void 0!==t.description?t.description||\\\"\\\":i.description,validation:void 0!==t.validation?t.validation||{}:i.validation},a=Object.prototype.hasOwnProperty.call(t,\\\"defaultValue\\\"),s=Y(n,a?t.defaultValue:this.values[i.name],this.warn);return!!s.valid&&(i.name!==r&&delete this.values[i.name],i.name=r,i.type=n.type,i.description=n.description,i.validation=n.validation,a&&(i.defaultValue=D(s.value)),this.values[i.name]=D(s.value),this.applyVariable(i),!1!==t.notify&&this.notify(),!0)}setValue(e,t,i={}){var r;const n=this.getDefinition(e);if(!n){const t=this.state.definitions.map(e=>e.name).join(\\\", \\\")||\\\"none\\\";return null==(r=this.warn)||r.call(this,`Unknown Unicorn Studio variable \\\"${e}\\\". Available variables: ${t}.`),!1}const a=Y(n,t,this.warn);return!!a.valid&&(this.values[n.name]=D(a.value),this.applyVariable(n),i.persistDefault&&(n.defaultValue=D(a.value),!1!==i.notify&&this.notify()),!0)}setValues(e={},t={}){const i=[];return Object.entries(e||{}).forEach(([e,r])=>{this.setValue(e,r,{...t,notify:!1})&&i.push(e)}),t.persistDefault&&this.notify(),i}applyInitialValues(e={}){Object.entries(e||{}).forEach(([e,t])=>this.setValue(e,t))}applyAll(){this.state.definitions.forEach(e=>this.applyVariable(e))}applyVariable(e){this.state.bindings.filter(t=>!1!==t.enabled&&t.variableId===e.id).forEach(t=>this.applyBinding(t,this.values[e.name]))}applyBinding(e,t){var i,r,n,a,s,l,o;const u=this.getLayer(e.layerId,e);if(!u){const t=this.getDefinition(e.variableId);return void(null==(i=this.warn)||i.call(this,`Unable to apply Unicorn Studio variable binding for \\\"${(null==t?void 0:t.name)||e.variableId}\\\". Layer \\\"${e.layerId}\\\" was not found. Target: ${e.kind||\\\"prop\\\"}:${e.target}.`))}const d=this.getDefinition(e.variableId);if(!d)return void(null==(r=this.warn)||r.call(this,`Unable to apply Unicorn Studio variable binding. Variable \\\"${e.variableId}\\\" was not found for layer \\\"${e.layerId}\\\" target \\\"${e.target}\\\".`));if(\\\"prop\\\"===(e.kind||\\\"prop\\\")&&!se(u,e.target))return void(null==(n=this.warn)||n.call(this,`Skipping variable binding for \\\"${e.target}\\\" because variables are disabled for that property.`));const c=he(d,u,e.target,t);if(\\\"source\\\"===e.kind){const t=H(c);if(\\\"function\\\"==typeof u.setSource)u.setSource(t,{onLoad:t=>pe(u,e,t)});else if(\\\"function\\\"==typeof u.replaceSource){const i=c&&\\\"object\\\"==typeof c?c.thumb||c.src:t;null==(a=u.setRuntimeOverride)||a.call(u,e.target||\\\"src\\\",t),u.replaceSource(t,i||u.thumb,u.naturalWidth,u.naturalHeight)}else\\\"function\\\"==typeof u.setProp?u.setProp(e.target||\\\"src\\\",t,{runtimeOverride:!0}):null==(s=this.warn)||s.call(this,`Unable to apply source variable \\\"${d.name}\\\". Layer \\\"${e.layerId}\\\" does not support source updates.`);return}const h=\\\"texture\\\"===e.kind?e.target:\\\"texture\\\"===d.type?ae(u,e.target):null;h?\\\"function\\\"==typeof u.setTexture?u.setTexture(h,c,{onLoad:t=>pe(u,e,t)}):\\\"function\\\"==typeof u.setProp?u.setProp(e.target,c,{runtimeOverride:!0}):null==(l=this.warn)||l.call(this,`Unable to apply texture variable \\\"${d.name}\\\". Layer \\\"${e.layerId}\\\" does not support texture target \\\"${e.target}\\\".`):\\\"function\\\"==typeof u.setPropertySource?u.setPropertySource(e.target,\\\"runtime\\\",c,{owner:\\\"variable\\\"}):\\\"function\\\"==typeof u.setRuntimeOverride?u.setRuntimeOverride(e.target,c,{source:\\\"variable\\\"}):\\\"function\\\"==typeof u.setProp?u.setProp(e.target,c,{runtimeOverride:!0}):Object.prototype.hasOwnProperty.call(u,e.target)?u[e.target]=c:null==(o=this.warn)||o.call(this,`Unable to apply prop variable \\\"${d.name}\\\". Layer \\\"${e.layerId}\\\" does not expose target \\\"${e.target}\\\".`)}clearBinding(e){const t=this.getLayer(e.layerId,e);if(t&&\\\"function\\\"==typeof t.clearRuntimeOverride){if(\\\"source\\\"===e.kind)return t.clearRuntimeOverride(e.target||\\\"src\\\"),void(\\\"function\\\"==typeof t.replaceSource&&t.replaceSource(t.src,t.thumb,t.naturalWidth,t.naturalHeight));if(\\\"texture\\\"===e.kind){const i=Object.keys(t).find(i=>{var r;return(null==(r=t[i])?void 0:r.sampler)===e.target})||\\\"texture\\\";return void t.clearRuntimeOverride(i)}t.clearRuntimeOverride(e.target)}}getManifest(){return this.getDefinitions().map(e=>{const t=this.state.bindings.filter(t=>t.variableId===e.id);return{...e,currentValue:D(this.values[e.name]),bindingCount:t.length,bindings:t.map(e=>({layerId:e.layerId,kind:e.kind,target:e.target,enabled:e.enabled}))}})}notify(){this.onChange(this.serialize())}}const ge=[\\\"base\\\",\\\"breakpoint\\\",\\\"runtime\\\",\\\"event\\\",\\\"preview\\\"],ye={runtime:\\\"runtimeOverrides\\\",event:\\\"stateEffectProps\\\",preview:\\\"previewProps\\\"},xe=[\\\"Desktop\\\",\\\"Tablet\\\",\\\"Mobile\\\"];function be(e,t){return!!e&&Object.prototype.hasOwnProperty.call(e,t)}function _e(e){return e&&\\\"function\\\"==typeof e.clone?e.clone():Array.isArray(e)?e.map(_e):e&&\\\"object\\\"==typeof e?JSON.parse(JSON.stringify(e)):e}function Te(e){return Array.isArray(e)?e:Array.isArray(null==e?void 0:e.breakpoints)?e.breakpoints:[]}function Pe(e,t={}){const i=Te(e);if(!i.length)return{};if(!t.breakpointName&&!be(t,\\\"width\\\"))return{};const r=t.breakpointName?function(e,t,i={}){const r=Te(e),n=function(e,t){return Array.isArray(t)&&t.length?t.map(e=>\\\"string\\\"==typeof e?e:null==e?void 0:e.name).filter(Boolean):e.map(e=>null==e?void 0:e.name).filter(Boolean)}(r,i.breakpointOrder),a=n.indexOf(t);if(-1===a)return{};const s={};for(let l=a;l>=0;l--){const e=r.find(e=>(null==e?void 0:e.name)===n[l]);(null==e?void 0:e.props)&&Object.keys(e.props).forEach(t=>{be(s,t)||(s[t]=e.props[t])})}return s}(i,t.breakpointName,t):function(e,t,i={}){const r=Te(e);if(!r.length)return{};const n=Number.isFinite(Number(t))?Number(t):0,a=[...r].sort((e,t)=>((null==t?void 0:t.min)??0)-((null==e?void 0:e.min)??0)),s={};for(let u=a.length-1;u>=0;u--){const e=a[u];(null==e?void 0:e.props)&&((null===e.max||n<=e.max)&&Object.keys(e.props).forEach(t=>{be(s,t)||(s[t]=e.props[t])}))}const l=i.baseBreakpointName||\\\"Desktop\\\",o=r.find(e=>(null==e?void 0:e.name)===l);(null==o?void 0:o.props)&&Object.keys(o.props).forEach(e=>{be(s,e)||(s[e]=o.props[e])});return s}(i,t.width,t);return function(e,t){return Array.isArray(t)?t.reduce((t,i)=>(be(e,i)&&(t[i]=e[i]),t),{}):e}(r,t.props)}function Ee(e,t,i,r,n={}){if(!e||!t)return!1;const a=n.cloneValue||_e;if(\\\"base\\\"===i)return function(e,t,i){const r=null==e?void 0:e[t];if(r&&(null==i?void 0:i.type)){const e=i.x??i._x,t=i.y??i._y,n=i.z??i._z;return void 0!==e&&(r.x=e),void 0!==t&&(r.y=t),void 0!==n&&(r.z=n),void 0!==e&&(r._x=e),void 0!==t&&(r._y=t),void 0!==n&&(r._z=n),r}e[t]=i}(e,t,a(r)),!0;if(\\\"breakpoint\\\"===i){const i=n.breakpointName,s=Te(e).find(e=>(null==e?void 0:e.name)===i);return!!s&&(s.props=s.props||{},s.props[t]=a(r),!0)}const s=ye[i];if(!s)return!1;if(e.local=e.local||{},e.local[s]=e.local[s]||{},\\\"runtime\\\"===i&&(e.local.runtimeOverrideBaseValues=e.local.runtimeOverrideBaseValues||{},!be(e.local[s],t))){const i=be(n,\\\"baseValue\\\")?n.baseValue:e[t];e.local.runtimeOverrideBaseValues[t]=a(i)}return e.local[s][t]=a(r),!0}function we(e,t,i,r={}){if(!e||!t)return;if(\\\"breakpoint\\\"===i){const i=Te(e).find(e=>(null==e?void 0:e.name)===r.breakpointName);if(!(null==i?void 0:i.props)||!be(i.props,t))return;const n=i.props[t];return delete i.props[t],n}if(!e.local)return;const n=ye[i];if(!n||!e.local[n]||!be(e.local[n],t))return;const a=e.local[n][t];if(delete e.local[n][t],\\\"runtime\\\"===i&&e.local.runtimeOverrideBaseValues){const i=e.local.runtimeOverrideBaseValues[t];return delete e.local.runtimeOverrideBaseValues[t],i}return a}function Me(e,t,i={}){var r,n,a,s,l,o;const u=i.breakpointProps||Pe(e,i),d={base:be(i,\\\"baseValue\\\")?i.baseValue:null==e?void 0:e[t],breakpoint:be(u,t)?u[t]:void 0,runtime:null==(n=null==(r=null==e?void 0:e.local)?void 0:r.runtimeOverrides)?void 0:n[t],event:null==(s=null==(a=null==e?void 0:e.local)?void 0:a.stateEffectProps)?void 0:s[t],preview:null==(o=null==(l=null==e?void 0:e.local)?void 0:l.previewProps)?void 0:o[t]},c=i.sources||ge;for(let h=c.length-1;h>=0;h--){const e=c[h];if(void 0!==d[e])return{prop:t,source:e,value:d[e],sources:d}}return{prop:t,source:\\\"base\\\",value:d.base,sources:d}}function Re(e,t,i,r=(null==e?void 0:e[t])){if(!e||!i)return r;const n=e.responsiveProps,a=xe.indexOf(i);if(-1===a){const e=null==n?void 0:n[i];return e&&be(e,t)?e[t]:r}for(let s=a;s>=0;s--){const e=null==n?void 0:n[xe[s]];if(e&&be(e,t))return e[t]}return r}const Se=[\\\"appear\\\",\\\"hover\\\",\\\"scroll\\\",\\\"mousemove\\\"],ke=[\\\"appear\\\",\\\"scroll\\\"];function Fe(e){return\\\"whileScrolling\\\"===e.mode?`${e.prop} speed`:e.prop}const Ie=.001,Ae=1e-4,Le=e=>e;function Ve(e,t,i){for(let r=0;r<i;r++)e=(e+t)/2;return+((e+t)/2).toFixed(4)}function Ce(e,t,i,r,n){return{value:e+(i=(i+(t-e)*(.05+.35*(1-Math.max(0,Math.min(1,r??0)))))*(.5+.32*n)),velocity:i}}function Oe(e){return Math.max(0,Math.min(1,e))}function De(e){return!!e.loop&&\\\"none\\\"!==e.loop}function Be(e,t){const i=e.end-e.start;return i>0?(t-e.start)/i:t<e.start?0:1}function Ue(e,t){const i=e.end-e.start;if(i<=0)return 1;const r=i+(e.loopDelay||0),n=Math.min(1,t%r/i);return\\\"reverse\\\"===e.loop&&Math.floor(t/r)%2==1?1-n:n}function ze(e,t,i,r){const n=i.breakpointName,{start:a,end:s}=function(e,t,i){const r=e.transition;if(\\\"scroll\\\"===t&&\\\"whileScrolling\\\"!==e.mode){const{top:t,height:n,viewportHeight:a}=i,s=t-a*e.offset;if(!r)return{start:s,end:s+(a+n)*e.range};const l=s+a*(r.delay||0);return{start:l,end:l+a*r.duration}}if(!r)return{start:0,end:1};const n=r.delay||0;return{start:n,end:n+r.duration}}(e,t,i.scroll);return\\\"appear\\\"===t?{effect:e,start:a,end:s,from:Re(e,\\\"value\\\",n,e.value),to:Re(e,\\\"endValue\\\",n,e.endValue??r),ease:i.getEase(e),loop:e.loop,loopDelay:e.loopDelay}:{effect:e,start:a,end:s,from:Re(e,\\\"startValue\\\",n,e.startValue),to:Re(e,\\\"value\\\",n,e.value),ease:e.transition?i.getEase(e):Le}}function Ne(e){return e.reduce((e,t)=>Math.max(e,t.end),e[0].end)}function He(e,t,i,r,n=!1){let a=e[0],s=a.from??i;for(let o=1;o<e.length&&e[o].start<=t;o++)s=e[o].from??a.to,a=e[o];const l=Be(a,t);return De(a)&&l>0?r(s,a.to,a.ease(Ue(a,t-a.start))):n&&(l<0&&a===e[0]||l>1&&a===e[e.length-1])?r(s,a.to,l):l<=0?s:l>=1?a.to:r(s,a.to,a.ease(l))}function je(e,t){return e[t]??e[`_${t}`]??0}function We(e,t){if(1===t.length)return t[0];if(\\\"number\\\"==typeof e)return t.reduce((t,i)=>t+i-e,e);if(\\\"Vec2\\\"!==(null==e?void 0:e.type)&&\\\"Vec3\\\"!==(null==e?void 0:e.type))return t[t.length-1];const i=(\\\"Vec3\\\"===e.type?[\\\"x\\\",\\\"y\\\",\\\"z\\\"]:[\\\"x\\\",\\\"y\\\"]).map(i=>{const r=je(e,i);return t.reduce((e,t)=>e+je(t,i)-r,r)}),r=t[t.length-1];return\\\"function\\\"==typeof r.clone?new r.constructor(...i):\\\"Vec3\\\"===e.type?{type:\\\"Vec3\\\",x:i[0],y:i[1],z:i[2]}:{type:\\\"Vec2\\\",x:i[0],y:i[1]}}function $e(e,t){e.forEach(e=>{e.effect.progress=e.ease(Oe(Be(e,t)))})}function Ge(e,t,i,r,n){let a=i;if(void 0!==t.lastTick){if(t.spring>0){const e=Ce(t.lastTick,a,t._velocity||0,t.momentum,t.spring);a=e.value,t._velocity=e.velocity}else a=Ve(a,t.lastTick,2*t.momentum);if((r?Math.abs(a)<Ie:Math.abs(t.lastTick-a)<Ie)&&Math.abs(t._velocity||0)<Ae)return{playhead:n(t.lastTick),changed:!1}}return t.lastTick=a,{playhead:n(a),changed:!0}}const qe={appear(e,t){const i=t.appearTime(e[0].effect);if(null===i)return{playhead:0,changed:!1};let r=!1;return e.forEach(e=>{const t=e.effect;if(t.complete)return;r=!0;const n=Oe(Be(e,i));De(e)?t.progress=e.ease(i>e.start?Ue(e,i-e.start):0):n>=1?(t.complete=!0,t.progress=0):t.progress=e.ease(n)}),{playhead:i,changed:r}},hover(e,t){var i;const r=e[0].effect,n=t.isHovered(r),a=r.playhead||0,s=void 0===r.lastTick||n&&!r.wasActive?0:t.now-r.lastTick;let l;return l=n?Math.min(Ne(e),a+s):(null==(i=r.transition)?void 0:i.forwardsOnly)?0:Math.max(0,a-s),r.playhead=l,r.lastTick=t.now,r.wasActive=n,$e(e,l),{playhead:l,changed:l!==a}},scroll(e,t){const i=e[0].effect,{scrollTop:r,viewportHeight:n,height:a,top:s}=t.scroll;if(\\\"whileScrolling\\\"===i.mode){const e=t.scroll.delta??r-(i.lastScrollTop||0);i.lastScrollTop=r;let n=e*i.delta;return i.absScrollValue&&(n=Math.abs(n)),Ge(0,i,n,!0,e=>e)}const l=e[0].start,o=Ne(e);e.forEach(e=>{Object.assign(e.effect,{progress:Oe(Be(e,r)),startScroll:e.start/n,endScroll:e.end/n,sceneHeight:a/n,sceneTop:s})});return Ge(0,i,o>l?Oe((r-l)/(o-l)):r<l?0:1,!1,e=>l+e*(o-l))},mousemove(e,t){const i=e[0].effect,r=t.mouse.pos;let n=0;if(i.lastMousePos&&r){const e=r.x-i.lastMousePos.x,a=r.y-i.lastMousePos.y;n=\\\"x\\\"===i.axisMode?Math.abs(e):\\\"y\\\"===i.axisMode?Math.abs(a):Math.sqrt(e*e+a*a),n>1e-4&&(i.lastMoveTime=t.now)}r&&(i.lastMousePos={x:r.x,y:r.y});const a=i.playhead||0,s=function(e,t,i,r){const{pos:n,width:a,height:s}=t.mouse;if(\\\"proximity\\\"===e.mode){if(!n||!a||!s)return null;let t=n.x-e.point.x*a,i=n.y-e.point.y*s,r=Math.sqrt(a*a+s*s);\\\"x\\\"===e.axisMode?(i=0,r=a):\\\"y\\\"===e.axisMode&&(t=0,r=s);const l=1-Math.min(1,Math.sqrt(t*t+i*i)/r);return Math.pow(l,1+4*e.sensitivity)}return(e.lastMoveTime?t.now-e.lastMoveTime:1/0)>e.delay?0:r>0?Math.min(1,i+r*(e.sensitivity/500)):i}(i,t,a,n);if(null===s)return{playhead:a,changed:!1};let l;if(i.spring>0){const e=Ce(a,s,i._velocity||0,i.momentum,i.spring);l=e.value,i._velocity=e.velocity}else l=Ve(s,a,i.momentum);return Math.abs(l-a)<Ae&&Math.abs(i._velocity||0)<Ae?Math.abs(l)<Ie&&0!==a?(i.playhead=0,i._velocity=0,$e(e,0),{playhead:0,changed:!0}):{playhead:a,changed:!1}:(i.playhead=l,$e(e,l),{playhead:l,changed:!0})}};function Ye(e,t,i){const r=i.playhead&&function(e,t=e.type){return ke.includes(t)&&\\\"whileScrolling\\\"!==e.mode}(t[0].effect,e)?i.playhead(e,t[0].effect):null;if(null==r)return null;if(\\\"scroll\\\"===e){const{top:e,viewportHeight:n}=i.scroll,a=e-n*t[0].effect.offset+n*r;return Math.min(Math.max(a,t[0].start),Ne(t))}return r}function Xe(e,t){return\\\"scroll\\\"===e&&\\\"whileScrolling\\\"!==t[0].effect.mode||(\\\"scroll\\\"===e||\\\"mousemove\\\"===e)&&(t[0].start<=0&&Ne(t)>=1)}let Je,Qe,Ke,Ze,et=!1,tt=window.innerHeight||document.documentElement.clientHeight,it=window.innerWidth||document.documentElement.clientWidth,rt=null,nt=_t(),at=0,st=0,lt=0,ot=0,ut=null,dt=!1,ct=!1,ht=[],ft=null;const pt=[\\\"relative\\\",\\\"fixed\\\",\\\"auto\\\"],mt=[\\\"relative\\\",\\\"fixed\\\"],vt={enterTime:null,movePos:{x:.5,y:.5}},gt=[\\\"lightColor\\\",\\\"ambientLightColor\\\",\\\"fillLightColor\\\"],yt=[\\\"left\\\",\\\"top\\\",\\\"width\\\",\\\"height\\\",\\\"fontSize\\\",\\\"lineHeight\\\",\\\"letterSpacing\\\",\\\"rotation\\\"];let xt=\\\"2.4.0\\\";function bt(e){if(null==e||\\\"\\\"===e)return null;if(\\\"string\\\"==typeof e&&\\\"\\\"===e.trim())return null;const t=Number(e);return Number.isFinite(t)?t:null}function _t(){return null!==rt?rt:window.scrollY||window.pageYOffset||0}function Tt(e=_t()){const t=bt(e);return null!==t&&(nt=t,st=nt-at,at=nt,!0)}function Pt(e){if(!e||\\\"string\\\"!=typeof e)return null;9===e.length?e=e.substring(0,7):8===e.length&&\\\"#\\\"!==e[0]&&(e=\\\"#\\\"+e.substring(0,6));e=e.replace(/^#?([a-f\\\\d])([a-f\\\\d])([a-f\\\\d])$/i,function(e,t,i,r){return t+t+i+i+r+r});const t=/^#?([a-f\\\\d]{2})([a-f\\\\d]{2})([a-f\\\\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:null}function Et(e){const t=Pt(e);return t?new P(...t.map(e=>e/255)):null}void 0!==document.hidden?(Je=\\\"hidden\\\",Qe=\\\"visibilitychange\\\"):void 0!==document.msHidden?(Je=\\\"msHidden\\\",Qe=\\\"msvisibilitychange\\\"):void 0!==document.webkitHidden&&(Je=\\\"webkitHidden\\\",Qe=\\\"webkitvisibilitychange\\\");const wt=new Set([\\\"gradient\\\",\\\"gradientMap\\\",\\\"gradientFill\\\"]);function Mt(e){return window.atob(e)}function Rt(e){return mt.includes(e)?e:mt[e??0]??mt[0]}function St(){return\\\"id-\\\"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function kt(e){const t={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e**4,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e**4:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e**5,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e**5:1-Math.pow(-2*e+2,5)/2,easeOutElastic:e=>{const t=2*Math.PI/3;return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*t)+1},easeInElastic:e=>{const t=2*Math.PI/3;return 0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*t)},easeInOutElastic:e=>{const t=2*Math.PI/4.5;return 0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*t)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*t)/2+1},easeOutSpringSoft:e=>0===e||1===e?e:1-Math.exp(-5*e)*Math.cos(3*e*Math.PI),easeOutSpring:e=>0===e||1===e?e:1-Math.exp(-6*e)*Math.cos(4.5*e*Math.PI),easeInSpring:e=>{if(0===e||1===e)return e;const t=1-e;return Math.exp(-6*t)*Math.cos(4.5*t*Math.PI)},easeInOutSpring:e=>{if(0===e||1===e)return e;if(e<.5){const t=1-2*e;return Math.exp(-6*t)*Math.cos(4.5*t*Math.PI)/2}const t=2*e-1;return 1-Math.exp(-6*t)*Math.cos(4.5*t*Math.PI)/2},easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInCirc:e=>1-Math.sqrt(1-e**2),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInExpo:e=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInBack:e=>{const t=1.70158;return(t+1)*e*e*e-t*e*e},easeOutBack:e=>{const t=1.70158;return 1+(t+1)*Math.pow(e-1,3)+t*Math.pow(e-1,2)},easeInOutBack:e=>{const t=2.5949095;return e<.5?Math.pow(2*e,2)*(7.189819*e-t)/2:(Math.pow(2*e-2,2)*((t+1)*(2*e-2)+t)+2)/2}};if(\\\"string\\\"==typeof e&&(e.includes(\\\"=>\\\")||e.includes(\\\"function\\\")))console.warn(\\\"Custom easing strings are deprecated. Please re-publish the project to update.\\\",e);else if(t[e])return t[e];return t.easeInOutQuad}function Ft(e){return e&&\\\"string\\\"==typeof e&&(e=JSON.parse(e)),Object.values(e)}let It=null;function At(){return null===It&&(It=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)),It}function Lt(e,t){return e.getAttribute(t)}function Vt(e){var t,i,r,n,a,s;if(void 0!==e.local.isDynamicCache)return e.local.isDynamicCache;if(e.isFlattened){const n=e.states&&[...e.states.appear,...e.states.scroll,...e.states.hover,...e.states.mousemove].length>0,a=Array.isArray(null==(t=e.data)?void 0:t.timeUniforms)&&e.data.timeUniforms.some(e=>!1!==(null==e?void 0:e.animating)&&Math.abs(Number((null==e?void 0:e.speed)??0))>1e-5),s=!!(null==(i=e.data)?void 0:i.hasMouseTracking),l=!!(null==(r=e.data)?void 0:r.hasVideoSublayers),o=Array.isArray(e.sublayers)&&e.sublayers.some(e=>!!e&&(\\\"video\\\"===e.type||(\\\"effect\\\"===e.layerType||\\\"model\\\"===e.layerType)&&!!e.animating)),u=n||a||s||l||o;return e.local.isDynamicCache=u,u}const l=[\\\"trackMouse\\\",\\\"axisTilt\\\",\\\"trackMouseMove\\\",\\\"rotationTracking\\\",\\\"lightTracking\\\"].some(t=>e.hasOwnProperty(t)&&0!==e[t]),o=e.states&&[...e.states.appear,...e.states.scroll,...e.states.hover,...e.states.mousemove].length>0,u=(\\\"effect\\\"===e.layerType||e.isModel||\\\"text\\\"===e.layerType&&\\\"custom\\\"===e.textShaderMode&&(null==(a=null==(n=e.data)?void 0:n.uniforms)?void 0:a.time))&&(e.animating||e.usesPingPong),d=\\\"video\\\"===e.type,c=Array.isArray(null==(s=e.data)?void 0:s.textures)&&e.data.textures.some(e=>\\\"video\\\"===(null==e?void 0:e.type)&&(null==e?void 0:e.src)),h=l||o||u||d||c;return e.local.isDynamicCache=h,h}function Ct(e,t){var i,r,n,a,s,l;if(e.noTextAsHtml)return;if(!t)return;const o=function(e){if(!e||\\\"string\\\"!=typeof e)return\\\"\\\";const t=e.trim();if(!t||/[\\\\u0000-\\\\u001F\\\\u007F]/.test(t))return\\\"\\\";const i=t.match(/^([a-z][a-z0-9+.-]*):/i);if(i){const e=i[1].toLowerCase();return[\\\"http\\\",\\\"https\\\",\\\"mailto\\\",\\\"tel\\\"].includes(e)?t:\\\"\\\"}if(t.startsWith(\\\"/\\\")||t.startsWith(\\\"#\\\")||t.startsWith(\\\"?\\\")||t.startsWith(\\\"./\\\")||t.startsWith(\\\"../\\\"))return t;if(t.startsWith(\\\"//\\\"))return t;return\\\"\\\"}(e.href),u=Rt(e.leftMode),d=Rt(e.topMode);let c=\\\"fixed\\\"===(pt.includes(e.widthMode)?e.widthMode:pt[e.widthMode??1])?e.width:e.width*t.offsetWidth,h=e.height,f=\\\"fixed\\\"===e.fontSizeMode?e.fontSize:e.fontSize*t.offsetWidth,p=\\\"fixed\\\"===e.fontSizeMode?e.lineHeight:e.lineHeight*f,m=\\\"fixed\\\"===e.fontSizeMode?e.letterSpacing:e.letterSpacing*f,v=\\\"fixed\\\"===d?e.top:e.top*t.offsetHeight,g=\\\"fixed\\\"===u?e.left:e.left*t.offsetWidth,y=oi(e.anchorPoint);g-=y.x*c,v-=y.y*h,v+=t.offsetTop,g+=t.offsetLeft;let x=t.querySelector(`[data-us-text=\\\"${e.local.id}\\\"]`);const b=o?\\\"a\\\":\\\"div\\\";let _=!x;x&&x.tagName.toLowerCase()!==b&&(x.remove(),x=null,_=!0),x=x||document.createElement(b);const T=Array.isArray(e.fill)?e.fill:[],P={MULTIPLY:\\\"multiply\\\",SCREEN:\\\"screen\\\",OVERLAY:\\\"overlay\\\",DARKEN:\\\"darken\\\",LIGHTEN:\\\"lighten\\\",COLOR_DODGE:\\\"color-dodge\\\",COLOR_BURN:\\\"color-burn\\\",HARD_LIGHT:\\\"hard-light\\\",SOFT_LIGHT:\\\"soft-light\\\",DIFFERENCE:\\\"difference\\\",EXCLUSION:\\\"exclusion\\\"}[e.blendMode&&0!==e.blendMode?String(e.blendMode).toUpperCase():\\\"NORMAL\\\"],E=(null==(r=null==(i=e.local)?void 0:i.stateEffectProps)?void 0:r.opacity)??e.opacity??(null==(n=e.data)?void 0:n.elementOpacity)??1,w=e.htmlOnly||(null==(a=e.local)?void 0:a.gpuTextFallback);let M=\\\"color:transparent;\\\";w&&(M=`color:${T[0]||\\\"#000000\\\"};`);const R=e.isGpuElement&&Array.isArray(null==(s=e.local)?void 0:s.wrappedLines)?e.local.wrappedLines:null;x.setAttribute(\\\"data-us-text\\\",e.local.id),o?(x.setAttribute(\\\"href\\\",o),x.setAttribute(\\\"target\\\",\\\"_blank\\\"),x.setAttribute(\\\"rel\\\",\\\"noopener noreferrer\\\")):(x.removeAttribute(\\\"href\\\"),x.removeAttribute(\\\"target\\\"),x.removeAttribute(\\\"rel\\\")),x.style.cssText=`width:${c}px;top:${v}px;left:${g}px;font-size:${f}px;line-height:${p}px;letter-spacing:${m}px;font-family:${e.fontFamily};font-style:${(null==(l=e.fontStyle)?void 0:l.includes(\\\"italic\\\"))?\\\"italic\\\":\\\"normal\\\"};font-weight:${e.fontWeight};text-align:${e.textAlign};position:absolute;word-break:break-word;white-space:${R?\\\"pre\\\":\\\"pre-wrap\\\"};transform:rotateZ(${Math.round(360*e.rotation)}deg);opacity:${E};z-index:${w?100+(e.htmlRenderOrder??0):2};display:block;text-decoration:none;pointer-events:${o?\\\"auto\\\":\\\"inherit\\\"};cursor:${o?\\\"pointer\\\":\\\"inherit\\\"};${P?`mix-blend-mode:${P};`:\\\"\\\"}${M}`,x.innerText=R?R.join(\\\"\\\\n\\\"):e.textContent,_&&t.appendChild(x)}function Ot(e){const t=e.split(\\\",\\\").map(e=>e.trim()),i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=/iPad|iPhone|iPod/.test(navigator.userAgent);if(i||r){const e=t.find(e=>e.endsWith(\\\".mov\\\")||e.endsWith(\\\".mp4\\\"));if(e)return e}const n=t.find(e=>e.endsWith(\\\".webm\\\"));return n||t[0]}function Dt(){Vi.filter(e=>!document.body.contains(e.element)).forEach(e=>{e.destroy();const t=Vi.indexOf(e);-1!==t&&Vi.splice(t,1)})}function Bt(e){return e&&e.renderer&&e.renderer.nextRender&&\\\"function\\\"==typeof e.renderer.nextRender.execute}function Ut(){cancelAnimationFrame(Ke);let e=Vi.filter(e=>!e.destroyed&&e.getDynamicLayers().length>0);Vi.forEach(t=>{e.includes(t)||(t.rendering=!1)});const t=i=>{let r=!1;e.forEach(e=>{if(!e.destroyed)if(e.isInView&&e.initialized){e.rendering=!0;const t=i-(e.lastTime||0);e.lastTime&&!(t>=e.frameDuration-2)||e.paused||(e.renderFrame(),e.lastTime=e.lastTime&&t>=e.frameDuration?i-t%e.frameDuration:i),r=!0}else e.rendering=!1}),(!lt||i-lt>64)&&(Tt(),lt=i,(st>1e3||st<0&&!at&&!nt)&&Mi()),r?(!function(){var e,t,i,r;let n=performance.now();const a=At();for(let s=0;s<Vi.length;s++){const l=Vi[s];if(l.isInView&&Ii(l))if(a&&(null==(t=null==(e=l.interactivity)?void 0:e.mouse)?void 0:t.disableMobile)||(null==(r=null==(i=l.interactivity)?void 0:i.mouse)?void 0:r.disabled));else{l.mouse.pos.y=l.mouse.movePos.y,l.mouse.pos.x=l.mouse.movePos.x,l.mouse.lastPos.x=l.mouse.pos.x,l.mouse.lastPos.y=l.mouse.pos.y;let e=l.isFixed?l.bbox.top:l.bbox.top+l.scrollY,t=l.bbox.left;l.mouse.page.x>t&&l.mouse.page.y>e&&l.mouse.page.x<l.lastBbox.width+t&&l.mouse.page.y<l.lastBbox.height+e?l.mouse.enterTime||(l.mouse.enterTime=n):l.mouse.enterTime=null}}}(),Ke=requestAnimationFrame(t)):cancelAnimationFrame(Ke)};e.length?Ke=requestAnimationFrame(t):cancelAnimationFrame(Ke)}function zt(e,t,i){return\\\"Vec3\\\"===(null==e?void 0:e.type)&&\\\"Vec3\\\"===(null==t?void 0:t.type)?{type:\\\"Vec3\\\",x:e._x+(t._x-e._x)*i,y:e._y+(t._y-e._y)*i,z:e._z+(t._z-e._z)*i}:\\\"Vec2\\\"===(null==e?void 0:e.type)&&\\\"Vec2\\\"===(null==t?void 0:t.type)?{type:\\\"Vec2\\\",x:e._x+(t._x-e._x)*i,y:e._y+(t._y-e._y)*i}:e+(t-e)*i}function Nt(e,t){return\\\"Vec2\\\"===e.type?e=new T(e._x,e._y):\\\"Vec3\\\"===e.type&&(e=new P(e._x,e._y,e._z)),e}function Ht(e,t,i){if((null==e?void 0:e.type)&&(\\\"Vec2\\\"===(null==e?void 0:e.type)||\\\"Vec3\\\"===(null==e?void 0:e.type))){const r=e.x??e._x??0,n=e.y??e._y??0,a=e.z??e._z??0;t.value.x=r,\\\"pos\\\"===i||i.endsWith(\\\"_pos\\\")?t.value.y=1-n:t.value.y=n,\\\"Vec3\\\"===e.type&&(t.value.z=a)}else t.value=e}function jt(e){return e&&\\\"function\\\"==typeof e.clone?e.clone():e&&\\\"object\\\"==typeof e?JSON.parse(JSON.stringify(e)):e}function Wt(e,t,i){const r=e[t];return\\\"Vec2\\\"===(null==r?void 0:r.type)&&i&&\\\"object\\\"==typeof i?(r.x=i.x??i._x??r.x,void(r.y=i.y??i._y??r.y)):\\\"Vec3\\\"===(null==r?void 0:r.type)&&i&&\\\"object\\\"==typeof i?(r.x=i.x??i._x??r.x,r.y=i.y??i._y??r.y,void(r.z=i.z??i._z??r.z)):void(e[t]=i)}function $t(e,t,i){var r,n,a,s;if(\\\"shape\\\"!==e.layerType&&\\\"text\\\"!==e.layerType)return!1;if(\\\"stroke\\\"===i){const i=Et(Array.isArray(e.stroke)?e.stroke[0]:e.stroke);return i&&(null==(r=t.uniforms)?void 0:r.strokeColor)&&Ht(i,t.uniforms.strokeColor,\\\"strokeColor\\\"),!0}if(\\\"fill\\\"!==i)return!1;const l=Array.isArray(e.fill)?e.fill:[e.fill||\\\"#777777\\\"],o=Math.min(l.length,16);if((null==(n=t.uniforms)?void 0:n.count)&&(t.uniforms.count.value=o),null==(a=t.uniforms)?void 0:a.fillAlpha){const e=l.map(e=>function(e){if(\\\"transparent\\\"===e)return 0;if(\\\"string\\\"!=typeof e)return 1;const t=/^#(?:[0-9a-f]{6})([0-9a-f]{2})$/i.exec(e);return t?parseInt(t[1],16)/255:1}(e));t.uniforms.fillAlpha.value=e.length?Math.max(...e):1}for(let u=0;u<16;u++){const e=null==(s=t.uniforms)?void 0:s[`color${u}`];if(!e)continue;const i=u<o?Et(l[u]):new P(0);i&&Ht(i,e,`color${u}`)}return!0}function Gt(e){if(!e)return{};if(\\\"object\\\"==typeof e)return e;try{return JSON.parse(e)}catch(t){return console.warn(\\\"Unable to parse data-us-vars JSON.\\\",t),{}}}let qt=null;function Yt(){return new URLSearchParams(window.location.search).get(\\\"preset\\\")||\\\"\\\"}function Xt(e){return!0===e||1===e||\\\"1\\\"===e||\\\"true\\\"===e}function Jt(e={}){return e.controls&&\\\"object\\\"==typeof e.controls?e.controls:{}}function Qt(e,t={}){var i;return Jt(t).title||t.controlsTitle||(null==(i=null==e?void 0:e.editMetadata)?void 0:i.sceneName)||(null==e?void 0:e.name)||\\\"Controls\\\"}function Kt(e,t={}){if(!1===t.controls)return!1;const i=Jt(t);if(Object.prototype.hasOwnProperty.call(i,\\\"enabled\\\"))return Xt(i.enabled);const r=Lt(e,\\\"data-us-controls\\\");return Xt(t.controls)||function(){const e=new URLSearchParams(window.location.search).get(\\\"controls\\\");return\\\"1\\\"===e||\\\"true\\\"===e}()||null!==r&&\\\"false\\\"!==r}function Zt(e,t,i={}){if(!Kt(e,i))return;const r=Jt(i);var n,a;(n=r.src||i.controlsSrc||Lt(e,\\\"data-us-controls-src\\\"),(null==(a=window.UnicornStudioControls)?void 0:a.initControls)?Promise.resolve(window.UnicornStudioControls):qt||(qt=new Promise((e,t)=>{const i=document.createElement(\\\"script\\\");i.src=n||\\\"https://assets.unicorn.studio/controls/controls.umd.js\\\",i.async=!0,i.onload=()=>{var i;(null==(i=window.UnicornStudioControls)?void 0:i.initControls)?e(window.UnicornStudioControls):t(new Error(\\\"UnicornStudioControls loaded without initControls().\\\"))},i.onerror=()=>t(new Error(`Unable to load Unicorn Studio controls from ${i.src}.`)),(document.head||document.body).appendChild(i)}),qt)).then(n=>n.initControls({...r,scene:t,element:e,title:Qt(t,i),draggable:r.draggable??i.controlsDraggable??!0})).catch(e=>console.warn(e))}function ei(e){var t;null==(t=e.textures)||t.forEach((t,i)=>{var r;t.index=i,(null==(r=e._program)?void 0:r.compiled)&&t._setTextureUniforms()})}function ti(e,t,i){var r,n;i&&(null==(r=null==e?void 0:e.target)?void 0:r.getTexture)&&i===e.target.getTexture()&&(i=null);const a=null==(n=e.textures)?void 0:n.find(e=>e._samplerName===t);if(a){if(i&&a._copiedFrom!==i)return a.copy(i),a;if(!i&&a._copiedFrom){a._dispose(),e.textures=e.textures.filter(e=>e!==a);const i=e.createTexture({sampler:t,premultiplyAlpha:!0});return ei(e),i}return a}return e.createTexture({sampler:t,premultiplyAlpha:!0,fromTexture:i})}function ii(e){return e&&\\\"object\\\"==typeof e?JSON.parse(JSON.stringify(e)):{}}class ri{constructor({prop:e,value:t,endValue:r,transition:n,breakpoints:a,uniformData:s,loop:l=\\\"none\\\",loopDelay:o=0,responsiveProps:u}){i(this,\\\"id\\\",St()),this.prop=e,this.transition=n,this.complete=!1,this.progress=0,this.uniformData=s,this.value=Nt(t),this.endValue=void 0!==r?Nt(r||0):null,this.responsiveProps=ii(u),this.startTime=null,this.breakpoints=a||[],this.loop=l,this.loopDelay=o,this.easeFunction=kt(this.transition.ease)}resetState(){this.progress=0,this.complete=!1}}class ni{constructor({prop:e,value:t,startValue:r,range:n,offset:a,transition:s,momentum:l,spring:o,uniformData:u,mode:d=\\\"scrollIntoView\\\",delta:c=.01,absScrollValue:h=!0,breakpoints:f=[],responsiveProps:p}){i(this,\\\"id\\\",St()),this.prop=e,this.progress=0,this.momentum=l,this.spring=o??0,this._velocity=0,this.range=n,this.offset=a,this.transition=s,this.mode=d,this.delta=c,this.absScrollValue=h,this.uniformData=u,this.value=Nt(t),this.startValue=void 0!==r?Nt(r):void 0,this.responsiveProps=ii(p),this.lastTick=void 0,this.breakpoints=f||[],s&&(this.easeFunction=kt(s.ease))}resetState(){this.lastTick=void 0}}class ai{constructor({prop:e,value:t,startValue:r,transition:n,breakpoints:a,uniformData:s,triggerOnElement:l,responsiveProps:o}){i(this,\\\"id\\\",St()),this.prop=e,this.transition=n,this.progress=0,this.value=Nt(t),this.startValue=void 0!==r?Nt(r):void 0,this.responsiveProps=ii(o),this.uniformData=s,this.triggerOnElement=void 0!==l?l:1,this.breakpoints=a||[],this.easeFunction=kt(this.transition.ease)}resetState(){this.progress=0,this.playhead=0,this.lastTick=void 0}}class si{constructor({prop:e,value:t,startValue:r,transition:n,sensitivity:a,momentum:s,spring:l,delay:o,mode:u,axisMode:d,point:c,breakpoints:h,uniformData:f,responsiveProps:p}){i(this,\\\"id\\\",St()),this.prop=e,this.progress=0,this.sensitivity=a??.5,this.momentum=s??.25,this.spring=l??0,this._velocity=0,this.delay=o??0,this.mode=u??\\\"velocity\\\",this.axisMode=d??\\\"both\\\",this.point=c??{x:.5,y:.5},this.transition=n,n&&(this.easeFunction=kt(n.ease)),this.value=Nt(t),this.startValue=void 0!==r?Nt(r):void 0,this.responsiveProps=ii(p),this.uniformData=f,this.lastMousePos=null,this.lastMoveTime=null,this.breakpoints=h||[]}resetState(){this.progress=0,this.playhead=0,this._velocity=0,this.lastMousePos=null,this.lastMoveTime=null}}class li{constructor(e,t,r){var n;i(this,\\\"local\\\",{id:\\\"\\\",projectId:\\\"\\\",lastMousePos:{x:.5,y:.5},createdAt:null}),this.initOptions=r,this.aspectRatio=e.aspectRatio||1,this.layerName=e.layerName||e.publicId||e.id,this.data=e.data||{},this.userDownsample=e.userDownsample||1,this.visible=!1!==e.visible,this.groupLayer=e.groupLayer||!1,this.breakpoints=((n=e.breakpoints||[]).forEach(e=>{var t,i;for(let r in e.props)\\\"Vec2\\\"===(null==(t=e.props[r])?void 0:t.type)?e.props[r]=new T(e.props[r]._x,e.props[r]._y):\\\"Vec3\\\"===(null==(i=e.props[r])?void 0:i.type)?e.props[r]=new P(e.props[r]._x,e.props[r]._y,e.props[r]._z):\\\"object\\\"==typeof e.props[r]&&(e.props[r]=Ft(e.props[r]))}),n),this.local.sceneId=t,this.id=e.id||St(),this.publicId=e.publicId||this.id,this.hasPublishedPublicId=Object.prototype.hasOwnProperty.call(e,\\\"publicId\\\"),this.local.id=this.id,this.editorLayerId=e.editorLayerId,this.compiledFragmentShaders=e.compiledFragmentShaders||[],this.compiledVertexShaders=e.compiledVertexShaders||[],this.states={appear:e.states&&e.states.appear?e.states.appear.map(e=>new ri(e)):[],scroll:e.states&&e.states.scroll?e.states.scroll.map(e=>new ni(e)):[],hover:e.states&&e.states.hover?e.states.hover.map(e=>new ai(e)):[],mousemove:e.states&&e.states.mousemove?e.states.mousemove.map(e=>new si(e)):[]},function(e){const t={};(e.breakpoints||[]).forEach(e=>{Object.assign(t,e.props||{})}),Object.keys(t).forEach(i=>{Object.prototype.hasOwnProperty.call(e,i)||(e[i]=jt(t[i]))})}(this)}state(){return Vi.find(e=>e.id===this.local.sceneId)||this.initOptions}getIndex(){return this.state().layers.map(e=>e.local.id).indexOf(this.local.id)}getPixelRatio(){const e=this.state();return e.dpi*e.scale*this.userDownsample}getPlane(){var e,t,i;return null==(i=null==(t=null==(e=this.state())?void 0:e.curtain)?void 0:t.planes)?void 0:i.find(e=>\\\"PingPongPlane\\\"!==e.type&&e.userData.id===this.local.id)}getPlanes(){var e,t,i;return(null==(i=null==(t=null==(e=this.state())?void 0:e.curtain)?void 0:t.planes)?void 0:i.filter(e=>\\\"PingPongPlane\\\"!==e.type&&e.userData.id===this.local.id))||[]}getMaskedItem(){return!!this.mask&&this.state().layers.filter(e=>!e.parentLayer&&!e.groupLayer)[this.getIndex()-1]}getChildEffectItems(){if(this.effects&&this.effects.length){const e=this.state();if(!e||!e.layers)return[];const t=e.layers.filter(e=>this.effects.includes(e.parentLayer));return this.effects.map(e=>t.find(t=>t.parentLayer===e)).filter(e=>void 0!==e)}return[]}getGroup(){var e,t;return this.groupLayer&&(null==(t=null==(e=this.state())?void 0:e.layers)?void 0:t.find(e=>{var t;return e.isGroup&&(null==(t=e.members)?void 0:t.includes(this.groupLayer))}))||null}setVisible(e=!this.visible){var t,i;const r=!1!==e;return this.visible===r||(this.visible=r,this.invalidatePerformanceCaches(),null==(i=null==(t=this.state())?void 0:t.applyLayerVisibility)||i.call(t)),this}show(){return this.setVisible(!0)}hide(){return this.setVisible(!1)}setAnimating(e=!this.animating){var t,i;const r=!1!==e;return this.animating===r||(null==(i=null==(t=this.state())?void 0:t.requestLayerRender)||i.call(t,this),this.animating=r,this.invalidatePerformanceCaches(),Ut()),this}play(){return this.setAnimating(!0)}pause(){return this.setAnimating(!1)}setProp(e,t,i={}){return i.runtimeOverride?this.setRuntimeOverride(e,t,i):this.applyRuntimeProp(e,t)}hasRuntimePropTarget(e){var t,i;return!(!this.local.stateEffectProps||!Object.prototype.hasOwnProperty.call(this.local.stateEffectProps,e))||(!!(null==(i=null==(t=this.data)?void 0:t.uniforms)?void 0:i[e])||(!!this.getPlanes().some(t=>{var i;return null==(i=t.uniforms)?void 0:i[e]})||!(!this.isText||!Object.prototype.hasOwnProperty.call(this,e))))}warnMissingRuntimeProp(e,t){var i,r;const n=null==(i=this.state)?void 0:i.call(this),a=null==(r=null==n?void 0:n.getCreateVariableUrl)?void 0:r.call(n,{layer:this,target:e,defaultValue:t,kind:\\\"prop\\\"});console.warn(`No corresponding variable or live uniform for property \\\"${e}\\\" on layer \\\"${this.id||this.layerName||this.name}\\\".`+(a?` Create a variable here: ${a}`:\\\"\\\"))}setRuntimeOverride(e,t,i={}){return\\\"scene.setProp\\\"!==i.source||this.hasRuntimePropTarget(e)||this.warnMissingRuntimeProp(e,t),Ee(this,e,\\\"runtime\\\",t,{cloneValue:jt}),this.applyRuntimeProp(e,t)}clearRuntimeOverride(e){if(!this.local.runtimeOverrides||!Object.prototype.hasOwnProperty.call(this.local.runtimeOverrides,e))return this;const t=we(this,e,\\\"runtime\\\");return void 0!==t&&this.applyRuntimeProp(e,t),this}setPropertySource(e,t,i){return\\\"runtime\\\"===t?this.setRuntimeOverride(e,i):\\\"event\\\"===t?(this.updateStateEffectProperty(e,i),this):(Ee(this,e,t,i,{cloneValue:jt}),this)}clearPropertySource(e,t,i={}){return\\\"runtime\\\"===t?this.clearRuntimeOverride(e):\\\"event\\\"===t?(we(this,e,\\\"event\\\"),this):(we(this,e,t,i),this)}applyRuntimeOverrides(){Object.entries(this.local.runtimeOverrides||{}).forEach(([e,t])=>{this.applyRuntimeProp(e,t)})}applyRuntimeProp(e,t){return\\\"visible\\\"===e?this.setVisible(t):\\\"animating\\\"===e?this.setAnimating(t):(Wt(this,e,jt(t)),this.syncRuntimeProp(e),this)}syncRuntimeProp(e){var t,i,r,n;const a=this.state();this.local.stateEffectProps&&Object.prototype.hasOwnProperty.call(this.local.stateEffectProps,e)?null==(t=null==a?void 0:a.requestLayerRender)||t.call(a,this):(this.getPlanes().forEach(t=>{var i;$t(this,t,e),function(e,t,i){var r,n,a,s;if(\\\"fill\\\"!==i||!wt.has(e.type))return!1;const l=Array.isArray(e.fill)?e.fill:[e.fill||\\\"#777777\\\"],o=Math.min(l.length,16),u=Math.max(o-1,1);(null==(r=t.uniforms)?void 0:r.count)&&(t.uniforms.count.value=o);for(let d=0;d<16;d++){const i=null==(n=t.uniforms)?void 0:n[`color${d}`];if(i&&d<o){const e=Et(l[d]);e&&Ht(e,i,`color${d}`)}const r=null==(a=t.uniforms)?void 0:a[`stop${d}`];r&&d<o&&(r.value=(null==(s=e.stops)?void 0:s[d])??d/u)}}(this,t,e),(null==(i=t.uniforms)?void 0:i[e])&&Ht(this[e],t.uniforms[e],e)}),this.isText&&\\\"function\\\"==typeof this.render&&(this.render(),null==(r=null==(i=this.preloadedCanvasTexture)?void 0:i.needUpdate)||r.call(i),Ct(this,null==a?void 0:a.element)),null==(n=null==a?void 0:a.requestLayerRender)||n.call(a,this))}setSource(e,t={}){var i,r,n;const a=e&&\\\"object\\\"==typeof e?e.src:e;if(!a)return this;this.setRuntimeOverride(\\\"src\\\",a);const s=this.state();if(!s)return this;if(this.local.sourceTexture=null,this.local.sourceTextureLoading=!1,\\\"image\\\"===this.layerType){const e=null==(i=this.getPlane)?void 0:i.call(this);s.preloadImage(a,\\\"uSourceImage\\\",i=>{var r,n,l;if(!i)return;this.local.sourceTexture=i,this.local.imageReady=!0;const o=null==(r=null==e?void 0:e.textures)?void 0:r.find(e=>\\\"uSourceImage\\\"===e._samplerName);(null==o?void 0:o.copy)?(o.copy(i),null==(n=o.needUpdate)||n.call(o)):e&&e.addTexture(i),null==(l=t.onLoad)||l.call(t,{layer:this,target:\\\"uSourceImage\\\",value:a,texture:i,plane:e,src:a}),s.requestSceneRender()})}else if(\\\"video\\\"===this.type){const e=null==(r=this.getPlane)?void 0:r.call(this);if(e){e.videos=[],e.textures=e.textures.filter(e=>\\\"video\\\"!==e.sourceType);const t=(null==(n=a.includes)?void 0:n.call(a,\\\", \\\"))?Ot(a):a;e.loadVideo(t,{sampler:\\\"uVideoTexture\\\",premultipliedAlpha:!1},()=>s.requestSceneRender())}}return this}setTexture(e,t,i={}){var r,n,a,s,l,o,u;if(!new Set([null==(r=this.texture)?void 0:r.sampler,null==(a=null==(n=this.data)?void 0:n.texture)?void 0:a.sampler,...((null==(s=this.data)?void 0:s.textures)||[]).map(e=>null==e?void 0:e.sampler),...this.getPlanes().flatMap(e=>(e.textures||[]).map(e=>e._samplerName))].filter(Boolean)).has(e))return console.warn(`Unable to set texture. Sampler \\\"${e}\\\" was not found on layer \\\"${this.id}\\\".`),this;const d=\\\"string\\\"==typeof t?{src:t,sampler:e}:{...t||{},sampler:e},c=Object.keys(this).find(t=>{var i;return(null==(i=this[t])?void 0:i.sampler)===e})||\\\"texture\\\";this.setRuntimeOverride(c,d);const h=d.src,f=this.getPlanes().find(t=>{var i;return null==(i=t.textures)?void 0:i.some(t=>t._samplerName===e)})||(null==(l=this.getPlane)?void 0:l.call(this)),p=this.state();if(!h||!f||!(null==p?void 0:p.preloadImage))return this;const m=f.textures.find(t=>t._samplerName===e);return!m||\\\"video\\\"!==d.type&&\\\"video\\\"!==m.sourceType||(null==(u=null==(o=m.source)?void 0:o.pause)||u.call(o),f.videos=(f.videos||[]).filter(e=>e!==m.source),f.textures=f.textures.filter(e=>e!==m)),\\\"video\\\"===d.type?(f.loadVideo(p.preloadVideo(h),{sampler:e,premultipliedAlpha:!0},t=>{var r;const n=null==t?void 0:t.source;n&&(n.loop=d.loop??!0,n.playbackRate=d.playbackRate||1,p.playVideoTexture(f,t,n)),null==(r=i.onLoad)||r.call(i,{layer:this,target:e,value:d,texture:t,plane:f,src:h}),p.requestSceneRender()}),this):(p.preloadImage(h,e,t=>{var r,n;if(!t)return;const a=f.textures.find(t=>t._samplerName===e);(null==a?void 0:a.copy)?(a.copy(t),null==(r=a.needUpdate)||r.call(a)):f.addTexture(t),null==(n=i.onLoad)||n.call(i,{layer:this,target:e,value:d,texture:t,plane:f,src:h}),p.requestSceneRender()},!1),this)}setBreakpointValues(e=null){var t,i;const r=null==(t=this.state)?void 0:t.call(this),n=(null==(i=null==r?void 0:r.getBreakpointWidth)?void 0:i.call(r))||(null==r?void 0:r.breakpointWidth),a=e||n||it,s=[...this.breakpoints].sort((e,t)=>t.min-e.min);if(1===s.length&&\\\"Desktop\\\"===s[0].name)return;if(s.length>=1&&!s.find(e=>\\\"Desktop\\\"===e.name))throw new Error(\\\"Malfored breakpoint data, missing Desktop\\\");const l=e=>{for(let t in e)if(Object.prototype.hasOwnProperty.call(this,t)){let i=e[t];(null==i?void 0:i.type)?(this[t].x=i._x,this[t].y=i._y,void 0!==i._z&&(this[t].z=i._z)):this[t]=i}};l(Pe(this,{breakpointName:\\\"Desktop\\\"}));const o=Pe(this,{width:a});l(o),this.local.bpProps=o,Object.keys(this.local.runtimeOverrides||{}).forEach(e=>{this.local.runtimeOverrideBaseValues=this.local.runtimeOverrideBaseValues||{},this.local.runtimeOverrideBaseValues[e]=jt(this[e])}),this.applyRuntimeOverrides()}updateStateEffects(){var e,t,i,r,n;if(!this.states.appear.some(e=>!e.complete)&&!(null==(e=this.states)?void 0:e.scroll.length)&&!(null==(t=this.states)?void 0:t.hover.length)&&!(null==(i=this.states)?void 0:i.mousemove.length)||this.isModel&&!this.local.modelLoaded)return;const a=this.state()||{},s=a.mouse||vt,l=performance.now();a.isInView&&null===this.local.createdAt&&(this.local.createdAt=l);const o=null==(r=this.getParent)?void 0:r.call(this),u=function(e,t){var i,r,n;const a={},s={},l={},o=[],u=e.local.cachedBreakpoint!==t.breakpointName;e.local.cachedBreakpoint=t.breakpointName;for(const c of Se){const d=e.states[c];if(!(null==d?void 0:d.length))continue;const h={};for(const e of d)!(null==(i=e.breakpoints)?void 0:i.length)||e.breakpoints.includes(t.breakpointName)?(h[r=Fe(e)]||(h[r]=[])).push(e):o.push(e.prop);if(\\\"scroll\\\"!==c||t.scroll)for(const i in h){const r=h[i][0].prop;r in l||(l[r]=t.getRest(r));const o=l[r];if(void 0===o&&\\\"appear\\\"!==c)continue;const d=h[i].map(e=>ze(e,c,t,o)).sort((e,t)=>e.start-t.start);if(d.some(e=>void 0===e.to||null===e.to))continue;const f=d[0].effect,p=Ye(c,d,t),m=f.held&&null===p;f.held=null!==p,f.held&&$e(d,p);const{playhead:v,changed:g}=f.held?{playhead:p,changed:!0}:qe[c](d,t);(a[r]||(a[r]=[])).push({stages:d,playhead:v,extrapolate:Xe(c,d)}),(g||m||u&&void 0!==(null==(n=e.local.stateEffectProps)?void 0:n[r]))&&(s[r]=!0)}}o.forEach(e=>{a[e]||t.clear(e)});const d={};for(const c in s){const e=a[c].map(e=>He(e.stages,e.playhead,l[c],t.interpolate,e.extrapolate));d[c]=We(l[c],e)}return d}(this,{now:l,breakpointName:null==(n=a.currentBreakpoint)?void 0:n.name,interpolate:zt,getEase:e=>e.easeFunction,getRest:e=>this.getEventValue?this.getEventValue(e,this[e]):this[e],clear:e=>we(this,e,\\\"event\\\"),appearTime:e=>a.isInView?l-(e.startTime||this.local.createdAt)-Math.abs(a.pauseTime||0):null,isHovered:e=>e.triggerOnElement&&(this.isElement||this.isModel||this.isFlattened||o)?!!(o||this).isHovered(e.prop):null!==s.enterTime&&void 0!==s.enterTime,scroll:a.bbox?{top:a.isFixed?0:a.bbox.top+nt,height:a.bbox.height/2,scrollTop:nt,viewportHeight:tt,delta:st}:null,mouse:{pos:s.movePos,width:.5*(a.canvasWidth||0),height:.5*(a.canvasHeight||0)}}),d=Object.keys(u);d.length&&(this.getPlanes().forEach(e=>{var t;for(const i of d){const r=u[i];void 0!==r&&((null==(t=e.uniforms[i])?void 0:t.lastValue)!==r&&(e.uniforms[i]&&Ht(r,e.uniforms[i],i),this.updateStateEffectProperty(i,this.fromEventValue?this.fromEventValue(i,r):r)))}}),this.isText&&yt.some(e=>e in u)&&this.local.stateEffectProps&&Object.keys(this.local.stateEffectProps).length&&this.render())}updateStateEffectProperty(e,t){Ee(this,e,\\\"event\\\",t,{cloneValue:jt})}invalidatePerformanceCaches(){this.local.isDynamicCache=void 0,this.local.cachedBreakpoint=void 0,this.local.lastCalculatedMousePos=void 0,this.local.lastCalculatedMouseValues=void 0}dispose(){this.invalidatePerformanceCaches()}}function oi(e){const t={topLeft:{x:0,y:0},topCenter:{x:.5,y:0},topRight:{x:1,y:0},rightCenter:{x:1,y:.5},bottomRight:{x:1,y:1},bottomCenter:{x:.5,y:1},bottomLeft:{x:0,y:1},leftCenter:{x:0,y:.5},center:{x:.5,y:.5}};return t[e]?t[e]:Object.values(t)[e]}function ui(e,t,i,r){const n=e.left??.5,a=e.top??.5,s=\\\"fixed\\\"===Rt(e.leftMode)?n:n*t,l=\\\"fixed\\\"===Rt(e.topMode)?a:a*i,o=pt.includes(e.widthMode)?e.widthMode:pt[e.widthMode??1],u=pt.includes(e.heightMode)?e.heightMode:pt[e.heightMode??1],d=e.aspectRatio||(e.imageNaturalSize?e.imageNaturalSize._x/e.imageNaturalSize._y:1);let c,h;return\\\"auto\\\"===o&&\\\"auto\\\"===u?(c=e.width??0,h=e.height??0):(\\\"auto\\\"!==o&&(c=\\\"fixed\\\"===o?e.width??0:(e.width??0)*t),h=\\\"auto\\\"===u?c/(d||1):\\\"fixed\\\"===u?e.height??0:(e.height??0)*i,\\\"auto\\\"===o&&(c=h*(d||1))),function(e,t,i,r,n,a){const s=oi(n??\\\"center\\\");i<0&&(i=Math.abs(i)),r<0&&(t+=r,r=Math.abs(r));const l=e-s.x*i,o=t-s.y*r;return 2*a.x>=l&&2*a.x<=l+i&&2*a.y>=o&&2*a.y<=o+r}(s,l,c,h,e.anchorPoint,r)}function di(e,t={}){const i=Number(t.maskDepth??e.maskDepth??0),r=Number.isFinite(i)?i:0,n=Number(t.maskDepthLayer??e.maskDepthLayer??1),a=Number.isFinite(n)?Math.max(0,Math.floor(n)):1;e.maskInvert=Object.prototype.hasOwnProperty.call(t,\\\"maskInvert\\\")?t.maskInvert:e.maskInvert??0,e.maskDepth=1===r?1:0,e.maskDepthLayer=1===r?a:0}class ci extends li{constructor(e,t){super(e,t),i(this,\\\"isElement\\\",!0),i(this,\\\"isGpuElement\\\",!1),this.width=e.width||0,this.height=e.height||0,this.widthMode=e.widthMode??\\\"fixed\\\",this.heightMode=e.heightMode??\\\"fixed\\\",this.anchorPoint=e.anchorPoint??\\\"center\\\",this.left=e.left||0,this.top=e.top||0,this.leftMode=e.leftMode??\\\"relative\\\",this.topMode=e.topMode??\\\"relative\\\",this.effects=e.effects||[],this.trackMouse=e.trackMouse||0,this.trackAxes=e.trackAxes||\\\"xy\\\",this.axisTilt=e.axisTilt||0,this.mouseMomentum=e.mouseMomentum||0,this.groupLayer=e.groupLayer||!1,this.mask=e.mask||0,this.maskAlpha=e.maskAlpha||0,this.maskBackground=e.maskBackground||new P(0),di(this,e)}unpackage(){this.effects=Ft(this.effects);for(let e in this)this[e]&&this[e].type&&(\\\"Vec2\\\"===this[e].type?this[e]=new T(this[e]._x,this[e]._y):\\\"Vec3\\\"===this[e].type&&(this[e]=new P(this[e]._x,this[e]._y,this[e]._z)));return this}dispose(){this.local.canvas&&(this.local.canvas.width=1,this.local.canvas.height=1,this.local.canvas=null),this.local.ctx&&(this.local.ctx=null),super.dispose()}box(){const e=oi(this.anchorPoint),{width:t,height:i}=this.getAbsoluteDimensions(),{left:r,top:n}=this.getAbsolutePosition();return{anchor:{x:r+t*(.5-e.x),y:n+i*(.5-e.y)},center:{x:r+t/2,y:n+i/2},left:r,top:n,width:t,height:i}}getAbsolutePosition(){var e,t,i,r;const n=this.state(),a=n.canvasWidth,s=n.canvasHeight;let l=(null==(t=null==(e=this.local)?void 0:e.stateEffectProps)?void 0:t.left)??this.left,o=(null==(r=null==(i=this.local)?void 0:i.stateEffectProps)?void 0:r.top)??this.top;let u=\\\"fixed\\\"===Rt(this.leftMode)?l:l*a,d=\\\"fixed\\\"===Rt(this.topMode)?o:o*s;return u=+u.toFixed(1),d=+d.toFixed(1),{left:u,top:d}}getAbsoluteDimensions(){var e,t,i,r;const n=this.state();let a,s;const l=n.canvasWidth,o=n.canvasHeight;let u=(null==(t=null==(e=this.local)?void 0:e.stateEffectProps)?void 0:t.width)??this.width,d=(null==(r=null==(i=this.local)?void 0:i.stateEffectProps)?void 0:r.height)??this.height,c=pt.includes(this.widthMode)?this.widthMode:pt[this.widthMode],h=pt.includes(this.heightMode)?this.heightMode:pt[this.heightMode];return\\\"auto\\\"!==c&&(a=\\\"fixed\\\"===c?u:u*l,\\\"auto\\\"===h&&(s=a/(this.aspectRatio||1),this.height=\\\"fixed\\\"===c?s:s/o)),\\\"auto\\\"!==h&&(s=\\\"fixed\\\"===h?d:d*o,\\\"auto\\\"===c&&(a=s*(this.aspectRatio||1),this.width=\\\"fixed\\\"===h?a:a/l)),\\\"text\\\"===this.layerType&&(s=this.height),{width:a,height:s}}isHovered(){const e=this.state();return ui(this,e.canvasWidth,e.canvasHeight,e.mouse.movePos)}}class hi extends ci{constructor(e,t,r){super(e,t),i(this,\\\"layerType\\\",\\\"shape\\\"),i(this,\\\"isElement\\\",!0),i(this,\\\"isGpuElement\\\",!0),this.initOptions=r;for(let i in e)i in this||(this[i]=e[i]);di(this,e),this.breakpoints.length&&this.setBreakpointValues()}}class fi extends li{constructor(e,t,r){super(e,t),i(this,\\\"layerType\\\",\\\"effect\\\"),this.initOptions=r,this.type=e.type||\\\"sine\\\",this.usesPingPong=e.usesPingPong||!1,this.speed=e.speed??.5,this.parentLayer=e.parentLayer||!1,this.animating=e.animating||!1,this.isMask=e.isMask||0,this.texture=e.texture||null,this.mouseMomentum=e.mouseMomentum||0;for(let i in e)this[i]||(this[i]=e[i]);this.breakpoints.length&&this.setBreakpointValues()}unpackage(){for(let e in this)this[e]&&this[e].type&&(\\\"Vec2\\\"===this[e].type?this[e]=new T(this[e]._x,this[e]._y):\\\"Vec3\\\"===this[e].type&&(this[e]=new P(this[e]._x,this[e]._y,this[e]._z)));return this}getParent(){var e,t;return null==(t=null==(e=this.state())?void 0:e.layers)?void 0:t.find(e=>{var t;return null==(t=e.effects)?void 0:t.includes(this.parentLayer)})}}class pi extends li{constructor(e,t,r){super(e,t,r),i(this,\\\"layerType\\\",\\\"group\\\"),i(this,\\\"isGroup\\\",!0),this.members=e.members||[],this.effects=e.effects||[],this.opacity=e.opacity??1,this.blendMode=e.blendMode||\\\"NORMAL\\\",this.trackMouse=e.trackMouse||0,this.axisTilt=e.axisTilt||0,this.mouseMomentum=e.mouseMomentum||0,this.mouseSpring=e.mouseSpring||0,this.displace=e.displace||0,this.bgDisplace=e.bgDisplace||0,this.dispersion=e.dispersion||0,this.mask=0}getMemberItems(){var e,t;if(!(null==(e=this.members)?void 0:e.length))return[];const i=this.state(),r=(null==(t=null==i?void 0:i.layers)?void 0:t.filter(e=>this.members.includes(e.groupLayer)))||[];return this.members.map(e=>r.find(t=>t.groupLayer===e)).filter(Boolean)}getChildEffectItems(){var e,t;if(!(null==(e=this.effects)?void 0:e.length))return[];const i=this.state(),r=(null==(t=null==i?void 0:i.layers)?void 0:t.filter(e=>this.effects.includes(e.parentLayer)))||[];return this.effects.map(e=>r.find(t=>t.parentLayer===e)).filter(Boolean)}unpackage(){return this.members=Ft(this.members),this.effects=Ft(this.effects),this}}class mi extends li{constructor(e,t,r){var n,a,s,l;super(e,t),i(this,\\\"layerType\\\",\\\"flattened\\\"),i(this,\\\"isFlattened\\\",!0),this.initOptions=r,this.sublayers=e.sublayers||[],this.visible=!1!==e.visible,this.consumedMaskId=e.consumedMaskId||null,this.mask=e.mask||0,this.maskDepthLayer=e.maskDepthLayer??0,this.maskInvert=e.maskInvert||0,this.maskDepth=e.maskDepth||0,this.maskAlpha=e.maskAlpha||0,this.local.textSublayers=[],this.local.imageSublayers=[],this.local.videoSublayers=[],this.local.modelSublayers=[],this.local.textInstances={},this.local.canvasTextures={},this.local.sourceTextures={},this.local.modelInstances={},this.local.modelTextures={},this.sublayers.forEach((e,i)=>{if(\\\"text\\\"===e.layerType){this.local.textSublayers.push(e);const n={...e},a=Number.isInteger(e.sublayerIndex)?e.sublayerIndex:i;this.local.textInstances[a]=new yi(n,t,r).unpackage()}else if(\\\"image\\\"===e.layerType)this.local.imageSublayers.push(e);else if(\\\"video\\\"===e.type)this.local.videoSublayers.push(e);else if(\\\"model\\\"===e.layerType){this.local.modelSublayers.push(e);const n=Number.isInteger(e.sublayerIndex)?e.sublayerIndex:i;this.local.modelInstances[n]=new gi(e,t,r)}}),this.states.hover.some(e=>e.triggerOnElement)&&Object.values(this.local.modelInstances).forEach(e=>{e.states.hover=[{triggerOnElement:1}]}),this.local.remainingEffectItems=[],this.effects=[],e.remainingEffects&&e.remainingEffects.length>0&&(this.local.remainingEffectItems=e.remainingEffects.map(e=>new fi(e,t,r).unpackage()),this.effects=e.remainingEffects.map(e=>e.parentLayer).filter(Boolean));[...(null==(n=e.states)?void 0:n.appear)||[],...(null==(a=e.states)?void 0:a.scroll)||[],...(null==(s=e.states)?void 0:s.hover)||[],...(null==(l=e.states)?void 0:l.mousemove)||[]].forEach(t=>{var i,r,n,a;if(!t.prop||void 0!==this[t.prop])return;let s;const l=t.originalProp||t.prop;if(l&&Number.isInteger(t.sublayerIndex)){const e=this.sublayers.find(e=>e.sublayerIndex===t.sublayerIndex);e&&void 0!==e[l]&&(s=e[l])}const o=null==(n=null==(r=null==(i=e.data)?void 0:i.uniforms)?void 0:r[t.prop])?void 0:n.value,u=null==(a=t.uniformData)?void 0:a.value;this[t.prop]=s??o??u??t.value}),this.breakpoints.length&&this.setBreakpointValues()}setBreakpointValues(e=null){super.setBreakpointValues(e),this.syncTextBreakpoints()}syncTextBreakpoints(){const e=this.local.bpProps||{};Object.entries(this.local.textInstances||{}).forEach(([t,i])=>{var r,n,a;const s=this.sublayers.find(e=>(null==e?void 0:e.sublayerIndex)===Number(t));let l=!1;Object.entries(e).forEach(([e,r])=>{const n=e.startsWith(`L${t}_`)?e.slice(t.length+2):null;n&&n in i&&(Wt(i,n,jt(r)),s&&n in s&&Wt(s,n,jt(r)),l=!0)}),l&&(null==(r=i.render)||r.call(i),null==(a=null==(n=this.local.canvasTextures[t])?void 0:n.needUpdate)||a.call(n))})}getChildEffectItems(){return this.local.remainingEffectItems||[]}hasRemainingEffects(){return this.local.remainingEffectItems&&this.local.remainingEffectItems.length>0}unpackage(){var e,t,i;for(let r in this)this[r]&&\\\"Vec2\\\"===this[r].type?this[r]=new T(this[r]._x,this[r]._y):this[r]&&\\\"Vec3\\\"===this[r].type&&(this[r]=new P(this[r]._x,this[r]._y,this[r]._z));if(null==(e=this.data)?void 0:e.uniforms)for(let r in this.data.uniforms){const e=this.data.uniforms[r];\\\"Vec2\\\"===(null==(t=null==e?void 0:e.value)?void 0:t.type)?e.value=new T(e.value._x,e.value._y):\\\"Vec3\\\"===(null==(i=null==e?void 0:e.value)?void 0:i.type)&&(e.value=new P(e.value._x,e.value._y,e.value._z))}return this}areTextAssetsReady(){return Object.values(this.local.textInstances).every(e=>e.local.loaded)}areImageAssetsReady(){var e;return!(null==(e=this.data)?void 0:e.textures)||this.data.textures.filter(e=>\\\"image\\\"===e.type).every(e=>{var t;return!!(null==(t=this.local.sourceTextures)?void 0:t[e.sublayerIndex])})}areModelAssetsReady(){var e;if(!(null==(e=this.data)?void 0:e.textures))return!0;const t=this.data.textures.filter(e=>\\\"modelRT\\\"===e.type);return!t.length||t.every(e=>{var t,i,r,n;const a=null==(t=this.local.modelInstances)?void 0:t[e.sublayerIndex];return!!((null==(i=null==a?void 0:a.local)?void 0:i.rendererLoaded)&&(null==(r=null==a?void 0:a.local)?void 0:r.modelLoaded)&&(null==(n=this.local.modelTextures)?void 0:n[e.sublayerIndex]))})}resize(){Object.entries(this.local.textInstances).forEach(([e,t])=>{var i,r;t.resize(),null==(r=null==(i=this.local.canvasTextures[e])?void 0:i.needUpdate)||r.call(i)})}isHovered(e){var t;if(e){const i=e.match(/^L(\\\\d+)_/);if(i){const e=parseInt(i[1],10),r=null==(t=this.local.modelInstances)?void 0:t[e];return(null==r?void 0:r.isHovered)?r.isHovered():this._isSublayerHovered(e)}}const i=this.local.modelInstances;if(i&&Object.values(i).some(e=>{var t;return null==(t=null==e?void 0:e.isHovered)?void 0:t.call(e)}))return!0;for(const r of this.sublayers)if(\\\"model\\\"!==r.layerType&&\\\"effect\\\"!==r.layerType&&this._isSublayerHovered(r.sublayerIndex))return!0;return!1}_isSublayerHovered(e){var t,i;const r=null==(t=this.sublayers)?void 0:t.find(t=>t.sublayerIndex===e);if(!r||\\\"effect\\\"===r.layerType)return!1;const n=this.state();return!!(null==(i=null==n?void 0:n.mouse)?void 0:i.movePos)&&ui(r,n.canvasWidth,n.canvasHeight,n.mouse.movePos)}}class vi extends ci{constructor(e,t,r){super(e,t),i(this,\\\"layerType\\\",\\\"image\\\"),i(this,\\\"isElement\\\",!0),i(this,\\\"isGpuElement\\\",!0),this.initOptions=r;for(let i in e)i in this||(this[i]=e[i]);di(this,e),this.breakpoints.length&&this.setBreakpointValues()}}class gi extends li{constructor(e,t,r){var n;super(e,t,r),i(this,\\\"layerType\\\",\\\"model\\\"),i(this,\\\"isModel\\\",!0),i(this,\\\"contextType\\\",\\\"webgl\\\"),e.moduleRef&&(null==(n=null==r?void 0:r.modules)?void 0:n[e.moduleRef])&&(this.moduleUrl=r.modules[e.moduleRef].url),this.trackMouse=void 0!==e.trackMouse?e.trackMouse:0,this.mouseMomentum=void 0!==e.mouseMomentum?e.mouseMomentum:0,this.mouseSpring=void 0!==e.mouseSpring?e.mouseSpring:0,this.trackAxes=e.trackAxes||\\\"xy\\\",this.lightTracking=void 0!==e.lightTracking?e.lightTracking:0,this.rotationTracking=void 0!==e.rotationTracking?e.rotationTracking:0,this.groupLayer=e.groupLayer||!1,this.speed=void 0!==e.speed?e.speed:.5,this.pos=new P(e.pos._x,e.pos._y,e.pos._z),this.modelUrl=e.modelUrl,this.scale=e.scale,this.modelRotation=new P(e.modelRotation._x,e.modelRotation._y,e.modelRotation._z),this.lightIntensity=e.lightIntensity,this.lightColor=e.lightColor,this.ambientLightColor=e.ambientLightColor,this.fillLightColor=e.fillLightColor,this.ambientLightIntensity=e.ambientLightIntensity??1.5,this.fillLightIntensity=e.fillLightIntensity??1,this.lightPosition=new P(e.lightPosition._x,e.lightPosition._y,e.lightPosition._z),this.materialMetalness=e.materialMetalness,this.materialRoughness=e.materialRoughness,this.refractScale=e.refractScale,this.animationAxis=new P(e.animationAxis._x,e.animationAxis._y,e.animationAxis._z),this.renderNormals=e.renderNormals,this.animating=e.animating,this.opacity=e.opacity,this.colorMapUrl=e.colorMapUrl,this.colorMapScale=e.colorMapScale??1,this.colorMapPosition=e.colorMapPosition?new T(e.colorMapPosition.x??.5,e.colorMapPosition.y??.5):new T(.5,.5),this.colorMapIntensity=e.colorMapIntensity??1,this.quality=e.quality||\\\"fast\\\",this.environmentMapIntensity=e.environmentMapIntensity??0,this.environmentMapUrl=e.environmentMapUrl||\\\"\\\",this.normalMapUrl=e.normalMapUrl||\\\"\\\",this.normalMapScale=e.normalMapScale??1,this.normalMapPosition=e.normalMapPosition?new T(e.normalMapPosition.x??.5,e.normalMapPosition.y??.5):new T(.5,.5),this.normalMapIntensity=e.normalMapIntensity??1,this.extrudeDepth=e.extrudeDepth??10,this.bevelEnabled=e.bevelEnabled??!1,this.bevelThickness=e.bevelThickness??1,this.bevelSize=e.bevelSize??1,this.bevelSegments=e.bevelSegments??2,this.glassIOR=e.glassIOR??1.5,this.glassThickness=e.glassThickness??.5,this.glassRoughness=e.glassRoughness??0,this.glassTint=e.glassTint||\\\"#ffffff\\\",this.glassDispersion=e.glassDispersion??0,this.materialMode=e.materialMode||(e.renderNormals?\\\"glass\\\":\\\"standard\\\"),this.matcapUrl=e.matcapUrl||\\\"https://assets.unicorn.studio/media/matcaps/unicorn_matcap_default.webp\\\",this.matcapIntensity=e.matcapIntensity??.5,this.matcapRotation=e.matcapRotation??0,this.renderNormals=\\\"glass\\\"===this.materialMode||this.renderNormals?1:0,this.loadCallback=null,this.breakpoints.length&&this.setBreakpointValues()}unpackage(){return this.pos=new P(this.pos._x,this.pos._y,this.pos._z),this.modelRotation=new P(this.modelRotation._x,this.modelRotation._y,this.modelRotation._z),this.lightPosition=new P(this.lightPosition._x,this.lightPosition._y,this.lightPosition._z),this.animationAxis=new P(this.animationAxis._x,this.animationAxis._y,this.animationAxis._z),this}async loadRenderer(){const e=this.state();if(!e.curtain||!e.curtain.renderer||!e.curtain.renderer.gl)return void console.error(\\\"No valid rendering context available for model\\\");let t=this.moduleUrl||`https://cdn.jsdelivr.net/gh/hiunicornstudio/unicornstudio.js@v${xt}/extensions/model-renderer.js`;try{const i=await import(t);this.local.initialize=i.initialize,this.local.loadModel=i.loadModel,this.local.draw=i.draw,this.local.dispose=i.dispose,this.local.rendererLoaded=!0,requestAnimationFrame(()=>{var t,i,r;const n=null==(i=null==(t=e.curtain)?void 0:t.renderer)?void 0:i.gl;if(!n)return;this.local.renderTarget&&!this.local.renderTarget._frameBuffer&&this.local.renderTarget._initRenderTarget(),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this.local.initialize(n,this),this.local.initialized=!0,this.local.loadModel(this);const a=null==(r=e.curtain)?void 0:r.renderer;a&&(a.state.flipY=null,a.state.premultiplyAlpha=null)})}catch(i){console.error(\\\"Failed to load model renderer:\\\",i)}}handleModelLoaded(e=null){var t,i,r,n;if(this.local.modelLoaded=!0,this.local.modelObject=e,this.local.renderTarget){let e=this.local.renderTarget.getTexture();const n=this.getPlane()||(null==(i=null==(t=this.local.hostLayer)?void 0:t.getPlane)?void 0:i.call(t)),a=this.local.targetSamplerName||\\\"uTexture\\\";let s=null==(r=null==n?void 0:n.textures)?void 0:r.find(e=>e._samplerName===a);s&&e&&s.copy(e)}this.animating||(this.renderModel(),this.local.renderedOnce=!0);const a={layer:this,object:this.local.modelObject,modelUrl:this.modelUrl};null==(n=this.loadCallback)||n.call(this,a)}onLoad(e){return\\\"function\\\"!=typeof e?()=>{}:(this.loadCallback=e,this.local.modelLoaded&&e({layer:this,object:this.local.modelObject||null,modelUrl:this.modelUrl}),()=>{this.loadCallback===e&&(this.loadCallback=null)})}renderModel(){var e,t,i,r,n,a;if(!this.local.rendererLoaded||!this.local.modelLoaded)return;const s=this.state();if(!s||s.destroyed||!s.curtain||!s.curtain.renderer||!s.curtain.renderer.gl)return;const l=s.curtain.renderer.gl;if(0===l.drawingBufferWidth||0===l.drawingBufferHeight)return;if(this.animating){void 0===this.local.time&&(this.local.time=0);let t=(null==(e=this.local.stateEffectProps)?void 0:e.speed)??this.speed??.5;const i=s.fps?60/s.fps:1;this.local.time+=t*i*60}const o=this.materialMode||(this.renderNormals?\\\"glass\\\":\\\"standard\\\"),u=this.environmentMapUrl||\\\"\\\";if(this.environmentMapIntensity>0){const e=this.getPlane()||(null==(i=null==(t=this.local.hostLayer)?void 0:t.getPlane)?void 0:i.call(t));if(e&&!u.trim()){const t=e.textures.find(e=>\\\"uBgTexture\\\"===e._samplerName);(null==t?void 0:t._copiedFrom)&&t._sampler?this.local.envTexture={gl:l,webglTexture:t._sampler.texture,width:t._size.width,height:t._size.height}:this.local.envTexture=null}else u.trim()||(this.local.envTexture=null)}else this.local.envTexture=null;if(\\\"glass\\\"===o){const e=this.getPlane()||(null==(n=null==(r=this.local.hostLayer)?void 0:r.getPlane)?void 0:n.call(r));if(e){const t=e.textures.find(e=>\\\"uBgTexture\\\"===e._samplerName);(null==t?void 0:t._copiedFrom)&&t._sampler&&t._sampler.texture?this.local.backgroundTexture={gl:l,webglTexture:t._sampler.texture,width:t._size.width,height:t._size.height}:this.local.backgroundTexture=null}else this.local.backgroundTexture=null}else this.local.backgroundTexture=null;const d=void 0!==this.local.time?this.local.time:performance.now();if(this.local.renderTarget)if(this.local.renderTarget._frameBuffer){const e=this.local.renderTarget._frameBuffer,t=this.local.renderTarget._size.width,i=this.local.renderTarget._size.height;l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!1),l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),l.bindFramebuffer(l.FRAMEBUFFER,e),l.viewport(0,0,t,i);try{this.local.draw(l,d,this)}finally{l.bindFramebuffer(l.FRAMEBUFFER,null),l.viewport(0,0,l.drawingBufferWidth,l.drawingBufferHeight),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0),l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);const e=null==(a=s.curtain)?void 0:a.renderer;e&&(e.setBlendFunc(),e.state.blending=!0,e.state.currentProgramID=null,e.state.currentGeometryID=null,e.state.forceBufferUpdate=!0,e.state.frameBufferID=null,e.state.activeTexture=null,e.state.depthTest=null,e.state.cullFace=null,e.state.flipY=null,e.state.premultiplyAlpha=null)}}else this.local.draw(l,d,this),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0)}resize(){var e;const t=this.state();if(!(null==t?void 0:t.resizeRenderTarget)||!this.local.renderTarget||!(null==(e=t.curtain)?void 0:e.canvas))return;const i=this.getPlane();let r=this.userDownsample||1;(null==i?void 0:i.userData)&&void 0!==i.userData.downSample&&(r=\\\"number\\\"==typeof i.userData.downSample?i.userData.downSample:1);const n=t.curtain.canvas.width*r,a=t.curtain.canvas.height*r;t.resizeRenderTarget(this.local.renderTarget,n,a)}cleanup(){var e;if(this.local.dispose&&this.local.dispose(this),this.local.initialize=null,this.local.loadModel=null,this.local.draw=null,this.local.dispose=null,this.local.rendererLoaded=!1,this.local.initialized=!1,this.local.modelLoaded=!1,this.local.modelObject=null,this.local.renderTarget){this.local.renderTarget.remove();let t=this.getPlane();t&&(null==(e=t.removeRenderTarget)||e.call(t)),this.local.renderTarget=null}}isAnimating(){return this.visible&&(this.animating||this.trackMouse>0||this.rotationTracking>0||this.lightTracking>0)}getProp(e){var t;return(null==(t=this.local.stateEffectProps)?void 0:t[e])??this[e]}isAnimatableLightColorProp(e){return gt.includes(e)}getEventValue(e,t=this[e]){if(!this.isAnimatableLightColorProp(e)||null==t)return t;if(\\\"Vec3\\\"===(null==t?void 0:t.type))return t instanceof P?t.clone():new P(t.x??t._x,t.y??t._y,t.z??t._z);const i=Pt(t);return i?new P(...i.map(e=>e/255)):t}fromEventValue(e,t){if(!this.isAnimatableLightColorProp(e)||null==t||\\\"string\\\"==typeof t)return t;if(\\\"Vec3\\\"===(null==t?void 0:t.type)){return function(e,t,i){return\\\"#\\\"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1)}(...[t.x??t._x??0,t.y??t._y??0,t.z??t._z??0].map(e=>Math.max(0,Math.min(255,Math.round(255*e)))))}return t}isHovered(){if(!this.local.boundingBox)return!1;const e=this.state(),t=e.canvasWidth,i=e.canvasHeight,r=this.local.boundingBox.min,n=this.local.boundingBox.max,a=r.x*t,s=r.y*i,l=n.x*t,o=n.y*i,u=e.mouse.movePos;return 2*u.x>=a&&2*u.x<=l&&2*u.y>=s&&2*u.y<=o}dispose(){this.cleanup(),super.dispose()}}class yi extends ci{constructor(e,t,r){var n;if(super(e,t),i(this,\\\"layerType\\\",\\\"text\\\"),i(this,\\\"isText\\\",!0),this.initOptions=r,this.opacity=e.opacity??1,this.displace=e.displace||0,this.bgDisplace=e.bgDisplace||0,this.dispersion=e.dispersion||0,this.rotation=e.rotation||0,this.blendMode=e.blendMode||\\\"NORMAL\\\",\\\"gpu\\\"===e.textRenderMode)for(let i in e)i in this||(this[i]=e[i]);else{let t=this.default(e||{});for(let e in t)this[e]=t[e]}this.breakpoints.length&&this.setBreakpointValues(),this.isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this.textRenderMode=e.textRenderMode||\\\"canvas\\\",this.fontAtlas=e.fontAtlas||\\\"\\\";const a=String((null==(n=this.compiledFragmentShaders)?void 0:n[0])||\\\"\\\").includes(R);var s;this.isGpuElement=a&&!!this.fontAtlas&&(s=this.textContent,String(s??\\\"\\\").length<=2048),this.local.gpuTextFallback=a&&!this.isGpuElement,Object.keys(e).length&&!this.isGpuElement&&this.createLocalCanvas(),this.loadFont()}createLocalCanvas(){const e=this.state(),t=document.createElement(\\\"canvas\\\"),i=this.getPixelRatio();t.width=e.canvasWidth*i,t.height=e.canvasHeight*i;const r=t.getContext(\\\"2d\\\");r.scale(i,i),this.local.canvas=t,this.local.ctx=r}resize(){var e,t,i;const r=this.state();if(this.local.canvas){const e=this.getPixelRatio();this.local.canvas.width=r.canvasWidth*e,this.local.canvas.height=r.canvasHeight*e,this.local.ctx.scale(e,e)}const n=null==(e=r.currentBreakpoint)?void 0:e.name;(null==(i=null==(t=this.states)?void 0:t.appear)?void 0:i.some(e=>!e.complete&&(!e.breakpoints||0===e.breakpoints.length||e.breakpoints.includes(n))))||this.render(),Ct(this,this.state().element)}default(e){return{fill:e.fill||[\\\"#ffffff\\\"],fontSize:e.fontSize??24,fontSizeMode:e.fontSizeMode||\\\"fixed\\\",fontCSS:e.fontCSS||null,lineHeight:e.lineHeight??25,letterSpacing:e.letterSpacing||0,minHeight:e.minHeight||0,fontFamily:e.fontFamily||\\\"arial\\\",fontStyle:e.fontStyle||\\\"normal\\\",fontWeight:e.fontWeight||\\\"normal\\\",textAlign:e.textAlign||\\\"left\\\",textContent:e.textContent||\\\"\\\",href:e.href||\\\"\\\",gradientAngle:e.gradientAngle||e.gradAngle||0,gradientType:e.gradientType||e.gradType||\\\"linear\\\",noTextAsHtml:e.noTextAsHtml||!1,htmlOnly:e.htmlOnly||!1,htmlRenderOrder:e.htmlRenderOrder??0}}unpackage(){return this.fill=Ft(this.fill),this}loadFont(){var e;const t=this.fontStyle.includes(\\\"italic\\\")?\\\"italic\\\":\\\"normal\\\",i=e=>\\\"normal\\\"===e||\\\"400\\\"===e||400===e?\\\"normal\\\":e.toString(),r=isNaN(parseInt(this.fontWeight))?\\\"normal\\\":i(this.fontWeight);if(Array.from(document.fonts).some(e=>e.family===this.fontFamily&&e.style===t&&i(e.weight)===r&&\\\"loaded\\\"===e.status)||!(null==(e=this.fontCSS)?void 0:e.src))return void this.handleFontLoaded();let n=this.fontCSS.src.split(\\\" \\\").join(\\\"%20\\\");const a=new FontFace(this.fontFamily,`url(${n})`,{style:t,weight:r});document.fonts.add(a),a.load().then(()=>{this.handleFontLoaded()}).catch(e=>{console.error(\\\"Font loading error:\\\",e),this.handleFontLoaded()})}handleFontLoaded(){this.local.loaded=!0,this.render(),this.render();const e=this.state();Bt(e.curtain)&&e.renderFrame(),Ct(this,this.state().element)}getAbsoluteFontValues(e){var t,i,r,n,a,s;const l=(null==(i=null==(t=this.local)?void 0:t.stateEffectProps)?void 0:i.fontSize)??this.fontSize,o=(null==(n=null==(r=this.local)?void 0:r.stateEffectProps)?void 0:n.lineHeight)??this.lineHeight,u=(null==(s=null==(a=this.local)?void 0:a.stateEffectProps)?void 0:s.letterSpacing)??this.letterSpacing,d=\\\"fixed\\\"===this.fontSizeMode?l:l*e.canvasWidth,c=e=>\\\"fixed\\\"===this.fontSizeMode?e:e*d;return{fontSize:d,lineHeight:c(o),letterSpacing:c(u),minHeight:c(this.minHeight||0)}}renderGpuLayout(){var e,t,i;const r=function(e){var t;return(null==(t=A.get(e))?void 0:t.value)||null}(this.fontAtlas);if(!r)return;const{left:n,top:a,width:s}=this.box(),{fontSize:l,lineHeight:o,letterSpacing:u,minHeight:d}=this.getAbsoluteFontValues(this.state()),c=O({textContent:this.textContent,width:s,fontSize:l,lineHeight:o,letterSpacing:u,textAlign:this.textAlign},r);this.height=Math.max(c.height,d),this.local.wrappedLines=c.lines,this.local.textMetrics=r,this.local.textLayoutCanvas=function(e,t){const i=Math.max(e.glyphs.length,e.lineStarts.length,1);t.width=i,t.height=3;const r=t.getContext(\\\"2d\\\"),n=r.createImageData(i,3),a=(e,t,r,a)=>{const s=4*((2-e)*i+t);n.data[s]=r>>8&255,n.data[s+1]=255&r,n.data[s+2]=a,n.data[s+3]=255};return e.glyphs.forEach((t,i)=>{const r=(t.x/e.width+1)/3;a(0,i,Math.round(65535*Math.min(Math.max(r,0),1)),255),a(2,i,Math.min(t.slot,65535),255)}),e.lineStarts.forEach((e,t)=>{a(1,t,Math.min(e,65535),255)}),r.putImageData(n,0,0),t}(c,this.local.textLayoutCanvas||document.createElement(\\\"canvas\\\")),null==(t=null==(e=this.local.textLayoutTexture)?void 0:e.needUpdate)||t.call(e);const h=oi(this.anchorPoint);this.local.textBoxPos={x:n-h.x*s,y:a-h.y*this.height},Ct(this,null==(i=this.state())?void 0:i.element)}render(){var e,t,i;if(this.isGpuElement)return void this.renderGpuLayout();if(!(null==(e=this.local)?void 0:e.ctx))return;let r=this.local.ctx,{left:n,top:a,width:s}=this.box();const l=oi(this.anchorPoint),o=((null==(i=null==(t=this.local)?void 0:t.stateEffectProps)?void 0:i.rotation)??this.rotation)||0;let u=this.state(),d=this.height,c=n-l.x*s,h=a-l.y*d,f=0,{fontSize:p,lineHeight:m,letterSpacing:v,minHeight:g}=this.getAbsoluteFontValues(u),y=this.fontStyle.includes(\\\"italic\\\")?\\\"italic\\\":\\\"normal\\\",x=/^\\\\d+$/.test(this.fontStyle)?this.fontStyle:\\\"400\\\";r.clearRect(0,0,u.canvasWidth,u.canvasHeight),r.font=`${y} ${x} ${p}px/${m}px ${this.fontFamily}, -apple-system, BlinkMacSystemFont, Helvetica, Arial`,this.isSafari||(r.textAlign=this.textAlign,r.letterSpacing=v+\\\"px\\\");const b=r.measureText(\\\"m\\\").width;s=Math.max(s,b);const _=(e,t)=>{let i=h+m*t+m/2+p/3;this.isSafari?((e,t,i,r,n,a,s)=>{let l,o=t.split(\\\"\\\").reduce((i,r,a)=>i+e.measureText(r).width+(a<t.length-1?n:0),0);if(l=\\\"center\\\"===a?i+(s-o)/2-s/2:i,\\\"right\\\"===a)for(let u=t.length-1;u>=0;u--){const i=t[u];l-=e.measureText(i).width,e.fillText(i,l,r),u>0&&(l-=n)}else for(let u=0;u<t.length;u++)e.fillText(t[u],l,r),l+=e.measureText(t[u]).width+n})(r,e,c,i,v,this.textAlign,s):r.fillText(e,c,i)},T=this.textContent?this.textContent.split(\\\"\\\\n\\\"):[\\\"\\\"];let P=T.length;const E=(e,t,i)=>t.split(\\\"\\\").reduce((r,n,a)=>(r+=e.measureText(n).width,a<t.length-1&&(r+=i),r),0);for(let R=0;R<P;R++){let e=\\\"\\\",t=T[R].split(/(\\\\s|\\\\n)/);for(let i=0;i<t.length;i++){const n=t[i],a=e+n;if((this.isSafari&&v?E(r,a,v):r.measureText(a).width)>s||\\\"\\\\n\\\"===n){if(\\\"\\\"!==e)T[R]=e.trim(),i!==t.length-1?(T.splice(R+1,0,t.slice(i).join(\\\"\\\")),P++):\\\"\\\\n\\\"!==n&&T.push(n);else{let e=n,a=R;for(;e.length>0;){let t=\\\"\\\";for(let i=0;i<e.length&&(r.measureText(t+e[i]).width<=s||0==i);i++)t+=e[i];e=e.slice(t.length),T[a]=t.trim(),e.length>0&&(T.splice(a+1,0,e),a++,P++)}t.slice(i+1).length>0&&(T[a]+=t.slice(i+1).join(\\\"\\\"))}break}e=a,i===t.length-1&&(T[R]=e.trim())}}this.height=Math.max(m*(T.length-1)+m,g),h=a-l.y*this.height,r.save();const w=c+s/2,M=h+this.height/2;r.translate(w,M),r.rotate(360*o*Math.PI/180),r.translate(-w,-M),\\\"center\\\"===this.textAlign&&(c+=s/2),\\\"right\\\"===this.textAlign&&(c+=s),r.fillStyle=this.fill[0],T.forEach((e,t)=>{_(e,f),t<T.length-1&&f++}),r.translate(-(c+s/2),-(h+d/2)),r.restore()}}function xi(){let e=performance.now();document[Je]?(cancelAnimationFrame(Ke),Vi.forEach(t=>{t.pauseTime=e})):(Ut(),Ei(),Vi.forEach(t=>{var i,r;t.pauseTime=t.pauseTime-e,null==(r=null==(i=t.curtain)?void 0:i.planes)||r.forEach(e=>{e.videos.forEach(e=>{var t;null==(t=e.play())||t.catch(()=>{})})})}))}function bi(){tt=window.innerHeight||document.documentElement.clientHeight,it=window.innerWidth||document.documentElement.clientWidth,Vi.filter(e=>e.initialized).forEach(e=>{e.refresh()}),Mi()}function _i(e,t,i=50){const r=t||e.getBoundingClientRect(),n=r.top>=-i&&r.top<=tt+i||r.bottom>=-i&&r.bottom<=tt+i||r.top<=0&&r.bottom>=tt,a=r.left>=-i&&r.left<=it+i||r.right>=-i&&r.right<=it+i||r.left<=0&&r.right>=it;return n&&a}function Ti(e){\\\"function\\\"==typeof window.requestIdleCallback?window.requestIdleCallback(e,{timeout:500}):setTimeout(()=>e({didTimeout:!1,timeRemaining:()=>8}),16)}function Pi(e){const t=e.bbox||e.element.getBoundingClientRect();return t.bottom<0?-t.bottom:t.top>tt?t.top-tt:0}function Ei(){!ct&&ht.length&&(ct=!0,Ti(()=>{if(ct=!1,ht=ht.filter(e=>!e.destroyed&&Vi.includes(e)&&document.body.contains(e.element)&&!e.initialized&&!e.initializing),!ht.length)return;const e=Vi.some(e=>e.isInView&&e.initializing&&!e.destroyed);if(dt||document.hidden||e)return void setTimeout(Ei,80);ht.sort((e,t)=>{const i=2*tt,r=Pi(e),n=Pi(t);return(r<=i?0:1)-(n<=i?0:1)||r-n});const t=ht.shift();t.local.prewarmQueued=!1,t.initializePlanes(()=>Ei(),!0)}))}function wi(e){!(null==e?void 0:e.lazyLoad)||e.destroyed||e.initialized||e.initializing||e.local.prewarmQueued||(e.local.prewarmQueued=!0,ht.push(e),Ei())}function Mi(){Vi.filter(e=>e.getDynamicLayers().length||e.lazyLoad&&!e.initialized).forEach(e=>{let t=e.element.getBoundingClientRect();if(e.scrollY=nt,e.lastBbox){0===Math.abs(t.top-e.lastBbox.top)&&st>0?(e.fixedCounter=(e.fixedCounter||0)+1,e.fixedCounter>3&&(e.isFixed=!0)):e.fixedCounter=0}e.lastBbox=e.bbox,e.bbox=t})}function Ri(){const e=performance.now();Vi.filter(e=>e.getDynamicLayers().length||e.lazyLoad&&!e.initialized).forEach(t=>{if(_i(t.element,t.bbox,100)){if(!t.isInView){t.isInView=!0,t.pauseTime=t.pauseTime-e;const i=t.element.offsetWidth>0&&t.element.offsetHeight>0;i&&t.curtain?t.resize():i||requestAnimationFrame(()=>{t.element.offsetWidth>0&&t.element.offsetHeight>0&&t.curtain&&t.resize()}),wi(t)}}else t.isInView&&(t.isInView=!1,t.pauseTime=e)})}function Si(){dt=!1,Tt(),Mi(),Ri();const e=Vi.filter(e=>e.getDynamicLayers().length),t=Vi.filter(e=>e.rendering);e.length&&!t.length&&Ut(),Ei()}function ki(){dt=!0;const e=Vi.filter(e=>e.getDynamicLayers().length),t=Vi.filter(e=>e.rendering);e.length&&!t.length&&Ut();const i=performance.now();(!ot||i-ot>80)&&(Mi(),ot=i),clearTimeout(ut),ut=setTimeout(Si,80),Ri()}function Fi(){Tt(),ki()}function Ii(e){var t;if(e._hasMousePos)return!0;if(!(null==(t=e.curtain)?void 0:t.planes))return!1;const i=e.curtain.planes.find(e=>e.uniforms.mousePos);return i&&(e._hasMousePos=!0),!!i}function Ai(e){for(let t=0;t<Vi.length;t++){const e=Vi[t];e.isInView&&(e.mouse.page.x=99999999999,e.mouse.page.y=99999999999,e.mouse.enterTime=null)}}function Li(e){let t=performance.now();for(let i=0;i<Vi.length;i++){const r=Vi[i];if(!r.isInView||!r.initialized)continue;let n,a,s=r.bbox;Math.abs(st)>1&&t-r.lastBboxTime>64&&(s=r.element.getBoundingClientRect(),r.lastBbox=r.bbox,r.bbox=s,r.scrollY=nt,r.lastBboxTime=t),e.targetTouches?(n=e.targetTouches[0].pageX,a=e.targetTouches[0].pageY):(n=e.pageX,a=e.pageY),r.isFixed&&(r.scrollY=0,a=e.targetTouches?e.targetTouches[0].clientY:e.clientY);const l=n-s.left,o=a-(s.top+(r.isFixed?0:r.scrollY));r.mouse.page.x=n,r.mouse.page.y=a,r.mouse.movePos.x=.5*l,r.mouse.movePos.y=.5*o,r.mouse.movedInView=!0}}let Vi=[];class Ci{constructor(e){i(this,\\\"local\\\",{}),i(this,\\\"scrollY\\\",0),i(this,\\\"paused\\\",!1),i(this,\\\"destroyed\\\",!1),i(this,\\\"lastBboxTime\\\",0),this.id=e.id;const t=[{name:\\\"Desktop\\\",max:1/0,min:992},{name:\\\"Tablet\\\",max:991,min:576},{name:\\\"Mobile\\\",max:575,min:0}];if(e.breakpoints)for(const i of e.breakpoints){const e=t.find(e=>e.name===i.name);e&&(void 0!==i.min&&(e.min=i.min),void 0!==i.max&&(e.max=i.max))}this.breakpoints=t,this.projectId=e.projectId,this.canvasWidth=e.width||e.element.offsetWidth||it,this.canvasHeight=e.height||e.element.offsetHeight||tt,this.curtain=void 0,this.curtainRafId=void 0,this.dpi=+e.dpi||Math.min(1.5,window.devicePixelRatio),this.element=e.element,this.altText=e.altText||\\\"\\\",this.ariaLabel=e.ariaLabel||\\\"Unicorn Studio Scene\\\",this.fps=e.fps||60,this.name=e.name,this.frameDuration=1e3/(e.fps||60),this.layers=e.layers,this.lazyLoad=e.lazyLoad,this.initialized=!1,this.lasTick=null,this.lastTime=0,this.rendering=!1,this.bbox={},this.isFixed=e.fixed||\\\"fixed\\\"===window.getComputedStyle(this.element).position,this.interactivity={mouse:{disableMobile:!1,disabled:!1}},this.mouse={downPos:{x:.5,y:.5},movePos:{x:.5,y:.5},lastPos:{x:.5,y:.5},delta:{x:0,y:0},page:{x:99999999999,y:99999999999},dragging:!1,movedInView:!1,enterTime:null,ticks:0,pos:{x:0,y:0}},this.renderingScale=e.renderingScale||1,this.scale=e.scale||1,this.split=!1,this.versionId=\\\"\\\",this.variableCallbacks=[],this.initialVariables=e.initialVariables||{},this.initialPreset=e.initialPreset||\\\"\\\",this.editMetadata=e.editMetadata||{},this.breakpointWidth=Number.isFinite(Number(e.breakpointWidth))?Number(e.breakpointWidth):null,e.width&&e.height&&(this.element.style.width=e.width+\\\"px\\\",this.element.style.height=e.height+\\\"px\\\"),this.bbox=this.element.getBoundingClientRect(),this.lastBbox=this.bbox,this.currentBreakpoint=this.getCurrentBreakpoint(),e.deferCurtains||this.ensureCurtains()}ensureCurtains(){return this.curtain||(this.createCurtains(),this.setCanvasScale()),Bt(this.curtain)&&this.curtain.gl&&(this.applyCanvasA11yAttrs(),this.textureLoader||(this.textureLoader=new _(this.curtain))),Bt(this.curtain)&&!!this.curtain.gl}applyCanvasA11yAttrs(){var e;(null==(e=this.curtain)?void 0:e.canvas)&&(this.curtain.canvas.innerText=this.altText,this.curtain.canvas.setAttribute(\\\"aria-label\\\",this.ariaLabel),this.curtain.canvas.setAttribute(\\\"role\\\",\\\"img\\\"))}hasValidTextureLoader(){var e;return!(!this.textureLoader||!(null==(e=this.textureLoader.renderer)?void 0:e.cache)&&!this.textureLoader.cache)}getLayer(e,t=null){var i,r;const n=this.layers.find(t=>E(t,e,{includeRuntimeLocalId:!0}))||null;if(n||!(null==t?void 0:t.target))return n;const a=this.layers.find(t=>!(!(null==t?void 0:t.isFlattened)||!Array.isArray(t.sublayers))&&t.sublayers.some(t=>E(t,e)));if(a){const n=a.sublayers.find(t=>E(t,e)),s=null==n?void 0:n.sublayerIndex;if(Number.isInteger(s))if(\\\"prop\\\"===(t.kind||\\\"prop\\\")){const e=`L${s}_${t.target}`,r=`L${s}_elemOpacity`,n=(null==(i=a.data)?void 0:i.uniforms)||{};\\\"opacity\\\"===t.target&&n[r]?t.target=r:n[e]&&(t.target=e)}else if(\\\"texture\\\"===t.kind||\\\"source\\\"===t.kind){const e=(null==(r=a.data)?void 0:r.textures)||[],i=`uL${s}_${String(t.target||\\\"\\\").replace(/^u/,\\\"\\\")}`,l=e.find(e=>(null==e?void 0:e.sublayerIndex)===s&&e.sampler===t.target)||e.find(e=>(null==e?void 0:e.sublayerIndex)===s&&e.sampler===i)||(\\\"source\\\"===t.kind&&\\\"video\\\"!==(null==n?void 0:n.type)?e.find(e=>(null==e?void 0:e.sublayerIndex)===s&&[\\\"image\\\",\\\"media\\\",\\\"canvas\\\",\\\"modelRT\\\"].includes(e.type)):null);(null==l?void 0:l.sampler)&&(t.kind=\\\"texture\\\",t.target=l.sampler)}return a}const s=this.layers.filter(e=>Object.prototype.hasOwnProperty.call(e,t.target));return 1===s.length?s[0]:null}setupVariables(e={},t={},i=\\\"\\\"){this.variables=new ve({variables:e,getLayer:(e,t)=>this.getLayer(e,t)}),this.variables.applyAll(),i&&this.variables.applyPreset(i),this.variables.applyInitialValues(t)}setVariable(e,t){var i;if(null==(i=this.variables)?void 0:i.setValue(e,t)){const t=this.getVariable(e),i=this.getVariables();this.variableCallbacks.forEach(r=>r(e,t,i))}else if(this.variables&&!this.variables.getDefinition(e)){const i=this.getCreateVariableUrl({name:e,defaultValue:t});i&&console.warn(`Variable \\\"${e}\\\" was not found. Create it here: ${i}`)}return this}setVariables(e={}){return Object.entries(e||{}).forEach(([e,t])=>this.setVariable(e,t)),this}setPreset(e){var t;const i=(null==(t=this.variables)?void 0:t.applyPreset(e))||[];if(i.length){const e=this.getVariables();i.forEach(t=>{this.variableCallbacks.forEach(i=>i(t,this.getVariable(t),e))})}return this}getPreset(e){var t;return(null==(t=this.variables)?void 0:t.getPreset(e))||null}getPresets(){var e;return(null==(e=this.variables)?void 0:e.getPresets())||[]}getVariable(e){var t;return null==(t=this.variables)?void 0:t.getValue(e)}getVariables(){var e;return(null==(e=this.variables)?void 0:e.getValues())||{}}getVariableDefinition(e){var t;const i=null==(t=this.variables)?void 0:t.getDefinition(e);return i?{...i,defaultValue:jt(i.defaultValue)}:null}getVariableDefinitions(){var e;return(null==(e=this.variables)?void 0:e.getDefinitions())||[]}getVariableManifest(){var e;return(null==(e=this.variables)?void 0:e.getManifest())||[]}getMouse(){var e,t,i,r,n,a,s,l,o,u;const d=!!(null==(e=this.mouse)?void 0:e.movedInView),c=(null==(t=this.bbox)?void 0:t.width)||(null==(i=this.element)?void 0:i.offsetWidth)||this.canvasWidth||0,h=(null==(r=this.bbox)?void 0:r.height)||(null==(n=this.element)?void 0:n.offsetHeight)||this.canvasHeight||0;if(!d||!c||!h)return{x:.5,y:.5,inBounds:!1,moved:d};const f=this.mouse.page||{},p=(null==(a=this.bbox)?void 0:a.left)||0,m=this.isFixed?(null==(s=this.bbox)?void 0:s.top)||0:((null==(l=this.bbox)?void 0:l.top)||0)+this.scrollY,v=(null==(o=this.lastBbox)?void 0:o.width)||c,g=(null==(u=this.lastBbox)?void 0:u.height)||h,y=f.x>p&&f.y>m&&f.x<v+p&&f.y<g+m;return{x:2*this.mouse.movePos.x/c,y:1-2*this.mouse.movePos.y/h,inBounds:y,moved:d}}onVariableChange(e){return\\\"function\\\"!=typeof e?()=>{}:(this.variableCallbacks.push(e),()=>{this.variableCallbacks=this.variableCallbacks.filter(t=>t!==e)})}getCreateVariableUrl({layer:e=null,target:t=\\\"\\\",defaultValue:i=0,kind:r=\\\"prop\\\",name:n=\\\"\\\"}={}){const a=(null==e?void 0:e.hasPublishedPublicId)?null==e?void 0:e.id:(null==e?void 0:e.editorLayerId)||(null==e?void 0:e.id);if(e&&t&&!a)return\\\"\\\";const s=ie({name:n,layerId:a,layerName:(null==e?void 0:e.layerName)||(null==e?void 0:e.name),target:t,kind:r,defaultValue:i,canvasId:this.editMetadata.canvasId});return function({baseUrl:e=\\\"https://unicorn.studio\\\",designId:t,intent:i}={}){const r=te(t);if(!r||!i)return\\\"\\\";const n=new URL(`/edit/${r}`,e),a=ie(i);return n.searchParams.set(\\\"createVariable\\\",re(a)),a.canvasId&&n.searchParams.set(\\\"canvasId\\\",a.canvasId),n.toString()}({designId:this.editMetadata.designId,intent:s})}setProp(e,t,i){const r=this.getLayer(e);return r?(r.setRuntimeOverride(t,i,{source:\\\"scene.setProp\\\"}),this):(console.warn(`Unable to set property. Layer \\\"${e}\\\" was not found.`),this)}setTexture(e,t,i){const r=this.getLayer(e);return r?(r.setTexture(t,i),this):(console.warn(`Unable to set texture. Layer \\\"${e}\\\" was not found.`),this)}getLayers(){return this.layers.map(e=>({id:e.id,publicId:e.publicId,name:e.layerName||e.name||e.id,type:e.layerType||e.type}))}preloadImage(e,t,i,r=!0){if(!e)return;if(!this.hasValidTextureLoader())return void(i&&i(null));this.local.preloadedImages=this.local.preloadedImages||{};let n=this.local.preloadedImages[e];if(n||(n=this.local.preloadedImages[e]={texture:null,loading:!0,claimed:!1,queue:[]},this.textureLoader.loadImage(e,{sampler:t,premultipliedAlpha:r},t=>{n.texture=t,n.loading=!1;for(const i of n.queue)this._resolvePreloadedImage(e,i);n.queue=[]},()=>{n.loading=!1,n.queue.forEach(e=>e.callback(null)),n.queue=[]})),!i)return;const a={callback:i,sampler:t,premultiplyAlpha:r};n.loading?n.queue.push(a):this._resolvePreloadedImage(e,a)}_resolvePreloadedImage(e,t){if(!this.hasValidTextureLoader())return void t.callback(null);const i=this.local.preloadedImages[e];i.claimed?this.textureLoader.loadImage(e,{sampler:t.sampler,premultipliedAlpha:t.premultiplyAlpha},t.callback,()=>t.callback(null)):(i.claimed=!0,t.callback(i.texture))}preloadVideo(e){if(!e)return null;const t=e.includes(\\\", \\\")?Ot(e):e;if(this.local.preloadedVideos=this.local.preloadedVideos||{},!this.local.preloadedVideos[t]){const e=document.createElement(\\\"video\\\");e.crossOrigin=\\\"anonymous\\\",e.muted=!0,e.preload=\\\"auto\\\",e.setAttribute(\\\"playsinline\\\",\\\"\\\"),e.src=t,e.load(),this.local.preloadedVideos[t]=e}return this.local.preloadedVideos[t]}playVideoTexture(e,t,i){var r;const n=null==t?void 0:t._samplerName;if(!e||!n||!i)return;const a=t=>{e.textures=e.textures.filter(e=>e._samplerName!==n),t?e.addTexture(t):ti(e,n),ei(e),this.requestSceneRender()};a(null);const s=()=>a(t);\\\"function\\\"==typeof i.requestVideoFrameCallback?i.requestVideoFrameCallback(s):i.addEventListener(\\\"playing\\\",s,{once:!0}),null==(r=i.play())||r.catch(()=>{})}shouldPreloadLayerAssets(e){return!1!==(null==e?void 0:e.visible)}ensureImageLayerTexture(e,t=null){\\\"image\\\"!==e.layerType||!e.src||e.local.sourceTexture||e.local.sourceTextureLoading||(e.local.sourceTextureLoading=!0,this.preloadImage(e.src,\\\"uSourceImage\\\",i=>{var r,n;if(e.local.sourceTextureLoading=!1,!i)return;e.local.sourceTexture=i,e.local.imageReady=!0;const a=t||(null==(r=e.getPlanes)?void 0:r.call(e).find(e=>{var t;return!(null==(t=e.userData)?void 0:t.isComposite)}))||(null==(n=e.getPlane)?void 0:n.call(e));a&&!a.textures.some(e=>\\\"uSourceImage\\\"===e._samplerName)&&a.addTexture(i),this.requestSceneRender()}))}isFlattenedSublayerHidden(e,t,i=null){var r,n,a,s;const l=null==t?void 0:t.sublayerIndex;if(!(null==e?void 0:e.isFlattened)||!Number.isInteger(l))return!1;const o=`L${l}_elemOpacity`,u=`L${l}_opacity`,d=(null==(r=null==i?void 0:i.uniforms)?void 0:r[o])||(null==(n=null==i?void 0:i.uniforms)?void 0:n[u]);if(d&&0===d.value)return!0;return 0===((null==(a=e.local.bpProps)?void 0:a[o])??(null==(s=e.local.bpProps)?void 0:s[u]))}ensureFlattenedTexture(e,t,i=null){var r;if((null==e?void 0:e.isFlattened)&&t&&!this.isFlattenedSublayerHidden(e,t,i)){if(\\\"image\\\"===t.type&&t.src){e.local.sourceTextures=e.local.sourceTextures||{};const r=e.local.sourceTextures[t.sublayerIndex];return r?void(i&&!i.textures.some(e=>e._samplerName===t.sampler)&&i.addTexture(r)):void this.preloadImage(t.src,t.sampler,r=>{var n;if(!r)return;e.local.sourceTextures[t.sublayerIndex]=r;const a=i||(null==(n=e.getPlane)?void 0:n.call(e));let s=!1;a&&!a.textures.some(e=>e._samplerName===t.sampler)&&(a.addTexture(r),s=!0),s&&this.requestSceneRender()})}if(\\\"video\\\"===t.type){const r=e.sublayers.find(e=>e.sublayerIndex===t.sublayerIndex),n=t.src||(null==r?void 0:r.src);if(!n)return;e.local.videoElements||(e.local.videoElements={}),e.local.videoTextures||(e.local.videoTextures={}),e.local.videoTextureLoading||(e.local.videoTextureLoading={});const a=e.local.videoElements[t.sampler]||this.preloadVideo(n);if(e.local.videoElements[t.sampler]=a,!i||i.textures.some(e=>e._samplerName===t.sampler))return;if(e.local.videoTextures[t.sampler])return void i.addTexture(e.local.videoTextures[t.sampler]);if(e.local.videoTextureLoading[t.sampler])return;return e.local.videoTextureLoading[t.sampler]=!0,void i.loadVideo(a,{premultipliedAlpha:!0,sampler:t.sampler},n=>{e.local.videoTextureLoading[t.sampler]=!1,e.local.videoTextures[t.sampler]=n;const s=(null==n?void 0:n.source)||(null==n?void 0:n._source)||a;if(!s)return;const l=Object.prototype.hasOwnProperty.call(t,\\\"loop\\\"),o=Object.prototype.hasOwnProperty.call(r||{},\\\"loop\\\");s.loop=l?t.loop:!o||r.loop,s.playbackRate=t.playbackRate??(null==r?void 0:r.playbackRate)??1,this.playVideoTexture(i,n,s),this.requestSceneRender()},()=>{e.local.videoTextureLoading[t.sampler]=!1})}if(\\\"media\\\"===t.type&&t.src){if(null==i?void 0:i.textures.some(e=>e._samplerName===t.sampler))return;this.preloadImage(t.src,t.sampler,r=>{var n;if(!r)return;const a=i||(null==(n=e.getPlane)?void 0:n.call(e));a&&!a.textures.some(e=>e._samplerName===t.sampler)&&(a.addTexture(r),this.requestSceneRender())},!1)}else if(\\\"modelRT\\\"===t.type){const n=null==(r=e.local.modelInstances)?void 0:r[t.sublayerIndex];if(!n||!this.curtain)return;n.local.hostLayer=e,n.local.targetSamplerName=t.sampler,n.local.renderTarget||(n.local.renderTarget=new b(this.curtain,{depth:!0,maxWidth:this.curtain.canvas.width*(n.userDownsample||1),maxHeight:this.curtain.canvas.height*(n.userDownsample||1),texturesOptions:{sampler:t.sampler,premultiplyAlpha:!0}}));const a=n.local.renderTarget.getTexture();a&&(e.local.modelTextures[t.sublayerIndex]=a,i&&!i.textures.some(e=>e._samplerName===t.sampler)&&(i.addTexture(a),this.requestSceneRender())),n.local.rendererLoaded||n.local.rendererLoading||(n.local.rendererLoading=!0,Promise.resolve(n.loadRenderer()).finally(()=>{n.local.rendererLoading=!1}))}}}preloadTextures(){!this.local.texturesPreloaded&&this.hasValidTextureLoader()&&(this.local.texturesPreloaded=!0,this.layers.forEach(e=>{var t,i,r,n,a,s,l;const o=this.shouldPreloadLayerAssets(e);if(e.isFlattened)return e.local.canvasTextures={},e.local.sourceTextures={},void((null==(t=e.data)?void 0:t.textures)&&e.data.textures.forEach(t=>{var i,r;if(\\\"canvas\\\"===t.type){const n=null==(i=e.local.textInstances)?void 0:i[t.sublayerIndex];(null==(r=null==n?void 0:n.local)?void 0:r.canvas)&&this.textureLoader.loadCanvas(n.local.canvas,{sampler:t.sampler,premultiplyAlpha:!0},i=>{var r;i.shouldUpdate=!0,e.local.canvasTextures[t.sublayerIndex]=i;const n=null==(r=e.getPlane)?void 0:r.call(e);n&&!n.textures.some(e=>e._samplerName===t.sampler)&&n.addTexture(i)})}else o&&this.ensureFlattenedTexture(e,t)}));if(e.isElement)\\\"text\\\"===e.layerType&&e.isGpuElement&&!e.htmlOnly?this.preloadTextAtlasTextures(e):e.local.canvas&&!e.htmlOnly?this.textureLoader.loadCanvas(e.local.canvas,{sampler:\\\"uTexture\\\",premultiplyAlpha:!0},t=>{t.userData.hasStateEffects=e.states.appear.length>0||e.states.scroll.length>0||e.states.hover.length>0||e.states.mousemove.length>0,e.preloadedCanvasTexture=t},e=>{console.error(\\\"Error loading canvas texture:\\\",e)}):\\\"image\\\"===e.layerType&&e.src&&o&&this.ensureImageLayerTexture(e);else{const t=(null==(i=null==e?void 0:e.texture)?void 0:i.src)||(null==(n=null==(r=null==e?void 0:e.data)?void 0:r.texture)?void 0:n.src),u=(null==(a=null==e?void 0:e.texture)?void 0:a.sampler)||(null==(l=null==(s=null==e?void 0:e.data)?void 0:s.texture)?void 0:l.sampler)||ae(e,\\\"texture\\\")||\\\"uTexture\\\";o&&t&&this.preloadImage(t,u,null,!1)}}))}preloadTextAtlasTextures(e){L(e.fontAtlas).then(t=>{var i,r,n;if(!t)return console.warn(\\\"Unicorn.studio could not load font metrics for\\\",e.fontAtlas),e.local.gpuTextFallback=!0,e.isGpuElement=!1,Ct(e,null==(i=e.state())?void 0:i.element),void(null==(n=null==(r=e.state())?void 0:r.renderFrame)||n.call(r));e.render(),this.textureLoader.loadCanvas(e.local.textLayoutCanvas,{sampler:R,generateMipmap:!1},t=>{e.local.textLayoutTexture=t,this.bindTextAtlasTextures(e)})}),[[w,e.fontAtlas],[M,I(e.fontAtlas)]].forEach(([t,i])=>{this.preloadImage(i,t,i=>{e.local.atlasTextures={...e.local.atlasTextures,[t]:i},this.bindTextAtlasTextures(e)},!1)})}bindTextAtlasTextures(e){const t=e.getPlanes().find(e=>!e.userData.isComposite),i=[...Object.values(e.local.atlasTextures||{}),e.local.textLayoutTexture];!t||i.length<3||i.some(e=>!e)||i.filter(e=>!t.textures.some(t=>t._samplerName===e._samplerName)).forEach(e=>t.addTexture(e))}setCanvasScale(){this.canvasWidth=this.element.offsetWidth,this.canvasHeight=this.element.offsetHeight}destroy(){var e,t;this.destroyed=!0,this.rendering=!1,this.isInView=!1,this.local.prewarmQueued=!1,ht=ht.filter(e=>e!==this),Ei();const i=Vi.findIndex(e=>e.id===this.id);-1!==i&&Vi.splice(i,1),this.layers.filter(e=>e.dispose).forEach(e=>e.dispose()),this.layers=[],(null==(e=this.curtain)?void 0:e.gl)&&(this.curtain.dispose(),this.curtain=null),this.element&&(this.element.removeAttribute(\\\"data-us-initialized\\\"),this.element.removeAttribute(\\\"data-scene-id\\\"),null==(t=this.element.querySelector(\\\"canvas\\\"))||t.remove(),this.element.querySelectorAll(\\\"[data-us-text]\\\").forEach(e=>{e.remove()})),Ut(),Vi.length||Ui()}syncPingPongVisibility(){var e;let t=!1;return null==(e=this.curtain)||e.planes.filter(e=>\\\"PingPongPlane\\\"===e.type).forEach(e=>{var i,r;const n=this.layers.find(t=>t.local.id===e.userData.id),a=(null==(r=null==(i=null==n?void 0:n.getPlanes())?void 0:i[0])?void 0:r.visible)??(null==n?void 0:n.visible)??!1;e.visible!==a&&(t=!0),e.visible=a}),t}syncPlaneVisibility(){this.layers.filter(e=>!e.parentLayer&&!e.groupLayer).forEach(e=>{const t=e.visible;e.isGroup&&e.getMemberItems().forEach(e=>{const i=t&&e.visible;e.getChildEffectItems().forEach(e=>{const t=i&&e.visible;e.getPlanes().forEach(e=>{e.visible=t})}),e.getPlanes().forEach(e=>{e.visible=i})}),e.getChildEffectItems().forEach(e=>{const i=t&&e.visible;e.getPlanes().forEach(e=>{e.visible=i})}),e.getPlanes().forEach(e=>{e.visible=t})}),this.syncPingPongVisibility()}applyLayerVisibility(){let e=!1;this.layers.filter(e=>!e.parentLayer&&!e.groupLayer).forEach(t=>{const i=t.visible;t.isGroup&&t.getMemberItems().forEach(t=>{const r=i&&t.visible;t.getChildEffectItems().forEach(t=>{const i=r&&t.visible;t.getPlanes().forEach(t=>{t.visible!==i&&(e=!0),t.visible=i})}),t.getPlanes().forEach(t=>{t.visible!==r&&(e=!0),t.visible=r})}),t.getChildEffectItems().forEach(t=>{const r=i&&t.visible;t.getPlanes().forEach(t=>{t.visible!==r&&(e=!0),t.visible=r})}),t.getPlanes().forEach(t=>{t.visible!==i&&(e=!0),t.visible=i}),i&&t.isModel&&!t.local.rendererLoaded&&!t.local.rendererLoading&&(t.local.rendererLoading=!0,Promise.resolve(t.loadRenderer()).finally(()=>{t.local.rendererLoading=!1}))}),this.syncPingPongVisibility()&&(e=!0),e&&(this.calculateRenderOrders(),this.createTextures(),this.renderFrame())}getBreakpointWidth(){return this.breakpointWidth||it}getCurrentBreakpoint(){const e=this.getBreakpointWidth();return this.breakpoints.find(t=>e>=t.min&&e<=t.max)}applyBreakpointValues(e=!1){var t;const i=this.currentBreakpoint;this.currentBreakpoint=this.getCurrentBreakpoint();const r=e||(null==i?void 0:i.name)!==(null==(t=this.currentBreakpoint)?void 0:t.name);for(let n=0;n<this.layers.length;n++){const e=this.layers[n];r&&e.breakpoints.length&&(e.setBreakpointValues(this.getBreakpointWidth()),this.applyBreakpointUniforms(e))}return r}resize(){this.lastBbox=this.bbox,this.bbox=this.element.getBoundingClientRect(),this.setCanvasScale();const e=this.applyBreakpointValues();if(Bt(this.curtain)){this.curtain.resize(),this.curtain.canvas.style.width=this.canvasWidth+\\\"px\\\",this.curtain.canvas.style.height=this.canvasHeight+\\\"px\\\";for(let e=0;e<this.curtain.planes.length;e++){const t=this.curtain.planes[e];t.uniforms.resolution&&(t.uniforms.resolution.value.x=this.curtain.canvas.width,t.uniforms.resolution.value.y=this.curtain.canvas.height),t.uniforms.artboardResolution&&(t.uniforms.artboardResolution.value.x=this.canvasWidth,t.uniforms.artboardResolution.value.y=this.canvasHeight)}}for(let t=0;t<this.layers.length;t++){const e=this.layers[t];e.visible&&e.resize&&e.resize()}e&&(this.applyLayerVisibility(),this.createTextures(),this.renderFrame())}refresh(){this.initialized=!1,this.layers.forEach(e=>{var t,i;null==(t=e.states)||t.scroll.forEach(e=>e.resetState()),null==(i=e.states)||i.appear.forEach(t=>{e[t.prop]=t.endValue??e.local.stateEffectProps[t.prop]??e[t.prop]}),e.breakpoints.length&&(e.setBreakpointValues(this.getBreakpointWidth()),this.applyBreakpointUniforms(e)),e.preloadedCanvasTexture&&(e.preloadedCanvasTexture.shouldUpdate=!0)}),requestAnimationFrame(()=>{this.curtain&&(this.curtain.planes.forEach(e=>{e._canDraw=!0}),this.scrollY=nt,this.applyLayerVisibility(),this.resize(),this.handlePlaneCreation())})}getDynamicLayers(){return this.layers.filter(e=>Vt(e))}createCurtains(){this.curtain=new g({container:this.element,premultipliedAlpha:!0,antialias:!1,autoRender:!1,autoResize:!1,watchScroll:!1,renderingScale:Math.min(Math.max(.25,this.renderingScale),1),production:!1,pixelRatio:this.dpi}),this.curtain.gl&&(this.curtain.onError(e=>{console.warn(\\\"Unicorn.studio scene encountered an error\\\",e)}),this.curtain.onContextLost(()=>{console.warn(\\\"Unicorn.studio scene lost WebGL context\\\"),this.curtain.restoreContext()}),this.curtain.onContextRestored(()=>{this.initialized&&(this.layers.forEach(e=>{e.preloadedCanvasTexture&&(e.preloadedCanvasTexture.shouldUpdate=!0)}),requestAnimationFrame(()=>{this.curtain&&(this.curtain.planes.forEach(e=>{e._canDraw=!0}),this.renderFrame())}))}),this.scrollY=nt)}applyBreakpointUniforms(e){e.local.bpProps&&e.getPlanes().forEach(t=>{var i,r,n,a,s;for(let l in t.uniforms){const o=this.getAppearStateUniformValue(e,l);if(o.hasValue){(null==(r=null==(i=e.states)?void 0:i.appear)?void 0:r.some(e=>e.prop===l&&e.complete))&&Ht(o.value,t.uniforms[l],l);continue}const u=Me(e,l,{breakpointProps:e.local.bpProps,baseValue:null==(s=null==(a=null==(n=e.data)?void 0:n.uniforms)?void 0:a[l])?void 0:s.value,sources:[\\\"base\\\",\\\"breakpoint\\\",\\\"runtime\\\"]});void 0!==u.value&&Ht(u.value,t.uniforms[l],l)}})}getAppearStateUniformValue(e,t){var i,r;const n=null==(r=null==(i=e.states)?void 0:i.appear)?void 0:r.filter(e=>e.prop===t).filter(e=>{var t,i;return!(null==(t=e.breakpoints)?void 0:t.length)||e.breakpoints.includes(null==(i=this.currentBreakpoint)?void 0:i.name)}).sort((e,t)=>(e.transition.delay||0)-(t.transition.delay||0));if(!(null==n?void 0:n.length))return{hasValue:!1};const a=[...n].reverse().find(e=>e.complete&&void 0!==e.endValue);if(a)return{hasValue:!0,value:a.endValue};const s=n.find(e=>!e.complete&&void 0!==e.value);return s?{hasValue:!0,value:s.value}:{hasValue:!1}}renderFrame(){var e,t;if(!this.destroyed)if(Bt(this.curtain)){if(this.layers.forEach(e=>{e.local.currentFrameMouseValues=null}),this.local.renderFrameId=(this.local.renderFrameId||0)+1,this.handleStateEffects(),null==(t=(e=this.curtain).needRender)||t.call(e),this.curtain.render(),this.local.pendingStaticRedrawFinish){const e=this.local.pendingStaticRedrawFinish;this.local.pendingStaticRedrawFinish=null,e()}}else console.warn(\\\"Curtains instance is not valid\\\")}requestSceneRender(){Bt(this.curtain)&&(this.rendering||(\\\"function\\\"==typeof this.curtain.requestRender?this.curtain.requestRender():this.renderFrame()))}requestLayerRender(e){if(!Bt(this.curtain))return;const t=this.getSplitOrderedItems();let i=t.static.indexOf(e);if(-1===i)return void this.requestSceneRender();const r=e=>{var r;const n=t.static.indexOf(e);-1!==n&&(i=Math.min(i,n)),null==(r=null==e?void 0:e.getChildEffectItems)||r.call(e).forEach(e=>{const r=t.static.indexOf(e);-1!==r&&(i=Math.min(i,r))})};r(e);if(e.getPlanes().some(e=>{var t;return null==(t=e.textures)?void 0:t.some(e=>\\\"uBgTexture\\\"===(null==e?void 0:e._samplerName))})&&i>0&&r(t.static[i-1]),t.static.slice(i).forEach(e=>{e.getPlanes().forEach(e=>{e._canDraw=!0})}),this.local.staticRedrawQueued)return;this.local.staticRedrawQueued=!0;const n=()=>{this.local.staticRedrawQueued=!1,this.disablePlanes()};this.rendering&&!this.paused?this.local.pendingStaticRedrawFinish=n:this.rendering?(this.renderFrame(),n()):this.renderNFrames(1,n)}renderNFrames(e,t){let i=0;const r=()=>{this.renderFrame(),i<e?(i++,requestAnimationFrame(r)):t&&t()};this.rendering||r()}setInteractiveParams(e,t){let i={mouse:{disableMobile:!1,disabled:!1}};t&&t.mouse&&(\\\"disableMobile\\\"in t.mouse&&(i.mouse.disableMobile=t.mouse.disableMobile),\\\"disabled\\\"in t.mouse&&(i.mouse.disabled=t.mouse.disabled)),e&&e.interactivity&&e.interactivity.mouse&&(\\\"disableMobile\\\"in e.interactivity.mouse&&(i.mouse.disableMobile=e.interactivity.mouse.disableMobile),\\\"disabled\\\"in e.interactivity.mouse&&(i.mouse.disabled=e.interactivity.mouse.disabled)),this.interactivity=i}getSplitOrderedItems(){let e=this.getOrderedItems(),t=0,i=e[t];if(i){let r=i.parentLayer?i.getParent():null,n=r&&Vt(r),a=r&&r.effects&&r.effects.length&&r.getChildEffectItems().filter(e=>Vt(e)).length;for(;i&&!Vt(i)&&!n&&!a;)t++,i=e[t],i&&(r=i.parentLayer?i.getParent():null,n=r&&Vt(r),a=r&&r.effects&&r.effects.length&&r.getChildEffectItems().filter(e=>Vt(e)).length);return{static:this.getOrderedItems().splice(0,t),dynamic:this.getOrderedItems().splice(t)}}return{static:[],dynamic:[]}}initializePlanes(e,t=!1){if(this.initializing=!0,!this.ensureCurtains())return this.initializing=!1,void(e&&e(this));const i=()=>{this.handleItemPlanes(()=>{this.handlePlaneCreation(),e&&e(this)},t)};t&&!this.local.texturesPreloaded?this.runIdleTasks([()=>this.preloadTextures()],i):(this.preloadTextures(),i())}getPassPlane(e,t){var i;return null==(i=this.curtain)?void 0:i.planes.find(i=>i.userData.id===e.local.id&&i.userData.passIndex===t)}getRenderTargets(){var e;return null==(e=this.curtain)?void 0:e.renderTargets.filter(e=>e.userData.id)}getPlanes(){var e;return null==(e=this.curtain)?void 0:e.planes.filter(e=>\\\"PingPongPlane\\\"!==e.type)}getPlaneParams(e,t){var i,r,n,a,s,l,o,u,d,c;const h=t>0?null==(r=null==(i=e.data)?void 0:i.passes)?void 0:r[t-1]:null,f=(null==h?void 0:h.widthSegments)||(null==(n=e.data)?void 0:n.widthSegments)||1,p=(null==h?void 0:h.heightSegments)||(null==(a=e.data)?void 0:a.heightSegments)||1,m=(null==h?void 0:h.independentGeometry)??((0===t||null==t)&&(null==(s=e.data)?void 0:s.independentGeometry)),v={resolution:{name:\\\"uResolution\\\",type:\\\"2f\\\",value:new T(this.canvasWidth,this.canvasHeight)},mousePos:{name:\\\"uMousePos\\\",type:\\\"2f\\\",value:new T(.5)},time:{name:\\\"uTime\\\",type:\\\"1f\\\",value:0}};e.usesPingPong&&(v.previousMousePos={name:\\\"uPreviousMousePos\\\",type:\\\"2f\\\",value:new T(.5)});let g=e.compiledFragmentShaders[t]||e.compiledFragmentShaders[0],y=e.compiledVertexShaders[t]??e.compiledVertexShaders[0];if(e.states&&[...e.states.appear,...e.states.scroll,...e.states.hover,...e.states.mousemove].forEach(t=>{v[t.prop]||t.uniformData&&(v[t.prop]=t.uniformData,v[t.prop].value=e[t.prop])}),null==(l=e.data)?void 0:l.uniforms)for(let x in e.data.uniforms){let t=e.data.uniforms[x];v[x]=e.data.uniforms[x],\\\"Vec3\\\"===(null==(o=t.value)?void 0:o.type)?v[x].value=new P(t.value._x,t.value._y,t.value._z):\\\"Vec2\\\"===(null==(u=t.value)?void 0:u.type)?v[x].value=new T(t.value._x,t.value._y):\\\"object\\\"==typeof t.value&&(v[x].value=Ft(t.value))}return v.artboardResolution={name:\\\"uArtboardResolution\\\",type:\\\"2f\\\",value:new T(this.canvasWidth,this.canvasHeight)},{fragmentShader:g,vertexShader:y,widthSegments:f,heightSegments:p,independentGeometry:m,depthTest:null==(d=e.data)?void 0:d.depth,cullFace:null==(c=e.data)?void 0:c.cullFace,texturesOptions:{floatingPoint:\\\"half-float\\\",premultiplyAlpha:!0},uniforms:v}}getCompositePlaneRenderOrder(e,t,i){const r=e.getChildEffectItems();if(0===r.length)return i;const n=r[r.length-1],a=t.indexOf(n);return-1!==a?a+1:i+r.length}createPlane(e,t){var i;let r,n;r=e.isElement||e.isModel||e.isFlattened?this.getPlaneParams(e):this.getPlaneParams(e,t?t.index:null),r.watchScroll=!1;try{if(!this.curtain.container)throw new Error(\\\"Can't find scene container\\\");let a=(null==t?void 0:t.downSample)||0===(null==t?void 0:t.index)&&(null==(i=e.data)?void 0:i.downSample),s=this.renderingScale;if(a&&(s=\\\"number\\\"==typeof a?a:.5,s*=this.renderingScale),e.userDownsample&&\\\"number\\\"==typeof e.userDownsample&&(s*=e.userDownsample),n=new x(this.curtain,this.curtain.container,r),!n||!n.userData||!n.textures)throw new Error(\\\"Plane not properly initialized\\\");return n.textures.length=0,n.userData.id=e.local.id,n.userData.layerType=e.layerType,n.userData.type=e.type,n.userData.downSample=s,n}catch(a){return console.error(\\\"Error creating plane:\\\",a),null}}clearPingPongTargets(e){var t;const i=null==(t=this.curtain)?void 0:t.gl,r=((null==e?void 0:e._targets)||[null==e?void 0:e.readPass,null==e?void 0:e.writePass]).filter(Boolean);if(!i||!r.length)return;const n=i.getParameter(i.COLOR_CLEAR_VALUE);n&&(i.clearColor(0,0,0,0),r.forEach(e=>{this.curtain.renderer.bindFrameBuffer(e,!0),i.clear(i.COLOR_BUFFER_BIT)}),this.curtain.renderer.bindFrameBuffer(null),i.clearColor(n[0],n[1],n[2],n[3]))}createPingPongPlane(e,t){var i,r,n;const a=\\\"number\\\"==typeof(null==t?void 0:t.index)?t.index:1+((null==t?void 0:t.length)||0);let s=this.getPlaneParams(e,a);s.widthSegments=1,s.heightSegments=1,s.independentGeometry=!1,s.targetSize=null==(i=e.data)?void 0:i.pingPongTargetSize,s.texturesOptions={...s.texturesOptions,...null==(r=e.data)?void 0:r.pingPongTexturesOptions};let l=null==(n=this.curtain)?void 0:n.planes.find(t=>\\\"PingPongPlane\\\"===t.type&&t.userData.id===e.local.id);if(!l){if(l=new y(this.curtain,this.curtain.container,s),!l)return;const i=s.targetSize;if((null==i?void 0:i.width)&&(null==i?void 0:i.height)){(l._targets||[l.readPass,l.writePass]).filter(Boolean).forEach(e=>this.resizeRenderTarget(e,i.width,i.height))}l.userData.id=e.local.id,l.userData.pingpong=!0,l.userData.passIndex=a,l.onReady(()=>{this.destroyed||(this.clearPingPongTargets(l),this.setInitialEffectPlaneUniforms(l,e,null==e?void 0:e.getParent(),t),l.userData.isReady=!0)}).onRender(()=>{this.setEffectPlaneUniforms(l,e)})}if(l)return this.handleMediaTextures(l,e,{passIndex:a}),l}createEffectPlane(e,t){var i,r;const n=this.createPlane(e,t);if(!n)return;const a=e.getParent();let s;if(!n||!n.userData||!n.textures)throw new Error(\\\"Plane not properly initialized\\\",n);t&&(n.userData.passIndex=t.index,n.userData.length=(null==(i=e.data.passes)?void 0:i.length)||0,n.userData.needsPreviousFrame=t.needsPreviousFrame,\\\"pass\\\"===t.needsPreviousFrame&&(n.userData.targetSize=t.targetSize,n.userData.floatingPoint=null==(r=t.texturesOptions)?void 0:r.floatingPoint),n.userData.blend=!!t.blend,Object.entries(t).forEach(([e,t])=>{n.uniforms[e]&&(n.uniforms[e].value=t)})),this.setInitialEffectPlaneUniforms(n,e,a,t),n.onReady(()=>{n.userData.isReady=!0}).onRender(()=>{s=this.curtain.renderer.state.blending,this.curtain.renderer.setBlending(!!n.userData.blend&&n.visible),this.setEffectPlaneUniforms(n,e)}).onAfterRender(()=>{this.curtain.renderer.setBlending(s);const t=n.userData.needsPreviousFrame;if(t){const i=n.userData.passIndex??0,r=e.local.previousFrameTargets||{},a=e.local.previousFrameInputTargets||{},s=\\\"target\\\"===t?a[i]:n.target,l=r[i];s&&l&&this.blitRenderTarget(s,l)}})}createFlattenedPlane(e,t=e=>e(),i=!1){var r;const n=this.createPlane(e);n&&(n.onReady(()=>{this.destroyed||(this.setInitialFlattenedPlaneUniforms(n,e),n.userData.isReady=!0)}).onRender(()=>this.setFlattenedPlaneUniforms(n,e)),(e.hasRemainingEffects()||e.mask&&0!==e.mask)&&(e.hasRemainingEffects()&&!i&&e.getChildEffectItems().forEach(e=>{e.getPlanes().length||this.createEffectPlanes(e,t)}),(null==(r=e.data)?void 0:r.compositeShader)&&t(()=>this.createCompositePlane(e))))}createGroupPlane(e,t=e=>e(),i=!1){const r={vertexShader:\\\"#version 300 es\\\\nprecision highp float;\\\\nin vec3 aVertexPosition;\\\\nin vec2 aTextureCoord;\\\\nuniform mat4 uMVMatrix;\\\\nuniform mat4 uPMatrix;\\\\nuniform mat4 uTextureMatrix;\\\\nout vec2 vTextureCoord;\\\\nvoid main() {\\\\n  gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\\\\n  vTextureCoord = (uTextureMatrix * vec4(aTextureCoord, 0.0, 1.0)).xy;\\\\n}\\\",fragmentShader:\\\"#version 300 es\\\\nprecision highp float;\\\\nin vec2 vTextureCoord;\\\\nout vec4 fragColor;\\\\nvoid main() {\\\\n  fragColor = vec4(0.0);\\\\n}\\\",texturesOptions:{premultiplyAlpha:!0},uniforms:{}},n=new x(this.curtain,this.curtain.container,r);n&&(n.textures.length=0,n.userData.id=e.local.id,n.userData.isGroupSource=!0,n.onReady(()=>{n.userData.isReady=!0}),i||e.getChildEffectItems().forEach(e=>{e.getPlanes().length||this.createEffectPlanes(e,t)}),t(()=>this.createCompositePlane(e)))}createElementPlane(e,t=e=>e()){const i=this.createPlane(e);i&&(e.getChildEffectItems().filter(e=>e.visible).length>0&&t(()=>this.createCompositePlane(e)),\\\"text\\\"===e.layerType&&e.isGpuElement&&this.bindTextAtlasTextures(e),i.onReady(()=>{this.setInitialElementPlaneUniforms(i,e),i.userData.isReady=!0}).onRender(()=>this.setElementPlaneUniforms(i,e)))}createCompositePlane(e){var t,i,r;if(!(null==(t=e.data)?void 0:t.compositeShader))return console.warn(\\\"No composite shader data for element\\\"),null;const n={vertexShader:e.data.compositeShader.vertexShader,fragmentShader:e.data.compositeShader.fragmentShader,texturesOptions:{premultiplyAlpha:!0},uniforms:{}};if(e.data.compositeUniforms)for(let s in e.data.compositeUniforms){let t=e.data.compositeUniforms[s];n.uniforms[s]={...t},\\\"Vec3\\\"===(null==(i=t.value)?void 0:i.type)?n.uniforms[s].value=new P(t.value._x,t.value._y,t.value._z):\\\"Vec2\\\"===(null==(r=t.value)?void 0:r.type)&&(n.uniforms[s].value=new T(t.value._x,t.value._y))}const a=new x(this.curtain,this.curtain.container,n);return a&&a.userData?(a.textures.length=0,a.userData.id=e.local.id,a.userData.isComposite=!0,a.onReady(()=>{a.userData.isReady=!0}).onRender(()=>{this.setCompositePlaneUniforms(a,e)}),a):(console.warn(\\\"Failed to create composite plane\\\"),null)}setCompositePlaneUniforms(e,t){var i,r,n;if((null==e?void 0:e.uniforms)&&e.visible&&(e.uniforms.resolution&&(e.uniforms.resolution.value.x=this.curtain.canvas.width,e.uniforms.resolution.value.y=this.curtain.canvas.height),e.uniforms.artboardResolution&&(e.uniforms.artboardResolution.value.x=this.canvasWidth,e.uniforms.artboardResolution.value.y=this.canvasHeight),e.uniforms.opacity&&(e.uniforms.opacity.value=(null==(i=t.local)?void 0:i.gpuTextFallback)?0:(null==(n=null==(r=t.local)?void 0:r.stateEffectProps)?void 0:n.opacity)??t.opacity??1),e.uniforms.mousePos)){t.local.currentFrameMouseValues||(t.local.currentFrameMouseValues=this.calculateItemMouseValues(t));const i=t.local.currentFrameMouseValues;i&&this.mouse.movedInView&&(e.uniforms.mousePos.value.x=i.x,e.uniforms.mousePos.value.y=i.y)}}handleMediaTextures(e,t,i){var r,n,a,s,l;const o=(null==(n=null==(r=t.data)?void 0:r.textures)?void 0:n.length)?t.data.textures:[t.texture,null==(a=t.data)?void 0:a.texture].filter(e=>null==e?void 0:e.src),u=i.passIndex??0,d=[t.compiledFragmentShaders[u],(null==(s=t.compiledVertexShaders)?void 0:s[u])??(null==(l=t.compiledVertexShaders)?void 0:l[0])];if(o.filter(e=>null==e?void 0:e.src).forEach(i=>{if(d.some(e=>null==e?void 0:e.includes(i.sampler))){if(\\\"video\\\"===i.type){const r=\\\"uVideoTexture\\\"===i.sampler&&t.src?t.src:i.src;if(!r||e.textures.some(e=>e._samplerName===i.sampler))return;const n=this.preloadVideo(r);if(!n)return;return void e.loadVideo(n,{premultipliedAlpha:!0,sampler:i.sampler},r=>{const n=null==r?void 0:r.source;n&&(n.loop=i.loop??t.loop??!0,n.playbackRate=i.playbackRate||t.playbackRate||1,this.playVideoTexture(e,r,n),e.userData.textureLoaded=!0)})}this.preloadImage(i.src,i.sampler,t=>{if(t){e.textures.some(e=>e._samplerName===i.sampler)||e.addTexture(t),e.userData.textureLoaded=!0}},!1)}}),\\\"video\\\"===t.type&&t.src){if(e.textures.some(e=>\\\"uVideoTexture\\\"===e._samplerName))return;const i=this.preloadVideo(t.src);e.loadVideo(i,{premultipliedAlpha:!0,sampler:\\\"uVideoTexture\\\"},i=>{const r=null==i?void 0:i.source;r&&(r.loop=!t.hasOwnProperty(\\\"loop\\\")||t.loop,r.playbackRate=t.playbackRate||1,this.playVideoTexture(e,i,r),e.userData.textureLoaded=!0)})}}handleEffectPlane(e,t,i,r){var n;const a=\\\"passIndex\\\"in i?this.getPassPlane(e,i.passIndex):e.getPlane();if(!a)return!1;let s=r[t-1],l=null==(n=this.curtain)?void 0:n.planes.find(t=>\\\"PingPongPlane\\\"===t.type&&t.userData.id===e.local.id),o=e.compiledFragmentShaders[i.passIndex??0],u=e.compiledVertexShaders[i.passIndex??0]??e.compiledVertexShaders[0];if(l&&((null==o?void 0:o.includes(\\\"uPingPongTexture\\\"))||(null==u?void 0:u.includes(\\\"uPingPongTexture\\\")))&&ti(a,\\\"uPingPongTexture\\\",l.getTexture()),s?ti(a,\\\"uTexture\\\",s.getTexture()):ti(a,\\\"uTexture\\\"),null==o?void 0:o.includes(\\\"uBgTexture\\\")){let e=r[t-(1+i.passIndex)];e&&ti(a,\\\"uBgTexture\\\",e.getTexture())}i.needsPreviousFrame&&ti(a,\\\"uPreviousFrameTexture\\\",this.createPreviousFrameTarget(e,i,t,r)),this.handleMediaTextures(a,e,i)}handleModelPlane(e,t,i){var r;const n=e.getPlane();let a=i[t-1],s=this.findPreviousLayerForMask(e,0);n.textures.forEach(e=>{}),n.textures=[],e.local.renderTarget?n.addTexture(e.local.renderTarget.getTexture()):a?ti(n,\\\"uTexture\\\",a.getTexture()):ti(n,\\\"uTexture\\\"),(null==(r=null==s?void 0:s.local)?void 0:r.lastTarget)?ti(n,\\\"uBgTexture\\\",s.local.lastTarget.getTexture()):ti(n,\\\"uBgTexture\\\")}createPreviousFrameTarget(e,t,i,r){var n,a,s;const l=t.passIndex??t.index??0,o=t.downSample||1,u=t.floatingPoint||null,d=(null==(n=t.targetSize)?void 0:n.width)||this.curtain.canvas.width*o,c=(null==(a=t.targetSize)?void 0:a.height)||this.curtain.canvas.height*o;e.local.previousFrameTargets||(e.local.previousFrameTargets={}),e.local.previousFrameInputTargets||(e.local.previousFrameInputTargets={});const h=e.local.previousFrameTargets[l];return h&&(h.userData.floatingPoint||null)!==u&&(h.remove(),e.local.previousFrameTargets[l]=null),e.local.previousFrameTargets[l]||(e.local.previousFrameTargets[l]=new b(this.curtain,{depth:!1,clear:!1,scaleWithCanvas:!(null==(s=t.targetSize)?void 0:s.width),maxWidth:d,maxHeight:c,...u?{texturesOptions:{floatingPoint:u}}:{}}),e.local.previousFrameTargets[l].userData.isPingPong=!0,e.local.previousFrameTargets[l].userData.isPreviousFrame=!0,e.local.previousFrameTargets[l].userData.floatingPoint=u),\\\"target\\\"===t.needsPreviousFrame&&void 0!==i&&(e.local.previousFrameInputTargets[l]=r[i-(1+t.passIndex)]),e.local.previousFrameTargets[l].getTexture()}findPreviousLayerForMask(e,t){var i;const r=this.layers.filter(e=>!e.parentLayer),n=r.indexOf(e);if(n<0)return null;const a=n-t-1;if(a<0)return null;for(let s=Math.max(0,a);s>=0;s--){const t=r[s];if((null==t?void 0:t.visible)&&(null==(i=null==t?void 0:t.local)?void 0:i.lastTarget)&&t!==e)return t}return null}handleFlattenedPlane(e,t,i){var r;const n=e.getPlane();if(!n)return;let a=i[t-1];a&&ti(n,\\\"uBgTexture\\\",a.getTexture()),(null==(r=e.data)?void 0:r.textures)&&e.data.textures.forEach(t=>{\\\"canvas\\\"===t.type?e.local.canvasTextures&&e.local.canvasTextures[t.sublayerIndex]&&n.addTexture(e.local.canvasTextures[t.sublayerIndex]):this.ensureFlattenedTexture(e,t,n)})}ensureFlattenedPlaneTextures(e,t){var i;e&&(null==(i=t.data)?void 0:i.textures)&&t.data.textures.forEach(i=>{var r;if(!e.textures.some(e=>e._samplerName===i.sampler))if(\\\"canvas\\\"===i.type){const n=null==(r=t.local.canvasTextures)?void 0:r[i.sublayerIndex];n&&e.addTexture(n)}else this.ensureFlattenedTexture(t,i,e)})}handleElementPlane(e,t,i){var r;const n=e.getPlanes().find(e=>!e.userData.isComposite);if(!n)return!1;const a=e.getChildEffectItems().filter(e=>e.visible);let s,l=i[t-1];if(e.mask&&e.maskDepthLayer>0){const t=this.findPreviousLayerForMask(e,e.maskDepthLayer??0);t&&(s=t.local.lastTarget)}if(e.isGpuElement){\\\"image\\\"===e.layerType?n.textures.some(e=>\\\"uSourceImage\\\"===e._samplerName)||(e.local.sourceTexture?(n.addTexture(e.local.sourceTexture),e.local.imageReady=!0):this.ensureImageLayerTexture(e,n)):\\\"text\\\"===e.layerType&&this.handleMediaTextures(n,e,{});return void((0===a.length||/\\\\b(?:texture|textureLod|texelFetch)\\\\s*\\\\(\\\\s*uBgTexture\\\\b/.test((null==(r=e.compiledFragmentShaders)?void 0:r[0])||\\\"\\\"))&&l&&(ti(n,\\\"uBgTexture\\\",l.getTexture()),s&&e.mask&&ti(n,\\\"uPreviousLayerTexture\\\",s.getTexture())))}if(a.length||(n.textures.length=0),l&&a.length?ti(n,\\\"uTexture\\\",l.getTexture()):n&&e.preloadedCanvasTexture&&n.addTexture(e.preloadedCanvasTexture),l){if(a.length){l=i[t-(1+a.reduce((e,t)=>e+t.getPlanes().length,0))]}l&&(ti(n,\\\"uBgTexture\\\",l.getTexture()),s&&e.mask&&ti(n,\\\"uPreviousLayerTexture\\\",s.getTexture()))}}handleCompositePlane(e,t,i,r){const n=e.getPlanes().find(e=>e.userData.isComposite);if(!n)return;let a;if(e.mask&&e.maskDepthLayer>0){const t=this.findPreviousLayerForMask(e,e.maskDepthLayer??0);t&&(a=t.local.lastTarget)}const s=r[t-1];s&&ti(n,\\\"uTexture\\\",s.getTexture());const l=i.findIndex(t=>t.userData.id===e.local.id&&!t.userData.isComposite),o=l>0?l-1:-1,u=o>=0?r[o]:null;u&&(ti(n,\\\"uBgTexture\\\",u.getTexture()),a&&e.mask&&ti(n,\\\"uPreviousLayerTexture\\\",a.getTexture()))}handleChildEffectPlane(e,t,i,r){var n,a,s,l,o,u,d,c,h;const f=\\\"passIndex\\\"in i?this.getPassPlane(e,i.passIndex):e.getPlane(),p=e.getParent();if(!f||!p)return;let m=r[t-1],v=null==(n=this.curtain)?void 0:n.planes.find(t=>\\\"PingPongPlane\\\"===t.type&&t.userData.id===e.local.id),g=e.compiledFragmentShaders[i.passIndex??0],y=e.compiledVertexShaders[i.passIndex??0]??e.compiledVertexShaders[0],x=p.effects.filter(e=>{if(this.layers.find(t=>t.parentLayer===e))return this.layers.find(t=>t.parentLayer===e)}),b=x.indexOf(e.parentLayer),_=x.at(-1)===x[b],T=i.passIndex===i.length;const P=p.isGpuElement||p.isFlattened;if(v&&((null==g?void 0:g.includes(\\\"uPingPongTexture\\\"))||(null==y?void 0:y.includes(\\\"uPingPongTexture\\\")))&&ti(f,\\\"uPingPongTexture\\\",v.getTexture()),null==g?void 0:g.includes(\\\"uBgTexture\\\"))if(b&&i.length>1){let e=r[t-(1+i.length)];e&&ti(f,\\\"uBgTexture\\\",e.getTexture())}else if(p.isGroup)m&&ti(f,\\\"uBgTexture\\\",m.getTexture());else if(P){const e=p.getPlanes().find(e=>!e.userData.isComposite);ti(f,\\\"uBgTexture\\\",null==(l=null==e?void 0:e.target)?void 0:l.getTexture())}else(null==(s=null==(a=p.preloadedCanvasTexture)?void 0:a.userData)?void 0:s.used)?f.loadCanvas(p.local.canvas,{sampler:\\\"uBgTexture\\\",premultiplyAlpha:!0},e=>{e.shouldUpdate=p.preloadedCanvasTexture.shouldUpdate}):p.preloadedCanvasTexture&&(p.preloadedCanvasTexture._samplerName=\\\"uBgTexture\\\",f.addTexture(p.preloadedCanvasTexture));if(m&&(b||i.passIndex)){if(e.isMask&&(!i.length||_&&T))if(!P&&p.preloadedCanvasTexture)f.addTexture(p.preloadedCanvasTexture);else{const e=p.getPlanes().find(e=>!e.userData.isComposite);ti(f,\\\"uMaskTexture\\\",null==(o=null==e?void 0:e.target)?void 0:o.getTexture())}ti(f,\\\"uTexture\\\",m.getTexture())}else if(e.isMask){if(!i.length||_&&T)if(!P&&p.preloadedCanvasTexture)f.addTexture(p.preloadedCanvasTexture);else{const e=p.getPlanes().find(e=>!e.userData.isComposite);ti(f,\\\"uMaskTexture\\\",null==(u=null==e?void 0:e.target)?void 0:u.getTexture())}_&&T&&!P?f.addTexture(p.preloadedCanvasTexture):m?ti(f,\\\"uTexture\\\",m.getTexture()):ti(f,\\\"uTexture\\\"),m=r[t-2],m&&ti(f,\\\"uTexture\\\",m.getTexture())}else if(null==g?void 0:g.includes(\\\"uTexture\\\"))if(p.isGroup&&m)ti(f,\\\"uTexture\\\",m.getTexture());else if(P){const e=p.getPlanes().find(e=>!e.userData.isComposite);ti(f,\\\"uTexture\\\",null==(d=null==e?void 0:e.target)?void 0:d.getTexture())}else p.preloadedCanvasTexture?(f.addTexture(p.preloadedCanvasTexture),p.preloadedCanvasTexture&&(p.preloadedCanvasTexture.userData.used=!0)):ti(f,\\\"uTexture\\\",m.getTexture());i.needsPreviousFrame&&ti(f,\\\"uPreviousFrameTexture\\\",this.createPreviousFrameTarget(e,i,t,r)),\\\"custom\\\"===e.type&&ti(f,\\\"uCustomTexture\\\",null==(h=null==(c=r[t])?void 0:c.getTexture)?void 0:h.call(c)),this.handleMediaTextures(f,e,i)}runIdleTasks(e,t){let i=0;const r=()=>{this.destroyed?this.initializing=!1:dt&&!this.isInView||document.hidden?setTimeout(()=>Ti(r),80):i<e.length?(e[i++](),Ti(r)):t&&t()};Ti(r)}createPlanes(e,t=!1){const i=[],r=t?e=>i.push(e):e=>e();this.getOrderedItems().forEach(e=>{\\\"text\\\"===e.layerType&&e.htmlOnly||r(()=>{e.getPlanes().length||(e.isGroup?this.createGroupPlane(e,r,t):e.isFlattened?this.createFlattenedPlane(e,r,t):e.isElement?this.createElementPlane(e,r):e.isModel?this.createModelPlane(e):this.createEffectPlanes(e,r))})});const n=()=>{this.calculateRenderOrders(),e&&e()};t?this.runIdleTasks(i,n):n()}calculateRenderOrders(){var e;let t=-9999;const i=e=>{var i,r,n;if(e.isBackground)return void(null==(i=e.getPlane())||i.setRenderOrder(t));const a=e.getPlanes().filter(e=>!e.userData.isComposite),s=e.isGpuElement||e.isFlattened&&((null==(r=e.hasRemainingEffects)?void 0:r.call(e))||e.mask&&0!==e.mask);s&&a.forEach(e=>e.setRenderOrder(t++)),(null==(n=e.effects)?void 0:n.length)&&e.getChildEffectItems().forEach(e=>{e.visible&&e.getPlanes().forEach(e=>e.setRenderOrder(t++))}),s||a.forEach(e=>e.setRenderOrder(t++));const l=e.getPlanes().find(e=>e.userData.isComposite);l&&l.setRenderOrder(t++)};this.layers.filter(e=>!e.parentLayer&&!e.groupLayer).forEach(e=>{if(e.isGroup){e.getPlanes().filter(e=>!e.userData.isComposite).forEach(e=>e.setRenderOrder(t++)),e.getMemberItems().filter(e=>!1!==e.visible).forEach(e=>{i(e)}),e.getChildEffectItems().forEach(e=>{e.visible&&e.getPlanes().forEach(e=>e.setRenderOrder(t++))});const r=e.getPlanes().find(e=>e.userData.isComposite);return void(r&&r.setRenderOrder(t++))}i(e)});const r=this.getPlanes().filter(e=>e.visible).sort((e,t)=>e.renderOrder-t.renderOrder).at(-1);if(null==r?void 0:r.target){const t=r.target;null==(e=r.removeRenderTarget)||e.call(r),t.remove()}}createModelPlane(e){const t=this.createPlane(e);t&&t.onReady(()=>{t.userData.isReady=!0,t.userData.createdAt=performance.now();let i=e.userDownsample||1,r=this.curtain.canvas.width*i,n=this.curtain.canvas.height*i;e.local.renderTarget||(e.local.renderTarget=new b(this.curtain,{depth:!0,maxWidth:r,maxHeight:n,texturesOptions:{sampler:\\\"uTexture\\\",premultiplyAlpha:!0}}),e.local.rendererLoaded||!1===e.visible||e.local.rendererLoading||(e.local.rendererLoading=!0,Promise.resolve(e.loadRenderer()).finally(()=>{e.local.rendererLoading=!1})))}).onRender(()=>{t.visible&&(this.setModelPlaneUniforms(t,e),this.curtain.gl&&e.renderModel())})}createEffectPlanes(e,t=e=>e()){var i,r,n,a,s;const l=e.data,o=\\\"custom\\\"===e.type?null==(i=e.customPasses)?void 0:i[0]:null,u=\\\"custom\\\"===e.type?(null==(r=e.customPasses)?void 0:r.length)||((null==(n=l.passes)?void 0:n.length)||0)+1:((null==(a=l.passes)?void 0:a.length)||0)+1,d=!!(null==(s=e.customPasses)?void 0:s.some(e=>null==e?void 0:e.pingPong));if(l.passes&&l.passes.length){const i={index:0,downSample:(null==o?void 0:o.downSample)??l.downSample,length:u,includeBg:null==o?void 0:o.includeBg,needsPreviousFrame:(null==o?void 0:o.needsPreviousFrame)??l.needsPreviousFrame,targetSize:null==o?void 0:o.targetSize,texturesOptions:null==o?void 0:o.texturesOptions,blend:(null==o?void 0:o.blend)??l.blend};(null==o?void 0:o.pingPong)?t(()=>this.createPingPongPlane(e,i)):t(()=>this.createEffectPlane(e,i)),l.passes.forEach((i,r)=>{const n={index:r+1,length:u,downSample:i.downSample,includeBg:i.includeBg,needsPreviousFrame:i.needsPreviousFrame,targetSize:i.targetSize,texturesOptions:i.texturesOptions,widthSegments:i.widthSegments,heightSegments:i.heightSegments,independentGeometry:i.independentGeometry,blend:i.blend,[i.prop]:i.value};i.pingPong?t(()=>this.createPingPongPlane(e,n)):t(()=>this.createEffectPlane(e,n))}),e.usesPingPong&&!d&&t(()=>this.createPingPongPlane(e,l.passes))}else{const i=o||l.needsPreviousFrame?{index:0,downSample:(null==o?void 0:o.downSample)??l.downSample,length:u,includeBg:null==o?void 0:o.includeBg,needsPreviousFrame:(null==o?void 0:o.needsPreviousFrame)??l.needsPreviousFrame,targetSize:null==o?void 0:o.targetSize,texturesOptions:null==o?void 0:o.texturesOptions,blend:(null==o?void 0:o.blend)??l.blend}:null;(null==o?void 0:o.pingPong)?t(()=>this.createPingPongPlane(e,i)):t(i?()=>this.createEffectPlane(e,i):()=>this.createEffectPlane(e)),e.usesPingPong&&!d&&t(()=>this.createPingPongPlane(e))}}createTextures(e,t=!1){const i=this.getPlanes().filter(e=>e.visible).sort((e,t)=>e.renderOrder-t.renderOrder),r=this.getRenderTargets(),n=i.length,a=[];for(let s=0;s<n;s++)a.push(()=>{const e=i[s];let t=this.layers.find(t=>t.local.id===e.userData.id);s<n-1&&this.assignRenderTargetToPlane(i,r,s,t,e),this.handleTextures(t,s,e.userData,i,r),t.local.lastTarget=e.target});t?this.runIdleTasks(a,e):(a.forEach(e=>e()),e&&e())}resizeRenderTarget(e,t,i){var r,n,a;const s=(null==(r=e._size)?void 0:r.width)||0,l=(null==(n=e._size)?void 0:n.height)||0;if(Math.abs(s-t)<=1&&Math.abs(l-i)<=1)return;const o=null==(a=e.textures)?void 0:a[0];if((!e._frameBuffer||!(null==o?void 0:o._copiedFrom))&&(e._size={width:t,height:i},e._maxSize={width:t,height:i},e._minSize={width:t,height:i},e._frameBuffer&&o)){o._size={width:t,height:i};const r=this.curtain.gl;r.bindTexture(r.TEXTURE_2D,o._sampler.texture),r.texImage2D(r.TEXTURE_2D,0,o._globalParameters.internalFormat,t,i,0,o._globalParameters.format,o._globalParameters.type,null),this.curtain.renderer.bindFrameBuffer(e,!0),e._depth&&e._depthBuffer&&(r.bindRenderbuffer(r.RENDERBUFFER,e._depthBuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,t,i),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,e._depthBuffer)),this.curtain.renderer.bindFrameBuffer(null)}}ensureRenderTargetInitialized(e,t,i){e&&(t&&i&&this.resizeRenderTarget(e,t,i),e._frameBuffer||(this.curtain.renderer.bindFrameBuffer(e,!0),this.curtain.renderer.bindFrameBuffer(null)))}blitRenderTarget(e,t){var i,r,n;const a=null==(i=this.curtain)?void 0:i.gl;if(!a||\\\"function\\\"!=typeof a.blitFramebuffer)return;const s=(null==(r=e._size)?void 0:r.width)||this.curtain.canvas.width,l=(null==(n=e._size)?void 0:n.height)||this.curtain.canvas.height;this.ensureRenderTargetInitialized(e,s,l),this.ensureRenderTargetInitialized(t,s,l),(null==e?void 0:e._frameBuffer)&&(null==t?void 0:t._frameBuffer)&&(a.bindFramebuffer(a.READ_FRAMEBUFFER,e._frameBuffer),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,t._frameBuffer),a.blitFramebuffer(0,0,s,l,0,0,s,l,a.COLOR_BUFFER_BIT,a.NEAREST),a.bindFramebuffer(a.READ_FRAMEBUFFER,null),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,null))}assignRenderTargetToPlane(e,t,i,r,n){var a;let s=this.getTextureParams(e,i,r),l=t[i];const o=`${(null==(a=s.texturesOptions)?void 0:a.floatingPoint)||\\\"\\\"}:${s.scaleWithCanvas}:${!!s.depth}`;if(l&&l.userData.formatKey!==o){const e=this.curtain.renderTargets.indexOf(l);l.remove(),l=new b(this.curtain,s);const r=this.curtain.renderTargets;r.splice(r.indexOf(l),1),r.splice(e,0,l),r.forEach((e,t)=>e.index=t),t[i]=l}else l?this.resizeRenderTarget(l,s.maxWidth,s.maxHeight):(l=new b(this.curtain,s),t[i]=l);l.userData.formatKey=o,l.userData.id=n.userData.id,n&&n.setRenderTarget(l)}handleTextures(e,t,i,r,n){i.isComposite?this.handleCompositePlane(e,t,r,n):e.isGroup||(e.isFlattened?this.handleFlattenedPlane(e,t,n):e.isElement?this.handleElementPlane(e,t,n):e.isModel?this.handleModelPlane(e,t,n):e.parentLayer?this.handleChildEffectPlane(e,t,i,n):this.handleEffectPlane(e,t,i,n))}handleItemPlanes(e,t=!1){this.createPlanes(()=>{this.syncPlaneVisibility(),this.createTextures(()=>this.checkIfReady(e,t),t)},t)}checkIfReady(e,t=!1){const i=()=>{var r;if(this.destroyed)return;if(t&&dt&&!this.isInView)return void requestAnimationFrame(i);let n=!1;const a=null==(r=this.curtain)?void 0:r.planes;if(a){for(let e=0;e<a.length;e++)if(!a[e].userData.isReady){n=!0;break}n?(this.renderFrame(),requestAnimationFrame(i)):e()}};i()}setModelPlaneUniforms(e,t){var i,r;e.uniforms.resolution.value.x=this.curtain.canvas.width,e.uniforms.resolution.value.y=this.curtain.canvas.height,t.local.currentFrameMouseValues||(t.local.currentFrameMouseValues=this.calculateItemMouseValues(t));const n=t.local.currentFrameMouseValues;n&&!t.local.mouse&&(t.local.mouse={x:.5,y:.5}),n&&(t.local.mouse.x=n.x,t.local.mouse.y=n.y),e.uniforms.opacity&&(e.uniforms.opacity.value=t.local.modelLoaded?(null==(r=null==(i=t.local)?void 0:i.stateEffectProps)?void 0:r.opacity)??t.opacity:0)}setInitialEffectPlaneUniforms(e,t,i,r){var n;if(!e.userData.initialUniformsSet||!e.userData.isReady){for(let i in e.uniforms)(null==(n=t.states)?void 0:n.scroll.some(e=>e.prop===i))||(t.local.bpProps&&i in t.local.bpProps?Ht(t.local.bpProps[i],e.uniforms[i],i):i in t&&Ht(t[i],e.uniforms[i],i));i&&r&&r.index<r.length-1&&e.uniforms.isMask&&(e.uniforms.isMask.value=0),i&&t.isMask&&!t.mouseMomentum&&(t.mouseMomentum=i.mouseMomentum),e.uniforms.resolution.value.x=this.curtain.canvas.width,e.uniforms.resolution.value.y=this.curtain.canvas.height,e.uniforms.artboardResolution&&(e.uniforms.artboardResolution.value.x=this.canvasWidth,e.uniforms.artboardResolution.value.y=this.canvasHeight),e.userData.initialUniformsSet=!0}}handleStateEffects(){this.layers.forEach(e=>{const t=e.parentLayer?e.getParent():null;(t?t.visible:e.visible)&&e.updateStateEffects()})}setInitialFlattenedPlaneUniforms(e,t){var i,r,n;e.uniforms.resolution&&(null==(i=this.curtain)?void 0:i.canvas)&&(e.uniforms.resolution.value.x=this.curtain.canvas.width,e.uniforms.resolution.value.y=this.curtain.canvas.height),e.uniforms.artboardResolution&&(e.uniforms.artboardResolution.value.x=this.canvasWidth,e.uniforms.artboardResolution.value.y=this.canvasHeight);for(let a in e.uniforms)(null==(r=t.states)?void 0:r.scroll.some(e=>e.prop===a))||(null==(n=t.states)?void 0:n.appear.some(e=>e.prop===a&&!e.complete))||(t.local.bpProps&&a in t.local.bpProps?Ht(t.local.bpProps[a],e.uniforms[a],a):a in t&&Ht(t[a],e.uniforms[a],a))}setFlattenedPlaneUniforms(e,t){var i,r,n,a,s;if(!e.visible)return;if(this.ensureFlattenedPlaneTextures(e,t),t.local.modelInstances&&Object.entries(t.local.modelInstances).forEach(([i,r])=>{if(!r||!r.local)return;const n=e.uniforms[`L${i}_elemOpacity`]||e.uniforms[`L${i}_opacity`];if(n&&0===n.value)return;const a=`L${i}_`,s={};if(t.local.bpProps)for(const e in t.local.bpProps)e.startsWith(a)&&(s[e.slice(a.length)]=t.local.bpProps[e]);if(t.local.stateEffectProps)for(const e in t.local.stateEffectProps)e.startsWith(a)&&(s[e.slice(a.length)]=t.local.stateEffectProps[e]);r.local.stateEffectProps=s;const l=this.calculateItemMouseValues(r);l&&!r.local.mouse&&(r.local.mouse={x:.5,y:.5}),l&&(r.local.mouse.x=l.x,r.local.mouse.y=l.y),r.renderModel()}),(null==(i=t.local.stateEffectProps)?void 0:i.playbackRate)&&e.videos.at(-1)&&(e.videos.at(-1).playbackRate=t.local.stateEffectProps.playbackRate),e.uniforms.mousePos&&this.mouse.movedInView){t.local.currentFrameMouseValues||(t.local.currentFrameMouseValues=this.calculateItemMouseValues(t));const i=t.local.currentFrameMouseValues;i&&(e.uniforms.mousePos.value.x=i.x,e.uniforms.mousePos.value.y=i.y)}const l=t=>{const i=t.match(/^L(\\\\d+)_/);if(!i)return!1;const r=i[1],n=e.uniforms[`L${r}_elemOpacity`]||e.uniforms[`L${r}_opacity`];return n&&0===n.value};if((null==(n=null==(r=t.data)?void 0:r.timeUniforms)?void 0:n.length)&&t.data.timeUniforms.forEach(({key:i,speed:r,animating:n})=>{var a;if(!l(i)&&e.uniforms[i]&&!1!==n){const n=i.replace(/_time$/,\\\"_speed\\\"),s=(null==(a=t.local.stateEffectProps)?void 0:a[n])??t[n]??r??1;e.uniforms[i].value+=60*s/this.fps}}),null==(s=null==(a=t.data)?void 0:a.mouseUniforms)?void 0:s.length){const i=this.bbox.width/2,r=this.bbox.height/2,n=this.mouse.pos.x,a=this.mouse.pos.y;t.local.mouseStates||(t.local.mouseStates={}),t.data.mouseUniforms.forEach(({key:s,momentum:o,spring:u,trackAxes:d})=>{if(!e.uniforms[s])return;if(l(s))return;const c=d||\\\"xy\\\",h=\\\"x\\\"===c||\\\"xy\\\"===c,f=\\\"y\\\"===c||\\\"xy\\\"===c,p=u||0;if(!t.local.mouseStates[s])return t.local.mouseStates[s]={x:h?n/i:.5,y:f?1-a/r:.5,vx:0,vy:0},e.uniforms[s].value.x=t.local.mouseStates[s].x,void(e.uniforms[s].value.y=t.local.mouseStates[s].y);const m=t.local.mouseStates[s],v=m.x*i,g=(1-m.y)*r;if(p>0){if(h){const e=Ce(v,n,m.vx,o,p);m.x=e.value/i,m.vx=e.velocity}else m.x=.5;if(f){const e=Ce(g,a,m.vy,o,p);m.y=1-e.value/r,m.vy=e.velocity}else m.y=.5}else m.x=h?Ve(n,v,2*o)/i:.5,m.y=f?1-Ve(a,g,2*o)/r:.5;e.uniforms[s].value.x=m.x,e.uniforms[s].value.y=m.y})}}setInitialElementPlaneUniforms(e,t){var i;e.uniforms.resolution.value.x=this.curtain.canvas.width,e.uniforms.resolution.value.y=this.curtain.canvas.height,e.uniforms.artboardResolution&&(e.uniforms.artboardResolution.value.x=this.canvasWidth,e.uniforms.artboardResolution.value.y=this.canvasHeight);for(let r in e.uniforms){const n=this.getAppearStateUniformValue(t,r);n.hasValue?Ht(n.value,e.uniforms[r],r):t.local.bpProps&&r in t.local.bpProps?Ht(t.local.bpProps[r],e.uniforms[r],r):r in t&&Ht((null==(i=t.local.stateEffectProps)?void 0:i[r])??t[r],e.uniforms[r],r)}$t(t,e,\\\"fill\\\"),$t(t,e,\\\"stroke\\\")}setElementPlaneUniforms(e,t){var i,r,n;if(e.visible){if((null==(i=t.local)?void 0:i.gpuTextFallback)&&e.uniforms.opacity&&(e.uniforms.opacity.value=0),$t(t,e,\\\"fill\\\"),$t(t,e,\\\"stroke\\\"),e.uniforms.fontSize&&t.isGpuElement){const{fontSize:i,lineHeight:n}=t.getAbsoluteFontValues(this);if(e.uniforms.fontSize.value=i,e.uniforms.lineHeight.value=n,e.uniforms.height.value=t.height,e.uniforms.lineCount&&(e.uniforms.lineCount.value=(null==(r=t.local.wrappedLines)?void 0:r.length)||1),t.local.textMetrics){const i=t.local.textMetrics;e.uniforms.ascender.value=i.ascender,e.uniforms.descender.value=i.descender,e.uniforms.capTop&&(e.uniforms.capTop.value=i.capTop),e.uniforms.atlasEmPx.value=i.emPx,e.uniforms.atlasPxRange.value=i.pxRange,e.uniforms.atlasTrueSdf.value=i.trueSdf?1:0}const a=function(e,t){let i=null,r=1;return(e.textAnimations||[]).forEach(e=>{const n=t(k(\\\"revealProgress\\\",e));(null===i||n<r)&&(i=e,r=n)}),null===i?null:{...F(e,i),revealProgress:r}}(t,e=>{var i;if(void 0!==(null==(i=t.local.stateEffectProps)?void 0:i[e]))return t.local.stateEffectProps[e];const r=this.getAppearStateUniformValue(t,e);return r.hasValue?r.value:t[e]});Object.entries(a||{}).forEach(([t,i])=>{e.uniforms[t]&&Ht(i,e.uniforms[t],t)})}if(e.uniforms.resolution&&(e.uniforms.resolution.value.x=this.curtain.canvas.width,e.uniforms.resolution.value.y=this.curtain.canvas.height),e.uniforms.artboardResolution&&(e.uniforms.artboardResolution.value.x=this.canvasWidth,e.uniforms.artboardResolution.value.y=this.canvasHeight),t.animating&&e.uniforms.time){const i=this.local.renderFrameId||0;if(e.userData.lastTimeUpdateFrameId!==i){const r=(null==(n=t.local.stateEffectProps)?void 0:n.speed)??t.speed??1;e.uniforms.time.value+=60*r/this.fps,e.userData.lastTimeUpdateFrameId=i}}if(e.uniforms.mousePos){t.local.currentFrameMouseValues||(t.local.currentFrameMouseValues=this.calculateItemMouseValues(t));const i=t.local.currentFrameMouseValues;!this.mouse.movedInView||e.uniforms.mousePos.value.x===i.x&&e.uniforms.mousePos.value.y===i.y||(e.uniforms.mousePos.value.x=i.x,e.uniforms.mousePos.value.y=i.y)}}}calculateItemMouseValues(e){if(!this.mouse.movedInView)return null;const t=this.bbox.width/2,i=this.bbox.height/2,r=this.getMousePosWithMomentum(e,t,i);return e.local.mouseValuePool||(e.local.mouseValuePool=new T(.5)),e.local.mouseValuePool.x=r.x,e.local.mouseValuePool.y=r.y,e.local.mouseValuePool}getMousePosWithMomentum(e,t,i){let r=this.mouse.pos.x,n=this.mouse.pos.y,a=e.trackAxes||\\\"xy\\\",s=\\\"x\\\"===a||\\\"xy\\\"===a,l=\\\"y\\\"===a||\\\"xy\\\"===a;const o=e.mouseMomentum||0,u=e.mouseSpring||0;let d=r/t,c=1-n/i;if(!o&&!u)return{x:s?d:.5,y:l?c:.5};if(!e.local.lastMousePos)return e.local.lastMousePos={x:s?d:.5,y:l?c:.5},e.local.lastMousePos;const h=e.local.lastMousePos.x*t,f=(1-e.local.lastMousePos.y)*i;if(u>0){if(e.local.mouseVelocity||(e.local.mouseVelocity={x:0,y:0}),s){const i=Ce(h,r,e.local.mouseVelocity.x,o,u);r=i.value,e.local.mouseVelocity.x=i.velocity,e.local.lastMousePos.x=r/t}else e.local.lastMousePos.x=.5;if(l){const t=Ce(f,n,e.local.mouseVelocity.y,o,u);n=t.value,e.local.mouseVelocity.y=t.velocity,e.local.lastMousePos.y=1-n/i}else e.local.lastMousePos.y=.5;return e.local.lastMousePos}const p=Math.abs(r-h),m=Math.abs(n-f);return p<.001&&m<.001||(s?(r=Ve(r,h,2*o),e.local.lastMousePos.x=r/t):e.local.lastMousePos.x=.5,l?(n=Ve(n,f,2*o),e.local.lastMousePos.y=1-n/i):e.local.lastMousePos.y=.5),e.local.lastMousePos}setEffectPlaneUniforms(e,t){var i,r,n,a;if(!e.visible)return;let s=(null==(i=t.local.stateEffectProps)?void 0:i.speed)??t.speed??1;if(t.animating&&e.uniforms.time){const t=this.local.renderFrameId||0;e.userData.lastTimeUpdateFrameId!==t&&(e.uniforms.time.value+=60*s/this.fps,e.userData.lastTimeUpdateFrameId=t)}if((null==(r=t.local.stateEffectProps)?void 0:r.playbackRate)&&e.videos.at(-1)&&(e.videos.at(-1).playbackRate=t.local.stateEffectProps.playbackRate),At()&&(null==(a=null==(n=this.interactivity)?void 0:n.mouse)?void 0:a.disableMobile))return!1;if(!this.mouse.movedInView)return;t.local.currentFrameMouseValues||(t.local.currentFrameMouseValues=this.calculateItemMouseValues(t));const l=t.local.currentFrameMouseValues;l&&(e.uniforms.previousMousePos&&(this.mouse.ticks>16?(e.uniforms.previousMousePos.value.x=e.uniforms.mousePos.value.x,e.uniforms.previousMousePos.value.y=e.uniforms.mousePos.value.y):(e.uniforms.previousMousePos.value.x=l.x,e.uniforms.previousMousePos.value.y=l.y)),e.uniforms.mousePos&&!l.equals(e.uniforms.mousePos.value)&&(e.uniforms.mousePos.value.x=l.x,e.uniforms.mousePos.value.y=l.y),this.mouse.ticks++)}getOrderedItems(){let e=[];return this.layers.filter(e=>!e.parentLayer&&!e.groupLayer).forEach(t=>{if(t.isGroup)return e.push(t),t.getMemberItems().filter(e=>!1!==e.visible).forEach(t=>{t.effects&&t.effects.length&&e.push(...t.getChildEffectItems()),e.push(t)}),void(t.effects&&t.effects.length&&e.push(...t.getChildEffectItems()));t.effects&&t.effects.length&&e.push(...t.getChildEffectItems()),e.push(t)}),e}getTextureParams(e,t,i){var r;const n=e[t];let a=1;n.userData.downSample&&(a=\\\"number\\\"==typeof n.userData.downSample?n.userData.downSample:.5);const{targetSize:s,floatingPoint:l}=n.userData,o={maxWidth:(null==s?void 0:s.width)||this.curtain.canvas.width*a,maxHeight:(null==s?void 0:s.height)||this.curtain.canvas.height*a,scaleWithCanvas:!(null==s?void 0:s.width),depth:null==(r=null==i?void 0:i.data)?void 0:r.depth};return l&&(o.texturesOptions={floatingPoint:l}),o}handlePlaneCreation(){this.initialized=!0,this.initializing=!1,this.rendering||this.renderNFrames(2),this.waitForAssetsAndDisablePlanes(),Ut()}waitForAssetsAndDisablePlanes(){var e,t;this.local.preloadedImages&&Object.values(this.local.preloadedImages).some(e=>e.loading)||this.layers.some(e=>!1!==e.visible&&(e.isModel&&!e.local.modelLoaded||\\\"image\\\"===e.layerType&&!e.local.imageReady||\\\"text\\\"===e.layerType&&!e.local.loaded||e.isFlattened&&(!e.areTextAssetsReady()||!e.areImageAssetsReady()||!e.areModelAssetsReady())))?setTimeout(()=>this.waitForAssetsAndDisablePlanes(),32):(this.layers.filter(e=>e.preloadedCanvasTexture).forEach(e=>{e.preloadedCanvasTexture.shouldUpdate=!0}),this.layers.filter(e=>e.isFlattened).forEach(e=>{Object.values(e.local.canvasTextures||{}).forEach(e=>{e&&(e.shouldUpdate=!0)})}),this.curtain&&this.curtain.planes.forEach(e=>{e.videos.forEach(e=>{e.currentTime=0}),e._canDraw=!0}),null==(t=null==(e=this.variables)?void 0:e.applyAll)||t.call(e),this.renderFrame(),this.layers.filter(e=>e.preloadedCanvasTexture).forEach(e=>{e.preloadedCanvasTexture.shouldUpdate=e.preloadedCanvasTexture.userData.hasStateEffects||!1}),this.layers.filter(e=>e.isFlattened).forEach(e=>{Object.values(e.local.canvasTextures||{}).forEach(e=>{e&&(e.shouldUpdate=!1)})}),setTimeout(()=>this.disablePlanes(),16))}disablePlanes(){const e=this.getSplitOrderedItems();e.dynamic.length||e.static.pop();for(const t of e.static)t.getPlanes().forEach(e=>{e._canDraw=!1})}}function Oi(e,t,i){e.addEventListener(t,i,{passive:!0})}function Di(e,t,i){e.removeEventListener(t,i)}function Bi(){Oi(window,\\\"scroll\\\",Fi),At()?Oi(window,\\\"touchmove\\\",Li):Oi(window,\\\"mousemove\\\",Li),Oi(window,\\\"routeChange\\\",Dt),Oi(document,\\\"mouseleave\\\",Ai),Ze=function(e,t){let i;return function(...r){clearTimeout(i),i=setTimeout(()=>{e.apply(this,r)},t)}}(bi,16),At()?Oi(window,\\\"orientationchange\\\",Ze):Oi(window,\\\"resize\\\",Ze),Oi(document,Qe,xi),et=!0}function Ui(){Di(window,\\\"mousemove\\\",Li),Di(window,\\\"touchmove\\\",Li),Di(window,\\\"scroll\\\",Fi),Di(window,\\\"routeChange\\\",Dt),Di(document,\\\"mouseleave\\\",Ai),Ze&&(Di(window,\\\"resize\\\",Ze),Di(window,\\\"orientationchange\\\",Ze)),Di(document,Qe,xi),et=!1}function zi(){var e;if(null!==ft)return ft;try{const t=document.createElement(\\\"canvas\\\").getContext(\\\"webgl2\\\");ft=!!t,null==(e=null==t?void 0:t.getExtension(\\\"WEBGL_lose_context\\\"))||e.loseContext()}catch{ft=!1}return ft}function Ni(e){let t=e.projectId?e.projectId.split(\\\"?\\\")[0]:null,i=e.projectId?e.projectId.split(\\\"?\\\")[1]:null;return new Promise((r,n)=>{(function(e,t,i,r,n){let a;if(i){a=i;const e=document.getElementById(i);if(e)try{let t=JSON.parse(e.innerText);return(null==t?void 0:t.options)&&((null==t?void 0:t.layers)||(null==t?void 0:t.history))?Promise.resolve(t):(r(new Error(`Did not find valid JSON inside ${i}`)),Promise.reject())}catch(s){return r(new Error(`Error parsing JSON from ${i}: ${s.message}`)),Promise.reject()}}else{let i=\\\"https://storage.googleapis.com/unicornstudio-production\\\";n||(null==t?void 0:t.includes(\\\"production=true\\\"))?(i=\\\"https://assets.unicorn.studio\\\",(null==t?void 0:t.includes(\\\"update=\\\"))||(t=null)):(null==t?void 0:t.includes(\\\"update=\\\"))||(t=`v=${Date.now()}`),a=`${i}/embeds/${e}${t?\\\"?\\\"+t:\\\"\\\"}`}return fetch(a).then(e=>e.json()).then(e=>e).catch(e=>console.error(\\\"Error fetching data:\\\",e))})(t,i,e.filePath,n,e.production).then(i=>{if(!i||!i.layers&&!i.history||!i.options)return void n(new Error(`Error fetching data for project id '${e.projectId}'`));const a=i.options||{},s=(l=e.element,(\\\"object\\\"==typeof HTMLElement?l instanceof HTMLElement:l&&\\\"object\\\"==typeof l&&null!==l&&1===l.nodeType&&\\\"string\\\"==typeof l.nodeName)?e.element:document.getElementById(e.elementId));var l;if(!s)return void n(new Error(`Couldn't find an element with id '${e.elementId}' on the page.`));const o=St();s.setAttribute(\\\"data-scene-id\\\",o);let u=e.scale||a.scale||1,d=e.dpi||a.dpi||Math.min(1.5,window.devicePixelRatio);const c=Number.isFinite(Number(e.breakpointWidth))?Number(e.breakpointWidth):null,h=function(e,t,i,r){const n=r?{...i,modules:r}:i,a=[];return e.forEach(e=>{switch(e.layerType){case\\\"text\\\":a.push(new yi(e,t,n).unpackage());break;case\\\"image\\\":a.push(new vi(e,t,n).unpackage());break;case\\\"model\\\":a.push(new gi(e,t,n).unpackage());break;case\\\"shape\\\":a.push(new hi(e,t,n).unpackage());break;case\\\"effect\\\":a.push(new fi(e,t,n).unpackage());break;case\\\"group\\\":a.push(new pi(e,t,n).unpackage());break;case\\\"flattened\\\":{const i=new mi(e,t,n).unpackage();a.push(i),i.getChildEffectItems().forEach(e=>{a.push(e)});break}}}),a}(i.layers||i.history,o,function(e,t,i,r=null){return{canvasWidth:e.offsetWidth,canvasHeight:e.offsetHeight,scale:t,dpi:i,element:e,breakpointWidth:r}}(s,u,d,c),i.modules);if(!zi()){const e=function({id:e,element:t,layers:i}){return{id:e,element:t,layers:i,destroyed:!1,fallbackOnly:!0,getMouse:()=>({x:.5,y:.5,inBounds:!1,moved:!1}),getDynamicLayers:()=>[],destroy(){this.destroyed=!0,this.element&&(this.element.removeAttribute(\\\"data-us-initialized\\\"),this.element.removeAttribute(\\\"data-scene-id\\\"),this.element.querySelectorAll(\\\"[data-us-text]\\\").forEach(e=>{e.remove()}))}}}({id:o,element:s,layers:h});return function(e,t){e.forEach(e=>{var i;\\\"text\\\"===e.layerType&&Ct(e,t),Object.values((null==(i=e.local)?void 0:i.textInstances)||{}).forEach(e=>{Ct(e,t)})})}(h,s),Vi.push(e),void r(e)}const f=e.initialPreset||Yt(),p=!!e.fixed||_i(s,null,50),m=new Ci({id:o,fps:e.fps||a.fps||60,dpi:d,name:a.name,projectId:t||e.filePath.split(\\\".\\\")[0],renderingScale:u,element:s,lazyLoad:e.lazyLoad,fixed:e.fixed,width:e.width,height:e.height,breakpoints:e.breakpoints||a.breakpoints,breakpointWidth:c,initialVariables:e.initialVariables,initialPreset:f,altText:e.altText,ariaLabel:e.ariaLabel,deferCurtains:!!e.lazyLoad&&!p,editMetadata:{designId:i.designId,canvasId:i.canvasId,designName:i.designName||i.projectName,sceneName:i.sceneName}});m.applyCanvasA11yAttrs();let v=a[Mt(\\\"ZnJlZVBsYW4=\\\")];!v&&a[Mt(\\\"aW5jbHVkZUxvZ28=\\\")]&&function(e,t){const i=document.createElement(\\\"a\\\");i.href=\\\"https://unicorn.studio?utm_source=public-url\\\",i.style=\\\"position: absolute; display: flex; bottom: 30px; left: 0; width: 190px; margin: 0 auto; right: 0rem; padding: 10px; border-radius: 6px; background-color: rgba(255, 255, 255, 1); box-shadow: 0 3px 9px 0 rgba(0, 0, 0, .2); z-index: 99999999; box-sizing: border-box;\\\",i.target=\\\"_blank\\\";const r=document.createElement(\\\"img\\\");r.src=Mt(\\\"aHR0cHM6Ly9hc3NldHMudW5pY29ybi5zdHVkaW8vbWVkaWEvbWFkZV9pbl91c19zbWFsbF93ZWIuc3Zn\\\"),r.alt=Mt(\\\"TWFkZSB3aXRoIHVuaWNvcm4uc3R1ZGlv\\\"),r.style=\\\"width: 170px; height: auto;\\\",i.appendChild(r),t.appendChild(i)}(0,s),Vi.push(m),m.layers=h,m.applyBreakpointValues(!0),m.setupVariables(i.variables,e.initialVariables,f),m.preloadTextures(),m.setInteractiveParams(e,a),m.isInView=m.isFixed||p,!m.lazyLoad||m.isInView?m.initializePlanes():wi(m),et||Bi(),Zt(s,m,e),r(m)}).catch(e=>{console.error(e),n(e)})})}e.addScene=Ni,e.destroy=function(){[...Vi].forEach(e=>{e.destroy()}),Vi.length=0,Ui()},e.init=function(){return zi()||console.warn(\\\"WebGL2 is not supported in this browser. Unicorn Studio will render available HTML fallbacks only.\\\"),new Promise((e,t)=>{const i=[...document.querySelectorAll(\\\"[data-us-project], [data-us-project-src]\\\")].filter(e=>!e.getAttribute(\\\"data-us-initialized\\\"));i.length?Promise.all(i.map(e=>{e.setAttribute(\\\"data-us-initialized\\\",!0);const t=Lt(e,\\\"data-us-project\\\"),i=Lt(e,\\\"data-us-project-src\\\"),r=Lt(e,\\\"data-us-disablemobile\\\"),n=Lt(e,\\\"data-us-disablemouse\\\");return Ni({projectId:i?null:t,filePath:i,element:e,dpi:+Lt(e,\\\"data-us-dpi\\\"),scale:+Lt(e,\\\"data-us-scale\\\"),production:Lt(e,\\\"data-us-production\\\"),fps:+Lt(e,\\\"data-us-fps\\\"),lazyLoad:Lt(e,\\\"data-us-lazyload\\\"),altText:Lt(e,\\\"data-us-alttext\\\"),ariaLabel:Lt(e,\\\"data-us-arialabel\\\"),fixed:Lt(e,\\\"data-us-fixed\\\"),initialVariables:Gt(Lt(e,\\\"data-us-vars\\\")),initialPreset:Lt(e,\\\"data-us-preset\\\")||Yt(),interactivity:r||n?{mouse:{disableMobile:r,disabled:n}}:null}).catch(t=>{throw e.removeAttribute(\\\"data-us-initialized\\\"),t})})).then(()=>e(Vi)).catch(t):e(Vi)})},e.scenes=Vi,e.setScroll=function(e){const t=bt(e);null!==t&&(rt=t,Tt(t),ki())},e.unbindEvents=Ui,e.useNativeScroll=function(){rt=null,Tt(),ki()},e.version=xt,Object.defineProperty(e,Symbol.toStringTag,{value:\\\"Module\\\"})});\\n\"\n    },\n    {\n      \"id\": \"model-renderer\",\n      \"relativePath\": \"extensions/model-renderer.js\",\n      \"content\": \"import{GLTFLoader,SVGLoader,THREE}from\\\"./three-bundle.js\\\";const e=new GLTFLoader,a=new SVGLoader,t=new THREE.TextureLoader,n=new THREE.Quaternion,r=new THREE.Quaternion,o=new THREE.Euler,i=new THREE.Vector3,l=new WeakMap;function s(e){return l.has(e)||l.set(e,{scene:null,camera:null,renderer:null,model:null,ambientLight:null,directionalLight:null,fillLight:null,customNormalMap:null,customEnvMap:null,envMap:null,customColorMap:null,glassMaterial:null,matcapMaterial:null,matcapTexture:null,backgroundTexture:null,animationMixer:null,animationClips:null,activeAnimationClip:null,lastAnimationTime:null}),l.get(e)}function m(e,a){var t;if(!a.animationMixer||!(null==(t=a.animationClips)?void 0:t.length))return;const n=function(e,a){var t;const n=(null==(t=a.animationClips)?void 0:t.length)||0;if(!n)return null;const r=e.getProp(\\\"selectedAnimationClip\\\"),o=Number.parseInt(r,10);return Number.isInteger(o)&&o>=0&&o<n?String(o):\\\"0\\\"}(e,a);if(null==n||a.activeAnimationClip===n)return;const r=a.animationClips[Number.parseInt(n,10)];r&&(a.animationMixer.stopAllAction(),a.animationMixer.clipAction(r).reset().play(),a.activeAnimationClip=n)}function c(e){return e.materialMode||(e.renderNormals?\\\"glass\\\":\\\"standard\\\")}function u(e,a,t){if(!e.scene)return;if(\\\"matcap\\\"===t)return e.ambientLight&&(e.scene.remove(e.ambientLight),e.ambientLight=null),e.directionalLight&&(e.scene.remove(e.directionalLight),e.directionalLight=null),void(e.fillLight&&(e.scene.remove(e.fillLight),e.fillLight=null));const n=a.getProp(\\\"ambientLightColor\\\")||\\\"#777777\\\",r=a.getProp(\\\"ambientLightIntensity\\\")??.75,o=a.getProp(\\\"lightColor\\\")||\\\"#777777\\\",i=a.getProp(\\\"lightIntensity\\\")??.2,l=a.getProp(\\\"fillLightColor\\\")||\\\"#777777\\\",s=a.getProp(\\\"fillLightIntensity\\\")??.2,m=a.getProp(\\\"lightPosition\\\")||{x:.75,y:.75,z:.75};e.ambientLight||(e.ambientLight=new THREE.AmbientLight(n,2*r),e.scene.add(e.ambientLight)),e.directionalLight||(e.directionalLight=new THREE.DirectionalLight(o,5*i*2),e.scene.add(e.directionalLight)),e.fillLight||(e.fillLight=new THREE.DirectionalLight(l,5*s*2),e.scene.add(e.fillLight)),e.ambientLight.color.set(n),e.ambientLight.intensity=2*r,e.directionalLight.color.set(o),e.directionalLight.intensity=5*i*2,e.fillLight.color.set(l),e.fillLight.intensity=5*s*2;const c=10*(m.x-.5),u=10*(m.y-.5),p=10*(m.z-.5);e.directionalLight.position.set(c,-u,p),e.fillLight.position.set(.8*-c,.8*u,.8*-p)}function p(e,a=!1,n=!1){return new Promise(n=>{t.load(e,e=>{a?(e.mapping=THREE.EquirectangularReflectionMapping,e.colorSpace=THREE.SRGBColorSpace,e.minFilter=THREE.LinearFilter,e.magFilter=THREE.LinearFilter,e.generateMipmaps=!1):(e.wrapS=e.wrapT=THREE.RepeatWrapping,e.flipY=!0),n(e)})})}function d(e){return new Promise(a=>{t.load(e,e=>{e.colorSpace=THREE.SRGBColorSpace,e.minFilter=THREE.LinearFilter,e.magFilter=THREE.LinearFilter,e.generateMipmaps=!1,e.wrapS=THREE.ClampToEdgeWrapping,e.wrapT=THREE.ClampToEdgeWrapping,e.flipY=!1,a(e)})})}function g(e,a,t=null){if(!a.matcapMaterial)return;const n=Math.max(0,e.getProp(\\\"matcapIntensity\\\")??.5),r=(t??e.getProp(\\\"matcapRotation\\\")??0)*Math.PI*2;a.matcapMaterial.color.set(\\\"#ffffff\\\"),a.matcapMaterial.matcap!==(a.matcapTexture||null)&&(a.matcapMaterial.matcap=a.matcapTexture||null,a.matcapMaterial.needsUpdate=!0);const o=a.matcapMaterial.userData.shader;(null==o?void 0:o.uniforms)&&(o.uniforms.uMatcapIntensity.value=n,o.uniforms.uMatcapRotation.value=r)}function v(e,a){var t,n;if(!(null==(n=null==(t=a.model)?void 0:t.userData)?void 0:n.meshes))return;const r=c(e);return\\\"glass\\\"===r?(a.glassMaterial||(a.glassMaterial=function(e){const a=e.getProp(\\\"lightPosition\\\");return new THREE.ShaderMaterial({uniforms:{uBackgroundTexture:{value:null},uEnvMap:{value:null},uEnvMapIntensity:{value:e.getProp(\\\"environmentMapIntensity\\\")??0},uResolution:{value:new THREE.Vector2(1,1)},uIOR:{value:e.getProp(\\\"glassIOR\\\")??1.5},uThickness:{value:e.getProp(\\\"glassThickness\\\")??.5},uBlur:{value:e.getProp(\\\"glassRoughness\\\")??0},uTint:{value:new THREE.Color(e.getProp(\\\"glassTint\\\")||\\\"#ffffff\\\")},uDispersion:{value:e.getProp(\\\"glassDispersion\\\")??0},uCameraPosition:{value:new THREE.Vector3(0,0,5)},uLightPosition:{value:new THREE.Vector3((null==a?void 0:a.x)??.75,(null==a?void 0:a.y)??.75,(null==a?void 0:a.z)??.75)},uMetalness:{value:e.getProp(\\\"materialMetalness\\\")??.5},uRoughness:{value:e.getProp(\\\"materialRoughness\\\")??.5},uLightIntensity:{value:e.getProp(\\\"lightIntensity\\\")??.2},uAmbientLightIntensity:{value:e.getProp(\\\"ambientLightIntensity\\\")??.75}},vertexShader:\\\"\\\\n  varying vec3 vWorldNormal;\\\\n  varying vec3 vWorldPosition;\\\\n  varying vec4 vClipPosition;\\\\n  \\\\n  void main() {\\\\n    vWorldNormal = normalize((modelMatrix * vec4(normal, 0.0)).xyz);\\\\n    vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;\\\\n    vec4 clipPos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\\\\n    vClipPosition = clipPos;\\\\n    gl_Position = clipPos;\\\\n  }\\\\n\\\",fragmentShader:\\\"\\\\n  uniform sampler2D uBackgroundTexture;\\\\n  uniform sampler2D uEnvMap;\\\\n  uniform float uEnvMapIntensity;\\\\n  uniform vec2 uResolution;\\\\n  uniform float uIOR;\\\\n  uniform float uThickness;\\\\n  uniform float uBlur;\\\\n  uniform vec3 uTint;\\\\n  uniform float uDispersion;\\\\n  uniform vec3 uCameraPosition;\\\\n  \\\\n  uniform vec3 uLightPosition;\\\\n  uniform float uMetalness;\\\\n  uniform float uRoughness;\\\\n  uniform float uLightIntensity;\\\\n  uniform float uAmbientLightIntensity;\\\\n  \\\\n  varying vec3 vWorldNormal;\\\\n  varying vec3 vWorldPosition;\\\\n  varying vec4 vClipPosition;\\\\n  \\\\n  #define PI 3.14159265359\\\\n  \\\\n  vec3 sampleBackground(vec2 screenUV, vec2 offset) {\\\\n    vec2 uv = clamp(screenUV + offset, 0.001, 0.999);\\\\n    return texture2D(uBackgroundTexture, uv).rgb;\\\\n  }\\\\n  \\\\n  vec3 sampleEnvMap(vec3 direction) {\\\\n    float phi = atan(direction.z, direction.x);\\\\n    float theta = asin(clamp(direction.y, -1.0, 1.0));\\\\n    vec2 uv = vec2(phi / (2.0 * PI) + 0.5, theta / PI + 0.5);\\\\n    return texture2D(uEnvMap, uv).rgb;\\\\n  }\\\\n  \\\\n  void main() {\\\\n    vec3 normal = normalize(vWorldNormal);\\\\n    vec3 viewDir = normalize(uCameraPosition - vWorldPosition);\\\\n    \\\\n    float facing = gl_FrontFacing ? 1.0 : -1.0;\\\\n    normal *= facing;\\\\n    \\\\n    vec2 screenUV = (vClipPosition.xy / vClipPosition.w) * 0.5 + 0.5;\\\\n    \\\\n    float eta = gl_FrontFacing ? (1.0 / uIOR) : uIOR;\\\\n    vec3 refractDir = refract(-viewDir, normal, eta);\\\\n    \\\\n    float iorStrength = abs(uIOR - 1.0) * 0.5;\\\\n    float refractStrength = iorStrength * (0.3 + uThickness * 0.4);\\\\n    vec2 refractOffset = refractDir.xy * refractStrength;\\\\n    \\\\n    vec3 refractedColor;\\\\n    if (uDispersion > 0.001) {\\\\n      float dispersionAmount = uDispersion * 0.05;\\\\n      float etaR = gl_FrontFacing ? (1.0 / (uIOR * (1.0 - dispersionAmount))) : (uIOR * (1.0 - dispersionAmount));\\\\n      float etaG = eta;\\\\n      float etaB = gl_FrontFacing ? (1.0 / (uIOR * (1.0 + dispersionAmount))) : (uIOR * (1.0 + dispersionAmount));\\\\n      \\\\n      vec3 redRefract = refract(-viewDir, normal, etaR);\\\\n      vec3 greenRefract = refract(-viewDir, normal, etaG);\\\\n      vec3 blueRefract = refract(-viewDir, normal, etaB);\\\\n      \\\\n      float r = sampleBackground(screenUV, redRefract.xy * refractStrength).r;\\\\n      float g = sampleBackground(screenUV, greenRefract.xy * refractStrength).g;\\\\n      float b = sampleBackground(screenUV, blueRefract.xy * refractStrength).b;\\\\n      refractedColor = vec3(r, g, b);\\\\n    } else {\\\\n      refractedColor = sampleBackground(screenUV, refractOffset);\\\\n    }\\\\n    \\\\n    if (uBlur > 0.001) {\\\\n      float blurAmount = uBlur * 0.02;\\\\n      vec3 blurred = refractedColor;\\\\n      blurred += sampleBackground(screenUV, refractOffset + vec2(blurAmount, 0.0));\\\\n      blurred += sampleBackground(screenUV, refractOffset + vec2(-blurAmount, 0.0));\\\\n      blurred += sampleBackground(screenUV, refractOffset + vec2(0.0, blurAmount));\\\\n      blurred += sampleBackground(screenUV, refractOffset + vec2(0.0, -blurAmount));\\\\n      refractedColor = blurred / 5.0;\\\\n    }\\\\n    \\\\n    refractedColor = mix(refractedColor, refractedColor * uTint, 0.5 + uThickness * 0.3);\\\\n    \\\\n    float F0 = pow((uIOR - 1.0) / (uIOR + 1.0), 2.0);\\\\n    float fresnel = F0 + (1.0 - F0) * pow(1.0 - max(dot(normal, viewDir), 0.0), 5.0);\\\\n    \\\\n    vec3 reflectedColor = refractedColor;\\\\n    if (uEnvMapIntensity > 0.001) {\\\\n      vec3 reflectDir = reflect(-viewDir, normal);\\\\n      vec3 envColor = sampleEnvMap(reflectDir) * uEnvMapIntensity;\\\\n      reflectedColor = mix(refractedColor, envColor, fresnel * uEnvMapIntensity);\\\\n    }\\\\n        \\\\n    vec3 lightDir = normalize(vec3(uLightPosition.xy * 2.0 - 1.0, uLightPosition.z * 2.0 - 1.0));\\\\n    float shininess = mix(2.0, 64.0, 1.0 - uRoughness);\\\\n    vec3 reflectVec = reflect(-lightDir, normal);\\\\n    float spec = pow(max(dot(reflectVec, viewDir), 0.0), shininess);\\\\n    \\\\n    vec3 specularColor = mix(vec3(1.0), reflectedColor, uMetalness) * uLightIntensity;\\\\n    \\\\n    float ndotv = max(dot(normal, viewDir), 0.0);\\\\n    float rimFresnel = pow(1.0 - ndotv, 3.0);\\\\n    float silhouetteFade = smoothstep(0.08, 0.22, ndotv);\\\\n    float rimDerivative = fwidth(ndotv);\\\\n    float stabilityFade = 1.0 - smoothstep(0.01, 0.08, rimDerivative);\\\\n    float rimVisibility = silhouetteFade * stabilityFade;\\\\n    \\\\n    vec3 litColor = reflectedColor * (1.0 + uAmbientLightIntensity * 0.5);\\\\n    litColor += specularColor * spec;\\\\n    float rimAmount = uEnvMapIntensity > 0.001 ? 0.3 : 1.0;\\\\n    litColor += rimFresnel * rimVisibility * uAmbientLightIntensity * rimAmount;\\\\n    \\\\n    gl_FragColor = vec4(litColor, 1.0);\\\\n  }\\\\n\\\",transparent:!0,side:THREE.DoubleSide,extensions:{derivatives:!0}})}(e)),void a.model.userData.meshes.forEach(e=>{e.userData.originalMaterial||(e.userData.originalMaterial=e.material),e.material=a.glassMaterial})):\\\"matcap\\\"===r?(a.matcapMaterial||(a.matcapMaterial=function(e){const a=new THREE.MeshMatcapMaterial({color:new THREE.Color(\\\"#ffffff\\\")});return a.onBeforeCompile=t=>{t.uniforms.uMatcapIntensity={value:Math.max(0,e.getProp(\\\"matcapIntensity\\\")??.5)},t.uniforms.uMatcapRotation={value:(e.getProp(\\\"matcapRotation\\\")??0)*Math.PI*2},t.fragmentShader=t.fragmentShader.replace(\\\"#include <common>\\\",\\\"#include <common>\\\\nuniform float uMatcapIntensity;\\\\nuniform float uMatcapRotation;\\\").replace(\\\"vec4 matcapColor = texture2D( matcap, uv );\\\",[\\\"vec2 centeredUv = uv - 0.5;\\\",\\\"float matcapCos = cos(uMatcapRotation);\\\",\\\"float matcapSin = sin(uMatcapRotation);\\\",\\\"vec2 rotatedUv = vec2(\\\",\\\"  centeredUv.x * matcapCos - centeredUv.y * matcapSin,\\\",\\\"  centeredUv.x * matcapSin + centeredUv.y * matcapCos\\\",\\\") + 0.5;\\\",\\\"vec4 matcapColor = texture2D( matcap, rotatedUv );\\\",\\\"float matcapExposure = exp2((uMatcapIntensity - 0.5) * 4.0);\\\",\\\"matcapColor.rgb *= matcapExposure;\\\"].join(\\\"\\\\n\\\")),a.userData.shader=t},a.customProgramCacheKey=()=>\\\"unicorn-matcap-v2\\\",a}(e)),g(e,a),void a.model.userData.meshes.forEach(e=>{e.userData.originalMaterial||(e.userData.originalMaterial=e.material),e.material=a.matcapMaterial})):void a.model.userData.meshes.forEach(e=>{e.userData.originalMaterial&&(e.material=e.userData.originalMaterial)})}function h(e,a,t,n,r=\\\"map\\\",o=1,i=1){a.repeat.setScalar(t);const l=-(t-1)/2,s=((null==n?void 0:n.x)??.5)-.5,m=((null==n?void 0:n.y)??.5)-.5;a.offset.set(l+s,l+m),e.model.traverse(e=>{e.isMesh&&(Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{(e.isMeshStandardMaterial||e.isMeshPhongMaterial||e.isMeshLambertMaterial)&&(\\\"map\\\"===r?(e.map=a,e.color&&e.color.setScalar(i)):\\\"normalMap\\\"===r&&void 0!==e.normalMap&&(e.normalMap=a,e.normalScale&&e.normalScale.set(o,-o)),e.needsUpdate=!0)})})}function f(e,a,t,n=!1){var r;a&&e.model&&(null==(r=e.model.userData.materials)||r.forEach(e=>{(e.isMeshStandardMaterial||e.isMeshPhysicalMaterial)&&(e.envMap=a,e.envMapIntensity=t,e.envMapRotation.x=n?Math.PI:0,e.needsUpdate=!0)}))}function M(e,a){var t,n,r,o;const i=c(a),l=\\\"standard\\\"===i;v(a,e),(null==(t=a.colorMapUrl)?void 0:t.trim())&&l&&p(a.colorMapUrl,!1).then(t=>{e.customColorMap=t;const n=Math.max(.001,a.getProp(\\\"colorMapScale\\\")??1),r=a.getProp(\\\"colorMapIntensity\\\")??1;h(e,t,n,a.getProp(\\\"colorMapPosition\\\"),\\\"map\\\",1,r)}),(null==(n=a.normalMapUrl)?void 0:n.trim())&&l&&p(a.normalMapUrl,!1,!0).then(t=>{e.customNormalMap=t;const n=Math.max(.001,a.getProp(\\\"normalMapScale\\\")??1);h(e,t,n,a.getProp(\\\"normalMapPosition\\\"),\\\"normalMap\\\",a.getProp(\\\"normalMapIntensity\\\"))});const s=a.getProp(\\\"environmentMapIntensity\\\");s>0&&(null==(r=a.environmentMapUrl)?void 0:r.trim())&&\\\"matcap\\\"!==i&&p(a.environmentMapUrl,!0).then(a=>{e.customEnvMap=a,l&&f(e,e.customEnvMap,s)}),(null==(o=a.matcapUrl)?void 0:o.trim())&&d(a.matcapUrl).then(t=>{e.matcapTexture&&e.matcapTexture.dispose(),e.matcapTexture=t,g(a,e)}),e.scene.add(e.model),a.handleModelLoaded(e.model)}function initialize(e,a){const t=s(a),n=e.canvas?e.canvas.width:e.drawingBufferWidth,r=e.canvas?e.canvas.height:e.drawingBufferHeight;0!==n&&0!==r&&(t.scene=new THREE.Scene,t.camera=new THREE.PerspectiveCamera(35,n/r,.1,100),t.camera.position.set(0,0,5),t.renderer=new THREE.WebGLRenderer({canvas:e.canvas,context:e,alpha:!0,preserveDrawingBuffer:!1,premultipliedAlpha:!0,logarithmicDepthBuffer:!0,antialias:\\\"high\\\"===a.quality}),t.renderer.setClearColor(0,0),t.renderer.outputColorSpace=THREE.SRGBColorSpace,function(e,a){e.renderer&&(e.renderer.toneMapping=a?THREE.ACESFilmicToneMapping:THREE.NoToneMapping,e.renderer.toneMappingExposure=a?1.5:1,e.renderer.physicallyCorrectLights=a)}(t,\\\"high\\\"===a.quality),t.renderer.setPixelRatio(1),t.renderer.setSize(n,r,!1),u(t,a,c(a)))}function loadModel(t){const n=s(t);n.animationMixer&&(n.animationMixer.stopAllAction(),n.animationMixer=null),n.animationClips=null,n.activeAnimationClip=null,n.lastAnimationTime=null,t.local.animationClipOptions=[],t.local.modelLoaded=!1,t.local.modelLoading=!1,t.local.modelObject=null;const r=t.modelUrl.toLowerCase(),o=r.startsWith(\\\"data:image/svg+xml\\\");if(r.split(\\\"?\\\")[0].endsWith(\\\".svg\\\")||o){const e=e=>{const a=e.paths,r=function(e,a,t){const n=new THREE.Group;for(let r=0;r<e.length;r++){const o=e[r],i=o.userData.style.fill;if(void 0!==i&&\\\"none\\\"!==i){const e=new THREE.MeshStandardMaterial({color:(new THREE.Color).setStyle(i),metalness:t.getProp(\\\"materialMetalness\\\")??.5,roughness:t.getProp(\\\"materialRoughness\\\")??.5,side:THREE.DoubleSide}),r=SVGLoader.createShapes(o);for(let t=0;t<r.length;t++){const o=r[t],i=new THREE.ExtrudeGeometry(o,a),l=i.attributes.position,s=i.attributes.uv;i.computeBoundingBox();const m=i.boundingBox.min,c=i.boundingBox.max,u=c.x-m.x,p=c.y-m.y,d=(e,a,t)=>{for(let n=e;n<e+a;n++){let e=n;if(i.index&&(e=i.index.getX(n)),t){const a=s.getX(e),t=s.getY(e),n=1/Math.max(u,p);s.setXY(e,a*n,t*n)}else{const a=l.getX(e),t=l.getY(e);s.setXY(e,(a-m.x)/u,(t-m.y)/p)}}};i.groups&&i.groups.length>0?i.groups.forEach(e=>{d(e.start,e.count,1===e.materialIndex)}):d(0,i.index?i.index.count:l.count,!1),s.needsUpdate=!0;const g=new THREE.Mesh(i,e);g.scale.set(1,-1,1),n.add(g)}}}return n}(a,{depth:t.getProp(\\\"extrudeDepth\\\")??10,bevelEnabled:t.getProp(\\\"bevelEnabled\\\")??!1,bevelThickness:t.getProp(\\\"bevelThickness\\\")??1,bevelSize:t.getProp(\\\"bevelSize\\\")??1,bevelSegments:t.getProp(\\\"bevelSegments\\\")??2,curveSegments:24},t);n.model=r,n.model.userData.isSVG=!0,n.model.userData.svgPaths=a;const o=(new THREE.Box3).setFromObject(n.model),i=o.getCenter(new THREE.Vector3);n.model.position.copy(i).multiplyScalar(-1);const l=o.getSize(new THREE.Vector3),s=Math.max(l.x,l.y,l.z),m=s>0?1/s:1,c=new THREE.Group;c.add(n.model),n.model=c,n.model.userData.baseScale=m,n.model.userData.isSVGWrapper=!0,n.model.userData.materials=[],n.model.userData.textureMaterials=[],n.model.userData.meshes=[],n.model.traverse(e=>{e.isMesh&&(n.model.userData.meshes.push(e),n.model.userData.materials.push(e.material),n.model.userData.textureMaterials.push(e.material),e.material.userData||(e.material.userData={}),e.material.userData.originalMap=null,e.material.userData.originalNormalMap=null)}),M(n,t)};if(o)try{const n=t.modelUrl.split(\\\",\\\")[1],r=decodeURIComponent(escape(atob(n)));e(a.parse(r))}catch(i){console.error(\\\"An error occurred while parsing the SVG data URL:\\\",i),t.local.modelLoading=!1}else a.load(t.modelUrl,e,e=>{e.total>0&&console.log(e.loaded/e.total*100+\\\"% loaded\\\")},e=>{console.error(\\\"An error occurred while loading the SVG:\\\",e),t.local.modelLoading=!1})}else e.load(t.modelUrl,e=>{var a,r;n.model=e.scene,(null==(a=e.animations)?void 0:a.length)?(n.animationMixer=new THREE.AnimationMixer(e.scene),n.animationClips=e.animations,t.local.animationClipOptions=e.animations.map((e,a)=>{var t;return{value:String(a),label:(null==(t=e.name)?void 0:t.trim())||`Animation ${a+1}`}}),m(t,n)):t.local.animationClipOptions=[];const o=(new THREE.Box3).setFromObject(n.model),i=o.getCenter(new THREE.Vector3);n.model.position.copy(i).multiplyScalar(-1);const l=o.getSize(new THREE.Vector3),s=Math.max(l.x,l.y,l.z),u=s>0?1/s:1,p=new THREE.Group;p.add(n.model),n.model=p,n.model.userData.baseScale=u,n.model.userData.materials=[],n.model.userData.meshes=[],n.model.traverse(e=>{if(e.isMesh){n.model.userData.meshes.push(e);const a=Array.isArray(e.material)?e.material:[e.material],r=t.getProp(\\\"materialMetalness\\\"),o=t.getProp(\\\"materialRoughness\\\");a.forEach((a,t)=>{var i;if((a.isMeshPhongMaterial||a.isMeshLambertMaterial)&&!(null==(i=a.userData)?void 0:i.converted)){const n=function(e){const a=new THREE.MeshStandardMaterial;return a.color.copy(e.color),a.map=e.map,a.normalMap=e.normalMap,a.emissiveMap=e.emissiveMap,a.aoMap=e.aoMap,a.emissive.copy(e.emissive||new THREE.Color(0,0,0)),a.opacity=e.opacity??1,a.transparent=e.transparent??!1,a.side=e.side??THREE.FrontSide,e.userData||(e.userData={}),a.userData=e.userData,a.userData.converted=!0,a}(a);Array.isArray(e.material)?e.material[t]=n:e.material=n,a=n}n.model.userData.materials.push(a),void 0!==a.metalness&&(a.metalnessMap&&(a.metalnessMap=null,a.needsUpdate=!0),a.metalness=r??a.metalness),void 0!==a.roughness&&(a.roughnessMap&&(a.roughnessMap=null,a.needsUpdate=!0),a.roughness=o??a.roughness),(a.isMeshStandardMaterial||a.isMeshPhysicalMaterial)&&(a.envMapIntensity=a.envMapIntensity??1),a.isMeshPhysicalMaterial&&a.transmission&&(a.transmission=0)})}}),(null==(r=t.colorMapUrl)?void 0:r.trim())&&\\\"standard\\\"===c(t)&&n.model.traverse(e=>{e.isMesh&&(Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{(e.isMeshStandardMaterial||e.isMeshPhongMaterial||e.isMeshLambertMaterial)&&(e.map=null,e.needsUpdate=!0)})}),M(n,t)},void 0,e=>{console.error(\\\"An error occurred while loading the model:\\\",e)});t.local.modelLoading=!0}function isLoading(e){return e.local.modelLoading&&!e.local.modelLoaded}function draw(e,a,t){var l,p,h,M,x,y,P,b,w,C,D;const L=s(t);if(!t.local.modelLoaded)return;if(!L.renderer||!L.renderer.getContext()||L.renderer.getContext().isContextLost())return console.warn(\\\"Three.js renderer context lost, reinitializing...\\\"),void(t.local.initialized=!1);const T=e.canvas?e.canvas.width:e.drawingBufferWidth,I=e.canvas?e.canvas.height:e.drawingBufferHeight;if(0===T||0===I)return;const S=c(t),A=\\\"glass\\\"===S,E=\\\"standard\\\"===S;if(L.animationMixer)if(m(t,L),null==L.lastAnimationTime)L.lastAnimationTime=a;else{const e=Math.max(0,.001*(a-L.lastAnimationTime));L.animationMixer.update(e),L.lastAnimationTime=a}u(L,t,S);const R=t.getProp(\\\"environmentMapIntensity\\\");if(R>0&&!(null==(l=t.environmentMapUrl)?void 0:l.trim())&&\\\"matcap\\\"!==S){const e=t.local.envTexture,a=(null==(p=L.model)?void 0:p.userData.lastEnvMapIntensity)!==R;!e||!a&&L.envMap||function(e,a,t,n,r,o){var i,l,s;if(t&&a)if(e.envMap)e.model.userData.lastEnvMapIntensity!==o&&(null==(s=e.model.userData.materials)||s.forEach(e=>{(e.isMeshStandardMaterial||e.isMeshPhysicalMaterial)&&(e.envMapIntensity=o)}),e.model.userData.lastEnvMapIntensity=o);else{e.envMap=new THREE.Texture,e.envMap.mapping=THREE.EquirectangularReflectionMapping,e.envMap.colorSpace=THREE.SRGBColorSpace,e.envMap.minFilter=THREE.LinearFilter,e.envMap.magFilter=THREE.LinearFilter,e.envMap.generateMipmaps=!1,e.envMap.flipY=!1,e.envMap.image={width:n,height:r};const a=e.renderer.properties.get(e.envMap);a.__webglTexture=t,a.__webglInit=!0;const i=e.renderer.info.memory;i&&i.textures++,f(e,e.envMap,o,!0)}else null==(l=null==(i=e.model)?void 0:i.userData.materials)||l.forEach(e=>{e.envMap&&(e.envMap=null,e.needsUpdate=!0)})}(L,e.gl,e.webglTexture,e.width,e.height,R)}let z=0,U=0,k=0,B=0,F=0,V=0,O=0,_=0;const W=t.getProp(\\\"trackMouse\\\"),N=t.getProp(\\\"rotationTracking\\\"),G=t.getProp(\\\"lightTracking\\\");if(0!=W||0!=N||0!=G){const e=t.local.mouse||{x:.5,y:.5},a=e.x-.5,n=e.y-.5;O=a,_=n,0!=W&&(z=a*W,U=-n*W),0!=N&&(k=-n*N,B=a*N),0!=G&&(F=a*G,V=-n*G)}L.camera.userData.dim||(L.camera.userData.dim={}),L.camera.userData.dim.w===T&&L.camera.userData.dim.h===I||(L.camera.aspect=T/I,L.camera.updateProjectionMatrix(),L.renderer.setSize(T,I,!1),L.camera.userData.dim={w:T,h:I});const j=L.scene.userData.lp=L.scene.userData.lp||{};if(E){const e=t.getProp(\\\"ambientLightIntensity\\\"),a=t.getProp(\\\"ambientLightColor\\\"),n=t.getProp(\\\"lightIntensity\\\"),r=t.getProp(\\\"lightColor\\\"),o=t.getProp(\\\"fillLightIntensity\\\"),i=t.getProp(\\\"fillLightColor\\\");!L.ambientLight||j.ai===e&&j.ac===a||(j.ai!==e&&(L.ambientLight.intensity=2*(e??.75)),j.ac!==a&&L.ambientLight.color.set(a||\\\"#777777\\\"),j.ai=e,j.ac=a),!L.directionalLight||j.li===n&&j.lc===r||(L.directionalLight.intensity=5*(n??.2)*2,L.directionalLight.color.set(r||\\\"#777777\\\"),j.li=n,j.lc=r),!L.fillLight||j.fli===o&&j.flc===i||(L.fillLight.intensity=5*(o??.2)*2,L.fillLight.color.set(i||\\\"#777777\\\"),j.fli=o,j.flc=i);const l=t.getProp(\\\"lightPosition\\\"),s=0!=G;if(L.directionalLight&&l&&(s||j.lx!==l.x||j.ly!==l.y||j.lz!==l.z)){const e=10*(l.x+F-.5),a=10*(l.y+V-.5),t=10*(l.z-.5);L.directionalLight.position.set(e,-a,t),L.fillLight.position.set(.8*-e,.8*a,.8*-t),s||(j.lx=l.x,j.ly=l.y,j.lz=l.z)}}if(L.model){const e=L.model.userData.mp=L.model.userData.mp||{};if(E){const a=t.getProp(\\\"materialMetalness\\\"),n=t.getProp(\\\"materialRoughness\\\");e.mm===a&&e.mr===n||(null==(h=L.model.userData.materials)||h.forEach(t=>{e.mm!==a&&void 0!==t.metalness&&(t.metalnessMap&&(t.metalnessMap=null,t.needsUpdate=!0),t.metalness=a),e.mr!==n&&void 0!==t.roughness&&(t.roughnessMap&&(t.roughnessMap=null,t.needsUpdate=!0),t.roughness=n)}),e.mm=a,e.mr=n);const r=t.getProp(\\\"colorMapScale\\\"),o=t.getProp(\\\"colorMapPosition\\\"),i=t.getProp(\\\"colorMapIntensity\\\");if(L.customColorMap&&(e.cms!==r||e.cmpx!==(null==o?void 0:o.x)||e.cmpy!==(null==o?void 0:o.y)||e.cmi!==i)){const a=Math.max(.001,r);L.customColorMap.repeat.setScalar(a);const t=-(a-1)/2,n=((null==o?void 0:o.x)??.5)-.5,l=((null==o?void 0:o.y)??.5)-.5;L.customColorMap.offset.set(t+n,t+l);const s=i??1;null==(M=L.model.userData.materials)||M.forEach(e=>{(e.isMeshStandardMaterial||e.isMeshPhongMaterial||e.isMeshLambertMaterial)&&(e.color&&e.color.setScalar(s),e.needsUpdate=!0)}),e.cms=r,e.cmpx=null==o?void 0:o.x,e.cmpy=null==o?void 0:o.y,e.cmi=i}const l=t.getProp(\\\"normalMapScale\\\"),s=t.getProp(\\\"normalMapPosition\\\"),m=t.getProp(\\\"normalMapIntensity\\\");if(L.customNormalMap&&(e.nms!==l||e.nmpx!==(null==s?void 0:s.x)||e.nmpy!==(null==s?void 0:s.y)||e.nmi!==m)){const a=Math.max(.001,l);L.customNormalMap.repeat.setScalar(a);const t=-(a-1)/2,n=((null==s?void 0:s.x)??.5)-.5,r=((null==s?void 0:s.y)??.5)-.5;L.customNormalMap.offset.set(t+n,t+r);const o=m??1;null==(x=L.model.userData.materials)||x.forEach(e=>{void 0!==e.normalMap&&e.normalScale&&(e.normalScale.set(o,-o),e.needsUpdate=!0)}),e.nms=l,e.nmpx=null==s?void 0:s.x,e.nmpy=null==s?void 0:s.y,e.nmi=m}const c=t.getProp(\\\"environmentMapIntensity\\\");L.customEnvMap&&e.emi!==c&&(f(L,L.customEnvMap,c),e.emi=c)}const i=L.model.userData.baseScale||1,l=t.getProp(\\\"pos\\\"),s=t.getProp(\\\"scale\\\");if(e.s!==s){const a=10*s*i;L.model.scale.set(a,a,a),e.s=s}const m=0!==z||0!==U;if(l&&(m||e.px!==l.x||e.py!==l.y||e.pz!==l.z)){const a=8*(l.x-.5+z),t=8*(l.y-.5+U),n=8*(l.z-.5);L.model.position.set(a,-t,n),m||(e.px=l.x,e.py=l.y,e.pz=l.z)}const c=t.getProp(\\\"modelRotation\\\"),u=t.getProp(\\\"speed\\\"),p=t.getProp(\\\"animationAxis\\\"),P=0!==k||0!==B,b=u>0&&t.animating,w=void 0!==e.wasAnimating&&e.wasAnimating!==b;if(e.wasAnimating=b,c&&(P||b||w||e.rx!==c.x||e.ry!==c.y||e.rz!==c.z)){let t=(c.y-.5+k)*Math.PI*2+Math.PI,i=L.model.userData.isSVGWrapper?Math.PI:0,l=(c.x-.5+B)*Math.PI*2+i,s=(c.z-.5)*Math.PI*2;if(b){o.set(t,l,s),n.setFromEuler(o);const e=u*a*.001,i=p.x>0?e*p.x:0,m=p.y>0?e*p.y:0,c=p.z>0?e*p.z:0;o.set(i,m,c),r.setFromEuler(o),n.multiply(r),L.model.quaternion.copy(n)}else L.model.rotation.set(t,l,s);P||b||(e.rx=c.x,e.ry=c.y,e.rz=c.z)}e.mode!==S&&(v(t,L),e.mode=S),e.mcu!==t.matcapUrl&&((null==(y=t.matcapUrl)?void 0:y.trim())?d(t.matcapUrl).then(e=>{L.matcapTexture&&L.matcapTexture.dispose(),L.matcapTexture=e,g(t,L)}):(L.matcapTexture&&(L.matcapTexture.dispose(),L.matcapTexture=null),g(t,L)),e.mcu=t.matcapUrl);const C=t.getProp(\\\"matcapIntensity\\\")??.5,D=t.getProp(\\\"matcapRotation\\\")??0;let R=D;if(\\\"matcap\\\"===S&&0!==G){const a=Math.min(1,Math.abs(G)),t=Math.atan2(-_,O);if(void 0!==e._prevMouseAngle){let a=t-e._prevMouseAngle;a>Math.PI&&(a-=2*Math.PI),a<-Math.PI&&(a+=2*Math.PI),e._continuousAngle+=a}else e._continuousAngle=t;e._prevMouseAngle=t,R=D+e._continuousAngle/(2*Math.PI)*a,R=(R%1+1)%1}if(e.mci===C&&e.mcr===D&&e.mtr===R&&e.mlt===G||(g(t,L,R),e.mci=C,e.mcr=D,e.mtr=R,e.mlt=G),A&&L.glassMaterial){const a=t.local.backgroundTexture;a&&(function(e,a,t,n){if(a&&a.webglTexture)if(e.backgroundTexture){const r=e.renderer.properties.get(e.backgroundTexture);r.__webglTexture!==a.webglTexture&&(r.__webglTexture=a.webglTexture),e.backgroundTexture.image.width===t&&e.backgroundTexture.image.height===n||(e.backgroundTexture.image={width:t,height:n})}else{e.backgroundTexture=new THREE.Texture,e.backgroundTexture.minFilter=THREE.LinearFilter,e.backgroundTexture.magFilter=THREE.LinearFilter,e.backgroundTexture.wrapS=THREE.ClampToEdgeWrapping,e.backgroundTexture.wrapT=THREE.ClampToEdgeWrapping,e.backgroundTexture.generateMipmaps=!1,e.backgroundTexture.flipY=!1,e.backgroundTexture.image={width:t,height:n};const r=e.renderer.properties.get(e.backgroundTexture);r.__webglTexture=a.webglTexture,r.__webglInit=!0}}(L,a,a.width,a.height),L.glassMaterial.uniforms.uBackgroundTexture.value=L.backgroundTexture,L.glassMaterial.uniforms.uResolution.value.set(T,I)),L.glassMaterial.uniforms.uCameraPosition.value.copy(L.camera.position);const n=t.getProp(\\\"glassIOR\\\")??1.5,r=t.getProp(\\\"glassThickness\\\")??.5,o=t.getProp(\\\"glassRoughness\\\")??0,i=t.getProp(\\\"glassTint\\\")||\\\"#ffffff\\\",l=t.getProp(\\\"glassDispersion\\\")??0;e.gior!==n&&(L.glassMaterial.uniforms.uIOR.value=n,e.gior=n),e.gth!==r&&(L.glassMaterial.uniforms.uThickness.value=r,e.gth=r),e.gbl!==o&&(L.glassMaterial.uniforms.uBlur.value=o,e.gbl=o),e.gti!==i&&(L.glassMaterial.uniforms.uTint.value.set(i),e.gti=i),e.gdi!==l&&(L.glassMaterial.uniforms.uDispersion.value=l,e.gdi=l);const s=t.getProp(\\\"lightPosition\\\"),m=t.getProp(\\\"materialMetalness\\\")??.5,c=t.getProp(\\\"materialRoughness\\\")??.5,u=t.getProp(\\\"lightIntensity\\\")??.2,p=t.getProp(\\\"ambientLightIntensity\\\")??.75;!s||e.glpx===s.x&&e.glpy===s.y&&e.glpz===s.z||(L.glassMaterial.uniforms.uLightPosition.value.set(s.x,s.y,s.z),e.glpx=s.x,e.glpy=s.y,e.glpz=s.z),e.gmet!==m&&(L.glassMaterial.uniforms.uMetalness.value=m,e.gmet=m),e.gmro!==c&&(L.glassMaterial.uniforms.uRoughness.value=c,e.gmro=c),e.gli!==u&&(L.glassMaterial.uniforms.uLightIntensity.value=u,e.gli=u),e.gai!==p&&(L.glassMaterial.uniforms.uAmbientLightIntensity.value=p,e.gai=p);const d=t.getProp(\\\"environmentMapIntensity\\\")??0;e.gemi!==d&&(L.glassMaterial.uniforms.uEnvMapIntensity.value=d,e.gemi=d),d>0&&(L.customEnvMap?L.glassMaterial.uniforms.uEnvMap.value=L.customEnvMap:L.envMap&&(L.glassMaterial.uniforms.uEnvMap.value=L.envMap))}}if(((null==(b=null==(P=t.states)?void 0:P.hover)?void 0:b.some(e=>e.triggerOnElement))||(null==(D=null==(C=null==(w=t.local.hostLayer)?void 0:w.states)?void 0:C.hover)?void 0:D.some(e=>e.triggerOnElement)))&&L.model&&(L.model.userData.localBoxCorners||function(e){const a=e.model.children[0];if(!a)return;const t=e.model.rotation.clone(),n=e.model.position.clone(),r=e.model.scale.clone();e.model.rotation.set(0,0,0),e.model.position.set(0,0,0),e.model.scale.set(1,1,1),e.model.updateMatrixWorld(!0);const o=(new THREE.Box3).setFromObject(a);e.model.userData.localBoxCorners=[new THREE.Vector3(o.min.x,o.min.y,o.max.z),new THREE.Vector3(o.max.x,o.min.y,o.max.z),new THREE.Vector3(o.max.x,o.min.y,o.min.z),new THREE.Vector3(o.min.x,o.min.y,o.min.z),new THREE.Vector3(o.min.x,o.max.y,o.max.z),new THREE.Vector3(o.max.x,o.max.y,o.max.z),new THREE.Vector3(o.max.x,o.max.y,o.min.z),new THREE.Vector3(o.min.x,o.max.y,o.min.z)],e.model.rotation.copy(t),e.model.position.copy(n),e.model.scale.copy(r),e.model.updateMatrixWorld(!0)}(L),L.model.userData.localBoxCorners)){L.model.updateMatrixWorld(!0);let e=1/0,a=1/0,n=-1/0,r=-1/0;L.model.userData.localBoxCorners.forEach(t=>{i.copy(t).applyMatrix4(L.model.matrixWorld),i.project(L.camera);const o=(i.x+1)/2,l=-(i.y-1)/2;e=Math.min(e,o),a=Math.min(a,l),n=Math.max(n,o),r=Math.max(r,l)}),t.local.boundingBox={min:{x:e,y:a},max:{x:n,y:r}}}L.renderer.render(L.scene,L.camera),L.renderer.resetState&&L.renderer.resetState()}function dispose(e){var a,t;const n=s(e);if(n.animationMixer&&(n.animationMixer.stopAllAction(),n.animationMixer=null),n.animationClips=null,n.activeAnimationClip=null,n.lastAnimationTime=null,e.local.animationClipOptions=[],n.customColorMap&&(n.customColorMap.dispose(),n.customColorMap=null),n.customNormalMap&&(n.customNormalMap.dispose(),n.customNormalMap=null),n.customEnvMap&&(n.customEnvMap.dispose(),n.customEnvMap=null),n.envMap&&(n.envMap.dispose(),n.envMap=null),n.glassMaterial&&(n.glassMaterial.dispose(),n.glassMaterial=null),n.matcapMaterial&&(n.matcapMaterial.dispose(),n.matcapMaterial=null),n.matcapTexture&&(n.matcapTexture.dispose(),n.matcapTexture=null),n.backgroundTexture){const e=null==(t=null==(a=n.renderer)?void 0:a.properties)?void 0:t.get(n.backgroundTexture);e&&(e.__webglTexture=null),n.backgroundTexture.dispose(),n.backgroundTexture=null}n.model&&(n.model.traverse(e=>{e.isMesh&&(e.geometry&&e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(e=>e.dispose()):e.material&&e.material.dispose())}),n.scene&&n.scene.remove(n.model),n.model=null),n.renderer&&(n.renderer.dispose(),n.renderer=null),n.scene=null,n.camera=null,n.ambientLight=null,n.directionalLight=null,n.fillLight=null,l.delete(e)}export{dispose,draw,initialize,isLoading,loadModel};\\n\"\n    },\n    {\n      \"id\": \"three-bundle\",\n      \"relativePath\": \"extensions/three-bundle.js\",\n      \"content\": \"/**\\n * @license\\n * Copyright 2010-2025 Three.js Authors\\n * SPDX-License-Identifier: MIT\\n */\\nfunction t(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function e(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function n(t){return document.createElementNS(\\\"http://www.w3.org/1999/xhtml\\\",t)}function i(){const t=n(\\\"canvas\\\");return t.style.display=\\\"block\\\",t}function r(...t){t.shift()}function s(...t){t.shift()}function a(...t){t.shift()}function o(...t){const e=t.join(\\\" \\\");e in xl||(xl[e]=!0,s(...t))}function l(t,e,n){return new Promise(function(i,r){setTimeout(function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}},n)})}function c(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Ml[255&t]+Ml[t>>8&255]+Ml[t>>16&255]+Ml[t>>24&255]+\\\"-\\\"+Ml[255&e]+Ml[e>>8&255]+\\\"-\\\"+Ml[e>>16&15|64]+Ml[e>>24&255]+\\\"-\\\"+Ml[63&n|128]+Ml[n>>8&255]+\\\"-\\\"+Ml[n>>16&255]+Ml[n>>24&255]+Ml[255&i]+Ml[i>>8&255]+Ml[i>>16&255]+Ml[i>>24&255]).toLowerCase()}function h(t,e,n){return Math.max(e,Math.min(n,t))}function u(t,e){return(t%e+e)%e}function d(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)}function p(t,e,n){return t!==e?(n-t)/(e-t):0}function f(t,e,n){return(1-n)*t+n*e}function m(t,e,n,i){return f(t,e,1-Math.exp(-n*i))}function g(t,e=1){return e-Math.abs(u(t,2*e)-e)}function _(t,e,n){return t>e?n>t?(t=(t-e)/(n-e))*t*(3-2*t):1:0}function v(t,e,n){return t>e?n>t?(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10):1:0}function x(t,e){return t+Math.floor(Math.random()*(e-t+1))}function y(t,e){return t+Math.random()*(e-t)}function M(t){return t*(.5-Math.random())}function S(t){void 0!==t&&(Sl=t);let e=Sl+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function T(t){return t*Tl}function b(t){return t*bl}function E(t){return!(t&t-1)&&0!==t}function A(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function w(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function R(t,e,n,i,r){const a=Math.cos,o=Math.sin,l=a(n/2),c=o(n/2),h=a((e+i)/2),u=o((e+i)/2),d=a((e-i)/2),p=o((e-i)/2),f=a((i-e)/2),m=o((i-e)/2);switch(r){case\\\"XYX\\\":t.set(l*u,c*d,c*p,l*h);break;case\\\"YZY\\\":t.set(c*p,l*u,c*d,l*h);break;case\\\"ZXZ\\\":t.set(c*d,c*p,l*u,l*h);break;case\\\"XZX\\\":t.set(l*u,c*m,c*f,l*h);break;case\\\"YXY\\\":t.set(c*f,l*u,c*m,l*h);break;case\\\"ZYZ\\\":t.set(c*m,c*f,l*u,l*h);break;default:s(\\\"MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: \\\"+r)}}function C(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error(\\\"Invalid component type.\\\")}}function P(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error(\\\"Invalid component type.\\\")}}function I(){const t={enabled:!0,workingColorSpace:nl,spaces:{},convert:function(t,e,n){return!1!==this.enabled&&e!==n&&e&&n?(this.spaces[e].transfer===rl&&(t.r=L(t.r),t.g=L(t.g),t.b=L(t.b)),this.spaces[e].primaries!==this.spaces[n].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===rl&&(t.r=N(t.r),t.g=N(t.g),t.b=N(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===tl?il:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||\\\"standard\\\"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,n){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,n){return o(\\\"ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().\\\"),t.workingToColorSpace(e,n)},toWorkingColorSpace:function(e,n){return o(\\\"ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().\\\"),t.colorSpaceToWorking(e,n)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[nl]:{primaries:e,whitePoint:i,transfer:il,toXYZ:Nl,fromXYZ:Ul,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:el},outputColorSpaceConfig:{drawingBufferColorSpace:el}},[el]:{primaries:e,whitePoint:i,transfer:rl,toXYZ:Nl,fromXYZ:Ul,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:el}}}),t}function L(t){return.04045>t?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function N(t){return.0031308>t?12.92*t:1.055*Math.pow(t,.41666)-.055}function U(t){return\\\"undefined\\\"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||\\\"undefined\\\"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||\\\"undefined\\\"!=typeof ImageBitmap&&t instanceof ImageBitmap?Fl.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(s(\\\"Texture: Unable to serialize Texture.\\\"),{})}function D(t,e,n,i,r){for(let s=0,a=t.length-3;a>=s;s+=3){oc.fromArray(t,s);const a=r.x*Math.abs(oc.x)+r.y*Math.abs(oc.y)+r.z*Math.abs(oc.z),o=e.dot(oc),l=n.dot(oc),c=i.dot(oc);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}function O(t,e,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(e-t)*n:.5>n?e:2/3>n?t+6*(e-t)*(2/3-n):t}function F(t,e,n,i,r,s,a,o){let l;if(l=1===e.side?i.intersectTriangle(a,s,r,!0,o):i.intersectTriangle(r,s,a,0===e.side,o),null===l)return null;Vh.copy(o),Vh.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Vh);return c<n.near||c>n.far?null:{distance:c,point:Vh.clone(),object:t}}function B(t,e,n,i,r,s,a,o,l,c){t.getVertexPosition(o,Dh),t.getVertexPosition(l,Oh),t.getVertexPosition(c,Fh);const h=F(t,e,n,i,Dh,Oh,Fh,kh);if(h){const t=new Rl;oh.getBarycoord(kh,Dh,Oh,Fh,t),r&&(h.uv=oh.getInterpolatedAttribute(r,o,l,c,t,new Al)),s&&(h.uv1=oh.getInterpolatedAttribute(s,o,l,c,t,new Al)),a&&(h.normal=oh.getInterpolatedAttribute(a,o,l,c,t,new Rl),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:o,b:l,c:c,normal:new Rl,materialIndex:0};oh.getNormal(Dh,Oh,Fh,e.normal),h.face=e,h.barycoord=t}return h}function z(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(s(\\\"UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().\\\"),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function k(t){const e={};for(let n=0;n<t.length;n++){const i=z(t[n]);for(const t in i)e[t]=i[t]}return e}function V(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function H(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Dl.workingColorSpace}function G(t,e,n,i,r,s,a){const o=t.geometry.attributes.position;if(Hu.fromBufferAttribute(o,r),Gu.fromBufferAttribute(o,s),n.distanceSqToSegment(Hu,Gu,qu,Yu)>i)return;qu.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(qu);return l<e.near||l>e.far?void 0:{distance:l,point:Yu.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}function W(t,e,n,i,r,s,a){const o=nd.distanceSqToPoint(t);if(n>o){const n=new Rl;nd.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}function X(){function t(t,s,a,o){e=t,n=a,i=-3*t+3*s-2*a-o,r=2*t-2*s+a+o}let e=0,n=0,i=0,r=0;return{initCatmullRom:function(e,n,i,r,s){t(n,i,s*(i-e),s*(r-n))},initNonuniformCatmullRom:function(e,n,i,r,s,a,o){let l=(n-e)/s-(i-e)/(s+a)+(i-n)/a,c=(i-n)/a-(r-n)/(a+o)+(r-i)/o;l*=a,c*=a,t(n,i,l,c)},calc:function(t){const s=t*t;return e+n*t+i*s+r*(s*t)}}}function j(t,e,n,i,r){const s=.5*(i-e),a=.5*(r-n),o=t*t;return(2*n-2*i+s+a)*(t*o)+(-3*n+3*i-2*s-a)*o+s*t+n}function q(t,e){const n=1-t;return n*n*e}function Y(t,e){return 2*(1-t)*t*e}function K(t,e){return t*t*e}function J(t,e,n,i){return q(t,e)+Y(t,n)+K(t,i)}function Z(t,e){const n=1-t;return n*n*n*e}function $(t,e){const n=1-t;return 3*n*n*t*e}function Q(t,e){return 3*(1-t)*t*t*e}function tt(t,e){return t*t*t*e}function et(t,e,n,i,r){return Z(t,e)+$(t,n)+Q(t,i)+tt(t,r)}function nt(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let s=it(t,0,r,n,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(i&&(s=ht(t,e,s,n)),t.length>80*n){o=t[0],l=t[1];let e=o,i=l;for(let s=n;r>s;s+=n){const n=t[s],r=t[s+1];o>n&&(o=n),l>r&&(l=r),n>e&&(e=n),r>i&&(i=r)}c=Math.max(e-o,i-l),c=0!==c?32767/c:0}return st(s,a,n,o,l,c,0),a}function it(t,e,n,i,r){let s;if(r===Ut(t,e,n,i)>0)for(let r=e;n>r;r+=i)s=It(r/i|0,t[r],t[r+1],s);else for(let r=n-i;r>=e;r-=i)s=It(r/i|0,t[r],t[r+1],s);return s&&Tt(s,s.next)&&(Lt(s),s=s.next),s}function rt(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Tt(i,i.next)&&0!==St(i.prev,i,i.next))i=i.next;else{if(Lt(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function st(t,e,n,i,r,s,a){if(!t)return;!a&&s&&mt(t,i,r,s);let o=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?ot(t,i,r,s):at(t))e.push(l.i,t.i,c.i),Lt(t),t=c.next,o=c.next;else if((t=c)===o){a?1===a?st(t=lt(rt(t),e),e,n,i,r,s,2):2===a&&ct(t,e,n,i,r,s):st(rt(t),e,n,i,r,s,1);break}}}function at(t){const e=t.prev,n=t,i=t.next;if(St(e,n,i)>=0)return!1;const r=e.x,s=n.x,a=i.x,o=e.y,l=n.y,c=i.y,h=Math.min(r,s,a),u=Math.min(o,l,c),d=Math.max(r,s,a),p=Math.max(o,l,c);let f=i.next;for(;f!==e;){if(f.x>=h&&f.x<=d&&f.y>=u&&f.y<=p&&yt(r,o,s,l,a,c,f.x,f.y)&&St(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ot(t,e,n,i){const r=t.prev,s=t,a=t.next;if(St(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,h=r.y,u=s.y,d=a.y,p=Math.min(o,l,c),f=Math.min(h,u,d),m=Math.max(o,l,c),g=Math.max(h,u,d),_=_t(p,f,e,n,i),v=_t(m,g,e,n,i);let x=t.prevZ,y=t.nextZ;for(;x&&x.z>=_&&y&&y.z<=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&yt(o,h,l,u,c,d,x.x,x.y)&&St(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&yt(o,h,l,u,c,d,y.x,y.y)&&St(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;x&&x.z>=_;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&yt(o,h,l,u,c,d,x.x,x.y)&&St(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=v;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&yt(o,h,l,u,c,d,y.x,y.y)&&St(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function lt(t,e){let n=t;do{const i=n.prev,r=n.next.next;!Tt(i,r)&&bt(i,n,n.next,r)&&Rt(i,r)&&Rt(r,i)&&(e.push(i.i,n.i,r.i),Lt(n),Lt(n.next),n=t=r),n=n.next}while(n!==t);return rt(n)}function ct(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Mt(a,t)){let o=Pt(a,t);return a=rt(a,a.next),o=rt(o,o.next),st(a,e,n,i,r,s,0),void st(o,e,n,i,r,s,0)}t=t.next}a=a.next}while(a!==t)}function ht(t,e,n,i){const r=[];for(let n=0,s=e.length;s>n;n++){const a=it(t,e[n]*i,s-1>n?e[n+1]*i:t.length,i,!1);a===a.next&&(a.steiner=!0),r.push(vt(a))}r.sort(ut);for(let t=0;t<r.length;t++)n=dt(r[t],n);return n}function ut(t,e){let n=t.x-e.x;return 0===n&&(n=t.y-e.y,0===n)&&(n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),n}function dt(t,e){const n=pt(t,e);if(!n)return e;const i=Pt(n,t);return rt(i,i.next),rt(n,n.next)}function pt(t,e){let n=e;const i=t.x,r=t.y;let s,a=-1/0;if(Tt(t,n))return n;do{if(Tt(t,n.next))return n.next;if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(i>=t&&t>a&&(a=t,s=n.x<n.next.x?n:n.next,t===i))return s}n=n.next}while(n!==e);if(!s)return null;const o=s,l=s.x,c=s.y;let h=1/0;n=s;do{if(i>=n.x&&n.x>=l&&i!==n.x&&xt(c>r?i:a,r,l,c,c>r?a:i,r,n.x,n.y)){const e=Math.abs(r-n.y)/(i-n.x);Rt(n,t)&&(h>e||e===h&&(n.x>s.x||n.x===s.x&&ft(s,n)))&&(s=n,h=e)}n=n.next}while(n!==o);return s}function ft(t,e){return 0>St(t.prev,t,e.prev)&&0>St(e.next,t,t.next)}function mt(t,e,n,i){let r=t;do{0===r.z&&(r.z=_t(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,gt(r)}function gt(t){let e,n=1;do{let i,r=t;t=null;let s=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;n>t&&(o++,a=a.nextZ,a);t++);let l=n;for(;o>0||l>0&&a;)0===o||0!==l&&a&&r.z>a.z?(i=a,a=a.nextZ,l--):(i=r,r=r.nextZ,o--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=a}s.nextZ=null,n*=2}while(e>1);return t}function _t(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vt(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function xt(t,e,n,i,r,s,a,o){return(r-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(i-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(r-a)*(i-o)}function yt(t,e,n,i,r,s,a,o){return!(t===a&&e===o)&&xt(t,e,n,i,r,s,a,o)}function Mt(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!wt(t,e)&&(Rt(t,e)&&Rt(e,t)&&Ct(t,e)&&(St(t.prev,t,e.prev)||St(t,e.prev,e))||Tt(t,e)&&St(t.prev,t,t.next)>0&&St(e.prev,e,e.next)>0)}function St(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Tt(t,e){return t.x===e.x&&t.y===e.y}function bt(t,e,n,i){const r=At(St(t,e,n)),s=At(St(t,e,i)),a=At(St(n,i,t)),o=At(St(n,i,e));return r!==s&&a!==o||!(0!==r||!Et(t,n,e))||!(0!==s||!Et(t,i,e))||!(0!==a||!Et(n,t,i))||!(0!==o||!Et(n,e,i))}function Et(t,e,n){return!(e.x>Math.max(t.x,n.x)||e.x<Math.min(t.x,n.x)||e.y>Math.max(t.y,n.y)||e.y<Math.min(t.y,n.y))}function At(t){return t>0?1:0>t?-1:0}function wt(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&bt(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Rt(t,e){return 0>St(t.prev,t,t.next)?St(t,e,t.next)>=0&&St(t,t.prev,e)>=0:0>St(t,e,t.prev)||0>St(t,t.next,e)}function Ct(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}function Pt(t,e){const n=Nt(t.i,t.x,t.y),i=Nt(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function It(t,e,n,i){const r=Nt(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Lt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Nt(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ut(t,e,n,i){let r=0;for(let s=e,a=n-i;n>s;s+=i)r+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return r}function Dt(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Ot(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}function Ft(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;i>e;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}function Bt(t,e){return t&&t.constructor!==e?\\\"number\\\"==typeof e.BYTES_PER_ELEMENT?new e(t):[].slice.call(t):t}function zt(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort(function(e,n){return t[e]-t[n]}),n}function kt(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r}function Vt(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push(...a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)}function Ht(t){switch(t.toLowerCase()){case\\\"scalar\\\":case\\\"double\\\":case\\\"float\\\":case\\\"number\\\":case\\\"integer\\\":return Yd;case\\\"vector\\\":case\\\"vector2\\\":case\\\"vector3\\\":case\\\"vector4\\\":return $d;case\\\"color\\\":return qd;case\\\"quaternion\\\":return Jd;case\\\"bool\\\":case\\\"boolean\\\":return jd;case\\\"string\\\":return Zd}throw new Error(\\\"THREE.KeyframeTrack: Unsupported typeName: \\\"+t)}function Gt(t){if(void 0===t.type)throw new Error(\\\"THREE.KeyframeTrack: track type undefined, can not parse\\\");const e=Ht(t.type);if(void 0===t.times){const e=[],n=[];Vt(t.keys,e,n,\\\"value\\\"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function Wt(t,e,n,i){const r=Xt(i);switch(n){case Wa:return t*e;case Ka:case Ja:return t*e/r.components*r.byteLength;case Za:case $a:return t*e*2/r.components*r.byteLength;case Xa:return t*e*3/r.components*r.byteLength;case ja:case Qa:return t*e*4/r.components*r.byteLength;case to:case eo:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case no:case io:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case so:case oo:return Math.max(t,16)*Math.max(e,8)/4;case ro:case ao:return Math.max(t,8)*Math.max(e,8)/2;case lo:case co:case uo:case po:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case ho:case fo:case mo:case go:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case _o:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case vo:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case xo:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case yo:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Mo:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case So:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case To:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case bo:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Eo:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Ao:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case wo:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case Ro:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case Co:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Po:case Io:case Lo:return Math.ceil(t/4)*Math.ceil(e/4)*16;case No:case Uo:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Do:case Oo:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Xt(t){switch(t){case Ia:case La:return{byteLength:1,components:1};case Ua:case Na:case Ba:return{byteLength:2,components:1};case za:case ka:return{byteLength:2,components:4};case Oa:case Da:case Fa:return{byteLength:4,components:1};case Ha:case Ga:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}\\n/**\\n* @license\\n* Copyright 2010-2025 Three.js Authors\\n* SPDX-License-Identifier: MIT\\n*/\\nfunction jt(){function t(n,s){i(n,s),r=e.requestAnimationFrame(t)}let e=null,n=!1,i=null,r=null;return{start:function(){!0!==n&&null!==i&&(r=e.requestAnimationFrame(t),n=!0)},stop:function(){e.cancelAnimationFrame(r),n=!1},setAnimationLoop:function(t){i=t},setContext:function(t){e=t}}}function qt(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const t=e.get(n);return void(t&&t.version>=n.version||e.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=e.get(n);if(void 0===r)e.set(n,function(e,n){const i=e.array,r=e.usage,s=i.byteLength,a=t.createBuffer();let o;if(t.bindBuffer(n,a),t.bufferData(n,i,r),e.onUploadCallback(),i instanceof Float32Array)o=t.FLOAT;else if(\\\"undefined\\\"!=typeof Float16Array&&i instanceof Float16Array)o=t.HALF_FLOAT;else if(i instanceof Uint16Array)o=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(i instanceof Int16Array)o=t.SHORT;else if(i instanceof Uint32Array)o=t.UNSIGNED_INT;else if(i instanceof Int32Array)o=t.INT;else if(i instanceof Int8Array)o=t.BYTE;else if(i instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error(\\\"THREE.WebGLAttributes: Unsupported buffer data format: \\\"+i);o=t.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error(\\\"THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.\\\");!function(e,n,i){const r=n.array,s=n.updateRanges;if(t.bindBuffer(i,e),0===s.length)t.bufferSubData(i,0,r);else{s.sort((t,e)=>t.start-e.start);let e=0;for(let t=1;t<s.length;t++){const n=s[e],i=s[t];i.start>n.start+n.count+1?(++e,s[e]=i):n.count=Math.max(n.count,i.start+i.count-n.start)}s.length=e+1;for(let e=0,n=s.length;n>e;e++){const n=s[e];t.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}function Yt(t,e,n,i,r,s,a){function o(t){let i=!0===t.isScene?t.background:null;return i&&i.isTexture&&(i=(t.backgroundBlurriness>0?n:e).get(i)),i}function l(e,n){e.getRGB(Pf,H(t)),i.buffers.color.setClear(Pf.r,Pf.g,Pf.b,n,a)}const c=new uh(0);let h,u,d=!0===s?0:1,p=null,f=0,m=null;return{getClearColor:function(){return c},setClearColor:function(t,e=1){c.set(t),d=e,l(c,d)},getClearAlpha:function(){return d},setClearAlpha:function(t){d=t,l(c,d)},render:function(e){let n=!1;const r=o(e);null===r?l(c,d):r&&r.isColor&&(l(r,1),n=!0);const s=t.xr.getEnvironmentBlendMode();\\\"additive\\\"===s?i.buffers.color.setClear(0,0,0,1,a):\\\"alpha-blend\\\"===s&&i.buffers.color.setClear(0,0,0,0,a),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,n){const i=o(n);i&&(i.isCubeTexture||i.mapping===Ma)?(void 0===u&&(u=new Hh(new Gh(1,1,1),new Xh({name:\\\"BackgroundCubeMaterial\\\",uniforms:z(Cf.backgroundCube.uniforms),vertexShader:Cf.backgroundCube.vertexShader,fragmentShader:Cf.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(\\\"normal\\\"),u.geometry.deleteAttribute(\\\"uv\\\"),u.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,\\\"envMap\\\",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),If.copy(n.backgroundRotation),If.x*=-1,If.y*=-1,If.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(If.y*=-1,If.z*=-1),u.material.uniforms.envMap.value=i,u.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Lf.makeRotationFromEuler(If)),u.material.toneMapped=Dl.getTransfer(i.colorSpace)!==rl,p===i&&f===i.version&&m===t.toneMapping||(u.material.needsUpdate=!0,p=i,f=i.version,m=t.toneMapping),u.layers.enableAll(),e.unshift(u,u.geometry,u.material,0,0,null)):i&&i.isTexture&&(void 0===h&&(h=new Hh(new Id(2,2),new Xh({name:\\\"BackgroundMaterial\\\",uniforms:z(Cf.background.uniforms),vertexShader:Cf.background.vertexShader,fragmentShader:Cf.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute(\\\"normal\\\"),Object.defineProperty(h.material,\\\"map\\\",{get:function(){return this.uniforms.t2D.value}}),r.update(h)),h.material.uniforms.t2D.value=i,h.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,h.material.toneMapped=Dl.getTransfer(i.colorSpace)!==rl,!0===i.matrixAutoUpdate&&i.updateMatrix(),h.material.uniforms.uvTransform.value.copy(i.matrix),p===i&&f===i.version&&m===t.toneMapping||(h.material.needsUpdate=!0,p=i,f=i.version,m=t.toneMapping),h.layers.enableAll(),e.unshift(h,h.geometry,h.material,0,0,null))},dispose:function(){void 0!==u&&(u.geometry.dispose(),u.material.dispose(),u=void 0),void 0!==h&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}}}function Kt(t,e){function n(e){return t.bindVertexArray(e)}function i(e){return t.deleteVertexArray(e)}function r(t){const e=[],n=[],i=[];for(let t=0;d>t;t++)e[t]=0,n[t]=0,i[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function s(){const t=m.newAttributes;for(let e=0,n=t.length;n>e;e++)t[e]=0}function a(t){o(t,0)}function o(e,n){const i=m.newAttributes,r=m.enabledAttributes,s=m.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),s[e]!==n&&(t.vertexAttribDivisor(e,n),s[e]=n)}function l(){const e=m.newAttributes,n=m.enabledAttributes;for(let i=0,r=n.length;r>i;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function c(e,n,i,r,s,a,o){!0===o?t.vertexAttribIPointer(e,n,i,s,a):t.vertexAttribPointer(e,n,i,r,s,a)}function h(){u(),g=!0,m!==f&&(m=f,n(m.object))}function u(){f.geometry=null,f.program=null,f.wireframe=!1}const d=t.getParameter(t.MAX_VERTEX_ATTRIBS),p={},f=r(null);let m=f,g=!1;return{setup:function(i,h,u,d,f){let _=!1;const v=function(e,n,i){const s=!0===i.wireframe;let a=p[e.id];void 0===a&&(a={},p[e.id]=a);let o=a[n.id];void 0===o&&(o={},a[n.id]=o);let l=o[s];return void 0===l&&(l=r(t.createVertexArray()),o[s]=l),l}(d,u,h);m!==v&&(m=v,n(m.object)),_=function(t,e,n,i){const r=m.attributes,s=e.attributes;let a=0;const o=n.getAttributes();for(const e in o)if(o[e].location>=0){const n=r[e];let i=s[e];if(void 0===i&&(\\\"instanceMatrix\\\"===e&&t.instanceMatrix&&(i=t.instanceMatrix),\\\"instanceColor\\\"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;a++}return m.attributesNum!==a||m.index!==i}(i,d,u,f),_&&function(t,e,n,i){const r={},s=e.attributes;let a=0;const o=n.getAttributes();for(const e in o)if(o[e].location>=0){let n=s[e];void 0===n&&(\\\"instanceMatrix\\\"===e&&t.instanceMatrix&&(n=t.instanceMatrix),\\\"instanceColor\\\"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,a++}m.attributes=r,m.attributesNum=a,m.index=i}(i,d,u,f),null!==f&&e.update(f,t.ELEMENT_ARRAY_BUFFER),(_||g)&&(g=!1,function(n,i,r,h){s();const u=h.attributes,d=r.getAttributes(),p=i.defaultAttributeValues;for(const i in d){const r=d[i];if(r.location>=0){let s=u[i];if(void 0===s&&(\\\"instanceMatrix\\\"===i&&n.instanceMatrix&&(s=n.instanceMatrix),\\\"instanceColor\\\"===i&&n.instanceColor&&(s=n.instanceColor)),void 0!==s){const i=s.normalized,l=s.itemSize,u=e.get(s);if(void 0===u)continue;const d=u.buffer,p=u.type,f=u.bytesPerElement,m=p===t.INT||p===t.UNSIGNED_INT||s.gpuType===Da;if(s.isInterleavedBufferAttribute){const e=s.data,u=e.stride,g=s.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)o(r.location+t,e.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===h._maxInstanceCount&&(h._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<r.locationSize;t++)a(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,d);for(let t=0;t<r.locationSize;t++)c(r.location+t,l/r.locationSize,p,i,u*f,(g+l/r.locationSize*t)*f,m)}else{if(s.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)o(r.location+t,s.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===h._maxInstanceCount&&(h._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let t=0;t<r.locationSize;t++)a(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,d);for(let t=0;t<r.locationSize;t++)c(r.location+t,l/r.locationSize,p,i,l*f,l/r.locationSize*t*f,m)}}else if(void 0!==p){const e=p[i];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(r.location,e);break;case 3:t.vertexAttrib3fv(r.location,e);break;case 4:t.vertexAttrib4fv(r.location,e);break;default:t.vertexAttrib1fv(r.location,e)}}}}l()}(i,h,u,d),null!==f&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(f).buffer))},reset:h,resetDefaultState:u,dispose:function(){h();for(const t in p){const e=p[t];for(const t in e){const n=e[t];for(const t in n)i(n[t].object),delete n[t];delete e[t]}delete p[t]}},releaseStatesOfGeometry:function(t){if(void 0===p[t.id])return;const e=p[t.id];for(const t in e){const n=e[t];for(const t in n)i(n[t].object),delete n[t];delete e[t]}delete p[t.id]},releaseStatesOfProgram:function(t){for(const e in p){const n=p[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)i(r[t].object),delete r[t];delete n[t.id]}},initAttributes:s,enableAttribute:a,disableUnusedAttributes:l}}function Jt(t,e,n){function i(e,i,s){0!==s&&(t.drawArraysInstanced(r,e,i,s),n.update(i,r,s))}let r;this.setMode=function(t){r=t},this.render=function(e,i){t.drawArrays(r,e,i),n.update(i,r,1)},this.renderInstances=i,this.renderMultiDraw=function(t,i,s){if(0===s)return;e.get(\\\"WEBGL_multi_draw\\\").multiDrawArraysWEBGL(r,t,0,i,0,s);let a=0;for(let t=0;s>t;t++)a+=i[t];n.update(a,r,1)},this.renderMultiDrawInstances=function(t,s,a,o){if(0===a)return;const l=e.get(\\\"WEBGL_multi_draw\\\");if(null===l)for(let e=0;e<t.length;e++)i(t[e],s[e],o[e]);else{l.multiDrawArraysInstancedWEBGL(r,t,0,s,0,o,0,a);let e=0;for(let t=0;a>t;t++)e+=s[t]*o[t];n.update(e,r,1)}}}function Zt(t,e,n,i){function r(e){if(\\\"highp\\\"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return\\\"highp\\\";e=\\\"mediump\\\"}return\\\"mediump\\\"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?\\\"mediump\\\":\\\"lowp\\\"}let a,o=void 0!==n.precision?n.precision:\\\"highp\\\";const l=r(o);return l!==o&&(s(\\\"WebGLRenderer:\\\",o,\\\"not supported, using\\\",l,\\\"instead.\\\"),o=l),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===e.has(\\\"EXT_texture_filter_anisotropic\\\")){const n=e.get(\\\"EXT_texture_filter_anisotropic\\\");a=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:r,textureFormatReadable:function(e){return e===ja||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===Ba&&(e.has(\\\"EXT_color_buffer_half_float\\\")||e.has(\\\"EXT_color_buffer_float\\\"));return!(n!==Ia&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Fa&&!r)},precision:o,logarithmicDepthBuffer:!0===n.logarithmicDepthBuffer,reversedDepthBuffer:!0===n.reversedDepthBuffer&&e.has(\\\"EXT_clip_control\\\"),maxTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:t.getParameter(t.MAX_SAMPLES),samples:t.getParameter(t.SAMPLES)}}function $t(t){function e(t,e,i,r){const s=null!==t?t.length:0;let a=null;if(0!==s){if(a=c.value,!0!==r||null===a){const n=i+4*s,r=e.matrixWorldInverse;l.getNormalMatrix(r),(null===a||a.length<n)&&(a=new Float32Array(n));for(let e=0,n=i;e!==s;++e,n+=4)o.copy(t[e]).applyMatrix4(r,l),o.normal.toArray(a,n),a[n+3]=o.constant}c.value=a,c.needsUpdate=!0}return n.numPlanes=s,n.numIntersection=0,a}const n=this;let i=null,r=0,s=!1,a=!1;const o=new Ou,l=new Il,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const n=0!==t.length||e||0!==r||s;return s=e,r=t.length,n},this.beginShadows=function(){a=!0,e(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(t,n){i=e(t,n,0)},this.setState=function(o,l,h){const u=o.clippingPlanes,d=o.clipIntersection,p=o.clipShadows,f=t.get(o);if(!s||null===u||0===u.length||a&&!p)a?e(null):(c.value!==i&&(c.value=i,c.needsUpdate=r>0),n.numPlanes=r,n.numIntersection=0);else{const t=a?0:r,n=4*t;let s=f.clippingState||null;c.value=s,s=e(u,l,n,h);for(let t=0;t!==n;++t)s[t]=i[t];f.clippingState=s,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function Qt(t){function e(t,e){return e===xa?t.mapping=_a:e===ya&&(t.mapping=va),t}function n(t){const e=t.target;e.removeEventListener(\\\"dispose\\\",n);const r=i.get(e);void 0!==r&&(i.delete(e),r.dispose())}let i=new WeakMap;return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===xa||s===ya){if(i.has(r))return e(i.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const a=new eu(s.height);return a.fromEquirectangularTexture(t,r),i.set(r,a),r.addEventListener(\\\"dispose\\\",n),e(a.texture,r.mapping)}return null}}}return r},dispose:function(){i=new WeakMap}}}function te(t){const e=[],n=[],i=[];let r=t;const s=t-4+1+Uf.length;for(let a=0;s>a;a++){const s=Math.pow(2,r);e.push(s);let o=1/s;a>t-4?o=Uf[a-t+4-1]:0===a&&(o=0),n.push(o);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,f=3,m=2,g=1,_=new Float32Array(f*p*d),v=new Float32Array(m*p*d),x=new Float32Array(g*p*d);for(let t=0;d>t;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];_.set(i,f*p*t),v.set(u,m*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const y=new Ph;y.setAttribute(\\\"position\\\",new xh(_,f)),y.setAttribute(\\\"uv\\\",new xh(v,m)),y.setAttribute(\\\"faceIndex\\\",new xh(x,g)),i.push(new Hh(y,null)),r>4&&r--}return{lodMeshes:i,sizeLods:e,sigmas:n}}function ee(t,e,n){const i=new Xl(t,e,n);return i.texture.mapping=Ma,i.texture.name=\\\"PMREM.cubeUv\\\",i.scissorTest=!0,i}function ne(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function ie(t,e,n){return new Xh({name:\\\"PMREMGGXConvolution\\\",defines:{GGX_SAMPLES:Of,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:oe(),fragmentShader:'\\\\n\\\\n\\\\t\\\\t\\\\tprecision highp float;\\\\n\\\\t\\\\t\\\\tprecision highp int;\\\\n\\\\n\\\\t\\\\t\\\\tvarying vec3 vOutputDirection;\\\\n\\\\n\\\\t\\\\t\\\\tuniform sampler2D envMap;\\\\n\\\\t\\\\t\\\\tuniform float roughness;\\\\n\\\\t\\\\t\\\\tuniform float mipInt;\\\\n\\\\n\\\\t\\\\t\\\\t#define ENVMAP_TYPE_CUBE_UV\\\\n\\\\t\\\\t\\\\t#include <cube_uv_reflection_fragment>\\\\n\\\\n\\\\t\\\\t\\\\t#define PI 3.14159265359\\\\n\\\\n\\\\t\\\\t\\\\t// Van der Corput radical inverse\\\\n\\\\t\\\\t\\\\tfloat radicalInverse_VdC(uint bits) {\\\\n\\\\t\\\\t\\\\t\\\\tbits = (bits << 16u) | (bits >> 16u);\\\\n\\\\t\\\\t\\\\t\\\\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\\\\n\\\\t\\\\t\\\\t\\\\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\\\\n\\\\t\\\\t\\\\t\\\\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\\\\n\\\\t\\\\t\\\\t\\\\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\\\\n\\\\t\\\\t\\\\t\\\\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t// Hammersley sequence\\\\n\\\\t\\\\t\\\\tvec2 hammersley(uint i, uint N) {\\\\n\\\\t\\\\t\\\\t\\\\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t// GGX VNDF importance sampling (Eric Heitz 2018)\\\\n\\\\t\\\\t\\\\t// \\\"Sampling the GGX Distribution of Visible Normals\\\"\\\\n\\\\t\\\\t\\\\t// https://jcgt.org/published/0007/04/01/\\\\n\\\\t\\\\t\\\\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\\\\n\\\\t\\\\t\\\\t\\\\tfloat alpha = roughness * roughness;\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t// Section 3.2: Transform view direction to hemisphere configuration\\\\n\\\\t\\\\t\\\\t\\\\tvec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t// Section 4.1: Orthonormal basis\\\\n\\\\t\\\\t\\\\t\\\\tfloat lensq = Vh.x * Vh.x + Vh.y * Vh.y;\\\\n\\\\t\\\\t\\\\t\\\\tvec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);\\\\n\\\\t\\\\t\\\\t\\\\tvec3 T2 = cross(Vh, T1);\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t// Section 4.2: Parameterization of projected area\\\\n\\\\t\\\\t\\\\t\\\\tfloat r = sqrt(Xi.x);\\\\n\\\\t\\\\t\\\\t\\\\tfloat phi = 2.0 * PI * Xi.y;\\\\n\\\\t\\\\t\\\\t\\\\tfloat t1 = r * cos(phi);\\\\n\\\\t\\\\t\\\\t\\\\tfloat t2 = r * sin(phi);\\\\n\\\\t\\\\t\\\\t\\\\tfloat s = 0.5 * (1.0 + Vh.z);\\\\n\\\\t\\\\t\\\\t\\\\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t// Section 4.3: Reprojection onto hemisphere\\\\n\\\\t\\\\t\\\\t\\\\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t// Section 3.4: Transform back to ellipsoid configuration\\\\n\\\\t\\\\t\\\\t\\\\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\tvoid main() {\\\\n\\\\t\\\\t\\\\t\\\\tvec3 N = normalize(vOutputDirection);\\\\n\\\\t\\\\t\\\\t\\\\tvec3 V = N; // Assume view direction equals normal for pre-filtering\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tvec3 prefilteredColor = vec3(0.0);\\\\n\\\\t\\\\t\\\\t\\\\tfloat totalWeight = 0.0;\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t// For very low roughness, just sample the environment directly\\\\n\\\\t\\\\t\\\\t\\\\tif (roughness < 0.001) {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\\\\n\\\\t\\\\t\\\\t\\\\t\\\\treturn;\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t// Tangent space basis for VNDF sampling\\\\n\\\\t\\\\t\\\\t\\\\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\\\\n\\\\t\\\\t\\\\t\\\\tvec3 tangent = normalize(cross(up, N));\\\\n\\\\t\\\\t\\\\t\\\\tvec3 bitangent = cross(N, tangent);\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t// Transform H back to world space\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tfloat NdotL = max(dot(N, L), 0.0);\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tif(NdotL > 0.0) {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t// Sample environment at fixed mip level\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t// VNDF importance sampling handles the distribution filtering\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t// Weight by NdotL for the split-sum approximation\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t// VNDF PDF naturally accounts for the visible microfacet distribution\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\tprefilteredColor += sampleColor * NdotL;\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\ttotalWeight += NdotL;\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tif (totalWeight > 0.0) {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tprefilteredColor = prefilteredColor / totalWeight;\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tgl_FragColor = vec4(prefilteredColor, 1.0);\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t',blending:0,depthTest:!1,depthWrite:!1})}function re(t,e,n){const i=new Float32Array(Df),r=new Rl(0,1,0);return new Xh({name:\\\"SphericalGaussianBlur\\\",defines:{n:Df,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:oe(),fragmentShader:\\\"\\\\n\\\\n\\\\t\\\\t\\\\tprecision mediump float;\\\\n\\\\t\\\\t\\\\tprecision mediump int;\\\\n\\\\n\\\\t\\\\t\\\\tvarying vec3 vOutputDirection;\\\\n\\\\n\\\\t\\\\t\\\\tuniform sampler2D envMap;\\\\n\\\\t\\\\t\\\\tuniform int samples;\\\\n\\\\t\\\\t\\\\tuniform float weights[ n ];\\\\n\\\\t\\\\t\\\\tuniform bool latitudinal;\\\\n\\\\t\\\\t\\\\tuniform float dTheta;\\\\n\\\\t\\\\t\\\\tuniform float mipInt;\\\\n\\\\t\\\\t\\\\tuniform vec3 poleAxis;\\\\n\\\\n\\\\t\\\\t\\\\t#define ENVMAP_TYPE_CUBE_UV\\\\n\\\\t\\\\t\\\\t#include <cube_uv_reflection_fragment>\\\\n\\\\n\\\\t\\\\t\\\\tvec3 getSample( float theta, vec3 axis ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tfloat cosTheta = cos( theta );\\\\n\\\\t\\\\t\\\\t\\\\t// Rodrigues' axis-angle rotation\\\\n\\\\t\\\\t\\\\t\\\\tvec3 sampleDirection = vOutputDirection * cosTheta\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t+ cross( axis, vOutputDirection ) * sin( theta )\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\\\\n\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\tvoid main() {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t\\\\taxis = normalize( axis );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\\\n\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tfor ( int i = 1; i < n; i++ ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tif ( i >= samples ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\tbreak;\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tfloat theta = dTheta * float( i );\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\",blending:0,depthTest:!1,depthWrite:!1})}function se(){return new Xh({name:\\\"EquirectangularToCubeUV\\\",uniforms:{envMap:{value:null}},vertexShader:oe(),fragmentShader:\\\"\\\\n\\\\n\\\\t\\\\t\\\\tprecision mediump float;\\\\n\\\\t\\\\t\\\\tprecision mediump int;\\\\n\\\\n\\\\t\\\\t\\\\tvarying vec3 vOutputDirection;\\\\n\\\\n\\\\t\\\\t\\\\tuniform sampler2D envMap;\\\\n\\\\n\\\\t\\\\t\\\\t#include <common>\\\\n\\\\n\\\\t\\\\t\\\\tvoid main() {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tvec3 outputDirection = normalize( vOutputDirection );\\\\n\\\\t\\\\t\\\\t\\\\tvec2 uv = equirectUv( outputDirection );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\\\\n\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\",blending:0,depthTest:!1,depthWrite:!1})}function ae(){return new Xh({name:\\\"CubemapToCubeUV\\\",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:oe(),fragmentShader:\\\"\\\\n\\\\n\\\\t\\\\t\\\\tprecision mediump float;\\\\n\\\\t\\\\t\\\\tprecision mediump int;\\\\n\\\\n\\\\t\\\\t\\\\tuniform float flipEnvMap;\\\\n\\\\n\\\\t\\\\t\\\\tvarying vec3 vOutputDirection;\\\\n\\\\n\\\\t\\\\t\\\\tuniform samplerCube envMap;\\\\n\\\\n\\\\t\\\\t\\\\tvoid main() {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\\\\n\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\",blending:0,depthTest:!1,depthWrite:!1})}function oe(){return\\\"\\\\n\\\\n\\\\t\\\\tprecision mediump float;\\\\n\\\\t\\\\tprecision mediump int;\\\\n\\\\n\\\\t\\\\tattribute float faceIndex;\\\\n\\\\n\\\\t\\\\tvarying vec3 vOutputDirection;\\\\n\\\\n\\\\t\\\\t// RH coordinate system; PMREM face-indexing convention\\\\n\\\\t\\\\tvec3 getDirection( vec2 uv, float face ) {\\\\n\\\\n\\\\t\\\\t\\\\tuv = 2.0 * uv - 1.0;\\\\n\\\\n\\\\t\\\\t\\\\tvec3 direction = vec3( uv, 1.0 );\\\\n\\\\n\\\\t\\\\t\\\\tif ( face == 0.0 ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tdirection = direction.zyx; // ( 1, v, u ) pos x\\\\n\\\\n\\\\t\\\\t\\\\t} else if ( face == 1.0 ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tdirection = direction.xzy;\\\\n\\\\t\\\\t\\\\t\\\\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\\\\n\\\\n\\\\t\\\\t\\\\t} else if ( face == 2.0 ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\\\\n\\\\n\\\\t\\\\t\\\\t} else if ( face == 3.0 ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tdirection = direction.zyx;\\\\n\\\\t\\\\t\\\\t\\\\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\\\\n\\\\n\\\\t\\\\t\\\\t} else if ( face == 4.0 ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tdirection = direction.xzy;\\\\n\\\\t\\\\t\\\\t\\\\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\\\\n\\\\n\\\\t\\\\t\\\\t} else if ( face == 5.0 ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\\\\n\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\treturn direction;\\\\n\\\\n\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\tvoid main() {\\\\n\\\\n\\\\t\\\\t\\\\tvOutputDirection = getDirection( uv, faceIndex );\\\\n\\\\t\\\\t\\\\tgl_Position = vec4( position, 1.0 );\\\\n\\\\n\\\\t\\\\t}\\\\n\\\\t\\\"}function le(t){function e(t){const i=t.target;i.removeEventListener(\\\"dispose\\\",e);const r=n.get(i);void 0!==r&&(n.delete(i),r.dispose())}let n=new WeakMap,i=null;return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=s===xa||s===ya,o=s===_a||s===va;if(a||o){let s=n.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===i&&(i=new Wf(t)),s=a?i.fromEquirectangular(r,s):i.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,n.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return a&&l&&l.height>0||o&&l&&function(t){let e=0;for(let n=0;6>n;n++)void 0!==t[n]&&e++;return 6===e}(l)?(null===i&&(i=new Wf(t)),s=a?i.fromEquirectangular(r):i.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,n.set(r,s),r.addEventListener(\\\"dispose\\\",e),s.texture):null}}}return r},dispose:function(){n=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function ce(t){function e(e){if(void 0!==n[e])return n[e];const i=t.getExtension(e);return n[e]=i,i}const n={};return{has:function(t){return null!==e(t)},init:function(){e(\\\"EXT_color_buffer_float\\\"),e(\\\"WEBGL_clip_cull_distance\\\"),e(\\\"OES_texture_float_linear\\\"),e(\\\"EXT_color_buffer_half_float\\\"),e(\\\"WEBGL_multisampled_render_to_texture\\\"),e(\\\"WEBGL_render_shared_exponent\\\")},get:function(t){const n=e(t);return null===n&&o(\\\"WebGLRenderer: \\\"+t+\\\" extension not supported.\\\"),n}}}function he(e,n,i,r){function s(t){const e=t.target;null!==e.index&&n.remove(e.index);for(const t in e.attributes)n.remove(e.attributes[t]);e.removeEventListener(\\\"dispose\\\",s),delete o[e.id];const a=l.get(e);a&&(n.remove(a),l.delete(e)),r.releaseStatesOfGeometry(e),!0===e.isInstancedBufferGeometry&&delete e._maxInstanceCount,i.memory.geometries--}function a(e){const i=[],r=e.index,s=e.attributes.position;let a=0;if(null!==r){const t=r.array;a=r.version;for(let e=0,n=t.length;n>e;e+=3){const n=t[e+0],r=t[e+1],s=t[e+2];i.push(n,r,r,s,s,n)}}else{if(void 0===s)return;{const t=s.array;a=s.version;for(let e=0,n=t.length/3-1;n>e;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}}const o=new(t(i)?Mh:yh)(i,1);o.version=a;const c=l.get(e);c&&n.remove(c),l.set(e,o)}const o={},l=new WeakMap;return{get:function(t,e){return!0===o[e.id]||(e.addEventListener(\\\"dispose\\\",s),o[e.id]=!0,i.memory.geometries++),e},update:function(t){const i=t.attributes;for(const t in i)n.update(i[t],e.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=l.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return l.get(t)}}}function ue(t,e,n){function i(e,i,o){0!==o&&(t.drawElementsInstanced(r,i,s,e*a,o),n.update(i,r,o))}let r,s,a;this.setMode=function(t){r=t},this.setIndex=function(t){s=t.type,a=t.bytesPerElement},this.render=function(e,i){t.drawElements(r,i,s,e*a),n.update(i,r,1)},this.renderInstances=i,this.renderMultiDraw=function(t,i,a){if(0===a)return;e.get(\\\"WEBGL_multi_draw\\\").multiDrawElementsWEBGL(r,i,0,s,t,0,a);let o=0;for(let t=0;a>t;t++)o+=i[t];n.update(o,r,1)},this.renderMultiDrawInstances=function(t,o,l,c){if(0===l)return;const h=e.get(\\\"WEBGL_multi_draw\\\");if(null===h)for(let e=0;e<t.length;e++)i(t[e]/a,o[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(r,o,0,s,t,0,c,0,l);let e=0;for(let t=0;l>t;t++)e+=o[t]*c[t];n.update(e,r,1)}}}function de(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:a(\\\"WebGLInfo: Unknown draw mode:\\\",i)}}}}function pe(t,e,n){const i=new WeakMap,r=new Gl;return{update:function(s,a,o){const l=s.morphTargetInfluences,c=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=void 0!==c?c.length:0;let u=i.get(a);if(void 0===u||u.count!==h){let t=function(){_.dispose(),i.delete(a),a.removeEventListener(\\\"dispose\\\",t)};void 0!==u&&u.texture.dispose();const n=void 0!==a.morphAttributes.position,s=void 0!==a.morphAttributes.normal,o=void 0!==a.morphAttributes.color,l=a.morphAttributes.position||[],c=a.morphAttributes.normal||[],d=a.morphAttributes.color||[];let p=0;!0===n&&(p=1),!0===s&&(p=2),!0===o&&(p=3);let f=a.attributes.position.count*p,m=1;f>e.maxTextureSize&&(m=Math.ceil(f/e.maxTextureSize),f=e.maxTextureSize);const g=new Float32Array(f*m*4*h),_=new jl(g,f,m,h);_.type=Fa,_.needsUpdate=!0;const v=4*p;for(let t=0;h>t;t++){const e=l[t],i=c[t],a=d[t],h=f*m*4*t;for(let t=0;t<e.count;t++){const l=t*v;!0===n&&(r.fromBufferAttribute(e,t),g[h+l+0]=r.x,g[h+l+1]=r.y,g[h+l+2]=r.z,g[h+l+3]=0),!0===s&&(r.fromBufferAttribute(i,t),g[h+l+4]=r.x,g[h+l+5]=r.y,g[h+l+6]=r.z,g[h+l+7]=0),!0===o&&(r.fromBufferAttribute(a,t),g[h+l+8]=r.x,g[h+l+9]=r.y,g[h+l+10]=r.z,g[h+l+11]=4===a.itemSize?r.w:1)}}u={count:h,texture:_,size:new Al(f,m)},i.set(a,u),a.addEventListener(\\\"dispose\\\",t)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)o.getUniforms().setValue(t,\\\"morphTexture\\\",s.morphTexture,n);else{let e=0;for(let t=0;t<l.length;t++)e+=l[t];const n=a.morphTargetsRelative?1:1-e;o.getUniforms().setValue(t,\\\"morphTargetBaseInfluence\\\",n),o.getUniforms().setValue(t,\\\"morphTargetInfluences\\\",l)}o.getUniforms().setValue(t,\\\"morphTargetsTexture\\\",u.texture,n),o.getUniforms().setValue(t,\\\"morphTargetsTextureSize\\\",u.size)}}}function fe(t,e,n,i){function r(t){const e=t.target;e.removeEventListener(\\\"dispose\\\",r),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}let s=new WeakMap;return{update:function(a){const o=i.render.frame,l=a.geometry,c=e.get(a,l);if(s.get(c)!==o&&(e.update(c),s.set(c,o)),a.isInstancedMesh&&(!1===a.hasEventListener(\\\"dispose\\\",r)&&a.addEventListener(\\\"dispose\\\",r),s.get(a)!==o&&(n.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&n.update(a.instanceColor,t.ARRAY_BUFFER),s.set(a,o))),a.isSkinnedMesh){const t=a.skeleton;s.get(t)!==o&&(t.update(),s.set(t,o))}return c},dispose:function(){s=new WeakMap}}}function me(t,e,n,i,r){const s=new Xl(e,n,{type:t,depthBuffer:i,stencilBuffer:r}),a=new Xl(e,n,{type:Ba,depthBuffer:!1,stencilBuffer:!1}),o=new Ph;o.setAttribute(\\\"position\\\",new Sh([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute(\\\"uv\\\",new Sh([0,2,0,0,2,0],2));const l=new Ld({uniforms:{tDiffuse:{value:null}},vertexShader:\\\"\\\\n\\\\t\\\\t\\\\tprecision highp float;\\\\n\\\\n\\\\t\\\\t\\\\tuniform mat4 modelViewMatrix;\\\\n\\\\t\\\\t\\\\tuniform mat4 projectionMatrix;\\\\n\\\\n\\\\t\\\\t\\\\tattribute vec3 position;\\\\n\\\\t\\\\t\\\\tattribute vec2 uv;\\\\n\\\\n\\\\t\\\\t\\\\tvarying vec2 vUv;\\\\n\\\\n\\\\t\\\\t\\\\tvoid main() {\\\\n\\\\t\\\\t\\\\t\\\\tvUv = uv;\\\\n\\\\t\\\\t\\\\t\\\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\\\n\\\\t\\\\t\\\\t}\\\",fragmentShader:\\\"\\\\n\\\\t\\\\t\\\\tprecision highp float;\\\\n\\\\n\\\\t\\\\t\\\\tuniform sampler2D tDiffuse;\\\\n\\\\n\\\\t\\\\t\\\\tvarying vec2 vUv;\\\\n\\\\n\\\\t\\\\t\\\\t#include <tonemapping_pars_fragment>\\\\n\\\\t\\\\t\\\\t#include <colorspace_pars_fragment>\\\\n\\\\n\\\\t\\\\t\\\\tvoid main() {\\\\n\\\\t\\\\t\\\\t\\\\tgl_FragColor = texture2D( tDiffuse, vUv );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t#ifdef LINEAR_TONE_MAPPING\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\\\\n\\\\t\\\\t\\\\t\\\\t#elif defined( REINHARD_TONE_MAPPING )\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\\\\n\\\\t\\\\t\\\\t\\\\t#elif defined( CINEON_TONE_MAPPING )\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\\\\n\\\\t\\\\t\\\\t\\\\t#elif defined( ACES_FILMIC_TONE_MAPPING )\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\\\\n\\\\t\\\\t\\\\t\\\\t#elif defined( AGX_TONE_MAPPING )\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\\\\n\\\\t\\\\t\\\\t\\\\t#elif defined( NEUTRAL_TONE_MAPPING )\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\\\\n\\\\t\\\\t\\\\t\\\\t#elif defined( CUSTOM_TONE_MAPPING )\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\\\\n\\\\t\\\\t\\\\t\\\\t#endif\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t#ifdef SRGB_TRANSFER\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\\\\n\\\\t\\\\t\\\\t\\\\t#endif\\\\n\\\\t\\\\t\\\\t}\\\",depthTest:!1,depthWrite:!1}),c=new Hh(o,l),h=new xp(-1,1,1,-1,0,1);let u,d=null,p=null,f=!1,m=null,g=[],_=!1;this.setSize=function(t,e){s.setSize(t,e),a.setSize(t,e);for(let n=0;n<g.length;n++){const i=g[n];i.setSize&&i.setSize(t,e)}},this.setEffects=function(t){g=t,_=g.length>0&&!0===g[0].isRenderPass;const e=s.width,n=s.height;for(let t=0;t<g.length;t++){const i=g[t];i.setSize&&i.setSize(e,n)}},this.begin=function(t,e){if(f)return!1;if(0===t.toneMapping&&0===g.length)return!1;if(m=e,null!==e){const t=e.width,n=e.height;s.width===t&&s.height===n||this.setSize(t,n)}return!1===_&&t.setRenderTarget(s),u=t.toneMapping,t.toneMapping=0,!0},this.hasRenderPass=function(){return _},this.end=function(t,e){t.toneMapping=u,f=!0;let n=s,i=a;for(let r=0;r<g.length;r++){const s=g[r];if(!1!==s.enabled&&(s.render(t,i,n,e),!1!==s.needsSwap)){const t=n;n=i,i=t}}if(d!==t.outputColorSpace||p!==t.toneMapping){d=t.outputColorSpace,p=t.toneMapping,l.defines={},Dl.getTransfer(d)===rl&&(l.defines.SRGB_TRANSFER=\\\"\\\");const e=Xf[p];e&&(l.defines[e]=\\\"\\\"),l.needsUpdate=!0}l.uniforms.tDiffuse.value=n.texture,t.setRenderTarget(m),t.render(c,h),m=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),l.dispose()}}function ge(t,e,n){const i=t[0];if(0>=i||i>0)return t;const r=e*n;let s=Zf[r];if(void 0===s&&(s=new Float32Array(r),Zf[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function _e(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;i>n;n++)if(t[n]!==e[n])return!1;return!0}function ve(t,e){for(let n=0,i=e.length;i>n;n++)t[n]=e[n]}function xe(t,e){let n=$f[e];void 0===n&&(n=new Int32Array(e),$f[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function ye(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Me(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(_e(n,e))return;t.uniform2fv(this.addr,e),ve(n,e)}}function Se(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(_e(n,e))return;t.uniform3fv(this.addr,e),ve(n,e)}}function Te(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(_e(n,e))return;t.uniform4fv(this.addr,e),ve(n,e)}}function be(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(_e(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ve(n,e)}else{if(_e(n,i))return;em.set(i),t.uniformMatrix2fv(this.addr,!1,em),ve(n,i)}}function Ee(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(_e(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ve(n,e)}else{if(_e(n,i))return;tm.set(i),t.uniformMatrix3fv(this.addr,!1,tm),ve(n,i)}}function Ae(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(_e(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ve(n,e)}else{if(_e(n,i))return;Qf.set(i),t.uniformMatrix4fv(this.addr,!1,Qf),ve(n,i)}}function we(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Re(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(_e(n,e))return;t.uniform2iv(this.addr,e),ve(n,e)}}function Ce(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(_e(n,e))return;t.uniform3iv(this.addr,e),ve(n,e)}}function Pe(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(_e(n,e))return;t.uniform4iv(this.addr,e),ve(n,e)}}function Ie(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Le(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(_e(n,e))return;t.uniform2uiv(this.addr,e),ve(n,e)}}function Ne(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(_e(n,e))return;t.uniform3uiv(this.addr,e),ve(n,e)}}function Ue(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(_e(n,e))return;t.uniform4uiv(this.addr,e),ve(n,e)}}function De(t,e,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),this.type===t.SAMPLER_2D_SHADOW?(qf.compareFunction=n.isReversedDepthBuffer()?pl:hl,s=qf):s=jf,n.setTexture2D(e||s,r)}function Oe(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||Kf,r)}function Fe(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||Jf,r)}function Be(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||Yf,r)}function ze(t){switch(t){case 5126:return ye;case 35664:return Me;case 35665:return Se;case 35666:return Te;case 35674:return be;case 35675:return Ee;case 35676:return Ae;case 5124:case 35670:return we;case 35667:case 35671:return Re;case 35668:case 35672:return Ce;case 35669:case 35673:return Pe;case 5125:return Ie;case 36294:return Le;case 36295:return Ne;case 36296:return Ue;case 35678:case 36198:case 36298:case 36306:case 35682:return De;case 35679:case 36299:case 36307:return Oe;case 35680:case 36300:case 36308:case 36293:return Fe;case 36289:case 36303:case 36311:case 36292:return Be}}function ke(t,e){t.uniform1fv(this.addr,e)}function Ve(t,e){const n=ge(e,this.size,2);t.uniform2fv(this.addr,n)}function He(t,e){const n=ge(e,this.size,3);t.uniform3fv(this.addr,n)}function Ge(t,e){const n=ge(e,this.size,4);t.uniform4fv(this.addr,n)}function We(t,e){const n=ge(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Xe(t,e){const n=ge(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function je(t,e){const n=ge(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function qe(t,e){t.uniform1iv(this.addr,e)}function Ye(t,e){t.uniform2iv(this.addr,e)}function Ke(t,e){t.uniform3iv(this.addr,e)}function Je(t,e){t.uniform4iv(this.addr,e)}function Ze(t,e){t.uniform1uiv(this.addr,e)}function $e(t,e){t.uniform2uiv(this.addr,e)}function Qe(t,e){t.uniform3uiv(this.addr,e)}function tn(t,e){t.uniform4uiv(this.addr,e)}function en(t,e,n){const i=this.cache,r=e.length,s=xe(n,r);let a;_e(i,s)||(t.uniform1iv(this.addr,s),ve(i,s)),a=this.type===t.SAMPLER_2D_SHADOW?qf:jf;for(let t=0;t!==r;++t)n.setTexture2D(e[t]||a,s[t])}function nn(t,e,n){const i=this.cache,r=e.length,s=xe(n,r);_e(i,s)||(t.uniform1iv(this.addr,s),ve(i,s));for(let t=0;t!==r;++t)n.setTexture3D(e[t]||Kf,s[t])}function rn(t,e,n){const i=this.cache,r=e.length,s=xe(n,r);_e(i,s)||(t.uniform1iv(this.addr,s),ve(i,s));for(let t=0;t!==r;++t)n.setTextureCube(e[t]||Jf,s[t])}function sn(t,e,n){const i=this.cache,r=e.length,s=xe(n,r);_e(i,s)||(t.uniform1iv(this.addr,s),ve(i,s));for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||Yf,s[t])}function an(t){switch(t){case 5126:return ke;case 35664:return Ve;case 35665:return He;case 35666:return Ge;case 35674:return We;case 35675:return Xe;case 35676:return je;case 5124:case 35670:return qe;case 35667:case 35671:return Ye;case 35668:case 35672:return Ke;case 35669:case 35673:return Je;case 5125:return Ze;case 36294:return $e;case 36295:return Qe;case 36296:return tn;case 35678:case 36198:case 36298:case 36306:case 35682:return en;case 35679:case 36299:case 36307:return nn;case 35680:case 36300:case 36308:case 36293:return rn;case 36289:case 36303:case 36311:case 36292:return sn}}function on(t,e){t.seq.push(e),t.map[e.id]=e}function ln(t,e,n){const i=t.name,r=i.length;for(sm.lastIndex=0;;){const s=sm.exec(i),a=sm.lastIndex;let o=s[1];const l=\\\"]\\\"===s[2],c=s[3];if(l&&(o|=0),void 0===c||\\\"[\\\"===c&&a+2===r){on(n,void 0===c?new nm(o,t,e):new im(o,t,e));break}{let t=n.map[o];void 0===t&&(t=new rm(o),on(n,t)),n=t}}}function cn(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}function hn(t,e){const n=t.split(\\\"\\\\n\\\"),i=[],r=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let t=r;s>t;t++){const r=t+1;i.push(`${r===e?\\\">\\\":\\\" \\\"} ${r}: ${n[t]}`)}return i.join(\\\"\\\\n\\\")}function un(t){Dl._getMatrix(cm,Dl.workingColorSpace,t);const e=`mat3( ${cm.elements.map(t=>t.toFixed(4))} )`;switch(Dl.getTransfer(t)){case il:return[e,\\\"LinearTransferOETF\\\"];case rl:return[e,\\\"sRGBTransferOETF\\\"];default:return s(\\\"WebGLProgram: Unsupported color space: \\\",t),[e,\\\"LinearTransferOETF\\\"]}}function dn(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=(t.getShaderInfoLog(e)||\\\"\\\").trim();if(i&&\\\"\\\"===r)return\\\"\\\";const s=/ERROR: 0:(\\\\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+\\\"\\\\n\\\\n\\\"+r+\\\"\\\\n\\\\n\\\"+hn(t.getShaderSource(e),i)}return r}function pn(t,e){const n=un(e);return[`vec4 ${t}( vec4 value ) {`,`\\\\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,\\\"}\\\"].join(\\\"\\\\n\\\")}function fn(t,e){const n=hm[e];return void 0===n?(s(\\\"WebGLProgram: Unsupported toneMapping:\\\",e),\\\"vec3 \\\"+t+\\\"( vec3 color ) { return LinearToneMapping( color ); }\\\"):\\\"vec3 \\\"+t+\\\"( vec3 color ) { return \\\"+n+\\\"ToneMapping( color ); }\\\"}function mn(){return Dl.getLuminanceCoefficients(um),[\\\"float luminance( const in vec3 rgb ) {\\\",`\\\\tconst vec3 weights = vec3( ${um.x.toFixed(4)}, ${um.y.toFixed(4)}, ${um.z.toFixed(4)} );`,\\\"\\\\treturn dot( weights, rgb );\\\",\\\"}\\\"].join(\\\"\\\\n\\\")}function gn(t){return[t.extensionClipCullDistance?\\\"#extension GL_ANGLE_clip_cull_distance : require\\\":\\\"\\\",t.extensionMultiDraw?\\\"#extension GL_ANGLE_multi_draw : require\\\":\\\"\\\"].filter(xn).join(\\\"\\\\n\\\")}function _n(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push(\\\"#define \\\"+n+\\\" \\\"+i)}return e.join(\\\"\\\\n\\\")}function vn(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;i>r;r++){const i=t.getActiveAttrib(e,r),s=i.name;let a=1;i.type===t.FLOAT_MAT2&&(a=2),i.type===t.FLOAT_MAT3&&(a=3),i.type===t.FLOAT_MAT4&&(a=4),n[s]={type:i.type,location:t.getAttribLocation(e,s),locationSize:a}}return n}function xn(t){return\\\"\\\"!==t}function yn(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Mn(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function Sn(t){return t.replace(dm,Tn)}function Tn(t,e){let n=wf[e];if(void 0===n){const t=pm.get(e);if(void 0===t)throw new Error(\\\"Can not resolve #include <\\\"+e+\\\">\\\");n=wf[t],s('WebGLRenderer: Shader chunk \\\"%s\\\" has been deprecated. Use \\\"%s\\\" instead.',e,t)}return Sn(n)}function bn(t){return t.replace(fm,En)}function En(t,e,n,i){let r=\\\"\\\";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\\\\[\\\\s*i\\\\s*\\\\]/g,\\\"[ \\\"+t+\\\" ]\\\").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function An(t){let e=`precision ${t.precision} float;\\\\n\\\\tprecision ${t.precision} int;\\\\n\\\\tprecision ${t.precision} sampler2D;\\\\n\\\\tprecision ${t.precision} samplerCube;\\\\n\\\\tprecision ${t.precision} sampler3D;\\\\n\\\\tprecision ${t.precision} sampler2DArray;\\\\n\\\\tprecision ${t.precision} sampler2DShadow;\\\\n\\\\tprecision ${t.precision} samplerCubeShadow;\\\\n\\\\tprecision ${t.precision} sampler2DArrayShadow;\\\\n\\\\tprecision ${t.precision} isampler2D;\\\\n\\\\tprecision ${t.precision} isampler3D;\\\\n\\\\tprecision ${t.precision} isamplerCube;\\\\n\\\\tprecision ${t.precision} isampler2DArray;\\\\n\\\\tprecision ${t.precision} usampler2D;\\\\n\\\\tprecision ${t.precision} usampler3D;\\\\n\\\\tprecision ${t.precision} usamplerCube;\\\\n\\\\tprecision ${t.precision} usampler2DArray;\\\\n\\\\t`;return\\\"highp\\\"===t.precision?e+=\\\"\\\\n#define HIGH_PRECISION\\\":\\\"mediump\\\"===t.precision?e+=\\\"\\\\n#define MEDIUM_PRECISION\\\":\\\"lowp\\\"===t.precision&&(e+=\\\"\\\\n#define LOW_PRECISION\\\"),e}function wn(t){return mm[t.shadowMapType]||\\\"SHADOWMAP_TYPE_BASIC\\\"}function Rn(t){return!1===t.envMap?\\\"ENVMAP_TYPE_CUBE\\\":gm[t.envMapMode]||\\\"ENVMAP_TYPE_CUBE\\\"}function Cn(t){return!1===t.envMap?\\\"ENVMAP_MODE_REFLECTION\\\":_m[t.envMapMode]||\\\"ENVMAP_MODE_REFLECTION\\\"}function Pn(t){return!1===t.envMap?\\\"ENVMAP_BLENDING_NONE\\\":vm[t.combine]||\\\"ENVMAP_BLENDING_NONE\\\"}function In(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function Ln(t,e,n,i){function r(e){if(t.debug.checkShaderErrors){const n=o.getProgramInfoLog(v)||\\\"\\\",i=o.getShaderInfoLog(b)||\\\"\\\",r=o.getShaderInfoLog(E)||\\\"\\\",l=n.trim(),c=i.trim(),h=r.trim();let u=!0,d=!0;if(!1===o.getProgramParameter(v,o.LINK_STATUS))if(u=!1,\\\"function\\\"==typeof t.debug.onShaderError)t.debug.onShaderError(o,v,b,E);else{const t=dn(o,b,\\\"vertex\\\"),n=dn(o,E,\\\"fragment\\\");a(\\\"THREE.WebGLProgram: Shader Error \\\"+o.getError()+\\\" - VALIDATE_STATUS \\\"+o.getProgramParameter(v,o.VALIDATE_STATUS)+\\\"\\\\n\\\\nMaterial Name: \\\"+e.name+\\\"\\\\nMaterial Type: \\\"+e.type+\\\"\\\\n\\\\nProgram Info Log: \\\"+l+\\\"\\\\n\\\"+t+\\\"\\\\n\\\"+n)}else\\\"\\\"!==l?s(\\\"WebGLProgram: Program Info Log:\\\",l):\\\"\\\"!==c&&\\\"\\\"!==h||(d=!1);d&&(e.diagnostics={runnable:u,programLog:l,vertexShader:{log:c,prefix:x},fragmentShader:{log:h,prefix:y}})}o.deleteShader(b),o.deleteShader(E),A=new am(o,v),w=vn(o,v)}const o=t.getContext(),l=n.defines;let c=n.vertexShader,h=n.fragmentShader;const u=wn(n),d=Rn(n),p=Cn(n),f=Pn(n),m=In(n),g=gn(n),_=_n(l),v=o.createProgram();let x,y,M=n.glslVersion?\\\"#version \\\"+n.glslVersion+\\\"\\\\n\\\":\\\"\\\";n.isRawShaderMaterial?(x=[\\\"#define SHADER_TYPE \\\"+n.shaderType,\\\"#define SHADER_NAME \\\"+n.shaderName,_].filter(xn).join(\\\"\\\\n\\\"),x.length>0&&(x+=\\\"\\\\n\\\"),y=[\\\"#define SHADER_TYPE \\\"+n.shaderType,\\\"#define SHADER_NAME \\\"+n.shaderName,_].filter(xn).join(\\\"\\\\n\\\"),y.length>0&&(y+=\\\"\\\\n\\\")):(x=[An(n),\\\"#define SHADER_TYPE \\\"+n.shaderType,\\\"#define SHADER_NAME \\\"+n.shaderName,_,n.extensionClipCullDistance?\\\"#define USE_CLIP_DISTANCE\\\":\\\"\\\",n.batching?\\\"#define USE_BATCHING\\\":\\\"\\\",n.batchingColor?\\\"#define USE_BATCHING_COLOR\\\":\\\"\\\",n.instancing?\\\"#define USE_INSTANCING\\\":\\\"\\\",n.instancingColor?\\\"#define USE_INSTANCING_COLOR\\\":\\\"\\\",n.instancingMorph?\\\"#define USE_INSTANCING_MORPH\\\":\\\"\\\",n.useFog&&n.fog?\\\"#define USE_FOG\\\":\\\"\\\",n.useFog&&n.fogExp2?\\\"#define FOG_EXP2\\\":\\\"\\\",n.map?\\\"#define USE_MAP\\\":\\\"\\\",n.envMap?\\\"#define USE_ENVMAP\\\":\\\"\\\",n.envMap?\\\"#define \\\"+p:\\\"\\\",n.lightMap?\\\"#define USE_LIGHTMAP\\\":\\\"\\\",n.aoMap?\\\"#define USE_AOMAP\\\":\\\"\\\",n.bumpMap?\\\"#define USE_BUMPMAP\\\":\\\"\\\",n.normalMap?\\\"#define USE_NORMALMAP\\\":\\\"\\\",n.normalMapObjectSpace?\\\"#define USE_NORMALMAP_OBJECTSPACE\\\":\\\"\\\",n.normalMapTangentSpace?\\\"#define USE_NORMALMAP_TANGENTSPACE\\\":\\\"\\\",n.displacementMap?\\\"#define USE_DISPLACEMENTMAP\\\":\\\"\\\",n.emissiveMap?\\\"#define USE_EMISSIVEMAP\\\":\\\"\\\",n.anisotropy?\\\"#define USE_ANISOTROPY\\\":\\\"\\\",n.anisotropyMap?\\\"#define USE_ANISOTROPYMAP\\\":\\\"\\\",n.clearcoatMap?\\\"#define USE_CLEARCOATMAP\\\":\\\"\\\",n.clearcoatRoughnessMap?\\\"#define USE_CLEARCOAT_ROUGHNESSMAP\\\":\\\"\\\",n.clearcoatNormalMap?\\\"#define USE_CLEARCOAT_NORMALMAP\\\":\\\"\\\",n.iridescenceMap?\\\"#define USE_IRIDESCENCEMAP\\\":\\\"\\\",n.iridescenceThicknessMap?\\\"#define USE_IRIDESCENCE_THICKNESSMAP\\\":\\\"\\\",n.specularMap?\\\"#define USE_SPECULARMAP\\\":\\\"\\\",n.specularColorMap?\\\"#define USE_SPECULAR_COLORMAP\\\":\\\"\\\",n.specularIntensityMap?\\\"#define USE_SPECULAR_INTENSITYMAP\\\":\\\"\\\",n.roughnessMap?\\\"#define USE_ROUGHNESSMAP\\\":\\\"\\\",n.metalnessMap?\\\"#define USE_METALNESSMAP\\\":\\\"\\\",n.alphaMap?\\\"#define USE_ALPHAMAP\\\":\\\"\\\",n.alphaHash?\\\"#define USE_ALPHAHASH\\\":\\\"\\\",n.transmission?\\\"#define USE_TRANSMISSION\\\":\\\"\\\",n.transmissionMap?\\\"#define USE_TRANSMISSIONMAP\\\":\\\"\\\",n.thicknessMap?\\\"#define USE_THICKNESSMAP\\\":\\\"\\\",n.sheenColorMap?\\\"#define USE_SHEEN_COLORMAP\\\":\\\"\\\",n.sheenRoughnessMap?\\\"#define USE_SHEEN_ROUGHNESSMAP\\\":\\\"\\\",n.mapUv?\\\"#define MAP_UV \\\"+n.mapUv:\\\"\\\",n.alphaMapUv?\\\"#define ALPHAMAP_UV \\\"+n.alphaMapUv:\\\"\\\",n.lightMapUv?\\\"#define LIGHTMAP_UV \\\"+n.lightMapUv:\\\"\\\",n.aoMapUv?\\\"#define AOMAP_UV \\\"+n.aoMapUv:\\\"\\\",n.emissiveMapUv?\\\"#define EMISSIVEMAP_UV \\\"+n.emissiveMapUv:\\\"\\\",n.bumpMapUv?\\\"#define BUMPMAP_UV \\\"+n.bumpMapUv:\\\"\\\",n.normalMapUv?\\\"#define NORMALMAP_UV \\\"+n.normalMapUv:\\\"\\\",n.displacementMapUv?\\\"#define DISPLACEMENTMAP_UV \\\"+n.displacementMapUv:\\\"\\\",n.metalnessMapUv?\\\"#define METALNESSMAP_UV \\\"+n.metalnessMapUv:\\\"\\\",n.roughnessMapUv?\\\"#define ROUGHNESSMAP_UV \\\"+n.roughnessMapUv:\\\"\\\",n.anisotropyMapUv?\\\"#define ANISOTROPYMAP_UV \\\"+n.anisotropyMapUv:\\\"\\\",n.clearcoatMapUv?\\\"#define CLEARCOATMAP_UV \\\"+n.clearcoatMapUv:\\\"\\\",n.clearcoatNormalMapUv?\\\"#define CLEARCOAT_NORMALMAP_UV \\\"+n.clearcoatNormalMapUv:\\\"\\\",n.clearcoatRoughnessMapUv?\\\"#define CLEARCOAT_ROUGHNESSMAP_UV \\\"+n.clearcoatRoughnessMapUv:\\\"\\\",n.iridescenceMapUv?\\\"#define IRIDESCENCEMAP_UV \\\"+n.iridescenceMapUv:\\\"\\\",n.iridescenceThicknessMapUv?\\\"#define IRIDESCENCE_THICKNESSMAP_UV \\\"+n.iridescenceThicknessMapUv:\\\"\\\",n.sheenColorMapUv?\\\"#define SHEEN_COLORMAP_UV \\\"+n.sheenColorMapUv:\\\"\\\",n.sheenRoughnessMapUv?\\\"#define SHEEN_ROUGHNESSMAP_UV \\\"+n.sheenRoughnessMapUv:\\\"\\\",n.specularMapUv?\\\"#define SPECULARMAP_UV \\\"+n.specularMapUv:\\\"\\\",n.specularColorMapUv?\\\"#define SPECULAR_COLORMAP_UV \\\"+n.specularColorMapUv:\\\"\\\",n.specularIntensityMapUv?\\\"#define SPECULAR_INTENSITYMAP_UV \\\"+n.specularIntensityMapUv:\\\"\\\",n.transmissionMapUv?\\\"#define TRANSMISSIONMAP_UV \\\"+n.transmissionMapUv:\\\"\\\",n.thicknessMapUv?\\\"#define THICKNESSMAP_UV \\\"+n.thicknessMapUv:\\\"\\\",n.vertexTangents&&!1===n.flatShading?\\\"#define USE_TANGENT\\\":\\\"\\\",n.vertexColors?\\\"#define USE_COLOR\\\":\\\"\\\",n.vertexAlphas?\\\"#define USE_COLOR_ALPHA\\\":\\\"\\\",n.vertexUv1s?\\\"#define USE_UV1\\\":\\\"\\\",n.vertexUv2s?\\\"#define USE_UV2\\\":\\\"\\\",n.vertexUv3s?\\\"#define USE_UV3\\\":\\\"\\\",n.pointsUvs?\\\"#define USE_POINTS_UV\\\":\\\"\\\",n.flatShading?\\\"#define FLAT_SHADED\\\":\\\"\\\",n.skinning?\\\"#define USE_SKINNING\\\":\\\"\\\",n.morphTargets?\\\"#define USE_MORPHTARGETS\\\":\\\"\\\",n.morphNormals&&!1===n.flatShading?\\\"#define USE_MORPHNORMALS\\\":\\\"\\\",n.morphColors?\\\"#define USE_MORPHCOLORS\\\":\\\"\\\",n.morphTargetsCount>0?\\\"#define MORPHTARGETS_TEXTURE_STRIDE \\\"+n.morphTextureStride:\\\"\\\",n.morphTargetsCount>0?\\\"#define MORPHTARGETS_COUNT \\\"+n.morphTargetsCount:\\\"\\\",n.doubleSided?\\\"#define DOUBLE_SIDED\\\":\\\"\\\",n.flipSided?\\\"#define FLIP_SIDED\\\":\\\"\\\",n.shadowMapEnabled?\\\"#define USE_SHADOWMAP\\\":\\\"\\\",n.shadowMapEnabled?\\\"#define \\\"+u:\\\"\\\",n.sizeAttenuation?\\\"#define USE_SIZEATTENUATION\\\":\\\"\\\",n.numLightProbes>0?\\\"#define USE_LIGHT_PROBES\\\":\\\"\\\",n.logarithmicDepthBuffer?\\\"#define USE_LOGARITHMIC_DEPTH_BUFFER\\\":\\\"\\\",n.reversedDepthBuffer?\\\"#define USE_REVERSED_DEPTH_BUFFER\\\":\\\"\\\",\\\"uniform mat4 modelMatrix;\\\",\\\"uniform mat4 modelViewMatrix;\\\",\\\"uniform mat4 projectionMatrix;\\\",\\\"uniform mat4 viewMatrix;\\\",\\\"uniform mat3 normalMatrix;\\\",\\\"uniform vec3 cameraPosition;\\\",\\\"uniform bool isOrthographic;\\\",\\\"#ifdef USE_INSTANCING\\\",\\\"\\\\tattribute mat4 instanceMatrix;\\\",\\\"#endif\\\",\\\"#ifdef USE_INSTANCING_COLOR\\\",\\\"\\\\tattribute vec3 instanceColor;\\\",\\\"#endif\\\",\\\"#ifdef USE_INSTANCING_MORPH\\\",\\\"\\\\tuniform sampler2D morphTexture;\\\",\\\"#endif\\\",\\\"attribute vec3 position;\\\",\\\"attribute vec3 normal;\\\",\\\"attribute vec2 uv;\\\",\\\"#ifdef USE_UV1\\\",\\\"\\\\tattribute vec2 uv1;\\\",\\\"#endif\\\",\\\"#ifdef USE_UV2\\\",\\\"\\\\tattribute vec2 uv2;\\\",\\\"#endif\\\",\\\"#ifdef USE_UV3\\\",\\\"\\\\tattribute vec2 uv3;\\\",\\\"#endif\\\",\\\"#ifdef USE_TANGENT\\\",\\\"\\\\tattribute vec4 tangent;\\\",\\\"#endif\\\",\\\"#if defined( USE_COLOR_ALPHA )\\\",\\\"\\\\tattribute vec4 color;\\\",\\\"#elif defined( USE_COLOR )\\\",\\\"\\\\tattribute vec3 color;\\\",\\\"#endif\\\",\\\"#ifdef USE_SKINNING\\\",\\\"\\\\tattribute vec4 skinIndex;\\\",\\\"\\\\tattribute vec4 skinWeight;\\\",\\\"#endif\\\",\\\"\\\\n\\\"].filter(xn).join(\\\"\\\\n\\\"),y=[An(n),\\\"#define SHADER_TYPE \\\"+n.shaderType,\\\"#define SHADER_NAME \\\"+n.shaderName,_,n.useFog&&n.fog?\\\"#define USE_FOG\\\":\\\"\\\",n.useFog&&n.fogExp2?\\\"#define FOG_EXP2\\\":\\\"\\\",n.alphaToCoverage?\\\"#define ALPHA_TO_COVERAGE\\\":\\\"\\\",n.map?\\\"#define USE_MAP\\\":\\\"\\\",n.matcap?\\\"#define USE_MATCAP\\\":\\\"\\\",n.envMap?\\\"#define USE_ENVMAP\\\":\\\"\\\",n.envMap?\\\"#define \\\"+d:\\\"\\\",n.envMap?\\\"#define \\\"+p:\\\"\\\",n.envMap?\\\"#define \\\"+f:\\\"\\\",m?\\\"#define CUBEUV_TEXEL_WIDTH \\\"+m.texelWidth:\\\"\\\",m?\\\"#define CUBEUV_TEXEL_HEIGHT \\\"+m.texelHeight:\\\"\\\",m?\\\"#define CUBEUV_MAX_MIP \\\"+m.maxMip+\\\".0\\\":\\\"\\\",n.lightMap?\\\"#define USE_LIGHTMAP\\\":\\\"\\\",n.aoMap?\\\"#define USE_AOMAP\\\":\\\"\\\",n.bumpMap?\\\"#define USE_BUMPMAP\\\":\\\"\\\",n.normalMap?\\\"#define USE_NORMALMAP\\\":\\\"\\\",n.normalMapObjectSpace?\\\"#define USE_NORMALMAP_OBJECTSPACE\\\":\\\"\\\",n.normalMapTangentSpace?\\\"#define USE_NORMALMAP_TANGENTSPACE\\\":\\\"\\\",n.emissiveMap?\\\"#define USE_EMISSIVEMAP\\\":\\\"\\\",n.anisotropy?\\\"#define USE_ANISOTROPY\\\":\\\"\\\",n.anisotropyMap?\\\"#define USE_ANISOTROPYMAP\\\":\\\"\\\",n.clearcoat?\\\"#define USE_CLEARCOAT\\\":\\\"\\\",n.clearcoatMap?\\\"#define USE_CLEARCOATMAP\\\":\\\"\\\",n.clearcoatRoughnessMap?\\\"#define USE_CLEARCOAT_ROUGHNESSMAP\\\":\\\"\\\",n.clearcoatNormalMap?\\\"#define USE_CLEARCOAT_NORMALMAP\\\":\\\"\\\",n.dispersion?\\\"#define USE_DISPERSION\\\":\\\"\\\",n.iridescence?\\\"#define USE_IRIDESCENCE\\\":\\\"\\\",n.iridescenceMap?\\\"#define USE_IRIDESCENCEMAP\\\":\\\"\\\",n.iridescenceThicknessMap?\\\"#define USE_IRIDESCENCE_THICKNESSMAP\\\":\\\"\\\",n.specularMap?\\\"#define USE_SPECULARMAP\\\":\\\"\\\",n.specularColorMap?\\\"#define USE_SPECULAR_COLORMAP\\\":\\\"\\\",n.specularIntensityMap?\\\"#define USE_SPECULAR_INTENSITYMAP\\\":\\\"\\\",n.roughnessMap?\\\"#define USE_ROUGHNESSMAP\\\":\\\"\\\",n.metalnessMap?\\\"#define USE_METALNESSMAP\\\":\\\"\\\",n.alphaMap?\\\"#define USE_ALPHAMAP\\\":\\\"\\\",n.alphaTest?\\\"#define USE_ALPHATEST\\\":\\\"\\\",n.alphaHash?\\\"#define USE_ALPHAHASH\\\":\\\"\\\",n.sheen?\\\"#define USE_SHEEN\\\":\\\"\\\",n.sheenColorMap?\\\"#define USE_SHEEN_COLORMAP\\\":\\\"\\\",n.sheenRoughnessMap?\\\"#define USE_SHEEN_ROUGHNESSMAP\\\":\\\"\\\",n.transmission?\\\"#define USE_TRANSMISSION\\\":\\\"\\\",n.transmissionMap?\\\"#define USE_TRANSMISSIONMAP\\\":\\\"\\\",n.thicknessMap?\\\"#define USE_THICKNESSMAP\\\":\\\"\\\",n.vertexTangents&&!1===n.flatShading?\\\"#define USE_TANGENT\\\":\\\"\\\",n.vertexColors||n.instancingColor||n.batchingColor?\\\"#define USE_COLOR\\\":\\\"\\\",n.vertexAlphas?\\\"#define USE_COLOR_ALPHA\\\":\\\"\\\",n.vertexUv1s?\\\"#define USE_UV1\\\":\\\"\\\",n.vertexUv2s?\\\"#define USE_UV2\\\":\\\"\\\",n.vertexUv3s?\\\"#define USE_UV3\\\":\\\"\\\",n.pointsUvs?\\\"#define USE_POINTS_UV\\\":\\\"\\\",n.gradientMap?\\\"#define USE_GRADIENTMAP\\\":\\\"\\\",n.flatShading?\\\"#define FLAT_SHADED\\\":\\\"\\\",n.doubleSided?\\\"#define DOUBLE_SIDED\\\":\\\"\\\",n.flipSided?\\\"#define FLIP_SIDED\\\":\\\"\\\",n.shadowMapEnabled?\\\"#define USE_SHADOWMAP\\\":\\\"\\\",n.shadowMapEnabled?\\\"#define \\\"+u:\\\"\\\",n.premultipliedAlpha?\\\"#define PREMULTIPLIED_ALPHA\\\":\\\"\\\",n.numLightProbes>0?\\\"#define USE_LIGHT_PROBES\\\":\\\"\\\",n.decodeVideoTexture?\\\"#define DECODE_VIDEO_TEXTURE\\\":\\\"\\\",n.decodeVideoTextureEmissive?\\\"#define DECODE_VIDEO_TEXTURE_EMISSIVE\\\":\\\"\\\",n.logarithmicDepthBuffer?\\\"#define USE_LOGARITHMIC_DEPTH_BUFFER\\\":\\\"\\\",n.reversedDepthBuffer?\\\"#define USE_REVERSED_DEPTH_BUFFER\\\":\\\"\\\",\\\"uniform mat4 viewMatrix;\\\",\\\"uniform vec3 cameraPosition;\\\",\\\"uniform bool isOrthographic;\\\",0!==n.toneMapping?\\\"#define TONE_MAPPING\\\":\\\"\\\",0!==n.toneMapping?wf.tonemapping_pars_fragment:\\\"\\\",0!==n.toneMapping?fn(\\\"toneMapping\\\",n.toneMapping):\\\"\\\",n.dithering?\\\"#define DITHERING\\\":\\\"\\\",n.opaque?\\\"#define OPAQUE\\\":\\\"\\\",wf.colorspace_pars_fragment,pn(\\\"linearToOutputTexel\\\",n.outputColorSpace),mn(),n.useDepthPacking?\\\"#define DEPTH_PACKING \\\"+n.depthPacking:\\\"\\\",\\\"\\\\n\\\"].filter(xn).join(\\\"\\\\n\\\")),c=Sn(c),c=yn(c,n),c=Mn(c,n),h=Sn(h),h=yn(h,n),h=Mn(h,n),c=bn(c),h=bn(h),!0!==n.isRawShaderMaterial&&(M=\\\"#version 300 es\\\\n\\\",x=[g,\\\"#define attribute in\\\",\\\"#define varying out\\\",\\\"#define texture2D texture\\\"].join(\\\"\\\\n\\\")+\\\"\\\\n\\\"+x,y=[\\\"#define varying in\\\",n.glslVersion===gl?\\\"\\\":\\\"layout(location = 0) out highp vec4 pc_fragColor;\\\",n.glslVersion===gl?\\\"\\\":\\\"#define gl_FragColor pc_fragColor\\\",\\\"#define gl_FragDepthEXT gl_FragDepth\\\",\\\"#define texture2D texture\\\",\\\"#define textureCube texture\\\",\\\"#define texture2DProj textureProj\\\",\\\"#define texture2DLodEXT textureLod\\\",\\\"#define texture2DProjLodEXT textureProjLod\\\",\\\"#define textureCubeLodEXT textureLod\\\",\\\"#define texture2DGradEXT textureGrad\\\",\\\"#define texture2DProjGradEXT textureProjGrad\\\",\\\"#define textureCubeGradEXT textureGrad\\\"].join(\\\"\\\\n\\\")+\\\"\\\\n\\\"+y);const S=M+x+c,T=M+y+h,b=cn(o,o.VERTEX_SHADER,S),E=cn(o,o.FRAGMENT_SHADER,T);let A,w;o.attachShader(v,b),o.attachShader(v,E),void 0!==n.index0AttributeName?o.bindAttribLocation(v,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(v,0,\\\"position\\\"),o.linkProgram(v),this.getUniforms=function(){return void 0===A&&r(this),A},this.getAttributes=function(){return void 0===w&&r(this),w};let R=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===R&&(R=o.getProgramParameter(v,om)),R},this.destroy=function(){i.releaseStatesOfProgram(this),o.deleteProgram(v),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=lm++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=b,this.fragmentShader=E,this}function Nn(t,e,n,i,r,a,o){function l(t){return u.add(t),0===t?\\\"uv\\\":`uv${t}`}const c=new Ic,h=new ym,u=new Set,d=[],p=new Map,f=r.logarithmicDepthBuffer;let m=r.precision;const g={MeshDepthMaterial:\\\"depth\\\",MeshDistanceMaterial:\\\"distance\\\",MeshNormalMaterial:\\\"normal\\\",MeshBasicMaterial:\\\"basic\\\",MeshLambertMaterial:\\\"lambert\\\",MeshPhongMaterial:\\\"phong\\\",MeshToonMaterial:\\\"toon\\\",MeshStandardMaterial:\\\"physical\\\",MeshPhysicalMaterial:\\\"physical\\\",MeshMatcapMaterial:\\\"matcap\\\",LineBasicMaterial:\\\"basic\\\",LineDashedMaterial:\\\"dashed\\\",PointsMaterial:\\\"points\\\",ShadowMaterial:\\\"shadow\\\",SpriteMaterial:\\\"sprite\\\"};return{getParameters:function(a,c,d,p,_){const v=p.fog,x=_.geometry,y=a.isMeshStandardMaterial?p.environment:null,M=(a.isMeshStandardMaterial?n:e).get(a.envMap||y),S=M&&M.mapping===Ma?M.image.height:null,T=g[a.type];null!==a.precision&&(m=r.getMaxPrecision(a.precision),m!==a.precision&&s(\\\"WebGLProgram.getParameters:\\\",a.precision,\\\"not supported, using\\\",m,\\\"instead.\\\"));const b=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,E=void 0!==b?b.length:0;let A,w,R,C,P=0;if(void 0!==x.morphAttributes.position&&(P=1),void 0!==x.morphAttributes.normal&&(P=2),void 0!==x.morphAttributes.color&&(P=3),T){const t=Cf[T];A=t.vertexShader,w=t.fragmentShader}else A=a.vertexShader,w=a.fragmentShader,h.update(a),R=h.getVertexShaderID(a),C=h.getFragmentShaderID(a);const I=t.getRenderTarget(),L=t.state.buffers.depth.getReversed(),N=!0===_.isInstancedMesh,U=!0===_.isBatchedMesh,D=!!a.map,O=!!a.matcap,F=!!M,B=!!a.aoMap,z=!!a.lightMap,k=!!a.bumpMap,V=!!a.normalMap,H=!!a.displacementMap,G=!!a.emissiveMap,W=!!a.metalnessMap,X=!!a.roughnessMap,j=a.anisotropy>0,q=a.clearcoat>0,Y=a.dispersion>0,K=a.iridescence>0,J=a.sheen>0,Z=a.transmission>0,$=j&&!!a.anisotropyMap,Q=q&&!!a.clearcoatMap,tt=q&&!!a.clearcoatNormalMap,et=q&&!!a.clearcoatRoughnessMap,nt=K&&!!a.iridescenceMap,it=K&&!!a.iridescenceThicknessMap,rt=J&&!!a.sheenColorMap,st=J&&!!a.sheenRoughnessMap,at=!!a.specularMap,ot=!!a.specularColorMap,lt=!!a.specularIntensityMap,ct=Z&&!!a.transmissionMap,ht=Z&&!!a.thicknessMap,ut=!!a.gradientMap,dt=!!a.alphaMap,pt=a.alphaTest>0,ft=!!a.alphaHash,mt=!!a.extensions;let gt=0;a.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(gt=t.toneMapping));const _t={shaderID:T,shaderType:a.type,shaderName:a.name,vertexShader:A,fragmentShader:w,defines:a.defines,customVertexShaderID:R,customFragmentShaderID:C,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:m,batching:U,batchingColor:U&&null!==_._colorsTexture,instancing:N,instancingColor:N&&null!==_.instanceColor,instancingMorph:N&&null!==_.morphTexture,outputColorSpace:null===I?t.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:nl,alphaToCoverage:!!a.alphaToCoverage,map:D,matcap:O,envMap:F,envMapMode:F&&M.mapping,envMapCubeUVHeight:S,aoMap:B,lightMap:z,bumpMap:k,normalMap:V,displacementMap:H,emissiveMap:G,normalMapObjectSpace:V&&1===a.normalMapType,normalMapTangentSpace:V&&0===a.normalMapType,metalnessMap:W,roughnessMap:X,anisotropy:j,anisotropyMap:$,clearcoat:q,clearcoatMap:Q,clearcoatNormalMap:tt,clearcoatRoughnessMap:et,dispersion:Y,iridescence:K,iridescenceMap:nt,iridescenceThicknessMap:it,sheen:J,sheenColorMap:rt,sheenRoughnessMap:st,specularMap:at,specularColorMap:ot,specularIntensityMap:lt,transmission:Z,transmissionMap:ct,thicknessMap:ht,gradientMap:ut,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:dt,alphaTest:pt,alphaHash:ft,combine:a.combine,mapUv:D&&l(a.map.channel),aoMapUv:B&&l(a.aoMap.channel),lightMapUv:z&&l(a.lightMap.channel),bumpMapUv:k&&l(a.bumpMap.channel),normalMapUv:V&&l(a.normalMap.channel),displacementMapUv:H&&l(a.displacementMap.channel),emissiveMapUv:G&&l(a.emissiveMap.channel),metalnessMapUv:W&&l(a.metalnessMap.channel),roughnessMapUv:X&&l(a.roughnessMap.channel),anisotropyMapUv:$&&l(a.anisotropyMap.channel),clearcoatMapUv:Q&&l(a.clearcoatMap.channel),clearcoatNormalMapUv:tt&&l(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&l(a.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&l(a.iridescenceMap.channel),iridescenceThicknessMapUv:it&&l(a.iridescenceThicknessMap.channel),sheenColorMapUv:rt&&l(a.sheenColorMap.channel),sheenRoughnessMapUv:st&&l(a.sheenRoughnessMap.channel),specularMapUv:at&&l(a.specularMap.channel),specularColorMapUv:ot&&l(a.specularColorMap.channel),specularIntensityMapUv:lt&&l(a.specularIntensityMap.channel),transmissionMapUv:ct&&l(a.transmissionMap.channel),thicknessMapUv:ht&&l(a.thicknessMap.channel),alphaMapUv:dt&&l(a.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(V||j),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===_.isPoints&&!!x.attributes.uv&&(D||dt),fog:!!v,useFog:!0===a.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===a.flatShading&&!1===a.wireframe,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:f,reversedDepthBuffer:L,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:E,morphTextureStride:P,numDirLights:c.directional.length,numPointLights:c.point.length,numSpotLights:c.spot.length,numSpotLightMaps:c.spotLightMap.length,numRectAreaLights:c.rectArea.length,numHemiLights:c.hemi.length,numDirLightShadows:c.directionalShadowMap.length,numPointLightShadows:c.pointShadowMap.length,numSpotLightShadows:c.spotShadowMap.length,numSpotLightShadowsWithMaps:c.numSpotLightShadowsWithMaps,numLightProbes:c.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&d.length>0,shadowMapType:t.shadowMap.type,toneMapping:gt,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&Dl.getTransfer(a.map.colorSpace)===rl,decodeVideoTextureEmissive:G&&!0===a.emissiveMap.isVideoTexture&&Dl.getTransfer(a.emissiveMap.colorSpace)===rl,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:mt&&!0===a.extensions.clipCullDistance&&i.has(\\\"WEBGL_clip_cull_distance\\\"),extensionMultiDraw:(mt&&!0===a.extensions.multiDraw||U)&&i.has(\\\"WEBGL_multi_draw\\\"),rendererExtensionParallelShaderCompile:i.has(\\\"KHR_parallel_shader_compile\\\"),customProgramCacheKey:a.customProgramCacheKey()};return _t.vertexUv1s=u.has(1),_t.vertexUv2s=u.has(2),_t.vertexUv3s=u.has(3),u.clear(),_t},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){c.disableAll(),e.instancing&&c.enable(0),e.instancingColor&&c.enable(1),e.instancingMorph&&c.enable(2),e.matcap&&c.enable(3),e.envMap&&c.enable(4),e.normalMapObjectSpace&&c.enable(5),e.normalMapTangentSpace&&c.enable(6),e.clearcoat&&c.enable(7),e.iridescence&&c.enable(8),e.alphaTest&&c.enable(9),e.vertexColors&&c.enable(10),e.vertexAlphas&&c.enable(11),e.vertexUv1s&&c.enable(12),e.vertexUv2s&&c.enable(13),e.vertexUv3s&&c.enable(14),e.vertexTangents&&c.enable(15),e.anisotropy&&c.enable(16),e.alphaHash&&c.enable(17),e.batching&&c.enable(18),e.dispersion&&c.enable(19),e.batchingColor&&c.enable(20),e.gradientMap&&c.enable(21),t.push(c.mask),c.disableAll(),e.fog&&c.enable(0),e.useFog&&c.enable(1),e.flatShading&&c.enable(2),e.logarithmicDepthBuffer&&c.enable(3),e.reversedDepthBuffer&&c.enable(4),e.skinning&&c.enable(5),e.morphTargets&&c.enable(6),e.morphNormals&&c.enable(7),e.morphColors&&c.enable(8),e.premultipliedAlpha&&c.enable(9),e.shadowMapEnabled&&c.enable(10),e.doubleSided&&c.enable(11),e.flipSided&&c.enable(12),e.useDepthPacking&&c.enable(13),e.dithering&&c.enable(14),e.transmission&&c.enable(15),e.sheen&&c.enable(16),e.opaque&&c.enable(17),e.pointsUvs&&c.enable(18),e.decodeVideoTexture&&c.enable(19),e.decodeVideoTextureEmissive&&c.enable(20),e.alphaToCoverage&&c.enable(21),t.push(c.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=g[t.type];let n;if(e){const t=Cf[e];n=Wh.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i=p.get(n);return void 0!==i?++i.usedTimes:(i=new Ln(t,n,e,a),d.push(i),p.set(n,i)),i},releaseProgram:function(t){if(0===--t.usedTimes){const e=d.indexOf(t);d[e]=d[d.length-1],d.pop(),p.delete(t.cacheKey),t.destroy()}},releaseShaderCache:function(t){h.remove(t)},programs:d,dispose:function(){h.dispose()}}}function Un(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Dn(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function On(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Fn(){function t(t,i,r,s,a,o){let l=e[n];return void 0===l?(l={id:t.id,object:t,geometry:i,material:r,groupOrder:s,renderOrder:t.renderOrder,z:a,group:o},e[n]=l):(l.id=t.id,l.object=t,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=t.renderOrder,l.z=a,l.group=o),n++,l}const e=[];let n=0;const i=[],r=[],s=[];return{opaque:i,transmissive:r,transparent:s,init:function(){n=0,i.length=0,r.length=0,s.length=0},push:function(e,n,a,o,l,c){const h=t(e,n,a,o,l,c);a.transmission>0?r.push(h):!0===a.transparent?s.push(h):i.push(h)},unshift:function(e,n,a,o,l,c){const h=t(e,n,a,o,l,c);a.transmission>0?r.unshift(h):!0===a.transparent?s.unshift(h):i.unshift(h)},finish:function(){for(let t=n,i=e.length;i>t;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.group=null}},sort:function(t,e){i.length>1&&i.sort(t||Dn),r.length>1&&r.sort(e||On),s.length>1&&s.sort(e||On)}}}function Bn(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new Fn,t.set(e,[r])):n<i.length?r=i[n]:(r=new Fn,i.push(r)),r},dispose:function(){t=new WeakMap}}}function zn(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case\\\"DirectionalLight\\\":n={direction:new Rl,color:new uh};break;case\\\"SpotLight\\\":n={position:new Rl,direction:new Rl,color:new uh,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case\\\"PointLight\\\":n={position:new Rl,color:new uh,distance:0,decay:0};break;case\\\"HemisphereLight\\\":n={direction:new Rl,skyColor:new uh,groundColor:new uh};break;case\\\"RectAreaLight\\\":n={color:new uh,position:new Rl,halfWidth:new Rl,halfHeight:new Rl}}return t[e.id]=n,n}}}function kn(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case\\\"DirectionalLight\\\":case\\\"SpotLight\\\":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Al};break;case\\\"PointLight\\\":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Al,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}function Vn(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Hn(t){const e=new zn,n=kn(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;9>t;t++)i.probe.push(new Rl);const r=new Rl,s=new yc,a=new yc;return{setup:function(r){let s=0,a=0,o=0;for(let t=0;9>t;t++)i.probe[t].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0;r.sort(Vn);for(let t=0,x=r.length;x>t;t++){const x=r[t],y=x.color,M=x.intensity,S=x.distance;let T=null;if(x.shadow&&x.shadow.map&&(T=x.shadow.map.texture.format===Za?x.shadow.map.texture:x.shadow.map.depthTexture||x.shadow.map.texture),x.isAmbientLight)s+=y.r*M,a+=y.g*M,o+=y.b*M;else if(x.isLightProbe){for(let t=0;9>t;t++)i.probe[t].addScaledVector(x.sh.coefficients[t],M);v++}else if(x.isDirectionalLight){const t=e.get(x);if(t.color.copy(x.color).multiplyScalar(x.intensity),x.castShadow){const t=x.shadow,e=n.get(x);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,i.directionalShadow[l]=e,i.directionalShadowMap[l]=T,i.directionalShadowMatrix[l]=x.shadow.matrix,p++}i.directional[l]=t,l++}else if(x.isSpotLight){const t=e.get(x);t.position.setFromMatrixPosition(x.matrixWorld),t.color.copy(y).multiplyScalar(M),t.distance=S,t.coneCos=Math.cos(x.angle),t.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),t.decay=x.decay,i.spot[h]=t;const r=x.shadow;if(x.map&&(i.spotLightMap[g]=x.map,g++,r.updateMatrices(x),x.castShadow&&_++),i.spotLightMatrix[h]=r.matrix,x.castShadow){const t=n.get(x);t.shadowIntensity=r.intensity,t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,i.spotShadow[h]=t,i.spotShadowMap[h]=T,m++}h++}else if(x.isRectAreaLight){const t=e.get(x);t.color.copy(y).multiplyScalar(M),t.halfWidth.set(.5*x.width,0,0),t.halfHeight.set(0,.5*x.height,0),i.rectArea[u]=t,u++}else if(x.isPointLight){const t=e.get(x);if(t.color.copy(x.color).multiplyScalar(x.intensity),t.distance=x.distance,t.decay=x.decay,x.castShadow){const t=x.shadow,e=n.get(x);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,i.pointShadow[c]=e,i.pointShadowMap[c]=T,i.pointShadowMatrix[c]=x.shadow.matrix,f++}i.point[c]=t,c++}else if(x.isHemisphereLight){const t=e.get(x);t.skyColor.copy(x.color).multiplyScalar(M),t.groundColor.copy(x.groundColor).multiplyScalar(M),i.hemi[d]=t,d++}}u>0&&(!0===t.has(\\\"OES_texture_float_linear\\\")?(i.rectAreaLTC1=Rf.LTC_FLOAT_1,i.rectAreaLTC2=Rf.LTC_FLOAT_2):(i.rectAreaLTC1=Rf.LTC_HALF_1,i.rectAreaLTC2=Rf.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=a,i.ambient[2]=o;const x=i.hash;x.directionalLength===l&&x.pointLength===c&&x.spotLength===h&&x.rectAreaLength===u&&x.hemiLength===d&&x.numDirectionalShadows===p&&x.numPointShadows===f&&x.numSpotShadows===m&&x.numSpotMaps===g&&x.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=u,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=m+g-_,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=_,i.numLightProbes=v,x.directionalLength=l,x.pointLength=c,x.spotLength=h,x.rectAreaLength=u,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=v,i.version=Sm++)},setupView:function(t,e){let n=0,o=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;d>e;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),a.identity(),s.copy(d.matrixWorld),s.premultiply(u),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),c++}else if(d.isPointLight){const t=i.point[o];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o++}else if(d.isHemisphereLight){const t=i.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),h++}}},state:i}}function Gn(t){const e=new Hn(t),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){r.camera=t,n.length=0,i.length=0},state:r,setupLights:function(){e.setup(n)},setupLightsView:function(t){e.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){i.push(t)}}}function Wn(t){let e=new WeakMap;return{get:function(n,i=0){const r=e.get(n);let s;return void 0===r?(s=new Gn(t),e.set(n,[s])):i<r.length?s=r[i]:(s=new Gn(t),r.push(s)),s},dispose:function(){e=new WeakMap}}}function Xn(t,e,n){function i(n,i){const r=e.update(y);_.defines.VSM_SAMPLES!==n.blurSamples&&(_.defines.VSM_SAMPLES=n.blurSamples,v.defines.VSM_SAMPLES=n.blurSamples,_.needsUpdate=!0,v.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Xl(c.x,c.y,{format:Za,type:Ba})),_.uniforms.shadow_pass.value=n.map.depthTexture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,_,y,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,v,y,null)}function r(e,n,i,r){let s=null;const a=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==a)s=a;else if(s=!0===i.isPointLight?p:d,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const t=s.uuid,e=n.uuid;let i=f[t];void 0===i&&(i={},f[t]=i);let r=i[e];void 0===r&&(r=s.clone(),i[e]=r,n.addEventListener(\\\"dispose\\\",o)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:g[n.side],s.alphaMap=n.alphaMap,s.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(t.properties.get(s).light=i),s}function a(n,i,s,o,c){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===c)&&(!n.frustumCulled||l.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const a=e.update(n),l=n.material;if(Array.isArray(l)){const e=a.groups;for(let h=0,u=e.length;u>h;h++){const u=e[h],d=l[u.materialIndex];if(d&&d.visible){const e=r(n,d,o,c);n.onBeforeShadow(t,n,i,s,a,e,u),t.renderBufferDirect(s,null,a,e,n,u),n.onAfterShadow(t,n,i,s,a,e,u)}}}else if(l.visible){const e=r(n,l,o,c);n.onBeforeShadow(t,n,i,s,a,e,null),t.renderBufferDirect(s,null,a,e,n,null),n.onAfterShadow(t,n,i,s,a,e,null)}}const h=n.children;for(let t=0,e=h.length;e>t;t++)a(h[t],i,s,o,c)}function o(t){t.target.removeEventListener(\\\"dispose\\\",o);for(const e in f){const n=f[e],i=t.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}let l=new ku;const c=new Al,h=new Al,u=new Gl,d=new Bd,p=new zd,f={},m=n.maxTextureSize,g={[ys]:1,[Ms]:0,[Ss]:2},_=new Xh({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Al},radius:{value:4}},vertexShader:Tm,fragmentShader:bm}),v=_.clone();v.defines.HORIZONTAL_PASS=1;const x=new Ph;x.setAttribute(\\\"position\\\",new xh(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Hh(x,_),M=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let S=this.type;this.render=function(e,n,r){if(!1===M.enabled)return;if(!1===M.autoUpdate&&!1===M.needsUpdate)return;if(0===e.length)return;2===e.type&&(s(\\\"WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead.\\\"),e.type=1);const o=t.getRenderTarget(),d=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),f=t.state;f.setBlending(0),!0===f.buffers.depth.getReversed()?f.buffers.color.setClear(0,0,0,0):f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);const g=S!==this.type;g&&n.traverse(function(t){t.material&&(Array.isArray(t.material)?t.material.forEach(t=>t.needsUpdate=!0):t.material.needsUpdate=!0)});for(let o=0,d=e.length;d>o;o++){const d=e[o],p=d.shadow;if(void 0===p){s(\\\"WebGLShadowMap:\\\",d,\\\"has no shadow.\\\");continue}if(!1===p.autoUpdate&&!1===p.needsUpdate)continue;c.copy(p.mapSize);const _=p.getFrameExtents();if(c.multiply(_),h.copy(p.mapSize),(c.x>m||c.y>m)&&(c.x>m&&(h.x=Math.floor(m/_.x),c.x=h.x*_.x,p.mapSize.x=h.x),c.y>m&&(h.y=Math.floor(m/_.y),c.y=h.y*_.y,p.mapSize.y=h.y)),null===p.map||!0===g){if(null!==p.map&&(null!==p.map.depthTexture&&(p.map.depthTexture.dispose(),p.map.depthTexture=null),p.map.dispose()),3===this.type){if(d.isPointLight){s(\\\"WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.\\\");continue}p.map=new Xl(c.x,c.y,{format:Za,type:Ba,minFilter:Ra,magFilter:Ra,generateMipmaps:!1}),p.map.texture.name=d.name+\\\".shadowMap\\\",p.map.depthTexture=new ad(c.x,c.y,Fa),p.map.depthTexture.name=d.name+\\\".shadowMapDepth\\\",p.map.depthTexture.format=qa,p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=Ea,p.map.depthTexture.magFilter=Ea}else{d.isPointLight?(p.map=new eu(c.x),p.map.depthTexture=new od(c.x,Oa)):(p.map=new Xl(c.x,c.y),p.map.depthTexture=new ad(c.x,c.y,Oa)),p.map.depthTexture.name=d.name+\\\".shadowMap\\\",p.map.depthTexture.format=qa;const e=t.state.buffers.depth.getReversed();1===this.type?(p.map.depthTexture.compareFunction=e?pl:hl,p.map.depthTexture.minFilter=Ra,p.map.depthTexture.magFilter=Ra):(p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=Ea,p.map.depthTexture.magFilter=Ea)}p.camera.updateProjectionMatrix()}const v=p.map.isWebGLCubeRenderTarget?6:1;for(let e=0;v>e;e++){if(p.map.isWebGLCubeRenderTarget)t.setRenderTarget(p.map,e),t.clear();else{0===e&&(t.setRenderTarget(p.map),t.clear());const n=p.getViewport(e);u.set(h.x*n.x,h.y*n.y,h.x*n.z,h.y*n.w),f.viewport(u)}if(d.isPointLight){const t=p.camera,n=p.matrix,i=d.distance||t.far;i!==t.far&&(t.far=i,t.updateProjectionMatrix()),Rm.setFromMatrixPosition(d.matrixWorld),t.position.copy(Rm),Cm.copy(t.position),Cm.add(Em[e]),t.up.copy(Am[e]),t.lookAt(Cm),t.updateMatrixWorld(),n.makeTranslation(-Rm.x,-Rm.y,-Rm.z),wm.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),p._frustum.setFromProjectionMatrix(wm,t.coordinateSystem,t.reversedDepth)}else p.updateMatrices(d);l=p.getFrustum(),a(n,r,p.camera,d,this.type)}!0!==p.isPointLightShadow&&3===this.type&&i(p,r),p.needsUpdate=!1}S=this.type,M.needsUpdate=!1,t.setRenderTarget(o,d,p)}}function jn(t,e){function n(e,n,i,r){const s=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let a=0;i>a;a++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,s):t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,s);return a}function i(e){!0!==m[e]&&(t.enable(e),m[e]=!0)}function r(e){!1!==m[e]&&(t.disable(e),m[e]=!1)}function s(e,n,s,o,l,c,h,u,d,p){if(0!==e){if(!1===y&&(i(t.BLEND),y=!0),5===e)l=l||n,c=c||s,h=h||o,n===S&&l===E||(t.blendEquationSeparate(q[n],q[l]),S=n,E=l),s===T&&o===b&&c===A&&h===w||(t.blendFuncSeparate(Y[s],Y[o],Y[c],Y[h]),T=s,b=o,A=c,w=h),!1!==u.equals(R)&&d===C||(t.blendColor(u.r,u.g,u.b,d),R.copy(u),C=d),M=e,P=!1;else if(e!==M||p!==P){if(S===Cs&&E===Cs||(t.blendEquation(t.FUNC_ADD),S=Cs,E=Cs),p)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:a(\\\"WebGLState: Invalid blending: \\\",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case 3:a(\\\"WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true\\\");break;case 4:a(\\\"WebGLState: MultiplyBlending requires material.premultipliedAlpha = true\\\");break;default:a(\\\"WebGLState: Invalid blending: \\\",e)}T=null,b=null,A=null,w=null,R.set(0,0,0),C=0,M=e,P=p}}else!0===y&&(r(t.BLEND),y=!1)}function o(e){I!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),I=e)}function l(e){0!==e?(i(t.CULL_FACE),e!==L&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):r(t.CULL_FACE),L=e}function c(e,n,s){e?(i(t.POLYGON_OFFSET_FILL),U===n&&D===s||(t.polygonOffset(n,s),U=n,D=s)):r(t.POLYGON_OFFSET_FILL)}const h=new function(){let e=!1;const n=new Gl;let i=null;const r=new Gl(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,s,a,o){!0===o&&(e*=a,i*=a,s*=a),n.set(e,i,s,a),!1===r.equals(n)&&(t.clearColor(e,i,s,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},u=new function(){let n=!1,s=!1,a=null,o=null,l=null;return{setReversed:function(t){if(s!==t){const n=e.get(\\\"EXT_clip_control\\\");t?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),s=t;const i=l;l=null,this.setClear(i)}},getReversed:function(){return s},setTest:function(e){e?i(t.DEPTH_TEST):r(t.DEPTH_TEST)},setMask:function(e){a===e||n||(t.depthMask(e),a=e)},setFunc:function(e){if(s&&(e=Pm[e]),o!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}o=e}},setLocked:function(t){n=t},setClear:function(e){l!==e&&(s&&(e=1-e),t.clearDepth(e),l=e)},reset:function(){n=!1,a=null,o=null,l=null,s=!1}}},d=new function(){let e=!1,n=null,s=null,a=null,o=null,l=null,c=null,h=null,u=null;return{setTest:function(n){e||(n?i(t.STENCIL_TEST):r(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,i){s===e&&a===n&&o===i||(t.stencilFunc(e,n,i),s=e,a=n,o=i)},setOp:function(e,n,i){l===e&&c===n&&h===i||(t.stencilOp(e,n,i),l=e,c=n,h=i)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,n=null,s=null,a=null,o=null,l=null,c=null,h=null,u=null}}},p=new WeakMap,f=new WeakMap;let m={},g={},_=new WeakMap,v=[],x=null,y=!1,M=null,S=null,T=null,b=null,E=null,A=null,w=null,R=new uh(0,0,0),C=0,P=!1,I=null,L=null,N=null,U=null,D=null;const O=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let F=!1,B=0;const z=t.getParameter(t.VERSION);-1!==z.indexOf(\\\"WebGL\\\")?(B=parseFloat(/^WebGL (\\\\d)/.exec(z)[1]),F=B>=1):-1!==z.indexOf(\\\"OpenGL ES\\\")&&(B=parseFloat(/^OpenGL ES (\\\\d)/.exec(z)[1]),F=B>=2);let k=null,V={};const H=t.getParameter(t.SCISSOR_BOX),G=t.getParameter(t.VIEWPORT),W=(new Gl).fromArray(H),X=(new Gl).fromArray(G),j={};j[t.TEXTURE_2D]=n(t.TEXTURE_2D,t.TEXTURE_2D,1),j[t.TEXTURE_CUBE_MAP]=n(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),j[t.TEXTURE_2D_ARRAY]=n(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),j[t.TEXTURE_3D]=n(t.TEXTURE_3D,t.TEXTURE_3D,1,1),h.setClear(0,0,0,1),u.setClear(1),d.setClear(0),i(t.DEPTH_TEST),u.setFunc(3),o(!1),l(1),i(t.CULL_FACE),s(0);const q={[Cs]:t.FUNC_ADD,[Ps]:t.FUNC_SUBTRACT,[Is]:t.FUNC_REVERSE_SUBTRACT};q[103]=t.MIN,q[104]=t.MAX;const Y={[Us]:t.ZERO,[Ds]:t.ONE,[Os]:t.SRC_COLOR,[Bs]:t.SRC_ALPHA,[Ws]:t.SRC_ALPHA_SATURATE,[Hs]:t.DST_COLOR,[ks]:t.DST_ALPHA,[Fs]:t.ONE_MINUS_SRC_COLOR,[zs]:t.ONE_MINUS_SRC_ALPHA,[Gs]:t.ONE_MINUS_DST_COLOR,[Vs]:t.ONE_MINUS_DST_ALPHA,[Xs]:t.CONSTANT_COLOR,[js]:t.ONE_MINUS_CONSTANT_COLOR,[qs]:t.CONSTANT_ALPHA,[Ys]:t.ONE_MINUS_CONSTANT_ALPHA};return{buffers:{color:h,depth:u,stencil:d},enable:i,disable:r,bindFramebuffer:function(e,n){return g[e]!==n&&(t.bindFramebuffer(e,n),g[e]=n,e===t.DRAW_FRAMEBUFFER&&(g[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(g[t.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(e,n){let i=v,r=!1;if(e){i=_.get(n),void 0===i&&(i=[],_.set(n,i));const s=e.textures;if(i.length!==s.length||i[0]!==t.COLOR_ATTACHMENT0){for(let e=0,n=s.length;n>e;e++)i[e]=t.COLOR_ATTACHMENT0+e;i.length=s.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)},useProgram:function(e){return x!==e&&(t.useProgram(e),x=e,!0)},setBlending:s,setMaterial:function(e,n){2===e.side?r(t.CULL_FACE):i(t.CULL_FACE);let a=1===e.side;n&&(a=!a),o(a),1===e.blending&&!1===e.transparent?s(0):s(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),u.setFunc(e.depthFunc),u.setTest(e.depthTest),u.setMask(e.depthWrite),h.setMask(e.colorWrite);const l=e.stencilWrite;d.setTest(l),l&&(d.setMask(e.stencilWriteMask),d.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),d.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),c(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?i(t.SAMPLE_ALPHA_TO_COVERAGE):r(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:o,setCullFace:l,setLineWidth:function(e){e!==N&&(F&&t.lineWidth(e),N=e)},setPolygonOffset:c,setScissorTest:function(e){e?i(t.SCISSOR_TEST):r(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+O-1),k!==e&&(t.activeTexture(e),k=e)},bindTexture:function(e,n,i){void 0===i&&(i=null===k?t.TEXTURE0+O-1:k);let r=V[i];void 0===r&&(r={type:void 0,texture:void 0},V[i]=r),r.type===e&&r.texture===n||(k!==i&&(t.activeTexture(i),k=i),t.bindTexture(e,n||j[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=V[k];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},texImage2D:function(){try{t.texImage2D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},texImage3D:function(){try{t.texImage3D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},updateUBOMapping:function(e,n){let i=f.get(n);void 0===i&&(i=new WeakMap,f.set(n,i));let r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){const i=f.get(n).get(e);p.get(n)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),p.set(n,i))},texStorage2D:function(){try{t.texStorage2D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},texStorage3D:function(){try{t.texStorage3D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},texSubImage2D:function(){try{t.texSubImage2D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},texSubImage3D:function(){try{t.texSubImage3D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D(...arguments)}catch(t){a(\\\"WebGLState:\\\",t)}},scissor:function(e){!1===W.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),W.copy(e))},viewport:function(e){!1===X.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),X.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),u.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),m={},k=null,V={},g={},_=new WeakMap,v=[],x=null,y=!1,M=null,S=null,T=null,b=null,E=null,A=null,w=null,R=new uh(0,0,0),C=0,P=!1,I=null,L=null,N=null,U=null,D=null,W.set(0,0,t.canvas.width,t.canvas.height),X.set(0,0,t.canvas.width,t.canvas.height),h.reset(),u.reset(),d.reset()}}}function qn(t,e,i,r,o,l,c){function h(t,e){return k?new OffscreenCanvas(t,e):n(\\\"canvas\\\")}function u(t,e,n){let i=1;const r=N(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),1>i){if(\\\"undefined\\\"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||\\\"undefined\\\"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||\\\"undefined\\\"!=typeof ImageBitmap&&t instanceof ImageBitmap||\\\"undefined\\\"!=typeof VideoFrame&&t instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===B&&(B=h(n,a));const o=e?h(n,a):B;return o.width=n,o.height=a,o.getContext(\\\"2d\\\").drawImage(t,0,0,n,a),s(\\\"WebGLRenderer: Texture has been resized from (\\\"+r.width+\\\"x\\\"+r.height+\\\") to (\\\"+n+\\\"x\\\"+a+\\\").\\\"),o}return\\\"data\\\"in t&&s(\\\"WebGLRenderer: Image in DataTexture is too big (\\\"+r.width+\\\"x\\\"+r.height+\\\").\\\"),t}return t}function d(t){return t.generateMipmaps}function p(e){t.generateMipmap(e)}function f(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function m(n,i,r,a,o=!1){if(null!==n){if(void 0!==t[n])return t[n];s(\\\"WebGLRenderer: Attempt to use non-existing WebGL internal format '\\\"+n+\\\"'\\\")}let l=i;if(i===t.RED&&(r===t.FLOAT&&(l=t.R32F),r===t.HALF_FLOAT&&(l=t.R16F),r===t.UNSIGNED_BYTE&&(l=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.R8UI),r===t.UNSIGNED_SHORT&&(l=t.R16UI),r===t.UNSIGNED_INT&&(l=t.R32UI),r===t.BYTE&&(l=t.R8I),r===t.SHORT&&(l=t.R16I),r===t.INT&&(l=t.R32I)),i===t.RG&&(r===t.FLOAT&&(l=t.RG32F),r===t.HALF_FLOAT&&(l=t.RG16F),r===t.UNSIGNED_BYTE&&(l=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.RG8UI),r===t.UNSIGNED_SHORT&&(l=t.RG16UI),r===t.UNSIGNED_INT&&(l=t.RG32UI),r===t.BYTE&&(l=t.RG8I),r===t.SHORT&&(l=t.RG16I),r===t.INT&&(l=t.RG32I)),i===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.RGB8UI),r===t.UNSIGNED_SHORT&&(l=t.RGB16UI),r===t.UNSIGNED_INT&&(l=t.RGB32UI),r===t.BYTE&&(l=t.RGB8I),r===t.SHORT&&(l=t.RGB16I),r===t.INT&&(l=t.RGB32I)),i===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(l=t.RGBA16UI),r===t.UNSIGNED_INT&&(l=t.RGBA32UI),r===t.BYTE&&(l=t.RGBA8I),r===t.SHORT&&(l=t.RGBA16I),r===t.INT&&(l=t.RGBA32I)),i===t.RGB&&(r===t.UNSIGNED_INT_5_9_9_9_REV&&(l=t.RGB9_E5),r===t.UNSIGNED_INT_10F_11F_11F_REV&&(l=t.R11F_G11F_B10F)),i===t.RGBA){const e=o?il:Dl.getTransfer(a);r===t.FLOAT&&(l=t.RGBA32F),r===t.HALF_FLOAT&&(l=t.RGBA16F),r===t.UNSIGNED_BYTE&&(l=e===rl?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(l=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(l=t.RGB5_A1)}return l!==t.R16F&&l!==t.R32F&&l!==t.RG16F&&l!==t.RG32F&&l!==t.RGBA16F&&l!==t.RGBA32F||e.get(\\\"EXT_color_buffer_float\\\"),l}function g(e,n){let i;return e?null===n||n===Oa||n===Va?i=t.DEPTH24_STENCIL8:n===Fa?i=t.DEPTH32F_STENCIL8:n===Ua&&(i=t.DEPTH24_STENCIL8,s(\\\"DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.\\\")):null===n||n===Oa||n===Va?i=t.DEPTH_COMPONENT24:n===Fa?i=t.DEPTH_COMPONENT32F:n===Ua&&(i=t.DEPTH_COMPONENT16),i}function _(t,e){return!0===d(t)||t.isFramebufferTexture&&t.minFilter!==Ea&&t.minFilter!==Ra?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function v(t){const e=t.target;e.removeEventListener(\\\"dispose\\\",v),function(t){const e=r.get(t);if(void 0===e.__webglInit)return;const n=t.source,i=z.get(n);if(i){const r=i[e.__cacheKey];r.usedTimes--,0===r.usedTimes&&y(t),0===Object.keys(i).length&&z.delete(n)}r.remove(t)}(e),e.isVideoTexture&&F.delete(e)}function x(e){const n=e.target;n.removeEventListener(\\\"dispose\\\",x),function(e){const n=r.get(e);if(e.depthTexture&&(e.depthTexture.dispose(),r.remove(e.depthTexture)),e.isWebGLCubeRenderTarget)for(let e=0;6>e;e++){if(Array.isArray(n.__webglFramebuffer[e]))for(let i=0;i<n.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(n.__webglFramebuffer[e][i]);else t.deleteFramebuffer(n.__webglFramebuffer[e]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[e])}else{if(Array.isArray(n.__webglFramebuffer))for(let e=0;e<n.__webglFramebuffer.length;e++)t.deleteFramebuffer(n.__webglFramebuffer[e]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let e=0;e<n.__webglColorRenderbuffer.length;e++)n.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[e]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const i=e.textures;for(let e=0,n=i.length;n>e;e++){const n=r.get(i[e]);n.__webglTexture&&(t.deleteTexture(n.__webglTexture),c.memory.textures--),r.remove(i[e])}r.remove(e)}(n)}function y(e){const n=r.get(e);t.deleteTexture(n.__webglTexture);const i=e.source;delete z.get(i)[n.__cacheKey],c.memory.textures--}function M(e,n){const a=r.get(e);if(e.isVideoTexture&&function(t){const e=c.render.frame;F.get(t)!==e&&(F.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&!0!==e.isExternalTexture&&e.version>0&&a.__version!==e.version){const t=e.image;if(null===t)s(\\\"WebGLRenderer: Texture marked for update but no image data found.\\\");else{if(!1!==t.complete)return void E(a,e,n);s(\\\"WebGLRenderer: Texture marked for update but image is incomplete\\\")}}else e.isExternalTexture&&(a.__webglTexture=e.sourceTexture?e.sourceTexture:null);i.bindTexture(t.TEXTURE_2D,a.__webglTexture,t.TEXTURE0+n)}function S(n,i){if(i.type!==Fa||!1!==e.has(\\\"OES_texture_float_linear\\\")||i.magFilter!==Ra&&i.magFilter!==Ca&&i.magFilter!==wa&&i.magFilter!==Pa&&i.minFilter!==Ra&&i.minFilter!==Ca&&i.minFilter!==wa&&i.minFilter!==Pa||s(\\\"WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.\\\"),t.texParameteri(n,t.TEXTURE_WRAP_S,H[i.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,H[i.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,H[i.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,G[i.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,G[i.minFilter]),i.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,W[i.compareFunction])),!0===e.has(\\\"EXT_texture_filter_anisotropic\\\")){if(i.magFilter===Ea)return;if(i.minFilter!==wa&&i.minFilter!==Pa)return;if(i.type===Fa&&!1===e.has(\\\"OES_texture_float_linear\\\"))return;if(i.anisotropy>1||r.get(i).__currentAnisotropy){const s=e.get(\\\"EXT_texture_filter_anisotropic\\\");t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i.anisotropy,o.getMaxAnisotropy())),r.get(i).__currentAnisotropy=i.anisotropy}}}function T(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener(\\\"dispose\\\",v));const r=n.source;let s=z.get(r);void 0===s&&(s={},z.set(r,s));const a=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(a!==e.__cacheKey){void 0===s[a]&&(s[a]={texture:t.createTexture(),usedTimes:0},c.memory.textures++,i=!0),s[a].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&y(n)),e.__cacheKey=a,e.__webglTexture=s[a].texture}return i}function b(t,e,n){return Math.floor(Math.floor(t/n)/e)}function E(e,n,a){let c=t.TEXTURE_2D;(n.isDataArrayTexture||n.isCompressedArrayTexture)&&(c=t.TEXTURE_2D_ARRAY),n.isData3DTexture&&(c=t.TEXTURE_3D);const h=T(e,n),f=n.source;i.bindTexture(c,e.__webglTexture,t.TEXTURE0+a);const v=r.get(f);if(f.version!==v.__version||!0===h){i.activeTexture(t.TEXTURE0+a);const e=Dl.getPrimaries(Dl.workingColorSpace),r=n.colorSpace===tl?null:Dl.getPrimaries(n.colorSpace),x=n.colorSpace===tl||e===r?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,x);let y=u(n.image,!1,o.maxTextureSize);y=L(n,y);const M=l.convert(n.format,n.colorSpace),T=l.convert(n.type);let E,A=m(n.internalFormat,M,T,n.colorSpace,n.isVideoTexture);S(c,n);const w=n.mipmaps,R=!0!==n.isVideoTexture,C=void 0===v.__version||!0===h,P=f.dataReady,I=_(n,y);if(n.isDepthTexture)A=g(n.format===Ya,n.type),C&&(R?i.texStorage2D(t.TEXTURE_2D,1,A,y.width,y.height):i.texImage2D(t.TEXTURE_2D,0,A,y.width,y.height,0,M,T,null));else if(n.isDataTexture)if(w.length>0){R&&C&&i.texStorage2D(t.TEXTURE_2D,I,A,w[0].width,w[0].height);for(let e=0,n=w.length;n>e;e++)E=w[e],R?P&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,E.width,E.height,M,T,E.data):i.texImage2D(t.TEXTURE_2D,e,A,E.width,E.height,0,M,T,E.data);n.generateMipmaps=!1}else R?(C&&i.texStorage2D(t.TEXTURE_2D,I,A,y.width,y.height),P&&function(e,n,r,s){const a=e.updateRanges;if(0===a.length)i.texSubImage2D(t.TEXTURE_2D,0,0,0,n.width,n.height,r,s,n.data);else{a.sort((t,e)=>t.start-e.start);let o=0;for(let t=1;t<a.length;t++){const e=a[o],i=a[t],r=e.start+e.count,s=b(i.start,n.width,4),l=b(e.start,n.width,4);i.start>r+1||s!==l||b(i.start+i.count-1,n.width,4)!==s?(++o,a[o]=i):e.count=Math.max(e.count,i.start+i.count-e.start)}a.length=o+1;const l=t.getParameter(t.UNPACK_ROW_LENGTH),c=t.getParameter(t.UNPACK_SKIP_PIXELS),h=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,n.width);for(let e=0,o=a.length;o>e;e++){const o=a[e],l=Math.floor(o.start/4),c=Math.ceil(o.count/4),h=l%n.width,u=Math.floor(l/n.width),d=c,p=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,h),t.pixelStorei(t.UNPACK_SKIP_ROWS,u),i.texSubImage2D(t.TEXTURE_2D,0,h,u,d,p,r,s,n.data)}e.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,l),t.pixelStorei(t.UNPACK_SKIP_PIXELS,c),t.pixelStorei(t.UNPACK_SKIP_ROWS,h)}}(n,y,M,T)):i.texImage2D(t.TEXTURE_2D,0,A,y.width,y.height,0,M,T,y.data);else if(n.isCompressedTexture)if(n.isCompressedArrayTexture){R&&C&&i.texStorage3D(t.TEXTURE_2D_ARRAY,I,A,w[0].width,w[0].height,y.depth);for(let e=0,r=w.length;r>e;e++)if(E=w[e],n.format!==ja)if(null!==M)if(R){if(P)if(n.layerUpdates.size>0){const r=Wt(E.width,E.height,n.format,n.type);for(const s of n.layerUpdates){const n=E.data.subarray(s*r/E.data.BYTES_PER_ELEMENT,(s+1)*r/E.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,s,E.width,E.height,1,M,n)}n.clearLayerUpdates()}else i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,E.width,E.height,y.depth,M,E.data)}else i.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,A,E.width,E.height,y.depth,0,E.data,0,0);else s(\\\"WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\\\");else R?P&&i.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,E.width,E.height,y.depth,M,T,E.data):i.texImage3D(t.TEXTURE_2D_ARRAY,e,A,E.width,E.height,y.depth,0,M,T,E.data)}else{R&&C&&i.texStorage2D(t.TEXTURE_2D,I,A,w[0].width,w[0].height);for(let e=0,r=w.length;r>e;e++)E=w[e],n.format!==ja?null!==M?R?P&&i.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,E.width,E.height,M,E.data):i.compressedTexImage2D(t.TEXTURE_2D,e,A,E.width,E.height,0,E.data):s(\\\"WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\\\"):R?P&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,E.width,E.height,M,T,E.data):i.texImage2D(t.TEXTURE_2D,e,A,E.width,E.height,0,M,T,E.data)}else if(n.isDataArrayTexture)if(R){if(C&&i.texStorage3D(t.TEXTURE_2D_ARRAY,I,A,y.width,y.height,y.depth),P)if(n.layerUpdates.size>0){const e=Wt(y.width,y.height,n.format,n.type);for(const r of n.layerUpdates){const n=y.data.subarray(r*e/y.data.BYTES_PER_ELEMENT,(r+1)*e/y.data.BYTES_PER_ELEMENT);i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,r,y.width,y.height,1,M,T,n)}n.clearLayerUpdates()}else i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,y.width,y.height,y.depth,M,T,y.data)}else i.texImage3D(t.TEXTURE_2D_ARRAY,0,A,y.width,y.height,y.depth,0,M,T,y.data);else if(n.isData3DTexture)R?(C&&i.texStorage3D(t.TEXTURE_3D,I,A,y.width,y.height,y.depth),P&&i.texSubImage3D(t.TEXTURE_3D,0,0,0,0,y.width,y.height,y.depth,M,T,y.data)):i.texImage3D(t.TEXTURE_3D,0,A,y.width,y.height,y.depth,0,M,T,y.data);else if(n.isFramebufferTexture){if(C)if(R)i.texStorage2D(t.TEXTURE_2D,I,A,y.width,y.height);else{let e=y.width,n=y.height;for(let r=0;I>r;r++)i.texImage2D(t.TEXTURE_2D,r,A,e,n,0,M,T,null),e>>=1,n>>=1}}else if(w.length>0){if(R&&C){const e=N(w[0]);i.texStorage2D(t.TEXTURE_2D,I,A,e.width,e.height)}for(let e=0,n=w.length;n>e;e++)E=w[e],R?P&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,M,T,E):i.texImage2D(t.TEXTURE_2D,e,A,M,T,E);n.generateMipmaps=!1}else if(R){if(C){const e=N(y);i.texStorage2D(t.TEXTURE_2D,I,A,e.width,e.height)}P&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,M,T,y)}else i.texImage2D(t.TEXTURE_2D,0,A,M,T,y);d(n)&&p(c),v.__version=f.version,n.onUpdate&&n.onUpdate(n)}e.__version=n.version}function A(e,n,s,a,o,c){const h=l.convert(s.format,s.colorSpace),u=l.convert(s.type),d=m(s.internalFormat,h,u,s.colorSpace),p=r.get(n),f=r.get(s);if(f.__renderTarget=n,!p.__hasExternalTextures){const e=Math.max(1,n.width>>c),r=Math.max(1,n.height>>c);o===t.TEXTURE_3D||o===t.TEXTURE_2D_ARRAY?i.texImage3D(o,c,d,e,r,n.depth,0,h,u,null):i.texImage2D(o,c,d,e,r,0,h,u,null)}i.bindFramebuffer(t.FRAMEBUFFER,e),I(n)?U.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,a,o,f.__webglTexture,0,P(n)):o!==t.TEXTURE_2D&&(o<t.TEXTURE_CUBE_MAP_POSITIVE_X||o>t.TEXTURE_CUBE_MAP_NEGATIVE_Z)||t.framebufferTexture2D(t.FRAMEBUFFER,a,o,f.__webglTexture,c),i.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer){const r=n.depthTexture,s=r&&r.isDepthTexture?r.type:null,a=g(n.stencilBuffer,s),o=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;I(n)?U.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,P(n),a,n.width,n.height):i?t.renderbufferStorageMultisample(t.RENDERBUFFER,P(n),a,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,a,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,o,t.RENDERBUFFER,e)}else{const e=n.textures;for(let r=0;r<e.length;r++){const s=e[r],a=l.convert(s.format,s.colorSpace),o=l.convert(s.type),c=m(s.internalFormat,a,o,s.colorSpace);I(n)?U.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,P(n),c,n.width,n.height):i?t.renderbufferStorageMultisample(t.RENDERBUFFER,P(n),c,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,c,n.width,n.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function R(e,n,s){const a=!0===n.isWebGLCubeRenderTarget;if(i.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error(\\\"renderTarget.depthTexture must be an instance of THREE.DepthTexture\\\");const o=r.get(n.depthTexture);if(o.__renderTarget=n,o.__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),a){if(void 0===o.__webglInit&&(o.__webglInit=!0,n.depthTexture.addEventListener(\\\"dispose\\\",v)),void 0===o.__webglTexture){o.__webglTexture=t.createTexture(),i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),S(t.TEXTURE_CUBE_MAP,n.depthTexture);const e=l.convert(n.depthTexture.format),r=l.convert(n.depthTexture.type);let s;n.depthTexture.format===qa?s=t.DEPTH_COMPONENT24:n.depthTexture.format===Ya&&(s=t.DEPTH24_STENCIL8);for(let i=0;6>i;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,s,n.width,n.height,0,e,r,null)}}else M(n.depthTexture,0);const c=o.__webglTexture,h=P(n),u=a?t.TEXTURE_CUBE_MAP_POSITIVE_X+s:t.TEXTURE_2D,d=n.depthTexture.format===Ya?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(n.depthTexture.format===qa)I(n)?U.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,d,u,c,0,h):t.framebufferTexture2D(t.FRAMEBUFFER,d,u,c,0);else{if(n.depthTexture.format!==Ya)throw new Error(\\\"Unknown depthTexture format\\\");I(n)?U.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,d,u,c,0,h):t.framebufferTexture2D(t.FRAMEBUFFER,d,u,c,0)}}function C(e){const n=r.get(e),s=!0===e.isWebGLCubeRenderTarget;if(n.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(n.__depthDisposeCallback&&n.__depthDisposeCallback(),t){const e=()=>{delete n.__boundDepthTexture,delete n.__depthDisposeCallback,t.removeEventListener(\\\"dispose\\\",e)};t.addEventListener(\\\"dispose\\\",e),n.__depthDisposeCallback=e}n.__boundDepthTexture=t}if(e.depthTexture&&!n.__autoAllocateDepthBuffer)if(s)for(let t=0;6>t;t++)R(n.__webglFramebuffer[t],e,t);else{const t=e.texture.mipmaps;t&&t.length>0?R(n.__webglFramebuffer[0],e,0):R(n.__webglFramebuffer,e,0)}else if(s){n.__webglDepthbuffer=[];for(let r=0;6>r;r++)if(i.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[r]),void 0===n.__webglDepthbuffer[r])n.__webglDepthbuffer[r]=t.createRenderbuffer(),w(n.__webglDepthbuffer[r],e,!1);else{const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,s=n.__webglDepthbuffer[r];t.bindRenderbuffer(t.RENDERBUFFER,s),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,s)}}else{const r=e.texture.mipmaps;if(r&&r.length>0?i.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[0]):i.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),void 0===n.__webglDepthbuffer)n.__webglDepthbuffer=t.createRenderbuffer(),w(n.__webglDepthbuffer,e,!1);else{const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,r=n.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,r)}}i.bindFramebuffer(t.FRAMEBUFFER,null)}function P(t){return Math.min(o.maxSamples,t.samples)}function I(t){const n=r.get(t);return t.samples>0&&!0===e.has(\\\"WEBGL_multisampled_render_to_texture\\\")&&!1!==n.__useRenderToTexture}function L(t,e){const n=t.colorSpace,i=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==nl&&n!==tl&&(Dl.getTransfer(n)===rl?i===ja&&r===Ia||s(\\\"WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.\\\"):a(\\\"WebGLTextures: Unsupported texture color space:\\\",n)),e}function N(t){return\\\"undefined\\\"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(O.width=t.naturalWidth||t.width,O.height=t.naturalHeight||t.height):\\\"undefined\\\"!=typeof VideoFrame&&t instanceof VideoFrame?(O.width=t.displayWidth,O.height=t.displayHeight):(O.width=t.width,O.height=t.height),O}const U=e.has(\\\"WEBGL_multisampled_render_to_texture\\\")?e.get(\\\"WEBGL_multisampled_render_to_texture\\\"):null,D=\\\"undefined\\\"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),O=new Al,F=new WeakMap;let B;const z=new WeakMap;let k=!1;try{k=\\\"undefined\\\"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext(\\\"2d\\\")}catch(t){}let V=0;const H={[Sa]:t.REPEAT,[Ta]:t.CLAMP_TO_EDGE,[ba]:t.MIRRORED_REPEAT},G={[Ea]:t.NEAREST,[Aa]:t.NEAREST_MIPMAP_NEAREST,[wa]:t.NEAREST_MIPMAP_LINEAR,[Ra]:t.LINEAR,[Ca]:t.LINEAR_MIPMAP_NEAREST,[Pa]:t.LINEAR_MIPMAP_LINEAR},W={[ol]:t.NEVER,[fl]:t.ALWAYS,[ll]:t.LESS,[hl]:t.LEQUAL,[cl]:t.EQUAL,[pl]:t.GEQUAL,[ul]:t.GREATER,[dl]:t.NOTEQUAL},X=[],j=[];this.allocateTextureUnit=function(){const t=V;return t<o.maxTextures||s(\\\"WebGLTextures: Trying to use \\\"+t+\\\" texture units while this GPU supports only \\\"+o.maxTextures),V+=1,t},this.resetTextureUnits=function(){V=0},this.setTexture2D=M,this.setTexture2DArray=function(e,n){const s=r.get(e);!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version?E(s,e,n):(e.isExternalTexture&&(s.__webglTexture=e.sourceTexture?e.sourceTexture:null),i.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+n))},this.setTexture3D=function(e,n){const s=r.get(e);!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version?E(s,e,n):i.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+n)},this.setTextureCube=function(e,n){const a=r.get(e);!0!==e.isCubeDepthTexture&&e.version>0&&a.__version!==e.version?function(e,n,a){if(6!==n.image.length)return;const c=T(e,n),h=n.source;i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+a);const f=r.get(h);if(h.version!==f.__version||!0===c){i.activeTexture(t.TEXTURE0+a);const e=Dl.getPrimaries(Dl.workingColorSpace),r=n.colorSpace===tl?null:Dl.getPrimaries(n.colorSpace),g=n.colorSpace===tl||e===r?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,g);const v=n.isCompressedTexture||n.image[0].isCompressedTexture,x=n.image[0]&&n.image[0].isDataTexture,y=[];for(let t=0;6>t;t++)y[t]=v||x?x?n.image[t].image:n.image[t]:u(n.image[t],!0,o.maxCubemapSize),y[t]=L(n,y[t]);const M=y[0],T=l.convert(n.format,n.colorSpace),b=l.convert(n.type),E=m(n.internalFormat,T,b,n.colorSpace),A=!0!==n.isVideoTexture,w=void 0===f.__version||!0===c,R=h.dataReady;let C,P=_(n,M);if(S(t.TEXTURE_CUBE_MAP,n),v){A&&w&&i.texStorage2D(t.TEXTURE_CUBE_MAP,P,E,M.width,M.height);for(let e=0;6>e;e++){C=y[e].mipmaps;for(let r=0;r<C.length;r++){const a=C[r];n.format!==ja?null!==T?A?R&&i.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,0,0,a.width,a.height,T,a.data):i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,E,a.width,a.height,0,a.data):s(\\\"WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()\\\"):A?R&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,0,0,a.width,a.height,T,b,a.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,E,a.width,a.height,0,T,b,a.data)}}}else{if(C=n.mipmaps,A&&w){C.length>0&&P++;const e=N(y[0]);i.texStorage2D(t.TEXTURE_CUBE_MAP,P,E,e.width,e.height)}for(let e=0;6>e;e++)if(x){A?R&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,y[e].width,y[e].height,T,b,y[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,E,y[e].width,y[e].height,0,T,b,y[e].data);for(let n=0;n<C.length;n++){const r=C[n].image[e].image;A?R&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,r.width,r.height,T,b,r.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,E,r.width,r.height,0,T,b,r.data)}}else{A?R&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,T,b,y[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,E,T,b,y[e]);for(let n=0;n<C.length;n++){const r=C[n];A?R&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,T,b,r.image[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,E,T,b,r.image[e])}}}d(n)&&p(t.TEXTURE_CUBE_MAP),f.__version=h.version,n.onUpdate&&n.onUpdate(n)}e.__version=n.version}(a,e,n):i.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture,t.TEXTURE0+n)},this.rebindTextures=function(e,n,i){const s=r.get(e);void 0!==n&&A(s.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==i&&C(e)},this.setupRenderTarget=function(e){const n=e.texture,s=r.get(e),a=r.get(n);e.addEventListener(\\\"dispose\\\",x);const o=e.textures,h=!0===e.isWebGLCubeRenderTarget,u=o.length>1;if(u||(void 0===a.__webglTexture&&(a.__webglTexture=t.createTexture()),a.__version=n.version,c.memory.textures++),h){s.__webglFramebuffer=[];for(let e=0;6>e;e++)if(n.mipmaps&&n.mipmaps.length>0){s.__webglFramebuffer[e]=[];for(let i=0;i<n.mipmaps.length;i++)s.__webglFramebuffer[e][i]=t.createFramebuffer()}else s.__webglFramebuffer[e]=t.createFramebuffer()}else{if(n.mipmaps&&n.mipmaps.length>0){s.__webglFramebuffer=[];for(let e=0;e<n.mipmaps.length;e++)s.__webglFramebuffer[e]=t.createFramebuffer()}else s.__webglFramebuffer=t.createFramebuffer();if(u)for(let e=0,n=o.length;n>e;e++){const n=r.get(o[e]);void 0===n.__webglTexture&&(n.__webglTexture=t.createTexture(),c.memory.textures++)}if(e.samples>0&&!1===I(e)){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=[],i.bindFramebuffer(t.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<o.length;n++){const i=o[n];s.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,s.__webglColorRenderbuffer[n]);const r=l.convert(i.format,i.colorSpace),a=l.convert(i.type),c=m(i.internalFormat,r,a,i.colorSpace,!0===e.isXRRenderTarget),h=P(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,c,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,s.__webglColorRenderbuffer[n])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),w(s.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){i.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture),S(t.TEXTURE_CUBE_MAP,n);for(let i=0;6>i;i++)if(n.mipmaps&&n.mipmaps.length>0)for(let r=0;r<n.mipmaps.length;r++)A(s.__webglFramebuffer[i][r],e,n,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,r);else A(s.__webglFramebuffer[i],e,n,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);d(n)&&p(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){for(let n=0,a=o.length;a>n;n++){const a=o[n],l=r.get(a);let c=t.TEXTURE_2D;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(c=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),i.bindTexture(c,l.__webglTexture),S(c,a),A(s.__webglFramebuffer,e,a,t.COLOR_ATTACHMENT0+n,c,0),d(a)&&p(c)}i.unbindTexture()}else{let r=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(r=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),i.bindTexture(r,a.__webglTexture),S(r,n),n.mipmaps&&n.mipmaps.length>0)for(let i=0;i<n.mipmaps.length;i++)A(s.__webglFramebuffer[i],e,n,t.COLOR_ATTACHMENT0,r,i);else A(s.__webglFramebuffer,e,n,t.COLOR_ATTACHMENT0,r,0);d(n)&&p(r),i.unbindTexture()}e.depthBuffer&&C(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let n=0,s=e.length;s>n;n++){const s=e[n];if(d(s)){const e=f(t),n=r.get(s).__webglTexture;i.bindTexture(e,n),p(e),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===I(e)){const n=e.textures,s=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const l=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=r.get(e),h=n.length>1;if(h)for(let e=0;e<n.length;e++)i.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),i.bindFramebuffer(t.FRAMEBUFFER,c.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);i.bindFramebuffer(t.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer);const u=e.texture.mipmaps;u&&u.length>0?i.bindFramebuffer(t.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):i.bindFramebuffer(t.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let i=0;i<n.length;i++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),h){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c.__webglColorRenderbuffer[i]);const e=r.get(n[i]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,s,a,0,0,s,a,o,t.NEAREST),!0===D&&(X.length=0,j.length=0,X.push(t.COLOR_ATTACHMENT0+i),e.depthBuffer&&!1===e.resolveDepthBuffer&&(X.push(l),j.push(l),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,j)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,X))}if(i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),h)for(let e=0;e<n.length;e++){i.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,c.__webglColorRenderbuffer[e]);const s=r.get(n[e]).__webglTexture;i.bindFramebuffer(t.FRAMEBUFFER,c.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,s,0)}i.bindFramebuffer(t.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&D){const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=C,this.setupFrameBufferTexture=A,this.useMultisampledRTT=I,this.isReversedDepthBuffer=function(){return i.buffers.depth.getReversed()}}function Yn(t,e){return{convert:function(n,i=\\\"\\\"){let r;const s=Dl.getTransfer(i);if(n===Ia)return t.UNSIGNED_BYTE;if(n===za)return t.UNSIGNED_SHORT_4_4_4_4;if(n===ka)return t.UNSIGNED_SHORT_5_5_5_1;if(n===Ha)return t.UNSIGNED_INT_5_9_9_9_REV;if(n===Ga)return t.UNSIGNED_INT_10F_11F_11F_REV;if(n===La)return t.BYTE;if(n===Na)return t.SHORT;if(n===Ua)return t.UNSIGNED_SHORT;if(n===Da)return t.INT;if(n===Oa)return t.UNSIGNED_INT;if(n===Fa)return t.FLOAT;if(n===Ba)return t.HALF_FLOAT;if(n===Wa)return t.ALPHA;if(n===Xa)return t.RGB;if(n===ja)return t.RGBA;if(n===qa)return t.DEPTH_COMPONENT;if(n===Ya)return t.DEPTH_STENCIL;if(n===Ka)return t.RED;if(n===Ja)return t.RED_INTEGER;if(n===Za)return t.RG;if(n===$a)return t.RG_INTEGER;if(n===Qa)return t.RGBA_INTEGER;if(n===to||n===eo||n===no||n===io)if(s===rl){if(r=e.get(\\\"WEBGL_compressed_texture_s3tc_srgb\\\"),null===r)return null;if(n===to)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===eo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===no)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===io)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get(\\\"WEBGL_compressed_texture_s3tc\\\"),null===r)return null;if(n===to)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===eo)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===no)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===io)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ro||n===so||n===ao||n===oo){if(r=e.get(\\\"WEBGL_compressed_texture_pvrtc\\\"),null===r)return null;if(n===ro)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===so)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ao)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===oo)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===lo||n===co||n===ho||n===uo||n===po||n===fo||n===mo){if(r=e.get(\\\"WEBGL_compressed_texture_etc\\\"),null===r)return null;if(n===lo||n===co)return s===rl?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ho)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===uo)return r.COMPRESSED_R11_EAC;if(n===po)return r.COMPRESSED_SIGNED_R11_EAC;if(n===fo)return r.COMPRESSED_RG11_EAC;if(n===mo)return r.COMPRESSED_SIGNED_RG11_EAC}if(n===go||n===_o||n===vo||n===xo||n===yo||n===Mo||n===So||n===To||n===bo||n===Eo||n===Ao||n===wo||n===Ro||n===Co){if(r=e.get(\\\"WEBGL_compressed_texture_astc\\\"),null===r)return null;if(n===go)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===_o)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===vo)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===xo)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===yo)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Mo)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===So)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===To)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===bo)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Eo)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ao)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===wo)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ro)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Co)return s===rl?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Po||n===Io||n===Lo){if(r=e.get(\\\"EXT_texture_compression_bptc\\\"),null===r)return null;if(n===Po)return s===rl?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Io)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Lo)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===No||n===Uo||n===Do||n===Oo){if(r=e.get(\\\"EXT_texture_compression_rgtc\\\"),null===r)return null;if(n===No)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Uo)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Do)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Oo)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Va?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}}}function Kn(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,1===i.side&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),1===i.side&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);const r=e.get(i),s=r.envMap,a=r.envMapRotation;s&&(t.envMap.value=s,Dm.copy(a),Dm.x*=-1,Dm.y*=-1,Dm.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(Dm.y*=-1,Dm.z*=-1),t.envMapRotation.value.setFromMatrix4(Om.makeRotationFromEuler(Dm)),t.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,H(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform)),t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform)),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate())),e.dispersion>0&&(t.dispersion.value=e.dispersion),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Jn(t,e,n,i){function r(t,e,n,i){const r=t.value,s=e+\\\"_\\\"+n;if(void 0===i[s])return i[s]=\\\"number\\\"==typeof r||\\\"boolean\\\"==typeof r?r:r.clone(),!0;{const t=i[s];if(\\\"number\\\"==typeof r||\\\"boolean\\\"==typeof r){if(t!==r)return i[s]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function o(t){const e={boundary:0,storage:0};return\\\"number\\\"==typeof t||\\\"boolean\\\"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?s(\\\"WebGLRenderer: Texture samplers can not be part of an uniforms group.\\\"):s(\\\"WebGLRenderer: Unsupported uniform value type.\\\",t),e}function l(e){const n=e.target;n.removeEventListener(\\\"dispose\\\",l);const i=u.indexOf(n.__bindingPointIndex);u.splice(i,1),t.deleteBuffer(c[n.id]),delete c[n.id],delete h[n.id]}let c={},h={},u=[];const d=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,s){let p=c[n.id];void 0===p&&(function(t){const e=t.uniforms;let n=0;for(let t=0,i=e.length;i>t;t++){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=i.length;e>t;t++){const e=i[t],r=Array.isArray(e.value)?e.value:[e.value];for(let t=0,i=r.length;i>t;t++){const i=o(r[t]),s=n%16,a=s%i.boundary,l=s+a;n+=a,0!==l&&16-l<i.storage&&(n+=16-l),e.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),t.__size=n,t.__cache={}}(n),p=function(e){const n=function(){for(let t=0;d>t;t++)if(-1===u.indexOf(t))return u.push(t),t;return a(\\\"WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.\\\"),0}();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,s),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),c[n.id]=p,n.addEventListener(\\\"dispose\\\",l));const f=s.program;i.updateUBOMapping(n,f);const m=e.render.frame;h[n.id]!==m&&(function(e){const n=c[e.id],i=e.uniforms,s=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(let e=0,n=i.length;n>e;e++){const n=Array.isArray(i[e])?i[e]:[i[e]];for(let i=0,a=n.length;a>i;i++){const a=n[i];if(!0===r(a,e,i,s)){const e=a.__offset,n=Array.isArray(a.value)?a.value:[a.value];let i=0;for(let r=0;r<n.length;r++){const s=n[r],l=o(s);\\\"number\\\"==typeof s||\\\"boolean\\\"==typeof s?(a.__data[0]=s,t.bufferSubData(t.UNIFORM_BUFFER,e+i,a.__data)):s.isMatrix3?(a.__data[0]=s.elements[0],a.__data[1]=s.elements[1],a.__data[2]=s.elements[2],a.__data[3]=0,a.__data[4]=s.elements[3],a.__data[5]=s.elements[4],a.__data[6]=s.elements[5],a.__data[7]=0,a.__data[8]=s.elements[6],a.__data[9]=s.elements[7],a.__data[10]=s.elements[8],a.__data[11]=0):(s.toArray(a.__data,i),i+=l.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,a.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),h[n.id]=m)},dispose:function(){for(const e in c)t.deleteBuffer(c[e]);u=[],c={},h={}}}}function Zn(){return null===Bm&&(Bm=new yu(Fm,16,16,Za,Ba),Bm.name=\\\"DFG_LUT\\\",Bm.minFilter=Ra,Bm.magFilter=Ra,Bm.wrapS=Ta,Bm.wrapT=Ta,Bm.generateMipmaps=!1,Bm.needsUpdate=!0),Bm}function $n(t,e){if(0===e)return t;if(2===e||1===e){let n=t.getIndex();if(null===n){const e=[],i=t.getAttribute(\\\"position\\\");if(void 0===i)return t;for(let t=0;t<i.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const i=n.count-2,r=[];if(2===e)for(let t=1;i>=t;t++)r.push(n.getX(0)),r.push(n.getX(t)),r.push(n.getX(t+1));else for(let t=0;i>t;t++)t%2==0?(r.push(n.getX(t)),r.push(n.getX(t+1)),r.push(n.getX(t+2))):(r.push(n.getX(t+2)),r.push(n.getX(t+1)),r.push(n.getX(t)));r.length;const s=t.clone();return s.setIndex(r),s.clearGroups(),s}return t}function Qn(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}function ti(t){return void 0===t.DefaultMaterial&&(t.DefaultMaterial=new Nd({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),t.DefaultMaterial}function ei(t,e,n){for(const i in n.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=n.extensions[i])}function ni(t,e){void 0!==e.extras&&\\\"object\\\"==typeof e.extras&&Object.assign(t.userData,e.extras)}function ii(t,e,n){let i=!1,r=!1,s=!1;for(let t=0,n=e.length;n>t;t++){const n=e[t];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(t);const a=[],o=[],l=[];for(let c=0,h=e.length;h>c;c++){const h=e[c];if(i){const e=void 0!==h.POSITION?n.getDependency(\\\"accessor\\\",h.POSITION):t.attributes.position;a.push(e)}if(r){const e=void 0!==h.NORMAL?n.getDependency(\\\"accessor\\\",h.NORMAL):t.attributes.normal;o.push(e)}if(s){const e=void 0!==h.COLOR_0?n.getDependency(\\\"accessor\\\",h.COLOR_0):t.attributes.color;l.push(e)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(e){const n=e[0],a=e[1],o=e[2];return i&&(t.morphAttributes.position=n),r&&(t.morphAttributes.normal=a),s&&(t.morphAttributes.color=o),t.morphTargetsRelative=!0,t})}function ri(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let n=0,i=e.weights.length;i>n;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let e=0,i=n.length;i>e;e++)t.morphTargetDictionary[n[e]]=e}}}function si(t){let e;const n=t.extensions&&t.extensions[km.KHR_DRACO_MESH_COMPRESSION];if(e=n?\\\"draco:\\\"+n.bufferView+\\\":\\\"+n.indices+\\\":\\\"+ai(n.attributes):t.indices+\\\":\\\"+ai(t.attributes)+\\\":\\\"+t.mode,void 0!==t.targets)for(let n=0,i=t.targets.length;i>n;n++)e+=\\\":\\\"+ai(t.targets[n]);return e}function ai(t){let e=\\\"\\\";const n=Object.keys(t).sort();for(let i=0,r=n.length;r>i;i++)e+=n[i]+\\\":\\\"+t[n[i]]+\\\";\\\";return e}function oi(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error(\\\"THREE.GLTFLoader: Unsupported normalized accessor component type.\\\")}}function li(t){return t.search(/\\\\.jpe?g($|\\\\?)/i)>0||0===t.search(/^data\\\\:image\\\\/jpeg/)?\\\"image/jpeg\\\":t.search(/\\\\.webp($|\\\\?)/i)>0||0===t.search(/^data\\\\:image\\\\/webp/)?\\\"image/webp\\\":t.search(/\\\\.ktx2($|\\\\?)/i)>0||0===t.search(/^data\\\\:image\\\\/ktx2/)?\\\"image/ktx2\\\":\\\"image/png\\\"}function ci(t,e,n){const i=e.attributes,r=new Yl;if(void 0===i.POSITION)return;{const t=n.json.accessors[i.POSITION],e=t.min,s=t.max;if(void 0===e||void 0===s)return;if(r.set(new Rl(e[0],e[1],e[2]),new Rl(s[0],s[1],s[2])),t.normalized){const e=oi(gg[t.componentType]);r.min.multiplyScalar(e),r.max.multiplyScalar(e)}}const s=e.targets;if(void 0!==s){const t=new Rl,e=new Rl;for(let i=0,r=s.length;r>i;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,a=i.max;if(void 0!==s&&void 0!==a){if(e.setX(Math.max(Math.abs(s[0]),Math.abs(a[0]))),e.setY(Math.max(Math.abs(s[1]),Math.abs(a[1]))),e.setZ(Math.max(Math.abs(s[2]),Math.abs(a[2]))),i.normalized){const t=oi(gg[i.componentType]);e.multiplyScalar(t)}t.max(e)}}}r.expandByVector(t)}t.boundingBox=r;const a=new uc;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=a}function hi(t,e,n){function i(e,i){return n.getDependency(\\\"accessor\\\",e).then(function(e){t.setAttribute(i,e)})}const r=e.attributes,s=[];for(const e in r){const n=yg[e]||e.toLowerCase();n in t.attributes||s.push(i(r[e],n))}if(void 0!==e.indices&&!t.index){const i=n.getDependency(\\\"accessor\\\",e.indices).then(function(e){t.setIndex(e)});s.push(i)}return Dl.workingColorSpace,ni(t,e),ci(t,e,n),Promise.all(s).then(function(){return void 0!==e.targets?ii(t,e.targets,n):t})}var ui,di,pi,fi,mi,gi,_i,vi,xi,yi,Mi,Si,Ti,bi,Ei,Ai,wi,Ri,Ci,Pi,Ii,Li,Ni,Ui,Di,Oi,Fi,Bi,zi,ki,Vi,Hi,Gi,Wi,Xi,ji,qi,Yi,Ki,Ji,Zi,$i,Qi,tr,er,nr,ir,rr,sr,ar,or,lr,cr,hr,ur,dr,pr,fr,mr,gr,_r,vr,xr,yr,Mr,Sr,Tr,br,Er,Ar,wr,Rr,Cr,Pr,Ir,Lr,Nr,Ur,Dr,Or,Fr,Br,zr,kr,Vr,Hr,Gr,Wr,Xr,jr,qr,Yr,Kr,Jr,Zr,$r,Qr,ts,es,ns,is,rs,ss,as,os,ls,cs,hs,us,ds;const ps=\\\"182\\\",fs=0,ms=1,gs=2,_s=1,vs=2,xs=3,ys=0,Ms=1,Ss=2,Ts=0,bs=1,Es=2,As=3,ws=4,Rs=5,Cs=100,Ps=101,Is=102,Ls=103,Ns=104,Us=200,Ds=201,Os=202,Fs=203,Bs=204,zs=205,ks=206,Vs=207,Hs=208,Gs=209,Ws=210,Xs=211,js=212,qs=213,Ys=214,Ks=0,Js=1,Zs=2,$s=3,Qs=4,ta=5,ea=6,na=7,ia=0,ra=1,sa=2,aa=0,oa=1,la=2,ca=3,ha=4,ua=5,da=6,pa=7,fa=\\\"attached\\\",ma=\\\"detached\\\",ga=300,_a=301,va=302,xa=303,ya=304,Ma=306,Sa=1e3,Ta=1001,ba=1002,Ea=1003,Aa=1004,wa=1005,Ra=1006,Ca=1007,Pa=1008,Ia=1009,La=1010,Na=1011,Ua=1012,Da=1013,Oa=1014,Fa=1015,Ba=1016,za=1017,ka=1018,Va=1020,Ha=35902,Ga=35899,Wa=1021,Xa=1022,ja=1023,qa=1026,Ya=1027,Ka=1028,Ja=1029,Za=1030,$a=1031,Qa=1033,to=33776,eo=33777,no=33778,io=33779,ro=35840,so=35841,ao=35842,oo=35843,lo=36196,co=37492,ho=37496,uo=37488,po=37489,fo=37490,mo=37491,go=37808,_o=37809,vo=37810,xo=37811,yo=37812,Mo=37813,So=37814,To=37815,bo=37816,Eo=37817,Ao=37818,wo=37819,Ro=37820,Co=37821,Po=36492,Io=36494,Lo=36495,No=36283,Uo=36284,Do=36285,Oo=36286,Fo=2200,Bo=2201,zo=2202,ko=2300,Vo=2301,Ho=2302,Go=2400,Wo=2401,Xo=2402,jo=2500,qo=2501,Yo=0,Ko=1,Jo=2,Zo=3200,$o=0,Qo=1,tl=\\\"\\\",el=\\\"srgb\\\",nl=\\\"srgb-linear\\\",il=\\\"linear\\\",rl=\\\"srgb\\\",sl=7680,al=519,ol=512,ll=513,cl=514,hl=515,ul=516,dl=517,pl=518,fl=519,ml=35044,gl=\\\"300 es\\\",_l=2e3,vl=2001,xl={};class yl{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){const n=this._listeners;return void 0!==n&&void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){const n=this._listeners;if(void 0===n)return;const i=n[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const n=e[t.type];if(void 0!==n){t.target=this;const e=n.slice(0);for(let n=0,i=e.length;i>n;n++)e[n].call(this,t);t.target=null}}}const Ml=[\\\"00\\\",\\\"01\\\",\\\"02\\\",\\\"03\\\",\\\"04\\\",\\\"05\\\",\\\"06\\\",\\\"07\\\",\\\"08\\\",\\\"09\\\",\\\"0a\\\",\\\"0b\\\",\\\"0c\\\",\\\"0d\\\",\\\"0e\\\",\\\"0f\\\",\\\"10\\\",\\\"11\\\",\\\"12\\\",\\\"13\\\",\\\"14\\\",\\\"15\\\",\\\"16\\\",\\\"17\\\",\\\"18\\\",\\\"19\\\",\\\"1a\\\",\\\"1b\\\",\\\"1c\\\",\\\"1d\\\",\\\"1e\\\",\\\"1f\\\",\\\"20\\\",\\\"21\\\",\\\"22\\\",\\\"23\\\",\\\"24\\\",\\\"25\\\",\\\"26\\\",\\\"27\\\",\\\"28\\\",\\\"29\\\",\\\"2a\\\",\\\"2b\\\",\\\"2c\\\",\\\"2d\\\",\\\"2e\\\",\\\"2f\\\",\\\"30\\\",\\\"31\\\",\\\"32\\\",\\\"33\\\",\\\"34\\\",\\\"35\\\",\\\"36\\\",\\\"37\\\",\\\"38\\\",\\\"39\\\",\\\"3a\\\",\\\"3b\\\",\\\"3c\\\",\\\"3d\\\",\\\"3e\\\",\\\"3f\\\",\\\"40\\\",\\\"41\\\",\\\"42\\\",\\\"43\\\",\\\"44\\\",\\\"45\\\",\\\"46\\\",\\\"47\\\",\\\"48\\\",\\\"49\\\",\\\"4a\\\",\\\"4b\\\",\\\"4c\\\",\\\"4d\\\",\\\"4e\\\",\\\"4f\\\",\\\"50\\\",\\\"51\\\",\\\"52\\\",\\\"53\\\",\\\"54\\\",\\\"55\\\",\\\"56\\\",\\\"57\\\",\\\"58\\\",\\\"59\\\",\\\"5a\\\",\\\"5b\\\",\\\"5c\\\",\\\"5d\\\",\\\"5e\\\",\\\"5f\\\",\\\"60\\\",\\\"61\\\",\\\"62\\\",\\\"63\\\",\\\"64\\\",\\\"65\\\",\\\"66\\\",\\\"67\\\",\\\"68\\\",\\\"69\\\",\\\"6a\\\",\\\"6b\\\",\\\"6c\\\",\\\"6d\\\",\\\"6e\\\",\\\"6f\\\",\\\"70\\\",\\\"71\\\",\\\"72\\\",\\\"73\\\",\\\"74\\\",\\\"75\\\",\\\"76\\\",\\\"77\\\",\\\"78\\\",\\\"79\\\",\\\"7a\\\",\\\"7b\\\",\\\"7c\\\",\\\"7d\\\",\\\"7e\\\",\\\"7f\\\",\\\"80\\\",\\\"81\\\",\\\"82\\\",\\\"83\\\",\\\"84\\\",\\\"85\\\",\\\"86\\\",\\\"87\\\",\\\"88\\\",\\\"89\\\",\\\"8a\\\",\\\"8b\\\",\\\"8c\\\",\\\"8d\\\",\\\"8e\\\",\\\"8f\\\",\\\"90\\\",\\\"91\\\",\\\"92\\\",\\\"93\\\",\\\"94\\\",\\\"95\\\",\\\"96\\\",\\\"97\\\",\\\"98\\\",\\\"99\\\",\\\"9a\\\",\\\"9b\\\",\\\"9c\\\",\\\"9d\\\",\\\"9e\\\",\\\"9f\\\",\\\"a0\\\",\\\"a1\\\",\\\"a2\\\",\\\"a3\\\",\\\"a4\\\",\\\"a5\\\",\\\"a6\\\",\\\"a7\\\",\\\"a8\\\",\\\"a9\\\",\\\"aa\\\",\\\"ab\\\",\\\"ac\\\",\\\"ad\\\",\\\"ae\\\",\\\"af\\\",\\\"b0\\\",\\\"b1\\\",\\\"b2\\\",\\\"b3\\\",\\\"b4\\\",\\\"b5\\\",\\\"b6\\\",\\\"b7\\\",\\\"b8\\\",\\\"b9\\\",\\\"ba\\\",\\\"bb\\\",\\\"bc\\\",\\\"bd\\\",\\\"be\\\",\\\"bf\\\",\\\"c0\\\",\\\"c1\\\",\\\"c2\\\",\\\"c3\\\",\\\"c4\\\",\\\"c5\\\",\\\"c6\\\",\\\"c7\\\",\\\"c8\\\",\\\"c9\\\",\\\"ca\\\",\\\"cb\\\",\\\"cc\\\",\\\"cd\\\",\\\"ce\\\",\\\"cf\\\",\\\"d0\\\",\\\"d1\\\",\\\"d2\\\",\\\"d3\\\",\\\"d4\\\",\\\"d5\\\",\\\"d6\\\",\\\"d7\\\",\\\"d8\\\",\\\"d9\\\",\\\"da\\\",\\\"db\\\",\\\"dc\\\",\\\"dd\\\",\\\"de\\\",\\\"df\\\",\\\"e0\\\",\\\"e1\\\",\\\"e2\\\",\\\"e3\\\",\\\"e4\\\",\\\"e5\\\",\\\"e6\\\",\\\"e7\\\",\\\"e8\\\",\\\"e9\\\",\\\"ea\\\",\\\"eb\\\",\\\"ec\\\",\\\"ed\\\",\\\"ee\\\",\\\"ef\\\",\\\"f0\\\",\\\"f1\\\",\\\"f2\\\",\\\"f3\\\",\\\"f4\\\",\\\"f5\\\",\\\"f6\\\",\\\"f7\\\",\\\"f8\\\",\\\"f9\\\",\\\"fa\\\",\\\"fb\\\",\\\"fc\\\",\\\"fd\\\",\\\"fe\\\",\\\"ff\\\"];let Sl=1234567;const Tl=Math.PI/180,bl=180/Math.PI,El={DEG2RAD:Tl,RAD2DEG:bl,generateUUID:c,clamp:h,euclideanModulo:u,mapLinear:d,inverseLerp:p,lerp:f,damp:m,pingpong:g,smoothstep:_,smootherstep:v,randInt:x,randFloat:y,randFloatSpread:M,seededRandom:S,degToRad:T,radToDeg:b,isPowerOfTwo:E,ceilPowerOfTwo:A,floorPowerOfTwo:w,setQuaternionFromProperEuler:R,normalize:P,denormalize:C};class Al{constructor(t=0,e=0){Al.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error(\\\"index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error(\\\"index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=h(this.x,t.x,e.x),this.y=h(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=h(this.x,t,e),this.y=h(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(h(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(h(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wl{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,s,a){let o=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3],u=r[s+0],d=r[s+1],p=r[s+2],f=r[s+3];if(0>=a)return t[e+0]=o,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(a>=1)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||o!==u||l!==d||c!==p){let t=o*u+l*d+c*p+h*f;0>t&&(u=-u,d=-d,p=-p,f=-f,t=-t);let e=1-a;if(.9995>t){const n=Math.acos(t),i=Math.sin(n);e=Math.sin(e*n)/i,o=o*e+u*(a=Math.sin(a*n)/i),l=l*e+d*a,c=c*e+p*a,h=h*e+f*a}else{o=o*e+u*a,l=l*e+d*a,c=c*e+p*a,h=h*e+f*a;const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,r=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(r/2),d=l(n/2),p=l(i/2),f=l(r/2);switch(a){case\\\"XYZ\\\":this._x=d*h*u+c*p*f,this._y=c*p*u-d*h*f,this._z=c*h*f+d*p*u,this._w=c*h*u-d*p*f;break;case\\\"YXZ\\\":this._x=d*h*u+c*p*f,this._y=c*p*u-d*h*f,this._z=c*h*f-d*p*u,this._w=c*h*u+d*p*f;break;case\\\"ZXY\\\":this._x=d*h*u-c*p*f,this._y=c*p*u+d*h*f,this._z=c*h*f+d*p*u,this._w=c*h*u-d*p*f;break;case\\\"ZYX\\\":this._x=d*h*u-c*p*f,this._y=c*p*u+d*h*f,this._z=c*h*f-d*p*u,this._w=c*h*u+d*p*f;break;case\\\"YZX\\\":this._x=d*h*u+c*p*f,this._y=c*p*u+d*h*f,this._z=c*h*f-d*p*u,this._w=c*h*u-d*p*f;break;case\\\"XZY\\\":this._x=d*h*u-c*p*f,this._y=c*p*u-d*h*f,this._z=c*h*f+d*p*u,this._w=c*h*u+d*p*f;break;default:s(\\\"Quaternion: .setFromEuler() encountered an unknown order: \\\"+a)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return 1e-8>n?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(h(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0>=e)return this;if(e>=1)return this.copy(t);let n=t._x,i=t._y,r=t._z,s=t._w,a=this.dot(t);0>a&&(n=-n,i=-i,r=-r,s=-s,a=-a);let o=1-e;if(.9995>a){const t=Math.acos(a),l=Math.sin(t);o=Math.sin(o*t)/l,e=Math.sin(e*t)/l,this._x=this._x*o+n*e,this._y=this._y*o+i*e,this._z=this._z*o+r*e,this._w=this._w*o+s*e,this._onChangeCallback()}else this._x=this._x*o+n*e,this._y=this._y*o+i*e,this._z=this._z*o+r*e,this._w=this._w*o+s*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Rl{constructor(t=0,e=0,n=0){Rl.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error(\\\"index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error(\\\"index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Pl.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Pl.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=2*(s*i-a*n),c=2*(a*e-r*i),h=2*(r*n-s*e);return this.x=e+o*l+s*h-a*c,this.y=n+o*c+a*l-r*h,this.z=i+o*h+r*c-s*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=h(this.x,t.x,e.x),this.y=h(this.y,t.y,e.y),this.z=h(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=h(this.x,t,e),this.y=h(this.y,t,e),this.z=h(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(h(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Cl.copy(this).projectOnVector(t),this.sub(Cl)}reflect(t){return this.sub(Cl.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(h(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Cl=new Rl,Pl=new wl;class Il{constructor(t,e,n,i,r,s,a,o,l){Il.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,l)}set(t,e,n,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],_=i[1],v=i[4],x=i[7],y=i[2],M=i[5],S=i[8];return r[0]=s*f+a*_+o*y,r[3]=s*m+a*v+o*M,r[6]=s*g+a*x+o*S,r[1]=l*f+c*_+h*y,r[4]=l*m+c*v+h*M,r[7]=l*g+c*x+h*S,r[2]=u*f+d*_+p*y,r[5]=u*m+d*v+p*M,r[8]=u*g+d*x+p*S,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-c*n)*f,t[2]=(a*n-i*s)*f,t[3]=u*f,t[4]=(c*e-i*o)*f,t[5]=(i*r-a*e)*f,t[6]=d*f,t[7]=(n*o-l*e)*f,t[8]=(s*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Ll.makeScale(t,e)),this}rotate(t){return this.premultiply(Ll.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ll.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let t=0;9>t;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;9>n;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Ll=new Il,Nl=(new Il).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ul=(new Il).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Dl=I();let Ol;class Fl{static getDataURL(t,e=\\\"image/png\\\"){if(/^data:/i.test(t.src))return t.src;if(\\\"undefined\\\"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===Ol&&(Ol=n(\\\"canvas\\\")),Ol.width=t.width,Ol.height=t.height;const e=Ol.getContext(\\\"2d\\\");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=Ol}return i.toDataURL(e)}static sRGBToLinear(t){if(\\\"undefined\\\"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||\\\"undefined\\\"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||\\\"undefined\\\"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=n(\\\"canvas\\\");e.width=t.width,e.height=t.height;const i=e.getContext(\\\"2d\\\");i.drawImage(t,0,0,t.width,t.height);const r=i.getImageData(0,0,t.width,t.height),s=r.data;for(let t=0;t<s.length;t++)s[t]=255*L(s[t]/255);return i.putImageData(r,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*L(e[t]/255)):e[t]=L(e[t]);return{data:e,width:t.width,height:t.height}}return s(\\\"ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.\\\"),t}}let Bl=0;class zl{constructor(t=null){this.isSource=!0,Object.defineProperty(this,\\\"id\\\",{value:Bl++}),this.uuid=c(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return\\\"undefined\\\"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):\\\"undefined\\\"!=typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||\\\"string\\\"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:\\\"\\\"},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;n>e;e++)i[e].isDataTexture?t.push(U(i[e].image)):t.push(U(i[e]))}else t=U(i);n.url=t}return e||(t.images[this.uuid]=n),n}}let kl=0;const Vl=new Rl;class Hl extends yl{constructor(t=Hl.DEFAULT_IMAGE,e=Hl.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,a=1023,o=Ia,l=Hl.DEFAULT_ANISOTROPY,h=\\\"\\\"){super(),this.isTexture=!0,Object.defineProperty(this,\\\"id\\\",{value:kl++}),this.uuid=c(),this.name=\\\"\\\",this.source=new zl(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Al(0,0),this.repeat=new Al(1,1),this.center=new Al(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Il,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Vl).x}get height(){return this.source.getSize(Vl).y}get depth(){return this.source.getSize(Vl).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const n=t[e];if(void 0===n){s(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[e]=n:s(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||\\\"string\\\"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.7,type:\\\"Texture\\\",generator:\\\"Texture.toJSON\\\"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}transformUv(t){if(this.mapping!==ga)return t;if(t.applyMatrix3(this.matrix),0>t.x||t.x>1)switch(this.wrapS){case Sa:t.x=t.x-Math.floor(t.x);break;case Ta:t.x=0>t.x?0:1;break;case ba:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(0>t.y||t.y>1)switch(this.wrapT){case Sa:t.y=t.y-Math.floor(t.y);break;case Ta:t.y=0>t.y?0:1;break;case ba:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Hl.DEFAULT_IMAGE=null,Hl.DEFAULT_MAPPING=ga,Hl.DEFAULT_ANISOTROPY=1;class Gl{constructor(t=0,e=0,n=0,i=1){Gl.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error(\\\"index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error(\\\"index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(c-u)<s&&Math.abs(h-f)<s&&Math.abs(p-m)<s){if(Math.abs(c+u)<a&&Math.abs(h+f)<a&&Math.abs(p+m)<a&&Math.abs(l+d+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,o=(d+1)/2,_=(g+1)/2,v=(c+u)/4,x=(h+f)/4,y=(p+m)/4;return t>o&&t>_?s>t?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=v/n,r=x/n):o>_?s>o?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=v/i,r=y/i):s>_?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(_),n=x/r,i=y/r),this.set(n,i,r,e),this}let _=Math.sqrt((m-p)*(m-p)+(h-f)*(h-f)+(u-c)*(u-c));return.001>Math.abs(_)&&(_=1),this.x=(m-p)/_,this.y=(h-f)/_,this.z=(u-c)/_,this.w=Math.acos((l+d+g-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=h(this.x,t.x,e.x),this.y=h(this.y,t.y,e.y),this.z=h(this.z,t.z,e.z),this.w=h(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=h(this.x,t,e),this.y=h(this.y,t,e),this.z=h(this.z,t,e),this.w=h(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(h(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Wl extends yl{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ra,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new Gl(0,0,t,e),this.scissorTest=!1,this.viewport=new Gl(0,0,t,e);const i={width:t,height:e,depth:n.depth},r=new Hl(i);this.textures=[];const s=n.count;for(let t=0;s>t;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(t={}){const e={minFilter:Ra,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==t.mapping&&(e.mapping=t.mapping),void 0!==t.wrapS&&(e.wrapS=t.wrapS),void 0!==t.wrapT&&(e.wrapT=t.wrapT),void 0!==t.wrapR&&(e.wrapR=t.wrapR),void 0!==t.magFilter&&(e.magFilter=t.magFilter),void 0!==t.minFilter&&(e.minFilter=t.minFilter),void 0!==t.format&&(e.format=t.format),void 0!==t.type&&(e.type=t.type),void 0!==t.anisotropy&&(e.anisotropy=t.anisotropy),void 0!==t.colorSpace&&(e.colorSpace=t.colorSpace),void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.generateMipmaps&&(e.generateMipmaps=t.generateMipmaps),void 0!==t.internalFormat&&(e.internalFormat=t.internalFormat);for(let t=0;t<this.textures.length;t++)this.textures[t].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.textures.length;r>i;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=n,!0!==this.textures[i].isData3DTexture&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;n>e;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const n=Object.assign({},t.textures[e].image);this.textures[e].source=new zl(n)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}}class Xl extends Wl{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class jl extends Hl{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Ea,this.minFilter=Ea,this.wrapR=Ta,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ql extends Hl{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Ea,this.minFilter=Ea,this.wrapR=Ta,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Yl{constructor(t=new Rl(1/0,1/0,1/0),e=new Rl(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;n>e;e+=3)this.expandByPoint(Jl.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;n>e;e++)this.expandByPoint(Jl.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;n>e;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Jl.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n){const i=n.getAttribute(\\\"position\\\");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,n=i.count;n>e;e++)!0===t.isMesh?t.getVertexPosition(e,Jl):Jl.fromBufferAttribute(i,e),Jl.applyMatrix4(t.matrixWorld),this.expandByPoint(Jl);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Zl.copy(t.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),Zl.copy(n.boundingBox)),Zl.applyMatrix4(t.matrixWorld),this.union(Zl)}const i=t.children;for(let t=0,n=i.length;n>t;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return!(this.min.x>t.min.x||t.max.x>this.max.x||this.min.y>t.min.y||t.max.y>this.max.y||this.min.z>t.min.z||t.max.z>this.max.z)}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Jl),Jl.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(rc),sc.subVectors(this.max,rc),$l.subVectors(t.a,rc),Ql.subVectors(t.b,rc),tc.subVectors(t.c,rc),ec.subVectors(Ql,$l),nc.subVectors(tc,Ql),ic.subVectors($l,tc);let e=[0,-ec.z,ec.y,0,-nc.z,nc.y,0,-ic.z,ic.y,ec.z,0,-ec.x,nc.z,0,-nc.x,ic.z,0,-ic.x,-ec.y,ec.x,0,-nc.y,nc.x,0,-ic.y,ic.x,0];return!!D(e,$l,Ql,tc,sc)&&(e=[1,0,0,0,1,0,0,0,1],!!D(e,$l,Ql,tc,sc)&&(ac.crossVectors(ec,nc),e=[ac.x,ac.y,ac.z],D(e,$l,Ql,tc,sc)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Jl).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Jl).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Kl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kl)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const Kl=[new Rl,new Rl,new Rl,new Rl,new Rl,new Rl,new Rl,new Rl],Jl=new Rl,Zl=new Yl,$l=new Rl,Ql=new Rl,tc=new Rl,ec=new Rl,nc=new Rl,ic=new Rl,rc=new Rl,sc=new Rl,ac=new Rl,oc=new Rl,lc=new Yl,cc=new Rl,hc=new Rl;class uc{constructor(t=new Rl,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):lc.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;r>e;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return 0>this.radius}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;cc.subVectors(t,this.center);const e=cc.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(cc,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(hc.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(cc.copy(t.center).add(hc)),this.expandByPoint(cc.copy(t.center).sub(hc))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}const dc=new Rl,pc=new Rl,fc=new Rl,mc=new Rl,gc=new Rl,_c=new Rl,vc=new Rl;class xc{constructor(t=new Rl,e=new Rl(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,dc)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return 0>n?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=dc.subVectors(t,this.origin).dot(this.direction);return 0>e?this.origin.distanceToSquared(t):(dc.copy(this.origin).addScaledVector(this.direction,e),dc.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){pc.copy(t).add(e).multiplyScalar(.5),fc.copy(e).sub(t).normalize(),mc.copy(this.origin).sub(pc);const r=.5*t.distanceTo(e),s=-this.direction.dot(fc),a=mc.dot(this.direction),o=-mc.dot(fc),l=mc.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,0>h)u>-p?u>p?(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else if(-p>u)u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else if(u>p)u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else{const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(pc).addScaledVector(fc,u),d}intersectSphere(t,e){dc.subVectors(t.center,this.origin);const n=dc.dot(this.direction),i=dc.dot(dc)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return 0>o?null:0>a?this.at(o,e):this.at(a,e)}intersectsSphere(t){return t.radius>=0&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return 0>n?null:n}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e}intersectBox(t,e){let n,i,r,s,a,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return 0>l?(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l):(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l),0>c?(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c):(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(i>s||isNaN(i))&&(i=s),0>h?(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h):(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(i>o||i!=i)&&(i=o),0>i?null:this.at(0>n?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,dc)}intersectTriangle(t,e,n,i,r){gc.subVectors(e,t),_c.subVectors(n,t),vc.crossVectors(gc,_c);let s,a=this.direction.dot(vc);if(a>0){if(i)return null;s=1}else{if(a>=0)return null;s=-1,a=-a}mc.subVectors(this.origin,t);const o=s*this.direction.dot(_c.crossVectors(mc,_c));if(0>o)return null;const l=s*this.direction.dot(gc.cross(mc));if(0>l)return null;if(o+l>a)return null;const c=-s*mc.dot(vc);return 0>c?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class yc{constructor(t,e,n,i,r,s,a,o,l,c,h,u,d,p,f,m){yc.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,f,m)}set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new yc).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return 0===this.determinant()?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinant())return this.identity();const e=this.elements,n=t.elements,i=1/Mc.setFromMatrixColumn(t,0).length(),r=1/Mc.setFromMatrixColumn(t,1).length(),s=1/Mc.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if(\\\"XYZ\\\"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if(\\\"YXZ\\\"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if(\\\"ZXY\\\"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if(\\\"ZYX\\\"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if(\\\"YZX\\\"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if(\\\"XZY\\\"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tc,t,bc)}lookAt(t,e,n){const i=this.elements;return wc.subVectors(t,e),0===wc.lengthSq()&&(wc.z=1),wc.normalize(),Ec.crossVectors(n,wc),0===Ec.lengthSq()&&(1===Math.abs(n.z)?wc.x+=1e-4:wc.z+=1e-4,wc.normalize(),Ec.crossVectors(n,wc)),Ec.normalize(),Ac.crossVectors(wc,Ec),i[0]=Ec.x,i[4]=Ac.x,i[8]=wc.x,i[1]=Ec.y,i[5]=Ac.y,i[9]=wc.y,i[2]=Ec.z,i[6]=Ac.z,i[10]=wc.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],_=n[3],v=n[7],x=n[11],y=n[15],M=i[0],S=i[4],T=i[8],b=i[12],E=i[1],A=i[5],w=i[9],R=i[13],C=i[2],P=i[6],I=i[10],L=i[14],N=i[3],U=i[7],D=i[11],O=i[15];return r[0]=s*M+a*E+o*C+l*N,r[4]=s*S+a*A+o*P+l*U,r[8]=s*T+a*w+o*I+l*D,r[12]=s*b+a*R+o*L+l*O,r[1]=c*M+h*E+u*C+d*N,r[5]=c*S+h*A+u*P+d*U,r[9]=c*T+h*w+u*I+d*D,r[13]=c*b+h*R+u*L+d*O,r[2]=p*M+f*E+m*C+g*N,r[6]=p*S+f*A+m*P+g*U,r[10]=p*T+f*w+m*I+g*D,r[14]=p*b+f*R+m*L+g*O,r[3]=_*M+v*E+x*C+y*N,r[7]=_*S+v*A+x*P+y*U,r[11]=_*T+v*w+x*I+y*D,r[15]=_*b+v*R+x*L+y*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14],p=t[3],f=t[7],m=t[11],g=t[15],_=o*d-l*u,v=a*d-l*h,x=a*u-o*h,y=s*d-l*c,M=s*u-o*c,S=s*h-a*c;return e*(f*_-m*v+g*x)-n*(p*_-m*y+g*M)+i*(p*v-f*y+g*S)-r*(p*x-f*M+m*S)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],_=h*m*l-f*u*l+f*o*d-a*m*d-h*o*g+a*u*g,v=p*u*l-c*m*l-p*o*d+s*m*d+c*o*g-s*u*g,x=c*f*l-p*h*l+p*a*d-s*f*d-c*a*g+s*h*g,y=p*h*o-c*f*o-p*a*u+s*f*u+c*a*m-s*h*m,M=e*_+n*v+i*x+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/M;return t[0]=_*S,t[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*S,t[2]=(a*m*r-f*o*r+f*i*l-n*m*l-a*i*g+n*o*g)*S,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*S,t[4]=v*S,t[5]=(c*m*r-p*u*r+p*i*d-e*m*d-c*i*g+e*u*g)*S,t[6]=(p*o*r-s*m*r-p*i*l+e*m*l+s*i*g-e*o*g)*S,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*S,t[8]=x*S,t[9]=(p*h*r-c*f*r-p*n*d+e*f*d+c*n*g-e*h*g)*S,t[10]=(s*f*r-p*a*r+p*n*l-e*f*l-s*n*g+e*a*g)*S,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*S,t[12]=y*S,t[13]=(c*f*i-p*h*i+p*n*u-e*f*u-c*n*m+e*h*m)*S,t[14]=(p*a*i-s*f*i-p*n*o+e*f*o+s*n*m-e*a*m)*S,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*S,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,f=s*c,m=s*h,g=a*h,_=o*l,v=o*c,x=o*h,y=n.x,M=n.y,S=n.z;return i[0]=(1-(f+g))*y,i[1]=(d+x)*y,i[2]=(p-v)*y,i[3]=0,i[4]=(d-x)*M,i[5]=(1-(u+g))*M,i[6]=(m+_)*M,i[7]=0,i[8]=(p+v)*S,i[9]=(m-_)*S,i[10]=(1-(u+f))*S,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;if(t.x=i[12],t.y=i[13],t.z=i[14],0===this.determinant())return n.set(1,1,1),e.identity(),this;let r=Mc.set(i[0],i[1],i[2]).length();const s=Mc.set(i[4],i[5],i[6]).length(),a=Mc.set(i[8],i[9],i[10]).length();0>this.determinant()&&(r=-r),Sc.copy(this);const o=1/r,l=1/s,c=1/a;return Sc.elements[0]*=o,Sc.elements[1]*=o,Sc.elements[2]*=o,Sc.elements[4]*=l,Sc.elements[5]*=l,Sc.elements[6]*=l,Sc.elements[8]*=c,Sc.elements[9]*=c,Sc.elements[10]*=c,e.setFromRotationMatrix(Sc),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s,a=2e3,o=!1){const l=this.elements,c=2*r/(e-t),h=2*r/(n-i),u=(e+t)/(e-t),d=(n+i)/(n-i);let p,f;if(o)p=r/(s-r),f=s*r/(s-r);else if(a===_l)p=-(s+r)/(s-r),f=-2*s*r/(s-r);else{if(a!==vl)throw new Error(\\\"THREE.Matrix4.makePerspective(): Invalid coordinate system: \\\"+a);p=-s/(s-r),f=-s*r/(s-r)}return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=f,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,i,r,s,a=2e3,o=!1){const l=this.elements,c=2/(e-t),h=2/(n-i),u=-(e+t)/(e-t),d=-(n+i)/(n-i);let p,f;if(o)p=1/(s-r),f=s/(s-r);else if(a===_l)p=-2/(s-r),f=-(s+r)/(s-r);else{if(a!==vl)throw new Error(\\\"THREE.Matrix4.makeOrthographic(): Invalid coordinate system: \\\"+a);p=-1/(s-r),f=-r/(s-r)}return l[0]=c,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=h,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=p,l[14]=f,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;16>t;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;16>n;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Mc=new Rl,Sc=new yc,Tc=new Rl(0,0,0),bc=new Rl(1,1,1),Ec=new Rl,Ac=new Rl,wc=new Rl,Rc=new yc,Cc=new wl;class Pc{constructor(t=0,e=0,n=0,i=Pc.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],a=i[4],o=i[8],l=i[1],c=i[5],u=i[9],d=i[2],p=i[6],f=i[10];switch(e){case\\\"XYZ\\\":this._y=Math.asin(h(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(p,c),this._z=0);break;case\\\"YXZ\\\":this._x=Math.asin(-h(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,r),this._z=0);break;case\\\"ZXY\\\":this._x=Math.asin(h(p,-1,1)),.9999999>Math.abs(p)?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case\\\"ZYX\\\":this._y=Math.asin(-h(d,-1,1)),.9999999>Math.abs(d)?(this._x=Math.atan2(p,f),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case\\\"YZX\\\":this._z=Math.asin(h(l,-1,1)),.9999999>Math.abs(l)?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,r)):(this._x=0,this._y=Math.atan2(o,f));break;case\\\"XZY\\\":this._z=Math.asin(-h(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,f),this._y=0);break;default:s(\\\"Euler: .setFromRotationMatrix() encountered an unknown order: \\\"+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Rc.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Rc,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Cc.setFromEuler(this),this.setFromQuaternion(Cc,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Pc.DEFAULT_ORDER=\\\"XYZ\\\";class Ic{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Lc=0;const Nc=new Rl,Uc=new wl,Dc=new yc,Oc=new Rl,Fc=new Rl,Bc=new Rl,zc=new wl,kc=new Rl(1,0,0),Vc=new Rl(0,1,0),Hc=new Rl(0,0,1),Gc={type:\\\"added\\\"},Wc={type:\\\"removed\\\"},Xc={type:\\\"childadded\\\",child:null},jc={type:\\\"childremoved\\\",child:null};class qc extends yl{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,\\\"id\\\",{value:Lc++}),this.uuid=c(),this.name=\\\"\\\",this.type=\\\"Object3D\\\",this.parent=null,this.children=[],this.up=qc.DEFAULT_UP.clone();const t=new Rl,e=new Pc,n=new wl,i=new Rl(1,1,1);e._onChange(function(){n.setFromEuler(e,!1)}),n._onChange(function(){e.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new yc},normalMatrix:{value:new Il}}),this.matrix=new yc,this.matrixWorld=new yc,this.matrixAutoUpdate=qc.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=qc.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ic,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Uc.setFromAxisAngle(t,e),this.quaternion.multiply(Uc),this}rotateOnWorldAxis(t,e){return Uc.setFromAxisAngle(t,e),this.quaternion.premultiply(Uc),this}rotateX(t){return this.rotateOnAxis(kc,t)}rotateY(t){return this.rotateOnAxis(Vc,t)}rotateZ(t){return this.rotateOnAxis(Hc,t)}translateOnAxis(t,e){return Nc.copy(t).applyQuaternion(this.quaternion),this.position.add(Nc.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(kc,t)}translateY(t){return this.translateOnAxis(Vc,t)}translateZ(t){return this.translateOnAxis(Hc,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Dc.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Oc.copy(t):Oc.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Fc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Dc.lookAt(Fc,Oc,this.up):Dc.lookAt(Oc,Fc,this.up),this.quaternion.setFromRotationMatrix(Dc),i&&(Dc.extractRotation(i.matrixWorld),Uc.setFromRotationMatrix(Dc),this.quaternion.premultiply(Uc.invert()))}add(t){if(arguments.length>1){for(let t=0;arguments.length>t;t++)this.add(arguments[t]);return this}return t===this?(a(\\\"Object3D.add: object can't be added as a child of itself.\\\",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Gc),Xc.child=t,this.dispatchEvent(Xc),Xc.child=null):a(\\\"Object3D.add: object not an instance of THREE.Object3D.\\\",t),this)}remove(t){if(arguments.length>1){for(let t=0;arguments.length>t;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Wc),jc.child=t,this.dispatchEvent(jc),jc.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Dc.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Dc.multiply(t.parent.matrixWorld)),t.applyMatrix4(Dc),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Gc),Xc.child=t,this.dispatchEvent(Xc),Xc.child=null,this}getObjectById(t){return this.getObjectByProperty(\\\"id\\\",t)}getObjectByName(t){return this.getObjectByProperty(\\\"name\\\",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;i>n;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let r=0,s=i.length;s>r;r++)i[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fc,t,Bc),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Fc,zc,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;i>n;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;i>n;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;i>n;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,n=t.length;n>e;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){function e(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}function n(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}const i=void 0===t||\\\"string\\\"==typeof t,r={};i&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:\\\"Object\\\",generator:\\\"Object3D.toJSON\\\"});const s={};if(s.uuid=this.uuid,s.type=this.type,\\\"\\\"!==this.name&&(s.name=this.name),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),!1===this.frustumCulled&&(s.frustumCulled=!1),0!==this.renderOrder&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type=\\\"InstancedMesh\\\",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type=\\\"BatchedMesh\\\",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(t=>({...t})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(s.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=e(t.geometries,this.geometry);const n=this.geometry.parameters;if(void 0!==n&&void 0!==n.shapes){const i=n.shapes;if(Array.isArray(i))for(let n=0,r=i.length;r>n;n++){const r=i[n];e(t.shapes,r)}else e(t.shapes,i)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(e(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const n=[];for(let i=0,r=this.material.length;r>i;i++)n.push(e(t.materials,this.material[i]));s.material=n}else s.material=e(t.materials,this.material);if(this.children.length>0){s.children=[];for(let e=0;e<this.children.length;e++)s.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let n=0;n<this.animations.length;n++){const i=this.animations[n];s.animations.push(e(t.animations,i))}}if(i){const e=n(t.geometries),i=n(t.materials),s=n(t.textures),a=n(t.images),o=n(t.shapes),l=n(t.skeletons),c=n(t.animations),h=n(t.nodes);e.length>0&&(r.geometries=e),i.length>0&&(r.materials=i),s.length>0&&(r.textures=s),a.length>0&&(r.images=a),o.length>0&&(r.shapes=o),l.length>0&&(r.skeletons=l),c.length>0&&(r.animations=c),h.length>0&&(r.nodes=h)}return r.object=s,r}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}qc.DEFAULT_UP=new Rl(0,1,0),qc.DEFAULT_MATRIX_AUTO_UPDATE=!0,qc.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Yc=new Rl,Kc=new Rl,Jc=new Rl,Zc=new Rl,$c=new Rl,Qc=new Rl,th=new Rl,eh=new Rl,nh=new Rl,ih=new Rl,rh=new Gl,sh=new Gl,ah=new Gl;class oh{constructor(t=new Rl,e=new Rl,n=new Rl){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),Yc.subVectors(t,e),i.cross(Yc);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Yc.subVectors(i,e),Kc.subVectors(n,e),Jc.subVectors(t,e);const s=Yc.dot(Yc),a=Yc.dot(Kc),o=Yc.dot(Jc),l=Kc.dot(Kc),c=Kc.dot(Jc),h=s*l-a*a;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,Zc)&&Zc.x>=0&&Zc.y>=0&&1>=Zc.x+Zc.y}static getInterpolation(t,e,n,i,r,s,a,o){return null===this.getBarycoord(t,e,n,i,Zc)?(o.x=0,o.y=0,\\\"z\\\"in o&&(o.z=0),\\\"w\\\"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Zc.x),o.addScaledVector(s,Zc.y),o.addScaledVector(a,Zc.z),o)}static getInterpolatedAttribute(t,e,n,i,r,s){return rh.setScalar(0),sh.setScalar(0),ah.setScalar(0),rh.fromBufferAttribute(t,e),sh.fromBufferAttribute(t,n),ah.fromBufferAttribute(t,i),s.setScalar(0),s.addScaledVector(rh,r.x),s.addScaledVector(sh,r.y),s.addScaledVector(ah,r.z),s}static isFrontFacing(t,e,n,i){return Yc.subVectors(n,e),Kc.subVectors(t,e),0>Yc.cross(Kc).dot(i)}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Yc.subVectors(this.c,this.b),Kc.subVectors(this.a,this.b),.5*Yc.cross(Kc).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return oh.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return oh.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return oh.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return oh.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return oh.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;$c.subVectors(i,n),Qc.subVectors(r,n),eh.subVectors(t,n);const o=$c.dot(eh),l=Qc.dot(eh);if(0>=o&&0>=l)return e.copy(n);nh.subVectors(t,i);const c=$c.dot(nh),h=Qc.dot(nh);if(c>=0&&c>=h)return e.copy(i);const u=o*h-c*l;if(0>=u&&o>=0&&0>=c)return s=o/(o-c),e.copy(n).addScaledVector($c,s);ih.subVectors(t,r);const d=$c.dot(ih),p=Qc.dot(ih);if(p>=0&&p>=d)return e.copy(r);const f=d*l-o*p;if(0>=f&&l>=0&&0>=p)return a=l/(l-p),e.copy(n).addScaledVector(Qc,a);const m=c*p-d*h;if(0>=m&&h-c>=0&&d-p>=0)return th.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(th,a);const g=1/(m+f+u);return s=f*g,a=u*g,e.copy(n).addScaledVector($c,s).addScaledVector(Qc,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const lh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ch={h:0,s:0,l:0},hh={h:0,s:0,l:0};class uh{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):\\\"number\\\"==typeof e?this.setHex(e):\\\"string\\\"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=el){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Dl.colorSpaceToWorking(this,e),this}setRGB(t,e,n,i=Dl.workingColorSpace){return this.r=t,this.g=e,this.b=n,Dl.colorSpaceToWorking(this,i),this}setHSL(t,e,n,i=Dl.workingColorSpace){if(t=u(t,1),e=h(e,0,1),n=h(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n>.5?n+e-n*e:n*(1+e),r=2*n-i;this.r=O(r,i,t+1/3),this.g=O(r,i,t),this.b=O(r,i,t-1/3)}return Dl.colorSpaceToWorking(this,i),this}setStyle(t,e=el){function n(e){void 0!==e&&1>parseFloat(e)&&s(\\\"Color: Alpha component of \\\"+t+\\\" will be ignored.\\\")}let i;if(i=/^(\\\\w+)\\\\(([^\\\\)]*)\\\\)/.exec(t)){let r;const a=i[1],o=i[2];switch(a){case\\\"rgb\\\":case\\\"rgba\\\":if(r=/^\\\\s*(\\\\d+)\\\\s*,\\\\s*(\\\\d+)\\\\s*,\\\\s*(\\\\d+)\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\\\\s*(\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d+)\\\\%\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case\\\"hsl\\\":case\\\"hsla\\\":if(r=/^\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\%\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:s(\\\"Color: Unknown color model \\\"+t)}}else if(i=/^\\\\#([A-Fa-f\\\\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);s(\\\"Color: Invalid hex color \\\"+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=el){const n=lh[t.toLowerCase()];return void 0!==n?this.setHex(n,e):s(\\\"Color: Unknown color \\\"+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=L(t.r),this.g=L(t.g),this.b=L(t.b),this}copyLinearToSRGB(t){return this.r=N(t.r),this.g=N(t.g),this.b=N(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=el){return Dl.workingToColorSpace(dh.copy(this),t),65536*Math.round(h(255*dh.r,0,255))+256*Math.round(h(255*dh.g,0,255))+Math.round(h(255*dh.b,0,255))}getHexString(t=el){return(\\\"000000\\\"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Dl.workingColorSpace){Dl.workingToColorSpace(dh.copy(this),e);const n=dh.r,i=dh.g,r=dh.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const t=s-a;switch(l=c>.5?t/(2-s-a):t/(s+a),s){case n:o=(i-r)/t+(r>i?6:0);break;case i:o=(r-n)/t+2;break;case r:o=(n-i)/t+4}o/=6}return t.h=o,t.s=l,t.l=c,t}getRGB(t,e=Dl.workingColorSpace){return Dl.workingToColorSpace(dh.copy(this),e),t.r=dh.r,t.g=dh.g,t.b=dh.b,t}getStyle(t=el){Dl.workingToColorSpace(dh.copy(this),t);const e=dh.r,n=dh.g,i=dh.b;return t!==el?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(t,e,n){return this.getHSL(ch),this.setHSL(ch.h+t,ch.s+e,ch.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(ch),t.getHSL(hh);const n=f(ch.h,hh.h,e),i=f(ch.s,hh.s,e),r=f(ch.l,hh.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const dh=new uh;uh.NAMES=lh;let ph=0;class fh extends yl{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,\\\"id\\\",{value:ph++}),this.uuid=c(),this.name=\\\"\\\",this.type=\\\"Material\\\",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Bs,this.blendDst=zs,this.blendEquation=Cs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new uh(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=al,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=sl,this.stencilZFail=sl,this.stencilZPass=sl,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){s(`Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:s(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){function e(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}const n=void 0===t||\\\"string\\\"==typeof t;n&&(t={textures:{},images:{}});const i={metadata:{version:4.7,type:\\\"Material\\\",generator:\\\"Material.toJSON\\\"}};if(i.uuid=this.uuid,i.type=this.type,\\\"\\\"!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),this.blendSrc!==Bs&&(i.blendSrc=this.blendSrc),this.blendDst!==zs&&(i.blendDst=this.blendDst),this.blendEquation!==Cs&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==al&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==sl&&(i.stencilFail=this.stencilFail),this.stencilZFail!==sl&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==sl&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),\\\"round\\\"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),\\\"round\\\"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),n){const n=e(t.textures),r=e(t.images);n.length>0&&(i.textures=n),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}set needsUpdate(t){!0===t&&this.version++}}class mh extends fh{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type=\\\"MeshBasicMaterial\\\",this.color=new uh(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pc,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const gh=new Rl,_h=new Al;let vh=0;class xh{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError(\\\"THREE.BufferAttribute: array should be a Typed Array.\\\");this.isBufferAttribute=!0,Object.defineProperty(this,\\\"id\\\",{value:vh++}),this.name=\\\"\\\",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=ml,this.updateRanges=[],this.gpuType=Fa,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;r>i;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;n>e;e++)_h.fromBufferAttribute(this,e),_h.applyMatrix3(t),this.setXY(e,_h.x,_h.y);else if(3===this.itemSize)for(let e=0,n=this.count;n>e;e++)gh.fromBufferAttribute(this,e),gh.applyMatrix3(t),this.setXYZ(e,gh.x,gh.y,gh.z);return this}applyMatrix4(t){for(let e=0,n=this.count;n>e;e++)gh.fromBufferAttribute(this,e),gh.applyMatrix4(t),this.setXYZ(e,gh.x,gh.y,gh.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;n>e;e++)gh.fromBufferAttribute(this,e),gh.applyNormalMatrix(t),this.setXYZ(e,gh.x,gh.y,gh.z);return this}transformDirection(t){for(let e=0,n=this.count;n>e;e++)gh.fromBufferAttribute(this,e),gh.transformDirection(t),this.setXYZ(e,gh.x,gh.y,gh.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=C(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=P(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=C(e,this.array)),e}setX(t,e){return this.normalized&&(e=P(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=C(e,this.array)),e}setY(t,e){return this.normalized&&(e=P(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=C(e,this.array)),e}setZ(t,e){return this.normalized&&(e=P(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=C(e,this.array)),e}setW(t,e){return this.normalized&&(e=P(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=P(e,this.array),n=P(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=P(e,this.array),n=P(n,this.array),i=P(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=P(e,this.array),n=P(n,this.array),i=P(i,this.array),r=P(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return\\\"\\\"!==this.name&&(t.name=this.name),this.usage!==ml&&(t.usage=this.usage),t}}class yh extends xh{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Mh extends xh{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Sh extends xh{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Th=0;const bh=new yc,Eh=new qc,Ah=new Rl,wh=new Yl,Rh=new Yl,Ch=new Rl;class Ph extends yl{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,\\\"id\\\",{value:Th++}),this.uuid=c(),this.name=\\\"\\\",this.type=\\\"BufferGeometry\\\",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(t(e)?Mh:yh)(e,1):this.index=e,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Il).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return bh.makeRotationFromQuaternion(t),this.applyMatrix4(bh),this}rotateX(t){return bh.makeRotationX(t),this.applyMatrix4(bh),this}rotateY(t){return bh.makeRotationY(t),this.applyMatrix4(bh),this}rotateZ(t){return bh.makeRotationZ(t),this.applyMatrix4(bh),this}translate(t,e,n){return bh.makeTranslation(t,e,n),this.applyMatrix4(bh),this}scale(t,e,n){return bh.makeScale(t,e,n),this.applyMatrix4(bh),this}lookAt(t){return Eh.lookAt(t),Eh.updateMatrix(),this.applyMatrix4(Eh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ah).negate(),this.translate(Ah.x,Ah.y,Ah.z),this}setFromPoints(t){const e=this.getAttribute(\\\"position\\\");if(void 0===e){const e=[];for(let n=0,i=t.length;i>n;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}this.setAttribute(\\\"position\\\",new Sh(e,3))}else{const n=Math.min(t.length,e.count);for(let i=0;n>i;i++){const n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length>e.count&&s(\\\"BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.\\\"),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Yl);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return a(\\\"BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.\\\",this),void this.boundingBox.set(new Rl(-1/0,-1/0,-1/0),new Rl(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;n>t;t++){const n=e[t];wh.setFromBufferAttribute(n),this.morphTargetsRelative?(Ch.addVectors(this.boundingBox.min,wh.min),this.boundingBox.expandByPoint(Ch),Ch.addVectors(this.boundingBox.max,wh.max),this.boundingBox.expandByPoint(Ch)):(this.boundingBox.expandByPoint(wh.min),this.boundingBox.expandByPoint(wh.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&a('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \\\"position\\\" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new uc);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return a(\\\"BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.\\\",this),void this.boundingSphere.set(new Rl,1/0);if(t){const n=this.boundingSphere.center;if(wh.setFromBufferAttribute(t),e)for(let t=0,n=e.length;n>t;t++){const n=e[t];Rh.setFromBufferAttribute(n),this.morphTargetsRelative?(Ch.addVectors(wh.min,Rh.min),wh.expandByPoint(Ch),Ch.addVectors(wh.max,Rh.max),wh.expandByPoint(Ch)):(wh.expandByPoint(Rh.min),wh.expandByPoint(Rh.max))}wh.getCenter(n);let i=0;for(let e=0,r=t.count;r>e;e++)Ch.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(Ch));if(e)for(let r=0,s=e.length;s>r;r++){const s=e[r],a=this.morphTargetsRelative;for(let e=0,r=s.count;r>e;e++)Ch.fromBufferAttribute(s,e),a&&(Ah.fromBufferAttribute(t,e),Ch.add(Ah)),i=Math.max(i,n.distanceToSquared(Ch))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&a('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \\\"position\\\" attribute is likely to have NaN values.',this)}}computeTangents(){function t(t,e,n){u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,n),f.fromBufferAttribute(o,t),m.fromBufferAttribute(o,e),g.fromBufferAttribute(o,n),d.sub(u),p.sub(u),m.sub(f),g.sub(f);const i=1/(m.x*g.y-g.x*m.y);isFinite(i)&&(_.copy(d).multiplyScalar(g.y).addScaledVector(p,-m.y).multiplyScalar(i),v.copy(p).multiplyScalar(m.x).addScaledVector(d,-g.x).multiplyScalar(i),c[t].add(_),c[e].add(_),c[n].add(_),h[t].add(v),h[e].add(v),h[n].add(v))}function e(t){S.fromBufferAttribute(s,t),T.copy(S);const e=c[t];y.copy(e),y.sub(S.multiplyScalar(S.dot(e))).normalize(),M.crossVectors(T,e);const n=0>M.dot(h[t])?-1:1;l.setXYZW(t,y.x,y.y,y.z,n)}const n=this.index,i=this.attributes;if(null===n||void 0===i.position||void 0===i.normal||void 0===i.uv)return void a(\\\"BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)\\\");const r=i.position,s=i.normal,o=i.uv;!1===this.hasAttribute(\\\"tangent\\\")&&this.setAttribute(\\\"tangent\\\",new xh(new Float32Array(4*r.count),4));const l=this.getAttribute(\\\"tangent\\\"),c=[],h=[];for(let t=0;t<r.count;t++)c[t]=new Rl,h[t]=new Rl;const u=new Rl,d=new Rl,p=new Rl,f=new Al,m=new Al,g=new Al,_=new Rl,v=new Rl;let x=this.groups;0===x.length&&(x=[{start:0,count:n.count}]);for(let e=0,i=x.length;i>e;++e){const i=x[e],r=i.start;for(let e=r,s=r+i.count;s>e;e+=3)t(n.getX(e+0),n.getX(e+1),n.getX(e+2))}const y=new Rl,M=new Rl,S=new Rl,T=new Rl;for(let t=0,i=x.length;i>t;++t){const i=x[t],r=i.start;for(let t=r,s=r+i.count;s>t;t+=3)e(n.getX(t+0)),e(n.getX(t+1)),e(n.getX(t+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute(\\\"position\\\");if(void 0!==e){let n=this.getAttribute(\\\"normal\\\");if(void 0===n)n=new xh(new Float32Array(3*e.count),3),this.setAttribute(\\\"normal\\\",n);else for(let t=0,e=n.count;e>t;t++)n.setXYZ(t,0,0,0);const i=new Rl,r=new Rl,s=new Rl,a=new Rl,o=new Rl,l=new Rl,c=new Rl,h=new Rl;if(t)for(let u=0,d=t.count;d>u;u+=3){const d=t.getX(u+0),p=t.getX(u+1),f=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,f),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),a.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),a.add(c),o.add(c),l.add(c),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,a=e.count;a>t;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;n>e;e++)Ch.fromBufferAttribute(t,e),Ch.normalize(),t.setXYZ(e,Ch.x,Ch.y,Ch.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,s=new n.constructor(e.length*i);let a=0,o=0;for(let r=0,l=e.length;l>r;r++){a=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;i>t;t++)s[o++]=n[a++]}return new xh(s,i,r)}if(null===this.index)return s(\\\"BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.\\\"),this;const e=new Ph,n=this.index.array,i=this.attributes;for(const r in i){const s=t(i[r],n);e.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],a=r[i];for(let e=0,i=a.length;i>e;e++){const i=t(a[e],n);s.push(i)}e.morphAttributes[i]=s}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,n=a.length;n>t;t++){const n=a[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.7,type:\\\"BufferGeometry\\\",generator:\\\"BufferGeometry.toJSON\\\"}};if(t.uuid=this.uuid,t.type=this.type,\\\"\\\"!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:[].slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;i>e;e++){const i=n[e];s.push(i.toJSON(t.data))}s.length>0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone());const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;r>t;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;e>t;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}}const Ih=new yc,Lh=new xc,Nh=new uc,Uh=new Rl,Dh=new Rl,Oh=new Rl,Fh=new Rl,Bh=new Rl,zh=new Rl,kh=new Rl,Vh=new Rl;class Hh extends qc{constructor(t=new Ph,e=new mh){super(),this.isMesh=!0,this.type=\\\"Mesh\\\",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;e>t;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const a=this.morphTargetInfluences;if(r&&a){zh.set(0,0,0);for(let n=0,i=r.length;i>n;n++){const i=a[n],o=r[n];0!==i&&(Bh.fromBufferAttribute(o,t),s?zh.addScaledVector(Bh,i):zh.addScaledVector(Bh.sub(e),i))}e.add(zh)}return e}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Nh.copy(n.boundingSphere),Nh.applyMatrix4(r),Lh.copy(t.ray).recast(t.near),!1===Nh.containsPoint(Lh.origin)){if(null===Lh.intersectSphere(Nh,Uh))return;if(Lh.origin.distanceToSquared(Uh)>(t.far-t.near)**2)return}Ih.copy(r).invert(),Lh.copy(t.ray).applyMatrix4(Ih),null!==n.boundingBox&&!1===Lh.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,Lh)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let r=0,o=u.length;o>r;r++){const o=u[r],p=s[o.materialIndex];for(let r=Math.max(o.start,d.start),s=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));s>r;r+=3)i=B(this,p,t,n,l,c,h,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);o>r;r+=3)i=B(this,s,t,n,l,c,h,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i));else if(void 0!==o)if(Array.isArray(s))for(let r=0,a=u.length;a>r;r++){const a=u[r],p=s[a.materialIndex];for(let r=Math.max(a.start,d.start),s=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));s>r;r+=3)i=B(this,p,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);a>r;r+=3)i=B(this,s,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}class Gh extends Ph{constructor(t=1,e=1,n=1,i=1,r=1,s=1){function a(t,e,n,i,r,s,a,f,m,g,_){const v=s/m,x=a/g,y=s/2,M=a/2,S=f/2,T=m+1,b=g+1;let E=0,A=0;const w=new Rl;for(let s=0;b>s;s++){const a=s*x-M;for(let o=0;T>o;o++){const l=o*v-y;w[t]=l*i,w[e]=a*r,w[n]=S,c.push(w.x,w.y,w.z),w[t]=0,w[e]=0,w[n]=f>0?1:-1,h.push(w.x,w.y,w.z),u.push(o/m),u.push(1-s/g),E+=1}}for(let t=0;g>t;t++)for(let e=0;m>e;e++){const n=d+e+T*t,i=d+e+T*(t+1),r=d+(e+1)+T*(t+1),s=d+(e+1)+T*t;l.push(n,i,s),l.push(i,r,s),A+=6}o.addGroup(p,A,_),p+=A,d+=E}super(),this.type=\\\"BoxGeometry\\\",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const l=[],c=[],h=[],u=[];let d=0,p=0;a(\\\"z\\\",\\\"y\\\",\\\"x\\\",-1,-1,n,e,t,s,r,0),a(\\\"z\\\",\\\"y\\\",\\\"x\\\",1,-1,n,e,-t,s,r,1),a(\\\"x\\\",\\\"z\\\",\\\"y\\\",1,1,t,n,e,i,s,2),a(\\\"x\\\",\\\"z\\\",\\\"y\\\",1,-1,t,n,-e,i,s,3),a(\\\"x\\\",\\\"y\\\",\\\"z\\\",1,-1,t,e,n,i,r,4),a(\\\"x\\\",\\\"y\\\",\\\"z\\\",-1,-1,t,e,-n,i,r,5),this.setIndex(l),this.setAttribute(\\\"position\\\",new Sh(c,3)),this.setAttribute(\\\"normal\\\",new Sh(h,3)),this.setAttribute(\\\"uv\\\",new Sh(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Gh(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}const Wh={clone:z,merge:k};ui=\\\"void main() {\\\\n\\\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\\\n}\\\",di=\\\"void main() {\\\\n\\\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\\\n}\\\";class Xh extends fh{constructor(t){super(),this.isShaderMaterial=!0,this.type=\\\"ShaderMaterial\\\",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ui,this.fragmentShader=di,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=z(t.uniforms),this.uniformsGroups=V(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:\\\"t\\\",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:\\\"c\\\",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:\\\"v2\\\",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:\\\"v3\\\",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:\\\"v4\\\",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:\\\"m3\\\",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:\\\"m4\\\",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class jh extends qc{constructor(){super(),this.isCamera=!0,this.type=\\\"Camera\\\",this.matrixWorldInverse=new yc,this.projectionMatrix=new yc,this.projectionMatrixInverse=new yc,this.coordinateSystem=_l,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const qh=new Rl,Yh=new Al,Kh=new Al;class Jh extends jh{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type=\\\"PerspectiveCamera\\\",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*bl*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Tl*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*bl*Math.atan(Math.tan(.5*Tl*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){qh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(qh.x,qh.y).multiplyScalar(-t/qh.z),qh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(qh.x,qh.y).multiplyScalar(-t/qh.z)}getViewSize(t,e){return this.getViewBounds(t,Yh,Kh),e.subVectors(Kh,Yh)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Tl*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Zh=-90,$h=1;class Qh extends qc{constructor(t,e,n){super(),this.type=\\\"CubeCamera\\\",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Jh(Zh,1,t,e);i.layers=this.layers,this.add(i);const r=new Jh(Zh,1,t,e);r.layers=this.layers,this.add(r);const s=new Jh(Zh,1,t,e);s.layers=this.layers,this.add(s);const a=new Jh(Zh,1,t,e);a.layers=this.layers,this.add(a);const o=new Jh(Zh,1,t,e);o.layers=this.layers,this.add(o);const l=new Jh(Zh,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,a,o]=e;for(const t of e)this.remove(t);if(t===_l)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==vl)throw new Error(\\\"THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: \\\"+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,l,c]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,s),t.setRenderTarget(n,2,i),t.render(e,a),t.setRenderTarget(n,3,i),t.render(e,o),t.setRenderTarget(n,4,i),t.render(e,l),n.texture.generateMipmaps=f,t.setRenderTarget(n,5,i),t.render(e,c),t.setRenderTarget(h,u,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class tu extends Hl{constructor(t=[],e=301,n,i,r,s,a,o,l,c){super(t,e,n,i,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class eu extends Xl{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new tu(i),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n=new Gh(5,5,5),i=new Xh({name:\\\"CubemapFromEquirect\\\",uniforms:z({tEquirect:{value:null}}),vertexShader:\\\"\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tvarying vec3 vWorldDirection;\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tvoid main() {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tvWorldDirection = transformDirection( position, modelMatrix );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t#include <begin_vertex>\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t#include <project_vertex>\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\t\\\",fragmentShader:\\\"\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tuniform sampler2D tEquirect;\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tvarying vec3 vWorldDirection;\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t#include <common>\\\\n\\\\n\\\\t\\\\t\\\\t\\\\tvoid main() {\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tvec3 direction = normalize( vWorldDirection );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tvec2 sampleUV = equirectUv( direction );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\t\\\",side:1,blending:0});i.uniforms.tEquirect.value=e;const r=new Hh(n,i),s=e.minFilter;return e.minFilter===Pa&&(e.minFilter=Ra),new Qh(1,10,this).update(t,r),e.minFilter=s,r.geometry.dispose(),r.material.dispose(),this}clear(t,e=!0,n=!0,i=!0){const r=t.getRenderTarget();for(let r=0;6>r;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}class nu extends qc{constructor(){super(),this.isGroup=!0,this.type=\\\"Group\\\"}}const iu={type:\\\"move\\\"};class ru{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new nu,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new nu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Rl,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Rl),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new nu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Rl,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Rl),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:\\\"connected\\\",data:t}),this}disconnect(t){return this.dispatchEvent({type:\\\"disconnected\\\",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&\\\"visible-blurred\\\"!==e.session.visibilityState){if(l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n),r=this._getHandJoint(l,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints[\\\"index-finger-tip\\\"],r=l.joints[\\\"thumb-tip\\\"],a=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&a>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:\\\"pinchend\\\",handedness:t.handedness,target:this})):l.inputState.pinching||a>o-c||(l.inputState.pinching=!0,this.dispatchEvent({type:\\\"pinchstart\\\",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(iu)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new nu;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class su extends qc{constructor(){super(),this.isScene=!0,this.type=\\\"Scene\\\",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Pc,this.environmentIntensity=1,this.environmentRotation=new Pc,this.overrideMaterial=null,\\\"undefined\\\"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\\\"observe\\\",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class au{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ml,this.updateRanges=[],this.version=0,this.uuid=c()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;r>i;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=c()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=c()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const ou=new Rl;class lu{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name=\\\"\\\",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;n>e;e++)ou.fromBufferAttribute(this,e),ou.applyMatrix4(t),this.setXYZ(e,ou.x,ou.y,ou.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;n>e;e++)ou.fromBufferAttribute(this,e),ou.applyNormalMatrix(t),this.setXYZ(e,ou.x,ou.y,ou.z);return this}transformDirection(t){for(let e=0,n=this.count;n>e;e++)ou.fromBufferAttribute(this,e),ou.transformDirection(t),this.setXYZ(e,ou.x,ou.y,ou.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=C(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=P(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=P(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=P(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=P(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=P(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=C(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=C(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=C(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=C(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=P(e,this.array),n=P(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=P(e,this.array),n=P(n,this.array),i=P(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=P(e,this.array),n=P(n,this.array),i=P(i,this.array),r=P(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){r(\\\"InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.\\\");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new xh(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new lu(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){r(\\\"InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.\\\");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const cu=new Rl,hu=new Gl,uu=new Gl,du=new Rl,pu=new yc,fu=new Rl,mu=new uc,gu=new yc,_u=new xc;class vu extends Hh{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type=\\\"SkinnedMesh\\\",this.bindMode=fa,this.bindMatrix=new yc,this.bindMatrixInverse=new yc,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Yl),this.boundingBox.makeEmpty();const e=t.getAttribute(\\\"position\\\");for(let t=0;t<e.count;t++)this.getVertexPosition(t,fu),this.boundingBox.expandByPoint(fu)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new uc),this.boundingSphere.makeEmpty();const e=t.getAttribute(\\\"position\\\");for(let t=0;t<e.count;t++)this.getVertexPosition(t,fu),this.boundingSphere.expandByPoint(fu)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),mu.copy(this.boundingSphere),mu.applyMatrix4(i),!1!==t.ray.intersectsSphere(mu)&&(gu.copy(i).invert(),_u.copy(t.ray).applyMatrix4(gu),null!==this.boundingBox&&!1===_u.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,_u)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Gl,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;i>n;n++){t.fromBufferAttribute(e,n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===fa?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ma?this.bindMatrixInverse.copy(this.bindMatrix).invert():s(\\\"SkinnedMesh: Unrecognized bindMode: \\\"+this.bindMode)}applyBoneTransform(t,e){const n=this.skeleton,i=this.geometry;hu.fromBufferAttribute(i.attributes.skinIndex,t),uu.fromBufferAttribute(i.attributes.skinWeight,t),cu.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;4>t;t++){const i=uu.getComponent(t);if(0!==i){const r=hu.getComponent(t);pu.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(du.copy(cu).applyMatrix4(pu),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}class xu extends qc{constructor(){super(),this.isBone=!0,this.type=\\\"Bone\\\"}}class yu extends Hl{constructor(t=null,e=1,n=1,i,r,s,a,o,l=1003,c=1003,h,u){super(null,s,a,o,l,c,i,r,h,u),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Mu=new yc,Su=new yc;class Tu{constructor(t=[],e=[]){this.uuid=c(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){s(\\\"Skeleton: Number of inverse bone matrices does not match amount of bones.\\\"),this.boneInverses=[];for(let t=0,e=this.bones.length;e>t;t++)this.boneInverses.push(new yc)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;e>t;t++){const e=new yc;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;e>t;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;e>t;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;r>i;i++){const r=t[i]?t[i].matrixWorld:Su;Mu.multiplyMatrices(r,e[i]),Mu.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Tu(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new yu(e,t,t,ja,Fa);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;n>e;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;i>n;n++){const i=t.bones[n];let r=e[i];void 0===r&&(s(\\\"Skeleton: No bone found with UUID:\\\",i),r=new xu),this.bones.push(r),this.boneInverses.push((new yc).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.7,type:\\\"Skeleton\\\",generator:\\\"Skeleton.toJSON\\\"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;r>i;i++){const r=e[i];t.bones.push(r.uuid);const s=n[i];t.boneInverses.push(s.toArray())}return t}}class bu extends xh{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const Eu=new yc,Au=new yc,wu=[],Ru=new Yl,Cu=new yc,Pu=new Hh,Iu=new uc;class Lu extends Hh{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new bu(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let t=0;n>t;t++)this.setMatrixAt(t,Cu)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new Yl),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;e>n;n++)this.getMatrixAt(n,Eu),Ru.copy(t.boundingBox).applyMatrix4(Eu),this.boundingBox.union(Ru)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new uc),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;e>n;n++)this.getMatrixAt(n,Eu),Iu.copy(t.boundingSphere).applyMatrix4(Eu),this.boundingSphere.union(Iu)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=t*(n.length+1)+1;for(let t=0;t<n.length;t++)n[t]=i[r+t]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Pu.geometry=this.geometry,Pu.material=this.material,void 0!==Pu.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Iu.copy(this.boundingSphere),Iu.applyMatrix4(n),!1!==t.ray.intersectsSphere(Iu)))for(let r=0;i>r;r++){this.getMatrixAt(r,Eu),Au.multiplyMatrices(n,Eu),Pu.matrixWorld=Au,Pu.raycast(t,wu);for(let t=0,n=wu.length;n>t;t++){const n=wu[t];n.instanceId=r,n.object=this,e.push(n)}wu.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new bu(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new yu(new Float32Array(i*this.count),i,this.count,Ka,Fa));const r=this.morphTexture.source.data.data;let s=0;for(let t=0;t<n.length;t++)s+=n[t];const a=this.geometry.morphTargetsRelative?1:1-s,o=i*t;r[o]=a,r.set(n,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:\\\"dispose\\\"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Nu=new Rl,Uu=new Rl,Du=new Il;class Ou{constructor(t=new Rl(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Nu.subVectors(n,e).cross(Uu.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Nu),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return 0>r||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return 0>e&&n>0||0>n&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Du.getNormalMatrix(t),i=this.coplanarPoint(Nu).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Fu=new uc,Bu=new Al(.5,.5),zu=new Rl;class ku{constructor(t=new Ou,e=new Ou,n=new Ou,i=new Ou,r=new Ou,s=new Ou){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;6>n;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=2e3,n=!1){const i=this.planes,r=t.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],p=r[8],f=r[9],m=r[10],g=r[11],_=r[12],v=r[13],x=r[14],y=r[15];if(i[0].setComponents(l-s,d-c,g-p,y-_).normalize(),i[1].setComponents(l+s,d+c,g+p,y+_).normalize(),i[2].setComponents(l+a,d+h,g+f,y+v).normalize(),i[3].setComponents(l-a,d-h,g-f,y-v).normalize(),n)i[4].setComponents(o,u,m,x).normalize(),i[5].setComponents(l-o,d-u,g-m,y-x).normalize();else if(i[4].setComponents(l-o,d-u,g-m,y-x).normalize(),e===_l)i[5].setComponents(l+o,d+u,g+m,y+x).normalize();else{if(e!==vl)throw new Error(\\\"THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: \\\"+e);i[5].setComponents(o,u,m,x).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Fu.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Fu.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Fu)}intersectsSprite(t){Fu.center.set(0,0,0);const e=Bu.distanceTo(t.center);return Fu.radius=.7071067811865476+e,Fu.applyMatrix4(t.matrixWorld),this.intersectsSphere(Fu)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;6>t;t++)if(i>e[t].distanceToPoint(n))return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;6>n;n++){const i=e[n];if(zu.x=i.normal.x>0?t.max.x:t.min.x,zu.y=i.normal.y>0?t.max.y:t.min.y,zu.z=i.normal.z>0?t.max.z:t.min.z,0>i.distanceToPoint(zu))return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;6>n;n++)if(0>e[n].distanceToPoint(t))return!1;return!0}clone(){return(new this.constructor).copy(this)}}class Vu extends fh{constructor(t){super(),this.isLineBasicMaterial=!0,this.type=\\\"LineBasicMaterial\\\",this.color=new uh(16777215),this.map=null,this.linewidth=1,this.linecap=\\\"round\\\",this.linejoin=\\\"round\\\",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Hu=new Rl,Gu=new Rl,Wu=new yc,Xu=new xc,ju=new uc,qu=new Rl,Yu=new Rl;class Ku extends qc{constructor(t=new Ph,e=new Vu){super(),this.isLine=!0,this.type=\\\"Line\\\",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;i>t;t++)Hu.fromBufferAttribute(e,t-1),Gu.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=Hu.distanceTo(Gu);t.setAttribute(\\\"lineDistance\\\",new Sh(n,1))}else s(\\\"Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\\\");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ju.copy(n.boundingSphere),ju.applyMatrix4(i),ju.radius+=r,!1===t.ray.intersectsSphere(ju))return;Wu.copy(i).invert(),Xu.copy(t.ray).applyMatrix4(Wu);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;s>r;r+=l){const n=c.getX(r),i=c.getX(r+1),s=G(this,t,Xu,o,n,i,r);s&&e.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),a=G(this,t,Xu,o,r,s,i-1);a&&e.push(a)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;s>r;r+=l){const n=G(this,t,Xu,o,r,r+1,r);n&&e.push(n)}if(this.isLineLoop){const r=G(this,t,Xu,o,i-1,n,i-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;e>t;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}const Ju=new Rl,Zu=new Rl;class $u extends Ku{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type=\\\"LineSegments\\\"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;i>t;t+=2)Ju.fromBufferAttribute(e,t),Zu.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Ju.distanceTo(Zu);t.setAttribute(\\\"lineDistance\\\",new Sh(n,1))}else s(\\\"LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\\\");return this}}class Qu extends Ku{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type=\\\"LineLoop\\\"}}class td extends fh{constructor(t){super(),this.isPointsMaterial=!0,this.type=\\\"PointsMaterial\\\",this.color=new uh(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const ed=new yc,nd=new xc,id=new uc,rd=new Rl;class sd extends qc{constructor(t=new Ph,e=new td){super(),this.isPoints=!0,this.type=\\\"Points\\\",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),id.copy(n.boundingSphere),id.applyMatrix4(i),id.radius+=r,!1===t.ray.intersectsSphere(id))return;ed.copy(i).invert(),nd.copy(t.ray).applyMatrix4(ed);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);r>n;n++){const r=l.getX(n);rd.fromBufferAttribute(c,r),W(rd,r,o,i,t,e,this)}else for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);r>n;n++)rd.fromBufferAttribute(c,n),W(rd,n,o,i,t,e,this)}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;e>t;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}class ad extends Hl{constructor(t,e,n=1014,i,r,s,a=1003,o=1003,l,c=1026,h=1){if(c!==qa&&c!==Ya)throw new Error(\\\"DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat\\\");super({width:t,height:e,depth:h},i,r,s,a,o,c,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new zl(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class od extends ad{constructor(t,e=1014,n=301,i,r,s=1003,a=1003,o,l=1026){const c={width:t,height:t,depth:1},h=[c,c,c,c,c,c];super(t,t,e,n,i,r,s,a,o,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class ld extends Hl{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class cd{constructor(){this.type=\\\"Curve\\\",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){s(\\\"Curve: .getPoint() not implemented.\\\")}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;t>=n;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;t>=n;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;t>=s;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let a,o=0,l=r-1;for(;l>=o;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,0>a)o=i+1;else{if(0>=a){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;0>i&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new Al:new Rl);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e=!1){const n=new Rl,i=[],r=[],s=[],a=new Rl,o=new yc;for(let e=0;t>=e;e++){const n=e/t;i[e]=this.getTangentAt(n,new Rl)}r[0]=new Rl,s[0]=new Rl;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);c>l||(l=c,n.set(1,0,0)),u>l||(l=u,n.set(0,1,0)),d>l||n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let e=1;t>=e;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(h(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(h(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;t>=n;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:\\\"Curve\\\",generator:\\\"Curve.toJSON\\\"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class hd extends cd{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type=\\\"EllipseCurve\\\",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new Al){const n=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;0>r;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const a=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=o-this.aX,i=l-this.aY;o=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class ud extends hd{constructor(t,e,n,i,r,s){super(t,e,n,n,i,r,s),this.isArcCurve=!0,this.type=\\\"ArcCurve\\\"}}const dd=new Rl,pd=new X,fd=new X,md=new X;class gd extends cd{constructor(t=[],e=!1,n=\\\"centripetal\\\",i=.5){super(),this.isCatmullRomCurve3=!0,this.type=\\\"CatmullRomCurve3\\\",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new Rl){const n=e,i=this.points,r=i.length,s=(r-(this.closed?0:1))*t;let a,o,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(dd.subVectors(i[0],i[1]).add(i[0]),a=dd);const h=i[l%r],u=i[(l+1)%r];if(this.closed||r>l+2?o=i[(l+2)%r]:(dd.subVectors(i[r-1],i[r-2]).add(i[r-1]),o=dd),\\\"centripetal\\\"===this.curveType||\\\"chordal\\\"===this.curveType){const t=\\\"chordal\\\"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(o),t);1e-4>n&&(n=1),1e-4>e&&(e=n),1e-4>i&&(i=n),pd.initNonuniformCatmullRom(a.x,h.x,u.x,o.x,e,n,i),fd.initNonuniformCatmullRom(a.y,h.y,u.y,o.y,e,n,i),md.initNonuniformCatmullRom(a.z,h.z,u.z,o.z,e,n,i)}else\\\"catmullrom\\\"===this.curveType&&(pd.initCatmullRom(a.x,h.x,u.x,o.x,this.tension),fd.initCatmullRom(a.y,h.y,u.y,o.y,this.tension),md.initCatmullRom(a.z,h.z,u.z,o.z,this.tension));return n.set(pd.calc(c),fd.calc(c),md.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;n>e;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;n>e;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;n>e;e++){const n=t.points[e];this.points.push((new Rl).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}class _d extends cd{constructor(t=new Al,e=new Al,n=new Al,i=new Al){super(),this.isCubicBezierCurve=!0,this.type=\\\"CubicBezierCurve\\\",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new Al){const n=e,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(et(t,i.x,r.x,s.x,a.x),et(t,i.y,r.y,s.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class vd extends cd{constructor(t=new Rl,e=new Rl,n=new Rl,i=new Rl){super(),this.isCubicBezierCurve3=!0,this.type=\\\"CubicBezierCurve3\\\",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new Rl){const n=e,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(et(t,i.x,r.x,s.x,a.x),et(t,i.y,r.y,s.y,a.y),et(t,i.z,r.z,s.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class xd extends cd{constructor(t=new Al,e=new Al){super(),this.isLineCurve=!0,this.type=\\\"LineCurve\\\",this.v1=t,this.v2=e}getPoint(t,e=new Al){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Al){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class yd extends cd{constructor(t=new Rl,e=new Rl){super(),this.isLineCurve3=!0,this.type=\\\"LineCurve3\\\",this.v1=t,this.v2=e}getPoint(t,e=new Rl){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Rl){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Md extends cd{constructor(t=new Al,e=new Al,n=new Al){super(),this.isQuadraticBezierCurve=!0,this.type=\\\"QuadraticBezierCurve\\\",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Al){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(J(t,i.x,r.x,s.x),J(t,i.y,r.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Sd extends cd{constructor(t=new Rl,e=new Rl,n=new Rl){super(),this.isQuadraticBezierCurve3=!0,this.type=\\\"QuadraticBezierCurve3\\\",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Rl){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(J(t,i.x,r.x,s.x),J(t,i.y,r.y,s.y),J(t,i.z,r.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Td extends cd{constructor(t=[]){super(),this.isSplineCurve=!0,this.type=\\\"SplineCurve\\\",this.points=t}getPoint(t,e=new Al){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),a=r-s,o=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(j(a,o.x,l.x,c.x,h.x),j(a,o.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;n>e;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;n>e;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;n>e;e++){const n=t.points[e];this.points.push((new Al).fromArray(n))}return this}}pi=Object.freeze({__proto__:null,ArcCurve:ud,CatmullRomCurve3:gd,CubicBezierCurve:_d,CubicBezierCurve3:vd,EllipseCurve:hd,LineCurve:xd,LineCurve3:yd,QuadraticBezierCurve:Md,QuadraticBezierCurve3:Sd,SplineCurve:Td});class bd extends cd{constructor(){super(),this.type=\\\"CurvePath\\\",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=!0===t.isVector2?\\\"LineCurve\\\":\\\"LineCurve3\\\";this.curves.push(new pi[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;i>n;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;t>=n;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],a=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,o=s.getPoints(a);for(let t=0;t<o.length;t++){const i=o[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;n>e;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;n>e;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;n>e;e++){const n=t.curves[e];this.curves.push((new pi[n.type]).fromJSON(n))}return this}}class Ed extends bd{constructor(t){super(),this.type=\\\"Path\\\",this.currentPoint=new Al,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;n>e;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new xd(this.currentPoint.clone(),new Al(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new Md(this.currentPoint.clone(),new Al(t,e),new Al(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,s){const a=new _d(this.currentPoint.clone(),new Al(t,e),new Al(n,i),new Al(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Td(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,s){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,n,i,r,s),this}absarc(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this}ellipse(t,e,n,i,r,s,a,o){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,i,r,s,a,o),this}absellipse(t,e,n,i,r,s,a,o){const l=new hd(t,e,n,i,r,s,a,o);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Ad extends Ed{constructor(t){super(t),this.uuid=c(),this.type=\\\"Shape\\\",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;i>n;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;n>e;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;n>e;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;n>e;e++){const n=t.holes[e];this.holes.push((new Ed).fromJSON(n))}return this}}class wd{static triangulate(t,e,n=2){return nt(t,e,n)}}class Rd{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;e>r;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return 0>Rd.area(t)}static triangulateShape(t,e){const n=[],i=[],r=[];Dt(t),Ot(n,t);let s=t.length;e.forEach(Dt);for(let t=0;t<e.length;t++)i.push(s),s+=e[t].length,Ot(n,e[t]);const a=wd.triangulate(n,i);for(let t=0;t<a.length;t+=3)r.push(a.slice(t,t+3));return r}}class Cd extends Ph{constructor(t=new Ad([new Al(.5,.5),new Al(-.5,.5),new Al(-.5,-.5),new Al(.5,-.5)]),e={}){function n(t){function n(t){const e=1e-10*1e-10;let n=t[0];for(let i=1;i<=t.length;i++){const r=i%t.length,s=t[r],a=s.x-n.x,o=s.y-n.y,l=a*a+o*o,c=Math.max(Math.abs(s.x),Math.abs(s.y),Math.abs(n.x),Math.abs(n.y));l>e*c*c?n=s:(t.splice(r,1),i--)}}function o(t,e,n){return e||a(\\\"ExtrudeGeometry: vec does not exist\\\"),t.clone().addScaledVector(e,n)}function l(t,e,n){let i,r,s;const a=t.x-e.x,o=t.y-e.y,l=n.x-t.x,c=n.y-t.y,h=a*a+o*o,u=a*c-o*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,f=e.y+a/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(a*c-o*l);i=p+a*m-t.x,r=f+o*m-t.y;const g=i*i+r*r;if(2>=g)return new Al(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new Al(i/s,r/s)}function c(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;0>r&&(r=t.length-1);for(let t=0,n=_+2*T;n>t;t++){const n=F*t,s=F*(t+1);d(e+i+n,e+r+n,e+r+s,e+i+s)}}}function h(t,e,n){m.push(t),m.push(e),m.push(n)}function u(t,e,n){p(t),p(e),p(n);const s=r.length/3,a=E.generateTopUV(i,r,s-3,s-2,s-1);f(a[0]),f(a[1]),f(a[2])}function d(t,e,n,s){p(t),p(e),p(s),p(e),p(n),p(s);const a=r.length/3,o=E.generateSideWallUV(i,r,a-6,a-3,a-2,a-1);f(o[0]),f(o[1]),f(o[3]),f(o[1]),f(o[2]),f(o[3])}function p(t){r.push(m[3*t+0]),r.push(m[3*t+1]),r.push(m[3*t+2])}function f(t){s.push(t.x),s.push(t.y)}const m=[],g=void 0!==e.curveSegments?e.curveSegments:12,_=void 0!==e.steps?e.steps:1,v=void 0!==e.depth?e.depth:1;let x=void 0===e.bevelEnabled||e.bevelEnabled,y=void 0!==e.bevelThickness?e.bevelThickness:.2,M=void 0!==e.bevelSize?e.bevelSize:y-.1,S=void 0!==e.bevelOffset?e.bevelOffset:0,T=void 0!==e.bevelSegments?e.bevelSegments:3;const b=e.extrudePath,E=void 0!==e.UVGenerator?e.UVGenerator:Pd;let A,w,R,C,P,I=!1;if(b){A=b.getSpacedPoints(_),I=!0,x=!1;const t=!!b.isCatmullRomCurve3&&b.closed;w=b.computeFrenetFrames(_,t),R=new Rl,C=new Rl,P=new Rl}x||(T=0,y=0,M=0,S=0);const L=t.extractPoints(g);let N=L.shape;const U=L.holes;if(!Rd.isClockWise(N)){N=N.reverse();for(let t=0,e=U.length;e>t;t++){const e=U[t];Rd.isClockWise(e)&&(U[t]=e.reverse())}}n(N),U.forEach(n);const D=U.length,O=N;for(let t=0;D>t;t++){const e=U[t];N=N.concat(e)}const F=N.length,B=[];for(let t=0,e=O.length,n=e-1,i=t+1;e>t;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),B[t]=l(O[t],O[n],O[i]);const z=[];let k,V,H=B.concat();for(let t=0,e=D;e>t;t++){const e=U[t];k=[];for(let t=0,n=e.length,i=n-1,r=t+1;n>t;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),k[t]=l(e[t],e[i],e[r]);z.push(k),H=H.concat(k)}if(0===T)V=Rd.triangulateShape(O,U);else{const t=[],e=[];for(let n=0;T>n;n++){const i=n/T,r=y*Math.cos(i*Math.PI/2),s=M*Math.sin(i*Math.PI/2)+S;for(let e=0,n=O.length;n>e;e++){const n=o(O[e],B[e],s);h(n.x,n.y,-r),0===i&&t.push(n)}for(let t=0,n=D;n>t;t++){const n=U[t];k=z[t];const a=[];for(let t=0,e=n.length;e>t;t++){const e=o(n[t],k[t],s);h(e.x,e.y,-r),0===i&&a.push(e)}0===i&&e.push(a)}}V=Rd.triangulateShape(t,e)}const G=V.length,W=M+S;for(let t=0;F>t;t++){const e=x?o(N[t],H[t],W):N[t];I?(C.copy(w.normals[0]).multiplyScalar(e.x),R.copy(w.binormals[0]).multiplyScalar(e.y),P.copy(A[0]).add(C).add(R),h(P.x,P.y,P.z)):h(e.x,e.y,0)}for(let t=1;_>=t;t++)for(let e=0;F>e;e++){const n=x?o(N[e],H[e],W):N[e];I?(C.copy(w.normals[t]).multiplyScalar(n.x),R.copy(w.binormals[t]).multiplyScalar(n.y),P.copy(A[t]).add(C).add(R),h(P.x,P.y,P.z)):h(n.x,n.y,v/_*t)}for(let t=T-1;t>=0;t--){const e=t/T,n=y*Math.cos(e*Math.PI/2),i=M*Math.sin(e*Math.PI/2)+S;for(let t=0,e=O.length;e>t;t++){const e=o(O[t],B[t],i);h(e.x,e.y,v+n)}for(let t=0,e=U.length;e>t;t++){const e=U[t];k=z[t];for(let t=0,r=e.length;r>t;t++){const r=o(e[t],k[t],i);I?h(r.x,r.y+A[_-1].y,A[_-1].x+n):h(r.x,r.y,v+n)}}}!function(){const t=r.length/3;if(x){let t=0,e=F*t;for(let t=0;G>t;t++){const n=V[t];u(n[2]+e,n[1]+e,n[0]+e)}t=_+2*T,e=F*t;for(let t=0;G>t;t++){const n=V[t];u(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;G>t;t++){const e=V[t];u(e[2],e[1],e[0])}for(let t=0;G>t;t++){const e=V[t];u(e[0]+F*_,e[1]+F*_,e[2]+F*_)}}i.addGroup(t,r.length/3-t,0)}(),function(){const t=r.length/3;let e=0;c(O,e),e+=O.length;for(let t=0,n=U.length;n>t;t++){const n=U[t];c(n,e),e+=n.length}i.addGroup(t,r.length/3-t,1)}()}super(),this.type=\\\"ExtrudeGeometry\\\",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,r=[],s=[];for(let e=0,i=t.length;i>e;e++)n(t[e]);this.setAttribute(\\\"position\\\",new Sh(r,3)),this.setAttribute(\\\"uv\\\",new Sh(s,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return Ft(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;r>i;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new pi[i.type]).fromJSON(i)),new Cd(n,t.options)}}const Pd={generateTopUV:function(t,e,n,i,r){const s=e[3*n],a=e[3*n+1],o=e[3*i],l=e[3*i+1],c=e[3*r],h=e[3*r+1];return[new Al(s,a),new Al(o,l),new Al(c,h)]},generateSideWallUV:function(t,e,n,i,r,s){const a=e[3*n],o=e[3*n+1],l=e[3*n+2],c=e[3*i],h=e[3*i+1],u=e[3*i+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*s],g=e[3*s+1],_=e[3*s+2];return Math.abs(o-h)<Math.abs(a-c)?[new Al(a,1-l),new Al(c,1-u),new Al(d,1-f),new Al(m,1-_)]:[new Al(o,1-l),new Al(h,1-u),new Al(p,1-f),new Al(g,1-_)]}};class Id extends Ph{constructor(t=1,e=1,n=1,i=1){super(),this.type=\\\"PlaneGeometry\\\",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,s=e/2,a=Math.floor(n),o=Math.floor(i),l=a+1,c=o+1,h=t/a,u=e/o,d=[],p=[],f=[],m=[];for(let t=0;c>t;t++){const e=t*u-s;for(let n=0;l>n;n++){const i=n*h-r;p.push(i,-e,0),f.push(0,0,1),m.push(n/a),m.push(1-t/o)}}for(let t=0;o>t;t++)for(let e=0;a>e;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),s=e+1+l*t;d.push(n,i,s),d.push(i,r,s)}this.setIndex(d),this.setAttribute(\\\"position\\\",new Sh(p,3)),this.setAttribute(\\\"normal\\\",new Sh(f,3)),this.setAttribute(\\\"uv\\\",new Sh(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Id(t.width,t.height,t.widthSegments,t.heightSegments)}}class Ld extends Xh{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type=\\\"RawShaderMaterial\\\"}}class Nd extends fh{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type=\\\"MeshStandardMaterial\\\",this.defines={STANDARD:\\\"\\\"},this.color=new uh(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new uh(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Al(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pc,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:\\\"\\\"},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Ud extends Nd{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:\\\"\\\",PHYSICAL:\\\"\\\"},this.type=\\\"MeshPhysicalMaterial\\\",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Al(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,\\\"reflectivity\\\",{get:function(){return h(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new uh(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new uh(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new uh(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:\\\"\\\",PHYSICAL:\\\"\\\"},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Dd extends fh{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type=\\\"MeshPhongMaterial\\\",this.color=new uh(16777215),this.specular=new uh(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new uh(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Al(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pc,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Od extends fh{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type=\\\"MeshNormalMaterial\\\",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Al(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class Fd extends fh{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type=\\\"MeshLambertMaterial\\\",this.color=new uh(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new uh(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Al(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Pc,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Bd extends fh{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type=\\\"MeshDepthMaterial\\\",this.depthPacking=Zo,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class zd extends fh{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type=\\\"MeshDistanceMaterial\\\",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class kd extends fh{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:\\\"\\\"},this.type=\\\"MeshMatcapMaterial\\\",this.color=new uh(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Al(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:\\\"\\\"},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Vd{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(t>=i){for(let s=n+2;;){if(void 0===i){if(r>t)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=e[++n],i>t)break e}s=e.length;break n}if(r>t){const a=e[1];a>t&&(n=2,r=a);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=e[--n-1],t>=r)break e}s=n,n=0;break n}break t}for(;s>n;){const i=n+s>>>1;t<e[i]?s=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error(\\\"call to abstract method\\\")}intervalChanged_(){}}class Hd extends Vd{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Go,endingEnd:Go}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,s=t+1,a=i[r],o=i[s];if(void 0===a)switch(this.getSettings_().endingStart){case Wo:r=t,a=2*e-n;break;case Xo:r=i.length-2,a=e+i[r]-i[r+1];break;default:r=t,a=n}if(void 0===o)switch(this.getSettings_().endingEnd){case Wo:s=t,o=2*n-e;break;case Xo:s=1,o=n+i[1]-i[0];break;default:s=t-1,o=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(o-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,_=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,v=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let t=0;t!==a;++t)r[t]=g*s[c+t]+_*s[l+t]+v*s[o+t]+x*s[h+t];return r}}class Gd extends Vd{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=(n-e)/(i-e),h=1-c;for(let t=0;t!==a;++t)r[t]=s[l+t]*h+s[o+t]*c;return r}}class Wd extends Vd{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Xd{constructor(t,e,n,i){if(void 0===t)throw new Error(\\\"THREE.KeyframeTrack: track name is undefined\\\");if(void 0===e||0===e.length)throw new Error(\\\"THREE.KeyframeTrack: no keyframes in track named \\\"+t);this.name=t,this.times=Bt(e,this.TimeBufferType),this.values=Bt(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Bt(t.times,Array),values:Bt(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Wd(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Gd(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Hd(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ko:e=this.InterpolantFactoryMethodDiscrete;break;case Vo:e=this.InterpolantFactoryMethodLinear;break;case Ho:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e=\\\"unsupported interpolation for \\\"+this.ValueTypeName+\\\" keyframe track named \\\"+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return s(\\\"KeyframeTrack:\\\",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ko;case this.InterpolantFactoryMethodLinear:return Vo;case this.InterpolantFactoryMethodSmooth:return Ho}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==r||s!==i){s>r||(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*t,s*t)}return this}validate(){let t=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(a(\\\"KeyframeTrack: Invalid value size in track.\\\",this),t=!1);const i=this.times,r=this.values,s=i.length;0===s&&(a(\\\"KeyframeTrack: Track is empty.\\\",this),t=!1);let o=null;for(let e=0;e!==s;e++){const n=i[e];if(\\\"number\\\"==typeof n&&isNaN(n)){a(\\\"KeyframeTrack: Time is not a valid number.\\\",this,e,n),t=!1;break}if(null!==o&&o>n){a(\\\"KeyframeTrack: Out of order keys.\\\",this,e,n,o),t=!1;break}o=n}if(void 0!==r&&e(r))for(let e=0,n=r.length;e!==n;++e){const n=r[e];if(isNaN(n)){a(\\\"KeyframeTrack: Value is not a valid number.\\\",this,e,n),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ho,r=t.length-1;let s=1;for(let a=1;r>a;++a){let r=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(i)r=!0;else{const t=a*n,i=t-n,s=t+n;for(let a=0;a!==n;++a){const n=e[t+a];if(n!==e[i+a]||n!==e[s+a]){r=!0;break}}}if(r){if(a!==s){t[s]=t[a];const i=a*n,r=s*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=e.slice(0,s*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Xd.prototype.ValueTypeName=\\\"\\\",Xd.prototype.TimeBufferType=Float32Array,Xd.prototype.ValueBufferType=Float32Array,Xd.prototype.DefaultInterpolation=Vo;class jd extends Xd{constructor(t,e,n){super(t,e,n)}}jd.prototype.ValueTypeName=\\\"bool\\\",jd.prototype.ValueBufferType=Array,jd.prototype.DefaultInterpolation=ko,jd.prototype.InterpolantFactoryMethodLinear=void 0,jd.prototype.InterpolantFactoryMethodSmooth=void 0;class qd extends Xd{constructor(t,e,n,i){super(t,e,n,i)}}qd.prototype.ValueTypeName=\\\"color\\\";class Yd extends Xd{constructor(t,e,n,i){super(t,e,n,i)}}Yd.prototype.ValueTypeName=\\\"number\\\";class Kd extends Vd{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(let t=l+a;l!==t;l+=4)wl.slerpFlat(r,0,s,l-a,s,l,o);return r}}class Jd extends Xd{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new Kd(this.times,this.values,this.getValueSize(),t)}}Jd.prototype.ValueTypeName=\\\"quaternion\\\",Jd.prototype.InterpolantFactoryMethodSmooth=void 0;class Zd extends Xd{constructor(t,e,n){super(t,e,n)}}Zd.prototype.ValueTypeName=\\\"string\\\",Zd.prototype.ValueBufferType=Array,Zd.prototype.DefaultInterpolation=ko,Zd.prototype.InterpolantFactoryMethodLinear=void 0,Zd.prototype.InterpolantFactoryMethodSmooth=void 0;class $d extends Xd{constructor(t,e,n,i){super(t,e,n,i)}}$d.prototype.ValueTypeName=\\\"vector\\\";class Qd{constructor(t=\\\"\\\",e=-1,n=[],i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=c(),this.userData={},0>this.duration&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Gt(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||\\\"{}\\\"),r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,i=n.length;t!==i;++t)e.push(Xd.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;r>t;t++){let a=[],o=[];a.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const l=zt(a);a=kt(a,1,l),o=kt(o,1,l),i||0!==a[0]||(a.push(r),o.push(o[0])),s.push(new Yd(\\\".morphTargetInfluences[\\\"+e[t].name+\\\"]\\\",a,o).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\\\\w-]*?)([\\\\d]+)$/;for(let e=0,n=t.length;n>e;e++){const n=t[e],s=n.name.match(r);if(s&&s.length>1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(t,e){if(s(\\\"AnimationClip: parseAnimation() is deprecated and will be removed with r185\\\"),!t)return a(\\\"AnimationClip: No animation in JSONLoader data.\\\"),null;const n=function(t,e,n,i,r){if(0!==n.length){const s=[],a=[];Vt(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||\\\"default\\\",o=t.fps||30,l=t.blendMode;let c=t.length||-1;const h=t.hierarchy||[];for(let t=0;t<h.length;t++){const r=h[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],s=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new Yd(\\\".morphTargetInfluence[\\\"+n+\\\"]\\\",t,s))}c=t.length*o}else{const s=\\\".bones[\\\"+e[t].name+\\\"]\\\";n($d,s+\\\".position\\\",r,\\\"pos\\\",i),n(Jd,s+\\\".quaternion\\\",r,\\\"rot\\\",i),n($d,s+\\\".scale\\\",r,\\\"scl\\\",i)}}return 0===i.length?null:new this(r,c,i,l)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());const e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}}const tp={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ep{constructor(t,e,n){const i=this;let r,s=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(t){o++,!1===s&&void 0!==i.onStart&&i.onStart(t,a,o),s=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;n>e;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const np=new ep;class ip{constructor(t){this.manager=void 0!==t?t:np,this.crossOrigin=\\\"anonymous\\\",this.withCredentials=!1,this.path=\\\"\\\",this.resourcePath=\\\"\\\",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise(function(i,r){n.load(t,i,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}ip.DEFAULT_MATERIAL_NAME=\\\"__DEFAULT\\\";const rp={};class sp extends Error{constructor(t,e){super(t),this.response=e}}class ap extends ip{constructor(t){super(t),this.mimeType=\\\"\\\",this.responseType=\\\"\\\",this._abortController=new AbortController}load(t,e,n,i){void 0===t&&(t=\\\"\\\"),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=tp.get(`file:${t}`);if(void 0!==r)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==rp[t])return void rp[t].push({onLoad:e,onProgress:n,onError:i});rp[t]=[],rp[t].push({onLoad:e,onProgress:n,onError:i});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?\\\"include\\\":\\\"same-origin\\\",signal:\\\"function\\\"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&s(\\\"FileLoader: HTTP Status 0 received.\\\"),\\\"undefined\\\"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=rp[t],i=e.body.getReader(),r=e.headers.get(\\\"X-File-Size\\\")||e.headers.get(\\\"Content-Length\\\"),a=r?parseInt(r):0,o=0!==a;let l=0;const c=new ReadableStream({start(t){!function e(){i.read().then(({done:i,value:r})=>{if(i)t.close();else{l+=r.byteLength;const i=new ProgressEvent(\\\"progress\\\",{lengthComputable:o,loaded:l,total:a});for(let t=0,e=n.length;e>t;t++){const e=n[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}},e=>{t.error(e)})}()}});return new Response(c)}throw new sp(`fetch for \\\"${e.url}\\\" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(l){case\\\"arraybuffer\\\":return t.arrayBuffer();case\\\"blob\\\":return t.blob();case\\\"document\\\":return t.text().then(t=>(new DOMParser).parseFromString(t,o));case\\\"json\\\":return t.json();default:if(\\\"\\\"===o)return t.text();{const e=/charset=\\\"?([^;\\\"\\\\s]*)\\\"?/i.exec(o),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{tp.add(`file:${t}`,e);const n=rp[t];delete rp[t];for(let t=0,i=n.length;i>t;t++){const i=n[t];i.onLoad&&i.onLoad(e)}}).catch(e=>{const n=rp[t];if(void 0===n)throw this.manager.itemError(t),e;delete rp[t];for(let t=0,i=n.length;i>t;t++){const i=n[t];i.onError&&i.onError(e)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const op=new WeakMap;class lp extends ip{constructor(t){super(t)}load(t,e,i,r){function s(){o(),e&&e(this);const n=op.get(this)||[];for(let t=0;t<n.length;t++){const e=n[t];e.onLoad&&e.onLoad(this)}op.delete(this),l.manager.itemEnd(t)}function a(e){o(),r&&r(e),tp.remove(`image:${t}`);const n=op.get(this)||[];for(let t=0;t<n.length;t++){const i=n[t];i.onError&&i.onError(e)}op.delete(this),l.manager.itemError(t),l.manager.itemEnd(t)}function o(){h.removeEventListener(\\\"load\\\",s,!1),h.removeEventListener(\\\"error\\\",a,!1)}void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const l=this,c=tp.get(`image:${t}`);if(void 0!==c){if(!0===c.complete)l.manager.itemStart(t),setTimeout(function(){e&&e(c),l.manager.itemEnd(t)},0);else{let t=op.get(c);void 0===t&&(t=[],op.set(c,t)),t.push({onLoad:e,onError:r})}return c}const h=n(\\\"img\\\");return h.addEventListener(\\\"load\\\",s,!1),h.addEventListener(\\\"error\\\",a,!1),\\\"data:\\\"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(h.crossOrigin=this.crossOrigin),tp.add(`image:${t}`,h),l.manager.itemStart(t),h.src=t,h}}class cp extends ip{constructor(t){super(t)}load(t,e,n,i){const r=new Hl,s=new lp(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},n,i),r}}class hp extends qc{constructor(t,e=1){super(),this.isLight=!0,this.type=\\\"Light\\\",this.color=new uh(t),this.intensity=e}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}}const up=new yc,dp=new Rl,pp=new Rl;class fp{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Al(512,512),this.mapType=Ia,this.map=null,this.mapPass=null,this.matrix=new yc,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ku,this._frameExtents=new Al(1,1),this._viewportCount=1,this._viewports=[new Gl(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;dp.setFromMatrixPosition(t.matrixWorld),e.position.copy(dp),pp.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(pp),e.updateMatrixWorld(),up.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(up,e.coordinateSystem,e.reversedDepth),e.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(up)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class mp extends fp{constructor(){super(new Jh(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){const e=this.camera,n=2*bl*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class gp extends hp{constructor(t,e,n=0,i=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type=\\\"SpotLight\\\",this.position.copy(qc.DEFAULT_UP),this.updateMatrix(),this.target=new qc,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new mp}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.map=t.map,this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.distance=this.distance,e.object.angle=this.angle,e.object.decay=this.decay,e.object.penumbra=this.penumbra,e.object.target=this.target.uuid,this.map&&this.map.isTexture&&(e.object.map=this.map.toJSON(t).uuid),e.object.shadow=this.shadow.toJSON(),e}}class _p extends fp{constructor(){super(new Jh(90,1,.5,500)),this.isPointLightShadow=!0}}class vp extends hp{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type=\\\"PointLight\\\",this.distance=n,this.decay=i,this.shadow=new _p}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.distance=this.distance,e.object.decay=this.decay,e.object.shadow=this.shadow.toJSON(),e}}class xp extends jh{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type=\\\"OrthographicCamera\\\",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class yp extends fp{constructor(){super(new xp(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Mp extends hp{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type=\\\"DirectionalLight\\\",this.position.copy(qc.DEFAULT_UP),this.updateMatrix(),this.target=new qc,this.shadow=new yp}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.shadow=this.shadow.toJSON(),e.object.target=this.target.uuid,e}}class Sp extends hp{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type=\\\"AmbientLight\\\"}}class Tp{static extractUrlBase(t){const e=t.lastIndexOf(\\\"/\\\");return-1===e?\\\"./\\\":t.slice(0,e+1)}static resolveURL(t,e){return\\\"string\\\"!=typeof t||\\\"\\\"===t?\\\"\\\":(/^https?:\\\\/\\\\//i.test(e)&&/^\\\\//.test(t)&&(e=e.replace(/(^https?:\\\\/\\\\/[^\\\\/]+).*/i,\\\"$1\\\")),/^(https?:)?\\\\/\\\\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}const bp=new WeakMap;class Ep extends ip{constructor(t){super(t),this.isImageBitmapLoader=!0,\\\"undefined\\\"==typeof createImageBitmap&&s(\\\"ImageBitmapLoader: createImageBitmap() not supported.\\\"),\\\"undefined\\\"==typeof fetch&&s(\\\"ImageBitmapLoader: fetch() not supported.\\\"),this.options={premultiplyAlpha:\\\"none\\\"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=\\\"\\\"),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=tp.get(`image-bitmap:${t}`);if(void 0!==s)return r.manager.itemStart(t),s.then?void s.then(n=>{if(!0!==bp.has(s))return e&&e(n),r.manager.itemEnd(t),n;i&&i(bp.get(s)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(s),r.manager.itemEnd(t)},0),s);const a={};a.credentials=\\\"anonymous\\\"===this.crossOrigin?\\\"same-origin\\\":\\\"include\\\",a.headers=this.requestHeader,a.signal=\\\"function\\\"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:\\\"none\\\"}))}).then(function(n){return tp.add(`image-bitmap:${t}`,n),e&&e(n),r.manager.itemEnd(t),n}).catch(function(e){i&&i(e),bp.set(o,e),tp.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});tp.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Ap extends Jh{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class wp{constructor(t,e,n){let i,r,s;switch(this.binding=t,this.valueSize=n,e){case\\\"quaternion\\\":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case\\\"string\\\":case\\\"bool\\\":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==i;++t)n[r+t]=n[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,1>r){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;e>n;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){wl.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;wl.multiplyQuaternionsFlat(t,s,t,e,t,n),wl.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const Rp=\\\"\\\\\\\\[\\\\\\\\]\\\\\\\\.:\\\\\\\\/\\\",Cp=new RegExp(\\\"[\\\"+Rp+\\\"]\\\",\\\"g\\\"),Pp=\\\"[^\\\"+Rp+\\\"]\\\",Ip=\\\"[^\\\"+Rp.replace(\\\"\\\\\\\\.\\\",\\\"\\\")+\\\"]\\\",Lp=/((?:WC+[\\\\/:])*)/.source.replace(\\\"WC\\\",Pp),Np=/(WCOD+)?/.source.replace(\\\"WCOD\\\",Ip),Up=/(?:\\\\.(WC+)(?:\\\\[(.+)\\\\])?)?/.source.replace(\\\"WC\\\",Pp),Dp=/\\\\.(WC+)(?:\\\\[(.+)\\\\])?/.source.replace(\\\"WC\\\",Pp),Op=new RegExp(\\\"^\\\"+Lp+Np+Up+Dp+\\\"$\\\"),Fp=[\\\"material\\\",\\\"materials\\\",\\\"bones\\\",\\\"map\\\"];class Bp{constructor(t,e,n){const i=n||zp.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}class zp{constructor(t,e,n){this.path=e,this.parsedPath=n||zp.parseTrackName(e),this.node=zp.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new zp.Composite(t,e,n):new zp(t,e,n)}static sanitizeNodeName(t){return t.replace(/\\\\s/g,\\\"_\\\").replace(Cp,\\\"\\\")}static parseTrackName(t){const e=Op.exec(t);if(null===e)throw new Error(\\\"PropertyBinding: Cannot parse trackName: \\\"+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(\\\".\\\");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Fp.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error(\\\"PropertyBinding: can not parse propertyName from trackName: \\\"+t);return n}static findNode(t,e){if(void 0===e||\\\"\\\"===e||\\\".\\\"===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const s=n(r.children);if(s)return s}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=zp.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void s(\\\"PropertyBinding: No target node found for track: \\\"+this.path+\\\".\\\");if(n){let i=e.objectIndex;switch(n){case\\\"materials\\\":if(!t.material)return void a(\\\"PropertyBinding: Can not bind to material as node does not have a material.\\\",this);if(!t.material.materials)return void a(\\\"PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.\\\",this);t=t.material.materials;break;case\\\"bones\\\":if(!t.skeleton)return void a(\\\"PropertyBinding: Can not bind to bones as node does not have a skeleton.\\\",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case\\\"map\\\":if(\\\"map\\\"in t){t=t.map;break}if(!t.material)return void a(\\\"PropertyBinding: Can not bind to material as node does not have a material.\\\",this);if(!t.material.map)return void a(\\\"PropertyBinding: Can not bind to material.map as node.material does not have a map.\\\",this);t=t.material.map;break;default:if(void 0===t[n])return void a(\\\"PropertyBinding: Can not bind to objectName of node undefined.\\\",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void a(\\\"PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.\\\",this,t);t=t[i]}}const o=t[i];if(void 0===o)return void a(\\\"PropertyBinding: Trying to update property for track: \\\"+e.nodeName+\\\".\\\"+i+\\\" but it wasn't found.\\\",t);let l=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?l=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(l=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(void 0!==r){if(\\\"morphTargetInfluences\\\"===i){if(!t.geometry)return void a(\\\"PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.\\\",this);if(!t.geometry.morphAttributes)return void a(\\\"PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.\\\",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}zp.Composite=Bp,zp.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},zp.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},zp.prototype.GetterByBindingType=[zp.prototype._getValue_direct,zp.prototype._getValue_array,zp.prototype._getValue_arrayElement,zp.prototype._getValue_toArray],zp.prototype.SetterByBindingTypeAndVersioning=[[zp.prototype._setValue_direct,zp.prototype._setValue_direct_setNeedsUpdate,zp.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[zp.prototype._setValue_array,zp.prototype._setValue_array_setNeedsUpdate,zp.prototype._setValue_array_setMatrixWorldNeedsUpdate],[zp.prototype._setValue_arrayElement,zp.prototype._setValue_arrayElement_setNeedsUpdate,zp.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[zp.prototype._setValue_fromArray,zp.prototype._setValue_fromArray_setNeedsUpdate,zp.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class kp{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,a=new Array(s),o={endingStart:Go,endingEnd:Go};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Bo,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n=!1){if(t.fadeOut(e),this.fadeIn(e),!0===n){const n=this._clip.duration,i=t._clip.duration,r=i/n,s=n/i;t.warp(1,r,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n=!1){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;0>i||0===n?e=0:(this._startTime=null,e=n*i)}e*=this._updateTimeScale(t);const s=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===qo)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const s=n===zo;if(0===t)return-1===r||!s||1&~r?i:e-i;if(n===Fo){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>i){if(i>=0){this.time=i;break t}i=0}else i=e;this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:\\\"finished\\\",action:this,direction:0>t?-1:1})}}else{if(-1===r&&(0>t?this._setEndings(0===this.repetitions,!0,s):(r=0,this._setEndings(!0,0===this.repetitions,s))),i>=e||0>i){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a>0){if(1===a){const e=0>t;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:\\\"loop\\\",action:this,loopDelta:n})}else this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:\\\"finished\\\",action:this,direction:t>0?1:-1})}else this.time=i;if(s&&!(1&~r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Wo,i.endingEnd=Wo):(i.endingStart=t?this.zeroSlopeAtStart?Wo:Go:Xo,i.endingEnd=e?this.zeroSlopeAtEnd?Wo:Go:Xo)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}const Vp=new Float32Array(1);class Hp extends yl{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,a=t._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[t]=h;else{if(h=s[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new wp(zp.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),s[t]=h}a[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0===n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,a=s[r],o=a.knownActions,l=o[o.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,o[c]=l,o.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0===--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[e];void 0===s&&(s={},i[e]=s),s[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,a=s[i],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete a[r],0===Object.keys(a).length&&delete s[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new Gd(new Float32Array(2),new Float32Array(2),1,Vp),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let s=\\\"string\\\"==typeof t?Qd.findByName(i,t):t;const a=null!==s?s.uuid:t,o=this._actionsByClip[a];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:jo),void 0!==o){const t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=o.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new kp(this,s,e,n);return this._bindAction(c,l),this._addInactiveAction(c,a,r),c}existingAction(t,e){const n=e||this._root,i=n.uuid,r=\\\"string\\\"==typeof t?Qd.findByName(n,t):t,s=r?r.uuid:t,a=this._actionsByClip[s];return void 0!==a&&a.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==n;++a)e[a]._update(i,t,r,s);const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,s=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}const Gp=new Al;class Wp{constructor(t=new Al(1/0,1/0),e=new Al(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;n>e;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Gp.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return!(this.min.x>t.min.x||t.max.x>this.max.x||this.min.y>t.min.y||t.max.y>this.max.y)}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Gp).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}class Xp{constructor(){this.type=\\\"ShapePath\\\",this.color=new uh,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Ed,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,s){return this.currentPath.bezierCurveTo(t,e,n,i,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const n=e.length;let i=!1;for(let r=n-1,s=0;n>s;r=s++){let n=e[r],a=e[s],o=a.x-n.x,l=a.y-n.y;if(Math.abs(l)>Number.EPSILON){if(0>l&&(n=e[s],o=-o,a=e[r],l=-l),t.y<n.y||t.y>a.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(0>e)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const n=Rd.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,a;const o=[];if(1===i.length)return s=i[0],a=new Ad,a.curves=s.curves,o.push(a),o;let l=!n(i[0].getPoints());l=t?!l:l;const c=[],h=[];let u,d,p=[],f=0;h[f]=void 0,p[f]=[];for(let e=0,a=i.length;a>e;e++)s=i[e],u=s.getPoints(),r=n(u),r=t?!r:r,r?(!l&&h[f]&&f++,h[f]={s:new Ad,p:u},h[f].s.curves=s.curves,l&&f++,p[f]=[]):p[f].push({h:s,p:u[0]});if(!h[0])return function(t){const e=[];for(let n=0,i=t.length;i>n;n++){const i=t[n],r=new Ad;r.curves=i.curves,e.push(r)}return e}(i);if(h.length>1){let t=!1,n=0;for(let t=0,e=h.length;e>t;t++)c[t]=[];for(let i=0,r=h.length;r>i;i++){const r=p[i];for(let s=0;s<r.length;s++){const a=r[s];let o=!0;for(let r=0;r<h.length;r++)e(a.p,h[r].p)&&(i!==r&&n++,o?(o=!1,c[r].push(a)):t=!0);o&&c[i].push(a)}}n>0&&!1===t&&(p=c)}for(let t=0,e=h.length;e>t;t++){a=h[t].s,o.push(a),d=p[t];for(let t=0,e=d.length;e>t;t++)a.holes.push(d[t].h)}return o}}\\\"undefined\\\"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\\\"register\\\",{detail:{revision:ps}})),\\\"undefined\\\"!=typeof window&&(window.__THREE__?s(\\\"WARNING: Multiple instances of Three.js being imported.\\\"):window.__THREE__=ps);const jp=\\\"varying vec2 vUv;\\\\nuniform mat3 uvTransform;\\\\nvoid main() {\\\\n\\\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\\\n\\\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\\\n}\\\",qp=\\\"uniform sampler2D t2D;\\\\nuniform float backgroundIntensity;\\\\nvarying vec2 vUv;\\\\nvoid main() {\\\\n\\\\tvec4 texColor = texture2D( t2D, vUv );\\\\n\\\\t#ifdef DECODE_VIDEO_TEXTURE\\\\n\\\\t\\\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\\\n\\\\t#endif\\\\n\\\\ttexColor.rgb *= backgroundIntensity;\\\\n\\\\tgl_FragColor = texColor;\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n}\\\",Yp=\\\"varying vec3 vWorldDirection;\\\\n#include <common>\\\\nvoid main() {\\\\n\\\\tvWorldDirection = transformDirection( position, modelMatrix );\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\tgl_Position.z = gl_Position.w;\\\\n}\\\",Kp=\\\"#ifdef ENVMAP_TYPE_CUBE\\\\n\\\\tuniform samplerCube envMap;\\\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\\\n\\\\tuniform sampler2D envMap;\\\\n#endif\\\\nuniform float flipEnvMap;\\\\nuniform float backgroundBlurriness;\\\\nuniform float backgroundIntensity;\\\\nuniform mat3 backgroundRotation;\\\\nvarying vec3 vWorldDirection;\\\\n#include <cube_uv_reflection_fragment>\\\\nvoid main() {\\\\n\\\\t#ifdef ENVMAP_TYPE_CUBE\\\\n\\\\t\\\\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\\\n\\\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\\\n\\\\t\\\\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\\\\n\\\\t#else\\\\n\\\\t\\\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\\\n\\\\t#endif\\\\n\\\\ttexColor.rgb *= backgroundIntensity;\\\\n\\\\tgl_FragColor = texColor;\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n}\\\",Jp=\\\"varying vec3 vWorldDirection;\\\\n#include <common>\\\\nvoid main() {\\\\n\\\\tvWorldDirection = transformDirection( position, modelMatrix );\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\tgl_Position.z = gl_Position.w;\\\\n}\\\",Zp=\\\"uniform samplerCube tCube;\\\\nuniform float tFlip;\\\\nuniform float opacity;\\\\nvarying vec3 vWorldDirection;\\\\nvoid main() {\\\\n\\\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\\\n\\\\tgl_FragColor = texColor;\\\\n\\\\tgl_FragColor.a *= opacity;\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n}\\\",$p=\\\"#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <displacementmap_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvarying vec2 vHighPrecisionZW;\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#ifdef USE_DISPLACEMENTMAP\\\\n\\\\t\\\\t#include <beginnormal_vertex>\\\\n\\\\t\\\\t#include <morphnormal_vertex>\\\\n\\\\t\\\\t#include <skinnormal_vertex>\\\\n\\\\t#endif\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <displacementmap_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\tvHighPrecisionZW = gl_Position.zw;\\\\n}\\\",Qp=\\\"#if DEPTH_PACKING == 3200\\\\n\\\\tuniform float opacity;\\\\n#endif\\\\n#include <common>\\\\n#include <packing>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvarying vec2 vHighPrecisionZW;\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( 1.0 );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\t#if DEPTH_PACKING == 3200\\\\n\\\\t\\\\tdiffuseColor.a = opacity;\\\\n\\\\t#endif\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\\\n\\\\t\\\\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\\\\n\\\\t#else\\\\n\\\\t\\\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\\\\n\\\\t#endif\\\\n\\\\t#if DEPTH_PACKING == 3200\\\\n\\\\t\\\\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\\\\n\\\\t#elif DEPTH_PACKING == 3201\\\\n\\\\t\\\\tgl_FragColor = packDepthToRGBA( fragCoordZ );\\\\n\\\\t#elif DEPTH_PACKING == 3202\\\\n\\\\t\\\\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\\\\n\\\\t#elif DEPTH_PACKING == 3203\\\\n\\\\t\\\\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\\\\n\\\\t#endif\\\\n}\\\",tf=\\\"#define DISTANCE\\\\nvarying vec3 vWorldPosition;\\\\n#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <displacementmap_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#ifdef USE_DISPLACEMENTMAP\\\\n\\\\t\\\\t#include <beginnormal_vertex>\\\\n\\\\t\\\\t#include <morphnormal_vertex>\\\\n\\\\t\\\\t#include <skinnormal_vertex>\\\\n\\\\t#endif\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <displacementmap_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <worldpos_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\tvWorldPosition = worldPosition.xyz;\\\\n}\\\",ef=\\\"#define DISTANCE\\\\nuniform vec3 referencePosition;\\\\nuniform float nearDistance;\\\\nuniform float farDistance;\\\\nvarying vec3 vWorldPosition;\\\\n#include <common>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main () {\\\\n\\\\tvec4 diffuseColor = vec4( 1.0 );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\tfloat dist = length( vWorldPosition - referencePosition );\\\\n\\\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\\\n\\\\tdist = saturate( dist );\\\\n\\\\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\\\\n}\\\",nf=\\\"varying vec3 vWorldDirection;\\\\n#include <common>\\\\nvoid main() {\\\\n\\\\tvWorldDirection = transformDirection( position, modelMatrix );\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <project_vertex>\\\\n}\\\",rf=\\\"uniform sampler2D tEquirect;\\\\nvarying vec3 vWorldDirection;\\\\n#include <common>\\\\nvoid main() {\\\\n\\\\tvec3 direction = normalize( vWorldDirection );\\\\n\\\\tvec2 sampleUV = equirectUv( direction );\\\\n\\\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n}\\\",sf=\\\"uniform float scale;\\\\nattribute float lineDistance;\\\\nvarying float vLineDistance;\\\\n#include <common>\\\\n#include <uv_pars_vertex>\\\\n#include <color_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\tvLineDistance = scale * lineDistance;\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <color_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphcolor_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n}\\\",af=\\\"uniform vec3 diffuse;\\\\nuniform float opacity;\\\\nuniform float dashSize;\\\\nuniform float totalSize;\\\\nvarying float vLineDistance;\\\\n#include <common>\\\\n#include <color_pars_fragment>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\\\n\\\\t\\\\tdiscard;\\\\n\\\\t}\\\\n\\\\tvec3 outgoingLight = vec3( 0.0 );\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <color_fragment>\\\\n\\\\toutgoingLight = diffuseColor.rgb;\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n\\\\t#include <premultiplied_alpha_fragment>\\\\n}\\\",of=\\\"#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <envmap_pars_vertex>\\\\n#include <color_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <color_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphcolor_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\\\n\\\\t\\\\t#include <beginnormal_vertex>\\\\n\\\\t\\\\t#include <morphnormal_vertex>\\\\n\\\\t\\\\t#include <skinbase_vertex>\\\\n\\\\t\\\\t#include <skinnormal_vertex>\\\\n\\\\t\\\\t#include <defaultnormal_vertex>\\\\n\\\\t#endif\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\t#include <worldpos_vertex>\\\\n\\\\t#include <envmap_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n}\\\",lf=\\\"uniform vec3 diffuse;\\\\nuniform float opacity;\\\\n#ifndef FLAT_SHADED\\\\n\\\\tvarying vec3 vNormal;\\\\n#endif\\\\n#include <common>\\\\n#include <dithering_pars_fragment>\\\\n#include <color_pars_fragment>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <aomap_pars_fragment>\\\\n#include <lightmap_pars_fragment>\\\\n#include <envmap_common_pars_fragment>\\\\n#include <envmap_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <specularmap_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <color_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\t#include <specularmap_fragment>\\\\n\\\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\\\n\\\\t#ifdef USE_LIGHTMAP\\\\n\\\\t\\\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\\\n\\\\t\\\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\\\n\\\\t#else\\\\n\\\\t\\\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\\\n\\\\t#endif\\\\n\\\\t#include <aomap_fragment>\\\\n\\\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\\\n\\\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\\\n\\\\t#include <envmap_fragment>\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n\\\\t#include <premultiplied_alpha_fragment>\\\\n\\\\t#include <dithering_fragment>\\\\n}\\\",cf=\\\"#define LAMBERT\\\\nvarying vec3 vViewPosition;\\\\n#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <displacementmap_pars_vertex>\\\\n#include <envmap_pars_vertex>\\\\n#include <color_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <normal_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <shadowmap_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <color_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphcolor_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <beginnormal_vertex>\\\\n\\\\t#include <morphnormal_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <skinnormal_vertex>\\\\n\\\\t#include <defaultnormal_vertex>\\\\n\\\\t#include <normal_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <displacementmap_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\tvViewPosition = - mvPosition.xyz;\\\\n\\\\t#include <worldpos_vertex>\\\\n\\\\t#include <envmap_vertex>\\\\n\\\\t#include <shadowmap_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n}\\\",hf=\\\"#define LAMBERT\\\\nuniform vec3 diffuse;\\\\nuniform vec3 emissive;\\\\nuniform float opacity;\\\\n#include <common>\\\\n#include <dithering_pars_fragment>\\\\n#include <color_pars_fragment>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <aomap_pars_fragment>\\\\n#include <lightmap_pars_fragment>\\\\n#include <emissivemap_pars_fragment>\\\\n#include <envmap_common_pars_fragment>\\\\n#include <envmap_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <bsdfs>\\\\n#include <lights_pars_begin>\\\\n#include <normal_pars_fragment>\\\\n#include <lights_lambert_pars_fragment>\\\\n#include <shadowmap_pars_fragment>\\\\n#include <bumpmap_pars_fragment>\\\\n#include <normalmap_pars_fragment>\\\\n#include <specularmap_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\\\n\\\\tvec3 totalEmissiveRadiance = emissive;\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <color_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\t#include <specularmap_fragment>\\\\n\\\\t#include <normal_fragment_begin>\\\\n\\\\t#include <normal_fragment_maps>\\\\n\\\\t#include <emissivemap_fragment>\\\\n\\\\t#include <lights_lambert_fragment>\\\\n\\\\t#include <lights_fragment_begin>\\\\n\\\\t#include <lights_fragment_maps>\\\\n\\\\t#include <lights_fragment_end>\\\\n\\\\t#include <aomap_fragment>\\\\n\\\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\\\n\\\\t#include <envmap_fragment>\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n\\\\t#include <premultiplied_alpha_fragment>\\\\n\\\\t#include <dithering_fragment>\\\\n}\\\",uf=\\\"#define MATCAP\\\\nvarying vec3 vViewPosition;\\\\n#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <color_pars_vertex>\\\\n#include <displacementmap_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <normal_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <color_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphcolor_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <beginnormal_vertex>\\\\n\\\\t#include <morphnormal_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <skinnormal_vertex>\\\\n\\\\t#include <defaultnormal_vertex>\\\\n\\\\t#include <normal_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <displacementmap_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n\\\\tvViewPosition = - mvPosition.xyz;\\\\n}\\\",df=\\\"#define MATCAP\\\\nuniform vec3 diffuse;\\\\nuniform float opacity;\\\\nuniform sampler2D matcap;\\\\nvarying vec3 vViewPosition;\\\\n#include <common>\\\\n#include <dithering_pars_fragment>\\\\n#include <color_pars_fragment>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <normal_pars_fragment>\\\\n#include <bumpmap_pars_fragment>\\\\n#include <normalmap_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <color_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\t#include <normal_fragment_begin>\\\\n\\\\t#include <normal_fragment_maps>\\\\n\\\\tvec3 viewDir = normalize( vViewPosition );\\\\n\\\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\\\n\\\\tvec3 y = cross( viewDir, x );\\\\n\\\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\\\n\\\\t#ifdef USE_MATCAP\\\\n\\\\t\\\\tvec4 matcapColor = texture2D( matcap, uv );\\\\n\\\\t#else\\\\n\\\\t\\\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\\\n\\\\t#endif\\\\n\\\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n\\\\t#include <premultiplied_alpha_fragment>\\\\n\\\\t#include <dithering_fragment>\\\\n}\\\",pf=\\\"#define NORMAL\\\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\\\n\\\\tvarying vec3 vViewPosition;\\\\n#endif\\\\n#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <displacementmap_pars_vertex>\\\\n#include <normal_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <beginnormal_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphnormal_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <skinnormal_vertex>\\\\n\\\\t#include <defaultnormal_vertex>\\\\n\\\\t#include <normal_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <displacementmap_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\\\n\\\\tvViewPosition = - mvPosition.xyz;\\\\n#endif\\\\n}\\\",ff=\\\"#define NORMAL\\\\nuniform float opacity;\\\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\\\n\\\\tvarying vec3 vViewPosition;\\\\n#endif\\\\n#include <uv_pars_fragment>\\\\n#include <normal_pars_fragment>\\\\n#include <bumpmap_pars_fragment>\\\\n#include <normalmap_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <normal_fragment_begin>\\\\n\\\\t#include <normal_fragment_maps>\\\\n\\\\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\\\\n\\\\t#ifdef OPAQUE\\\\n\\\\t\\\\tgl_FragColor.a = 1.0;\\\\n\\\\t#endif\\\\n}\\\",mf=\\\"#define PHONG\\\\nvarying vec3 vViewPosition;\\\\n#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <displacementmap_pars_vertex>\\\\n#include <envmap_pars_vertex>\\\\n#include <color_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <normal_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <shadowmap_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <color_vertex>\\\\n\\\\t#include <morphcolor_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <beginnormal_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphnormal_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <skinnormal_vertex>\\\\n\\\\t#include <defaultnormal_vertex>\\\\n\\\\t#include <normal_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <displacementmap_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\tvViewPosition = - mvPosition.xyz;\\\\n\\\\t#include <worldpos_vertex>\\\\n\\\\t#include <envmap_vertex>\\\\n\\\\t#include <shadowmap_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n}\\\",gf=\\\"#define PHONG\\\\nuniform vec3 diffuse;\\\\nuniform vec3 emissive;\\\\nuniform vec3 specular;\\\\nuniform float shininess;\\\\nuniform float opacity;\\\\n#include <common>\\\\n#include <dithering_pars_fragment>\\\\n#include <color_pars_fragment>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <aomap_pars_fragment>\\\\n#include <lightmap_pars_fragment>\\\\n#include <emissivemap_pars_fragment>\\\\n#include <envmap_common_pars_fragment>\\\\n#include <envmap_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <bsdfs>\\\\n#include <lights_pars_begin>\\\\n#include <normal_pars_fragment>\\\\n#include <lights_phong_pars_fragment>\\\\n#include <shadowmap_pars_fragment>\\\\n#include <bumpmap_pars_fragment>\\\\n#include <normalmap_pars_fragment>\\\\n#include <specularmap_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\\\n\\\\tvec3 totalEmissiveRadiance = emissive;\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <color_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\t#include <specularmap_fragment>\\\\n\\\\t#include <normal_fragment_begin>\\\\n\\\\t#include <normal_fragment_maps>\\\\n\\\\t#include <emissivemap_fragment>\\\\n\\\\t#include <lights_phong_fragment>\\\\n\\\\t#include <lights_fragment_begin>\\\\n\\\\t#include <lights_fragment_maps>\\\\n\\\\t#include <lights_fragment_end>\\\\n\\\\t#include <aomap_fragment>\\\\n\\\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\\\n\\\\t#include <envmap_fragment>\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n\\\\t#include <premultiplied_alpha_fragment>\\\\n\\\\t#include <dithering_fragment>\\\\n}\\\",_f=\\\"#define STANDARD\\\\nvarying vec3 vViewPosition;\\\\n#ifdef USE_TRANSMISSION\\\\n\\\\tvarying vec3 vWorldPosition;\\\\n#endif\\\\n#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <displacementmap_pars_vertex>\\\\n#include <color_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <normal_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <shadowmap_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <color_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphcolor_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <beginnormal_vertex>\\\\n\\\\t#include <morphnormal_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <skinnormal_vertex>\\\\n\\\\t#include <defaultnormal_vertex>\\\\n\\\\t#include <normal_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <displacementmap_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\tvViewPosition = - mvPosition.xyz;\\\\n\\\\t#include <worldpos_vertex>\\\\n\\\\t#include <shadowmap_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n#ifdef USE_TRANSMISSION\\\\n\\\\tvWorldPosition = worldPosition.xyz;\\\\n#endif\\\\n}\\\",vf=\\\"#define STANDARD\\\\n#ifdef PHYSICAL\\\\n\\\\t#define IOR\\\\n\\\\t#define USE_SPECULAR\\\\n#endif\\\\nuniform vec3 diffuse;\\\\nuniform vec3 emissive;\\\\nuniform float roughness;\\\\nuniform float metalness;\\\\nuniform float opacity;\\\\n#ifdef IOR\\\\n\\\\tuniform float ior;\\\\n#endif\\\\n#ifdef USE_SPECULAR\\\\n\\\\tuniform float specularIntensity;\\\\n\\\\tuniform vec3 specularColor;\\\\n\\\\t#ifdef USE_SPECULAR_COLORMAP\\\\n\\\\t\\\\tuniform sampler2D specularColorMap;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_SPECULAR_INTENSITYMAP\\\\n\\\\t\\\\tuniform sampler2D specularIntensityMap;\\\\n\\\\t#endif\\\\n#endif\\\\n#ifdef USE_CLEARCOAT\\\\n\\\\tuniform float clearcoat;\\\\n\\\\tuniform float clearcoatRoughness;\\\\n#endif\\\\n#ifdef USE_DISPERSION\\\\n\\\\tuniform float dispersion;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCE\\\\n\\\\tuniform float iridescence;\\\\n\\\\tuniform float iridescenceIOR;\\\\n\\\\tuniform float iridescenceThicknessMinimum;\\\\n\\\\tuniform float iridescenceThicknessMaximum;\\\\n#endif\\\\n#ifdef USE_SHEEN\\\\n\\\\tuniform vec3 sheenColor;\\\\n\\\\tuniform float sheenRoughness;\\\\n\\\\t#ifdef USE_SHEEN_COLORMAP\\\\n\\\\t\\\\tuniform sampler2D sheenColorMap;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\\\n\\\\t\\\\tuniform sampler2D sheenRoughnessMap;\\\\n\\\\t#endif\\\\n#endif\\\\n#ifdef USE_ANISOTROPY\\\\n\\\\tuniform vec2 anisotropyVector;\\\\n\\\\t#ifdef USE_ANISOTROPYMAP\\\\n\\\\t\\\\tuniform sampler2D anisotropyMap;\\\\n\\\\t#endif\\\\n#endif\\\\nvarying vec3 vViewPosition;\\\\n#include <common>\\\\n#include <dithering_pars_fragment>\\\\n#include <color_pars_fragment>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <aomap_pars_fragment>\\\\n#include <lightmap_pars_fragment>\\\\n#include <emissivemap_pars_fragment>\\\\n#include <iridescence_fragment>\\\\n#include <cube_uv_reflection_fragment>\\\\n#include <envmap_common_pars_fragment>\\\\n#include <envmap_physical_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <lights_pars_begin>\\\\n#include <normal_pars_fragment>\\\\n#include <lights_physical_pars_fragment>\\\\n#include <transmission_pars_fragment>\\\\n#include <shadowmap_pars_fragment>\\\\n#include <bumpmap_pars_fragment>\\\\n#include <normalmap_pars_fragment>\\\\n#include <clearcoat_pars_fragment>\\\\n#include <iridescence_pars_fragment>\\\\n#include <roughnessmap_pars_fragment>\\\\n#include <metalnessmap_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\\\n\\\\tvec3 totalEmissiveRadiance = emissive;\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <color_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\t#include <roughnessmap_fragment>\\\\n\\\\t#include <metalnessmap_fragment>\\\\n\\\\t#include <normal_fragment_begin>\\\\n\\\\t#include <normal_fragment_maps>\\\\n\\\\t#include <clearcoat_normal_fragment_begin>\\\\n\\\\t#include <clearcoat_normal_fragment_maps>\\\\n\\\\t#include <emissivemap_fragment>\\\\n\\\\t#include <lights_physical_fragment>\\\\n\\\\t#include <lights_fragment_begin>\\\\n\\\\t#include <lights_fragment_maps>\\\\n\\\\t#include <lights_fragment_end>\\\\n\\\\t#include <aomap_fragment>\\\\n\\\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\\\n\\\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\\\n\\\\t#include <transmission_fragment>\\\\n\\\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\\\n\\\\t#ifdef USE_SHEEN\\\\n \\\\n\\\\t\\\\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\\\\n \\\\n \\\\t#endif\\\\n\\\\t#ifdef USE_CLEARCOAT\\\\n\\\\t\\\\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\\\\n\\\\t\\\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\\\n\\\\t\\\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\\\\n\\\\t#endif\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n\\\\t#include <premultiplied_alpha_fragment>\\\\n\\\\t#include <dithering_fragment>\\\\n}\\\",xf=\\\"#define TOON\\\\nvarying vec3 vViewPosition;\\\\n#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <uv_pars_vertex>\\\\n#include <displacementmap_pars_vertex>\\\\n#include <color_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <normal_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <shadowmap_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\t#include <color_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphcolor_vertex>\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <beginnormal_vertex>\\\\n\\\\t#include <morphnormal_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <skinnormal_vertex>\\\\n\\\\t#include <defaultnormal_vertex>\\\\n\\\\t#include <normal_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <displacementmap_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\tvViewPosition = - mvPosition.xyz;\\\\n\\\\t#include <worldpos_vertex>\\\\n\\\\t#include <shadowmap_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n}\\\",yf=\\\"#define TOON\\\\nuniform vec3 diffuse;\\\\nuniform vec3 emissive;\\\\nuniform float opacity;\\\\n#include <common>\\\\n#include <dithering_pars_fragment>\\\\n#include <color_pars_fragment>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <aomap_pars_fragment>\\\\n#include <lightmap_pars_fragment>\\\\n#include <emissivemap_pars_fragment>\\\\n#include <gradientmap_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <bsdfs>\\\\n#include <lights_pars_begin>\\\\n#include <normal_pars_fragment>\\\\n#include <lights_toon_pars_fragment>\\\\n#include <shadowmap_pars_fragment>\\\\n#include <bumpmap_pars_fragment>\\\\n#include <normalmap_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\\\n\\\\tvec3 totalEmissiveRadiance = emissive;\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <color_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\t#include <normal_fragment_begin>\\\\n\\\\t#include <normal_fragment_maps>\\\\n\\\\t#include <emissivemap_fragment>\\\\n\\\\t#include <lights_toon_fragment>\\\\n\\\\t#include <lights_fragment_begin>\\\\n\\\\t#include <lights_fragment_maps>\\\\n\\\\t#include <lights_fragment_end>\\\\n\\\\t#include <aomap_fragment>\\\\n\\\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n\\\\t#include <premultiplied_alpha_fragment>\\\\n\\\\t#include <dithering_fragment>\\\\n}\\\",Mf=\\\"uniform float size;\\\\nuniform float scale;\\\\n#include <common>\\\\n#include <color_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\n#ifdef USE_POINTS_UV\\\\n\\\\tvarying vec2 vUv;\\\\n\\\\tuniform mat3 uvTransform;\\\\n#endif\\\\nvoid main() {\\\\n\\\\t#ifdef USE_POINTS_UV\\\\n\\\\t\\\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\\\n\\\\t#endif\\\\n\\\\t#include <color_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphcolor_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\tgl_PointSize = size;\\\\n\\\\t#ifdef USE_SIZEATTENUATION\\\\n\\\\t\\\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\\\n\\\\t\\\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\\\n\\\\t#endif\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\t#include <worldpos_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n}\\\",Sf=\\\"uniform vec3 diffuse;\\\\nuniform float opacity;\\\\n#include <common>\\\\n#include <color_pars_fragment>\\\\n#include <map_particle_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\tvec3 outgoingLight = vec3( 0.0 );\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_particle_fragment>\\\\n\\\\t#include <color_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\toutgoingLight = diffuseColor.rgb;\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n\\\\t#include <premultiplied_alpha_fragment>\\\\n}\\\",Tf=\\\"#include <common>\\\\n#include <batching_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <morphtarget_pars_vertex>\\\\n#include <skinning_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <shadowmap_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <batching_vertex>\\\\n\\\\t#include <beginnormal_vertex>\\\\n\\\\t#include <morphinstance_vertex>\\\\n\\\\t#include <morphnormal_vertex>\\\\n\\\\t#include <skinbase_vertex>\\\\n\\\\t#include <skinnormal_vertex>\\\\n\\\\t#include <defaultnormal_vertex>\\\\n\\\\t#include <begin_vertex>\\\\n\\\\t#include <morphtarget_vertex>\\\\n\\\\t#include <skinning_vertex>\\\\n\\\\t#include <project_vertex>\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <worldpos_vertex>\\\\n\\\\t#include <shadowmap_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n}\\\",bf=\\\"uniform vec3 color;\\\\nuniform float opacity;\\\\n#include <common>\\\\n#include <fog_pars_fragment>\\\\n#include <bsdfs>\\\\n#include <lights_pars_begin>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <shadowmap_pars_fragment>\\\\n#include <shadowmask_pars_fragment>\\\\nvoid main() {\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n}\\\",Ef=\\\"uniform float rotation;\\\\nuniform vec2 center;\\\\n#include <common>\\\\n#include <uv_pars_vertex>\\\\n#include <fog_pars_vertex>\\\\n#include <logdepthbuf_pars_vertex>\\\\n#include <clipping_planes_pars_vertex>\\\\nvoid main() {\\\\n\\\\t#include <uv_vertex>\\\\n\\\\tvec4 mvPosition = modelViewMatrix[ 3 ];\\\\n\\\\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\\\\n\\\\t#ifndef USE_SIZEATTENUATION\\\\n\\\\t\\\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\\\n\\\\t\\\\tif ( isPerspective ) scale *= - mvPosition.z;\\\\n\\\\t#endif\\\\n\\\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\\\n\\\\tvec2 rotatedPosition;\\\\n\\\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\\\n\\\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\\\n\\\\tmvPosition.xy += rotatedPosition;\\\\n\\\\tgl_Position = projectionMatrix * mvPosition;\\\\n\\\\t#include <logdepthbuf_vertex>\\\\n\\\\t#include <clipping_planes_vertex>\\\\n\\\\t#include <fog_vertex>\\\\n}\\\",Af=\\\"uniform vec3 diffuse;\\\\nuniform float opacity;\\\\n#include <common>\\\\n#include <uv_pars_fragment>\\\\n#include <map_pars_fragment>\\\\n#include <alphamap_pars_fragment>\\\\n#include <alphatest_pars_fragment>\\\\n#include <alphahash_pars_fragment>\\\\n#include <fog_pars_fragment>\\\\n#include <logdepthbuf_pars_fragment>\\\\n#include <clipping_planes_pars_fragment>\\\\nvoid main() {\\\\n\\\\tvec4 diffuseColor = vec4( diffuse, opacity );\\\\n\\\\t#include <clipping_planes_fragment>\\\\n\\\\tvec3 outgoingLight = vec3( 0.0 );\\\\n\\\\t#include <logdepthbuf_fragment>\\\\n\\\\t#include <map_fragment>\\\\n\\\\t#include <alphamap_fragment>\\\\n\\\\t#include <alphatest_fragment>\\\\n\\\\t#include <alphahash_fragment>\\\\n\\\\toutgoingLight = diffuseColor.rgb;\\\\n\\\\t#include <opaque_fragment>\\\\n\\\\t#include <tonemapping_fragment>\\\\n\\\\t#include <colorspace_fragment>\\\\n\\\\t#include <fog_fragment>\\\\n}\\\",wf={alphahash_fragment:fi=\\\"#ifdef USE_ALPHAHASH\\\\n\\\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\\\n#endif\\\",alphahash_pars_fragment:mi=\\\"#ifdef USE_ALPHAHASH\\\\n\\\\tconst float ALPHA_HASH_SCALE = 0.05;\\\\n\\\\tfloat hash2D( vec2 value ) {\\\\n\\\\t\\\\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\\\\n\\\\t}\\\\n\\\\tfloat hash3D( vec3 value ) {\\\\n\\\\t\\\\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\\\\n\\\\t}\\\\n\\\\tfloat getAlphaHashThreshold( vec3 position ) {\\\\n\\\\t\\\\tfloat maxDeriv = max(\\\\n\\\\t\\\\t\\\\tlength( dFdx( position.xyz ) ),\\\\n\\\\t\\\\t\\\\tlength( dFdy( position.xyz ) )\\\\n\\\\t\\\\t);\\\\n\\\\t\\\\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\\\\n\\\\t\\\\tvec2 pixScales = vec2(\\\\n\\\\t\\\\t\\\\texp2( floor( log2( pixScale ) ) ),\\\\n\\\\t\\\\t\\\\texp2( ceil( log2( pixScale ) ) )\\\\n\\\\t\\\\t);\\\\n\\\\t\\\\tvec2 alpha = vec2(\\\\n\\\\t\\\\t\\\\thash3D( floor( pixScales.x * position.xyz ) ),\\\\n\\\\t\\\\t\\\\thash3D( floor( pixScales.y * position.xyz ) )\\\\n\\\\t\\\\t);\\\\n\\\\t\\\\tfloat lerpFactor = fract( log2( pixScale ) );\\\\n\\\\t\\\\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\\\\n\\\\t\\\\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\\\\n\\\\t\\\\tvec3 cases = vec3(\\\\n\\\\t\\\\t\\\\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\\\\n\\\\t\\\\t\\\\t( x - 0.5 * a ) / ( 1.0 - a ),\\\\n\\\\t\\\\t\\\\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\\\\n\\\\t\\\\t);\\\\n\\\\t\\\\tfloat threshold = ( x < ( 1.0 - a ) )\\\\n\\\\t\\\\t\\\\t? ( ( x < a ) ? cases.x : cases.y )\\\\n\\\\t\\\\t\\\\t: cases.z;\\\\n\\\\t\\\\treturn clamp( threshold , 1.0e-6, 1.0 );\\\\n\\\\t}\\\\n#endif\\\",alphamap_fragment:gi=\\\"#ifdef USE_ALPHAMAP\\\\n\\\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\\\n#endif\\\",alphamap_pars_fragment:_i=\\\"#ifdef USE_ALPHAMAP\\\\n\\\\tuniform sampler2D alphaMap;\\\\n#endif\\\",alphatest_fragment:vi=\\\"#ifdef USE_ALPHATEST\\\\n\\\\t#ifdef ALPHA_TO_COVERAGE\\\\n\\\\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\\\\n\\\\tif ( diffuseColor.a == 0.0 ) discard;\\\\n\\\\t#else\\\\n\\\\tif ( diffuseColor.a < alphaTest ) discard;\\\\n\\\\t#endif\\\\n#endif\\\",alphatest_pars_fragment:xi=\\\"#ifdef USE_ALPHATEST\\\\n\\\\tuniform float alphaTest;\\\\n#endif\\\",aomap_fragment:yi=\\\"#ifdef USE_AOMAP\\\\n\\\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\\\n\\\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\\\n\\\\t#if defined( USE_CLEARCOAT ) \\\\n\\\\t\\\\tclearcoatSpecularIndirect *= ambientOcclusion;\\\\n\\\\t#endif\\\\n\\\\t#if defined( USE_SHEEN ) \\\\n\\\\t\\\\tsheenSpecularIndirect *= ambientOcclusion;\\\\n\\\\t#endif\\\\n\\\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\\\n\\\\t\\\\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\\\\n\\\\t\\\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\\\n\\\\t#endif\\\\n#endif\\\",aomap_pars_fragment:Mi=\\\"#ifdef USE_AOMAP\\\\n\\\\tuniform sampler2D aoMap;\\\\n\\\\tuniform float aoMapIntensity;\\\\n#endif\\\",batching_pars_vertex:Si=\\\"#ifdef USE_BATCHING\\\\n\\\\t#if ! defined( GL_ANGLE_multi_draw )\\\\n\\\\t#define gl_DrawID _gl_DrawID\\\\n\\\\tuniform int _gl_DrawID;\\\\n\\\\t#endif\\\\n\\\\tuniform highp sampler2D batchingTexture;\\\\n\\\\tuniform highp usampler2D batchingIdTexture;\\\\n\\\\tmat4 getBatchingMatrix( const in float i ) {\\\\n\\\\t\\\\tint size = textureSize( batchingTexture, 0 ).x;\\\\n\\\\t\\\\tint j = int( i ) * 4;\\\\n\\\\t\\\\tint x = j % size;\\\\n\\\\t\\\\tint y = j / size;\\\\n\\\\t\\\\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\\\\n\\\\t\\\\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\\\\n\\\\t\\\\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\\\\n\\\\t\\\\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\\\\n\\\\t\\\\treturn mat4( v1, v2, v3, v4 );\\\\n\\\\t}\\\\n\\\\tfloat getIndirectIndex( const in int i ) {\\\\n\\\\t\\\\tint size = textureSize( batchingIdTexture, 0 ).x;\\\\n\\\\t\\\\tint x = i % size;\\\\n\\\\t\\\\tint y = i / size;\\\\n\\\\t\\\\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\\\\n\\\\t}\\\\n#endif\\\\n#ifdef USE_BATCHING_COLOR\\\\n\\\\tuniform sampler2D batchingColorTexture;\\\\n\\\\tvec3 getBatchingColor( const in float i ) {\\\\n\\\\t\\\\tint size = textureSize( batchingColorTexture, 0 ).x;\\\\n\\\\t\\\\tint j = int( i );\\\\n\\\\t\\\\tint x = j % size;\\\\n\\\\t\\\\tint y = j / size;\\\\n\\\\t\\\\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\\\\n\\\\t}\\\\n#endif\\\",batching_vertex:Ti=\\\"#ifdef USE_BATCHING\\\\n\\\\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\\\\n#endif\\\",begin_vertex:bi=\\\"vec3 transformed = vec3( position );\\\\n#ifdef USE_ALPHAHASH\\\\n\\\\tvPosition = vec3( position );\\\\n#endif\\\",beginnormal_vertex:Ei=\\\"vec3 objectNormal = vec3( normal );\\\\n#ifdef USE_TANGENT\\\\n\\\\tvec3 objectTangent = vec3( tangent.xyz );\\\\n#endif\\\",bsdfs:Ai=\\\"float G_BlinnPhong_Implicit( ) {\\\\n\\\\treturn 0.25;\\\\n}\\\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\\\n\\\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\\\n}\\\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\\\n\\\\tvec3 halfDir = normalize( lightDir + viewDir );\\\\n\\\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\\\n\\\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\\\n\\\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\\\n\\\\tfloat G = G_BlinnPhong_Implicit( );\\\\n\\\\tfloat D = D_BlinnPhong( shininess, dotNH );\\\\n\\\\treturn F * ( G * D );\\\\n} // validated\\\",iridescence_fragment:wi=\\\"#ifdef USE_IRIDESCENCE\\\\n\\\\tconst mat3 XYZ_TO_REC709 = mat3(\\\\n\\\\t\\\\t 3.2404542, -0.9692660,  0.0556434,\\\\n\\\\t\\\\t-1.5371385,  1.8760108, -0.2040259,\\\\n\\\\t\\\\t-0.4985314,  0.0415560,  1.0572252\\\\n\\\\t);\\\\n\\\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\\\n\\\\t\\\\tvec3 sqrtF0 = sqrt( fresnel0 );\\\\n\\\\t\\\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\\\n\\\\t}\\\\n\\\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\\\n\\\\t\\\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\\\n\\\\t}\\\\n\\\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\\\n\\\\t\\\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\\\n\\\\t}\\\\n\\\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\\\n\\\\t\\\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\\\n\\\\t\\\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\\\n\\\\t\\\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\\\n\\\\t\\\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\\\n\\\\t\\\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\\\n\\\\t\\\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\\\n\\\\t\\\\txyz /= 1.0685e-7;\\\\n\\\\t\\\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\\\n\\\\t\\\\treturn rgb;\\\\n\\\\t}\\\\n\\\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\\\n\\\\t\\\\tvec3 I;\\\\n\\\\t\\\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\\\n\\\\t\\\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\\\n\\\\t\\\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\\\n\\\\t\\\\tif ( cosTheta2Sq < 0.0 ) {\\\\n\\\\t\\\\t\\\\treturn vec3( 1.0 );\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\\\n\\\\t\\\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\\\n\\\\t\\\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\\\n\\\\t\\\\tfloat T121 = 1.0 - R12;\\\\n\\\\t\\\\tfloat phi12 = 0.0;\\\\n\\\\t\\\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\\\n\\\\t\\\\tfloat phi21 = PI - phi12;\\\\n\\\\t\\\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\\\t\\\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\\\n\\\\t\\\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\\\n\\\\t\\\\tvec3 phi23 = vec3( 0.0 );\\\\n\\\\t\\\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\\\n\\\\t\\\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\\\n\\\\t\\\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\\\n\\\\t\\\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\\\n\\\\t\\\\tvec3 phi = vec3( phi21 ) + phi23;\\\\n\\\\t\\\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\\\n\\\\t\\\\tvec3 r123 = sqrt( R123 );\\\\n\\\\t\\\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\\\n\\\\t\\\\tvec3 C0 = R12 + Rs;\\\\n\\\\t\\\\tI = C0;\\\\n\\\\t\\\\tvec3 Cm = Rs - T121;\\\\n\\\\t\\\\tfor ( int m = 1; m <= 2; ++ m ) {\\\\n\\\\t\\\\t\\\\tCm *= r123;\\\\n\\\\t\\\\t\\\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\\\n\\\\t\\\\t\\\\tI += Cm * Sm;\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\treturn max( I, vec3( 0.0 ) );\\\\n\\\\t}\\\\n#endif\\\",bumpmap_pars_fragment:Ri=\\\"#ifdef USE_BUMPMAP\\\\n\\\\tuniform sampler2D bumpMap;\\\\n\\\\tuniform float bumpScale;\\\\n\\\\tvec2 dHdxy_fwd() {\\\\n\\\\t\\\\tvec2 dSTdx = dFdx( vBumpMapUv );\\\\n\\\\t\\\\tvec2 dSTdy = dFdy( vBumpMapUv );\\\\n\\\\t\\\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\\\n\\\\t\\\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\\\n\\\\t\\\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\\\n\\\\t\\\\treturn vec2( dBx, dBy );\\\\n\\\\t}\\\\n\\\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\\\n\\\\t\\\\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\\\\n\\\\t\\\\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\\\\n\\\\t\\\\tvec3 vN = surf_norm;\\\\n\\\\t\\\\tvec3 R1 = cross( vSigmaY, vN );\\\\n\\\\t\\\\tvec3 R2 = cross( vN, vSigmaX );\\\\n\\\\t\\\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\\\n\\\\t\\\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\\\n\\\\t\\\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\\\n\\\\t}\\\\n#endif\\\",clipping_planes_fragment:Ci=\\\"#if NUM_CLIPPING_PLANES > 0\\\\n\\\\tvec4 plane;\\\\n\\\\t#ifdef ALPHA_TO_COVERAGE\\\\n\\\\t\\\\tfloat distanceToPlane, distanceGradient;\\\\n\\\\t\\\\tfloat clipOpacity = 1.0;\\\\n\\\\t\\\\t#pragma unroll_loop_start\\\\n\\\\t\\\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\\\n\\\\t\\\\t\\\\tplane = clippingPlanes[ i ];\\\\n\\\\t\\\\t\\\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\\\n\\\\t\\\\t\\\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\\\n\\\\t\\\\t\\\\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\\\n\\\\t\\\\t\\\\tif ( clipOpacity == 0.0 ) discard;\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\t#pragma unroll_loop_end\\\\n\\\\t\\\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\\\n\\\\t\\\\t\\\\tfloat unionClipOpacity = 1.0;\\\\n\\\\t\\\\t\\\\t#pragma unroll_loop_start\\\\n\\\\t\\\\t\\\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\\\n\\\\t\\\\t\\\\t\\\\tplane = clippingPlanes[ i ];\\\\n\\\\t\\\\t\\\\t\\\\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\\\\n\\\\t\\\\t\\\\t\\\\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\\\\n\\\\t\\\\t\\\\t\\\\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\t#pragma unroll_loop_end\\\\n\\\\t\\\\t\\\\tclipOpacity *= 1.0 - unionClipOpacity;\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tdiffuseColor.a *= clipOpacity;\\\\n\\\\t\\\\tif ( diffuseColor.a == 0.0 ) discard;\\\\n\\\\t#else\\\\n\\\\t\\\\t#pragma unroll_loop_start\\\\n\\\\t\\\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\\\n\\\\t\\\\t\\\\tplane = clippingPlanes[ i ];\\\\n\\\\t\\\\t\\\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\t#pragma unroll_loop_end\\\\n\\\\t\\\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\\\n\\\\t\\\\t\\\\tbool clipped = true;\\\\n\\\\t\\\\t\\\\t#pragma unroll_loop_start\\\\n\\\\t\\\\t\\\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\\\n\\\\t\\\\t\\\\t\\\\tplane = clippingPlanes[ i ];\\\\n\\\\t\\\\t\\\\t\\\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\t#pragma unroll_loop_end\\\\n\\\\t\\\\t\\\\tif ( clipped ) discard;\\\\n\\\\t\\\\t#endif\\\\n\\\\t#endif\\\\n#endif\\\",clipping_planes_pars_fragment:Pi=\\\"#if NUM_CLIPPING_PLANES > 0\\\\n\\\\tvarying vec3 vClipPosition;\\\\n\\\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\\\n#endif\\\",clipping_planes_pars_vertex:Ii=\\\"#if NUM_CLIPPING_PLANES > 0\\\\n\\\\tvarying vec3 vClipPosition;\\\\n#endif\\\",clipping_planes_vertex:Li=\\\"#if NUM_CLIPPING_PLANES > 0\\\\n\\\\tvClipPosition = - mvPosition.xyz;\\\\n#endif\\\",color_fragment:Ni=\\\"#if defined( USE_COLOR_ALPHA )\\\\n\\\\tdiffuseColor *= vColor;\\\\n#elif defined( USE_COLOR )\\\\n\\\\tdiffuseColor.rgb *= vColor;\\\\n#endif\\\",color_pars_fragment:Ui=\\\"#if defined( USE_COLOR_ALPHA )\\\\n\\\\tvarying vec4 vColor;\\\\n#elif defined( USE_COLOR )\\\\n\\\\tvarying vec3 vColor;\\\\n#endif\\\",color_pars_vertex:Di=\\\"#if defined( USE_COLOR_ALPHA )\\\\n\\\\tvarying vec4 vColor;\\\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\\\\n\\\\tvarying vec3 vColor;\\\\n#endif\\\",color_vertex:Oi=\\\"#if defined( USE_COLOR_ALPHA )\\\\n\\\\tvColor = vec4( 1.0 );\\\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\\\\n\\\\tvColor = vec3( 1.0 );\\\\n#endif\\\\n#ifdef USE_COLOR\\\\n\\\\tvColor *= color;\\\\n#endif\\\\n#ifdef USE_INSTANCING_COLOR\\\\n\\\\tvColor.xyz *= instanceColor.xyz;\\\\n#endif\\\\n#ifdef USE_BATCHING_COLOR\\\\n\\\\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\\\\n\\\\tvColor.xyz *= batchingColor.xyz;\\\\n#endif\\\",common:Fi=\\\"#define PI 3.141592653589793\\\\n#define PI2 6.283185307179586\\\\n#define PI_HALF 1.5707963267948966\\\\n#define RECIPROCAL_PI 0.3183098861837907\\\\n#define RECIPROCAL_PI2 0.15915494309189535\\\\n#define EPSILON 1e-6\\\\n#ifndef saturate\\\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\\\n#endif\\\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\\\nfloat pow2( const in float x ) { return x*x; }\\\\nvec3 pow2( const in vec3 x ) { return x*x; }\\\\nfloat pow3( const in float x ) { return x*x*x; }\\\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\\\nhighp float rand( const in vec2 uv ) {\\\\n\\\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\\\n\\\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\\\n\\\\treturn fract( sin( sn ) * c );\\\\n}\\\\n#ifdef HIGH_PRECISION\\\\n\\\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\\\n#else\\\\n\\\\tfloat precisionSafeLength( vec3 v ) {\\\\n\\\\t\\\\tfloat maxComponent = max3( abs( v ) );\\\\n\\\\t\\\\treturn length( v / maxComponent ) * maxComponent;\\\\n\\\\t}\\\\n#endif\\\\nstruct IncidentLight {\\\\n\\\\tvec3 color;\\\\n\\\\tvec3 direction;\\\\n\\\\tbool visible;\\\\n};\\\\nstruct ReflectedLight {\\\\n\\\\tvec3 directDiffuse;\\\\n\\\\tvec3 directSpecular;\\\\n\\\\tvec3 indirectDiffuse;\\\\n\\\\tvec3 indirectSpecular;\\\\n};\\\\n#ifdef USE_ALPHAHASH\\\\n\\\\tvarying vec3 vPosition;\\\\n#endif\\\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\\\n\\\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\\\n}\\\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\\\n\\\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\\\n}\\\\nbool isPerspectiveMatrix( mat4 m ) {\\\\n\\\\treturn m[ 2 ][ 3 ] == - 1.0;\\\\n}\\\\nvec2 equirectUv( in vec3 dir ) {\\\\n\\\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\\\n\\\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\\\n\\\\treturn vec2( u, v );\\\\n}\\\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\\\n\\\\treturn RECIPROCAL_PI * diffuseColor;\\\\n}\\\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\\\n\\\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\\\n\\\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\\\n}\\\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\\\n\\\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\\\n\\\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\\\n} // validated\\\",cube_uv_reflection_fragment:Bi=\\\"#ifdef ENVMAP_TYPE_CUBE_UV\\\\n\\\\t#define cubeUV_minMipLevel 4.0\\\\n\\\\t#define cubeUV_minTileSize 16.0\\\\n\\\\tfloat getFace( vec3 direction ) {\\\\n\\\\t\\\\tvec3 absDirection = abs( direction );\\\\n\\\\t\\\\tfloat face = - 1.0;\\\\n\\\\t\\\\tif ( absDirection.x > absDirection.z ) {\\\\n\\\\t\\\\t\\\\tif ( absDirection.x > absDirection.y )\\\\n\\\\t\\\\t\\\\t\\\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\\\n\\\\t\\\\t\\\\telse\\\\n\\\\t\\\\t\\\\t\\\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\\\n\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\tif ( absDirection.z > absDirection.y )\\\\n\\\\t\\\\t\\\\t\\\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\\\n\\\\t\\\\t\\\\telse\\\\n\\\\t\\\\t\\\\t\\\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\treturn face;\\\\n\\\\t}\\\\n\\\\tvec2 getUV( vec3 direction, float face ) {\\\\n\\\\t\\\\tvec2 uv;\\\\n\\\\t\\\\tif ( face == 0.0 ) {\\\\n\\\\t\\\\t\\\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\\\n\\\\t\\\\t} else if ( face == 1.0 ) {\\\\n\\\\t\\\\t\\\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\\\n\\\\t\\\\t} else if ( face == 2.0 ) {\\\\n\\\\t\\\\t\\\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\\\n\\\\t\\\\t} else if ( face == 3.0 ) {\\\\n\\\\t\\\\t\\\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\\\n\\\\t\\\\t} else if ( face == 4.0 ) {\\\\n\\\\t\\\\t\\\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\\\n\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\treturn 0.5 * ( uv + 1.0 );\\\\n\\\\t}\\\\n\\\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\\\n\\\\t\\\\tfloat face = getFace( direction );\\\\n\\\\t\\\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\\\n\\\\t\\\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\\\n\\\\t\\\\tfloat faceSize = exp2( mipInt );\\\\n\\\\t\\\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\\\n\\\\t\\\\tif ( face > 2.0 ) {\\\\n\\\\t\\\\t\\\\tuv.y += faceSize;\\\\n\\\\t\\\\t\\\\tface -= 3.0;\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\tuv.x += face * faceSize;\\\\n\\\\t\\\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\\\n\\\\t\\\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\\\n\\\\t\\\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\\\n\\\\t\\\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\\\n\\\\t\\\\t#ifdef texture2DGradEXT\\\\n\\\\t\\\\t\\\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\treturn texture2D( envMap, uv ).rgb;\\\\n\\\\t\\\\t#endif\\\\n\\\\t}\\\\n\\\\t#define cubeUV_r0 1.0\\\\n\\\\t#define cubeUV_m0 - 2.0\\\\n\\\\t#define cubeUV_r1 0.8\\\\n\\\\t#define cubeUV_m1 - 1.0\\\\n\\\\t#define cubeUV_r4 0.4\\\\n\\\\t#define cubeUV_m4 2.0\\\\n\\\\t#define cubeUV_r5 0.305\\\\n\\\\t#define cubeUV_m5 3.0\\\\n\\\\t#define cubeUV_r6 0.21\\\\n\\\\t#define cubeUV_m6 4.0\\\\n\\\\tfloat roughnessToMip( float roughness ) {\\\\n\\\\t\\\\tfloat mip = 0.0;\\\\n\\\\t\\\\tif ( roughness >= cubeUV_r1 ) {\\\\n\\\\t\\\\t\\\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\\\n\\\\t\\\\t} else if ( roughness >= cubeUV_r4 ) {\\\\n\\\\t\\\\t\\\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\\\n\\\\t\\\\t} else if ( roughness >= cubeUV_r5 ) {\\\\n\\\\t\\\\t\\\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\\\n\\\\t\\\\t} else if ( roughness >= cubeUV_r6 ) {\\\\n\\\\t\\\\t\\\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\\\n\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\tmip = - 2.0 * log2( 1.16 * roughness );\\\\t\\\\t}\\\\n\\\\t\\\\treturn mip;\\\\n\\\\t}\\\\n\\\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\\\n\\\\t\\\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\\\n\\\\t\\\\tfloat mipF = fract( mip );\\\\n\\\\t\\\\tfloat mipInt = floor( mip );\\\\n\\\\t\\\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\\\n\\\\t\\\\tif ( mipF == 0.0 ) {\\\\n\\\\t\\\\t\\\\treturn vec4( color0, 1.0 );\\\\n\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\\\n\\\\t\\\\t\\\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\\\n\\\\t\\\\t}\\\\n\\\\t}\\\\n#endif\\\",defaultnormal_vertex:zi=\\\"vec3 transformedNormal = objectNormal;\\\\n#ifdef USE_TANGENT\\\\n\\\\tvec3 transformedTangent = objectTangent;\\\\n#endif\\\\n#ifdef USE_BATCHING\\\\n\\\\tmat3 bm = mat3( batchingMatrix );\\\\n\\\\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\\\\n\\\\ttransformedNormal = bm * transformedNormal;\\\\n\\\\t#ifdef USE_TANGENT\\\\n\\\\t\\\\ttransformedTangent = bm * transformedTangent;\\\\n\\\\t#endif\\\\n#endif\\\\n#ifdef USE_INSTANCING\\\\n\\\\tmat3 im = mat3( instanceMatrix );\\\\n\\\\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\\\\n\\\\ttransformedNormal = im * transformedNormal;\\\\n\\\\t#ifdef USE_TANGENT\\\\n\\\\t\\\\ttransformedTangent = im * transformedTangent;\\\\n\\\\t#endif\\\\n#endif\\\\ntransformedNormal = normalMatrix * transformedNormal;\\\\n#ifdef FLIP_SIDED\\\\n\\\\ttransformedNormal = - transformedNormal;\\\\n#endif\\\\n#ifdef USE_TANGENT\\\\n\\\\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\\\\n\\\\t#ifdef FLIP_SIDED\\\\n\\\\t\\\\ttransformedTangent = - transformedTangent;\\\\n\\\\t#endif\\\\n#endif\\\",displacementmap_pars_vertex:ki=\\\"#ifdef USE_DISPLACEMENTMAP\\\\n\\\\tuniform sampler2D displacementMap;\\\\n\\\\tuniform float displacementScale;\\\\n\\\\tuniform float displacementBias;\\\\n#endif\\\",displacementmap_vertex:Vi=\\\"#ifdef USE_DISPLACEMENTMAP\\\\n\\\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\\\n#endif\\\",emissivemap_fragment:Hi=\\\"#ifdef USE_EMISSIVEMAP\\\\n\\\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\\\n\\\\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\\\\n\\\\t\\\\temissiveColor = sRGBTransferEOTF( emissiveColor );\\\\n\\\\t#endif\\\\n\\\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\\\n#endif\\\",emissivemap_pars_fragment:Gi=\\\"#ifdef USE_EMISSIVEMAP\\\\n\\\\tuniform sampler2D emissiveMap;\\\\n#endif\\\",colorspace_fragment:Wi=\\\"gl_FragColor = linearToOutputTexel( gl_FragColor );\\\",colorspace_pars_fragment:Xi=\\\"vec4 LinearTransferOETF( in vec4 value ) {\\\\n\\\\treturn value;\\\\n}\\\\nvec4 sRGBTransferEOTF( in vec4 value ) {\\\\n\\\\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\\\\n}\\\\nvec4 sRGBTransferOETF( in vec4 value ) {\\\\n\\\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\\\n}\\\",envmap_fragment:ji=\\\"#ifdef USE_ENVMAP\\\\n\\\\t#ifdef ENV_WORLDPOS\\\\n\\\\t\\\\tvec3 cameraToFrag;\\\\n\\\\t\\\\tif ( isOrthographic ) {\\\\n\\\\t\\\\t\\\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\\\n\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\\\n\\\\t\\\\t#ifdef ENVMAP_MODE_REFLECTION\\\\n\\\\t\\\\t\\\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\\\n\\\\t\\\\t#endif\\\\n\\\\t#else\\\\n\\\\t\\\\tvec3 reflectVec = vReflect;\\\\n\\\\t#endif\\\\n\\\\t#ifdef ENVMAP_TYPE_CUBE\\\\n\\\\t\\\\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\\\n\\\\t#else\\\\n\\\\t\\\\tvec4 envColor = vec4( 0.0 );\\\\n\\\\t#endif\\\\n\\\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\\\n\\\\t\\\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\\\n\\\\t#elif defined( ENVMAP_BLENDING_MIX )\\\\n\\\\t\\\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\\\n\\\\t#elif defined( ENVMAP_BLENDING_ADD )\\\\n\\\\t\\\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\\\n\\\\t#endif\\\\n#endif\\\",envmap_common_pars_fragment:qi=\\\"#ifdef USE_ENVMAP\\\\n\\\\tuniform float envMapIntensity;\\\\n\\\\tuniform float flipEnvMap;\\\\n\\\\tuniform mat3 envMapRotation;\\\\n\\\\t#ifdef ENVMAP_TYPE_CUBE\\\\n\\\\t\\\\tuniform samplerCube envMap;\\\\n\\\\t#else\\\\n\\\\t\\\\tuniform sampler2D envMap;\\\\n\\\\t#endif\\\\n#endif\\\",envmap_pars_fragment:Yi=\\\"#ifdef USE_ENVMAP\\\\n\\\\tuniform float reflectivity;\\\\n\\\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\\\n\\\\t\\\\t#define ENV_WORLDPOS\\\\n\\\\t#endif\\\\n\\\\t#ifdef ENV_WORLDPOS\\\\n\\\\t\\\\tvarying vec3 vWorldPosition;\\\\n\\\\t\\\\tuniform float refractionRatio;\\\\n\\\\t#else\\\\n\\\\t\\\\tvarying vec3 vReflect;\\\\n\\\\t#endif\\\\n#endif\\\",envmap_pars_vertex:Ki=\\\"#ifdef USE_ENVMAP\\\\n\\\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\\\n\\\\t\\\\t#define ENV_WORLDPOS\\\\n\\\\t#endif\\\\n\\\\t#ifdef ENV_WORLDPOS\\\\n\\\\t\\\\t\\\\n\\\\t\\\\tvarying vec3 vWorldPosition;\\\\n\\\\t#else\\\\n\\\\t\\\\tvarying vec3 vReflect;\\\\n\\\\t\\\\tuniform float refractionRatio;\\\\n\\\\t#endif\\\\n#endif\\\",envmap_physical_pars_fragment:ar=\\\"#ifdef USE_ENVMAP\\\\n\\\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\\\n\\\\t\\\\t#ifdef ENVMAP_TYPE_CUBE_UV\\\\n\\\\t\\\\t\\\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\\\n\\\\t\\\\t\\\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\\\\n\\\\t\\\\t\\\\treturn PI * envMapColor.rgb * envMapIntensity;\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\treturn vec3( 0.0 );\\\\n\\\\t\\\\t#endif\\\\n\\\\t}\\\\n\\\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\\\n\\\\t\\\\t#ifdef ENVMAP_TYPE_CUBE_UV\\\\n\\\\t\\\\t\\\\tvec3 reflectVec = reflect( - viewDir, normal );\\\\n\\\\t\\\\t\\\\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\\\\n\\\\t\\\\t\\\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\\\n\\\\t\\\\t\\\\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\\\\n\\\\t\\\\t\\\\treturn envMapColor.rgb * envMapIntensity;\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\treturn vec3( 0.0 );\\\\n\\\\t\\\\t#endif\\\\n\\\\t}\\\\n\\\\t#ifdef USE_ANISOTROPY\\\\n\\\\t\\\\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\\\\n\\\\t\\\\t\\\\t#ifdef ENVMAP_TYPE_CUBE_UV\\\\n\\\\t\\\\t\\\\t\\\\tvec3 bentNormal = cross( bitangent, viewDir );\\\\n\\\\t\\\\t\\\\t\\\\tbentNormal = normalize( cross( bentNormal, bitangent ) );\\\\n\\\\t\\\\t\\\\t\\\\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\\\\n\\\\t\\\\t\\\\t\\\\treturn getIBLRadiance( viewDir, bentNormal, roughness );\\\\n\\\\t\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\t\\\\treturn vec3( 0.0 );\\\\n\\\\t\\\\t\\\\t#endif\\\\n\\\\t\\\\t}\\\\n\\\\t#endif\\\\n#endif\\\",envmap_vertex:Ji=\\\"#ifdef USE_ENVMAP\\\\n\\\\t#ifdef ENV_WORLDPOS\\\\n\\\\t\\\\tvWorldPosition = worldPosition.xyz;\\\\n\\\\t#else\\\\n\\\\t\\\\tvec3 cameraToVertex;\\\\n\\\\t\\\\tif ( isOrthographic ) {\\\\n\\\\t\\\\t\\\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\\\n\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\\\n\\\\t\\\\t#ifdef ENVMAP_MODE_REFLECTION\\\\n\\\\t\\\\t\\\\tvReflect = reflect( cameraToVertex, worldNormal );\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\\\n\\\\t\\\\t#endif\\\\n\\\\t#endif\\\\n#endif\\\",fog_vertex:Zi=\\\"#ifdef USE_FOG\\\\n\\\\tvFogDepth = - mvPosition.z;\\\\n#endif\\\",fog_pars_vertex:$i=\\\"#ifdef USE_FOG\\\\n\\\\tvarying float vFogDepth;\\\\n#endif\\\",fog_fragment:Qi=\\\"#ifdef USE_FOG\\\\n\\\\t#ifdef FOG_EXP2\\\\n\\\\t\\\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\\\n\\\\t#else\\\\n\\\\t\\\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\\\n\\\\t#endif\\\\n\\\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\\\n#endif\\\",fog_pars_fragment:tr=\\\"#ifdef USE_FOG\\\\n\\\\tuniform vec3 fogColor;\\\\n\\\\tvarying float vFogDepth;\\\\n\\\\t#ifdef FOG_EXP2\\\\n\\\\t\\\\tuniform float fogDensity;\\\\n\\\\t#else\\\\n\\\\t\\\\tuniform float fogNear;\\\\n\\\\t\\\\tuniform float fogFar;\\\\n\\\\t#endif\\\\n#endif\\\",gradientmap_pars_fragment:er=\\\"#ifdef USE_GRADIENTMAP\\\\n\\\\tuniform sampler2D gradientMap;\\\\n#endif\\\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\\\n\\\\tfloat dotNL = dot( normal, lightDirection );\\\\n\\\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\\\n\\\\t#ifdef USE_GRADIENTMAP\\\\n\\\\t\\\\treturn vec3( texture2D( gradientMap, coord ).r );\\\\n\\\\t#else\\\\n\\\\t\\\\tvec2 fw = fwidth( coord ) * 0.5;\\\\n\\\\t\\\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\\\n\\\\t#endif\\\\n}\\\",lightmap_pars_fragment:nr=\\\"#ifdef USE_LIGHTMAP\\\\n\\\\tuniform sampler2D lightMap;\\\\n\\\\tuniform float lightMapIntensity;\\\\n#endif\\\",lights_lambert_fragment:ir=\\\"LambertMaterial material;\\\\nmaterial.diffuseColor = diffuseColor.rgb;\\\\nmaterial.specularStrength = specularStrength;\\\",lights_lambert_pars_fragment:rr=\\\"varying vec3 vViewPosition;\\\\nstruct LambertMaterial {\\\\n\\\\tvec3 diffuseColor;\\\\n\\\\tfloat specularStrength;\\\\n};\\\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\\\n\\\\tvec3 irradiance = dotNL * directLight.color;\\\\n\\\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\\\n}\\\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\\\n}\\\\n#define RE_Direct\\\\t\\\\t\\\\t\\\\tRE_Direct_Lambert\\\\n#define RE_IndirectDiffuse\\\\t\\\\tRE_IndirectDiffuse_Lambert\\\",lights_pars_begin:sr=\\\"uniform bool receiveShadow;\\\\nuniform vec3 ambientLightColor;\\\\n#if defined( USE_LIGHT_PROBES )\\\\n\\\\tuniform vec3 lightProbe[ 9 ];\\\\n#endif\\\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\\\n\\\\tfloat x = normal.x, y = normal.y, z = normal.z;\\\\n\\\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\\\n\\\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\\\n\\\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\\\n\\\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\\\n\\\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\\\n\\\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\\\n\\\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\\\n\\\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\\\n\\\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\\\n\\\\treturn result;\\\\n}\\\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\\\n\\\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\\\n\\\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\\\n\\\\treturn irradiance;\\\\n}\\\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\\\n\\\\tvec3 irradiance = ambientLightColor;\\\\n\\\\treturn irradiance;\\\\n}\\\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\\\n\\\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\\\n\\\\tif ( cutoffDistance > 0.0 ) {\\\\n\\\\t\\\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\\\n\\\\t}\\\\n\\\\treturn distanceFalloff;\\\\n}\\\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\\\n\\\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\\\n}\\\\n#if NUM_DIR_LIGHTS > 0\\\\n\\\\tstruct DirectionalLight {\\\\n\\\\t\\\\tvec3 direction;\\\\n\\\\t\\\\tvec3 color;\\\\n\\\\t};\\\\n\\\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\\\n\\\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\\\\n\\\\t\\\\tlight.color = directionalLight.color;\\\\n\\\\t\\\\tlight.direction = directionalLight.direction;\\\\n\\\\t\\\\tlight.visible = true;\\\\n\\\\t}\\\\n#endif\\\\n#if NUM_POINT_LIGHTS > 0\\\\n\\\\tstruct PointLight {\\\\n\\\\t\\\\tvec3 position;\\\\n\\\\t\\\\tvec3 color;\\\\n\\\\t\\\\tfloat distance;\\\\n\\\\t\\\\tfloat decay;\\\\n\\\\t};\\\\n\\\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\\\n\\\\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\\\\n\\\\t\\\\tvec3 lVector = pointLight.position - geometryPosition;\\\\n\\\\t\\\\tlight.direction = normalize( lVector );\\\\n\\\\t\\\\tfloat lightDistance = length( lVector );\\\\n\\\\t\\\\tlight.color = pointLight.color;\\\\n\\\\t\\\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\\\n\\\\t\\\\tlight.visible = ( light.color != vec3( 0.0 ) );\\\\n\\\\t}\\\\n#endif\\\\n#if NUM_SPOT_LIGHTS > 0\\\\n\\\\tstruct SpotLight {\\\\n\\\\t\\\\tvec3 position;\\\\n\\\\t\\\\tvec3 direction;\\\\n\\\\t\\\\tvec3 color;\\\\n\\\\t\\\\tfloat distance;\\\\n\\\\t\\\\tfloat decay;\\\\n\\\\t\\\\tfloat coneCos;\\\\n\\\\t\\\\tfloat penumbraCos;\\\\n\\\\t};\\\\n\\\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\\\n\\\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\\\\n\\\\t\\\\tvec3 lVector = spotLight.position - geometryPosition;\\\\n\\\\t\\\\tlight.direction = normalize( lVector );\\\\n\\\\t\\\\tfloat angleCos = dot( light.direction, spotLight.direction );\\\\n\\\\t\\\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\\\n\\\\t\\\\tif ( spotAttenuation > 0.0 ) {\\\\n\\\\t\\\\t\\\\tfloat lightDistance = length( lVector );\\\\n\\\\t\\\\t\\\\tlight.color = spotLight.color * spotAttenuation;\\\\n\\\\t\\\\t\\\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\\\n\\\\t\\\\t\\\\tlight.visible = ( light.color != vec3( 0.0 ) );\\\\n\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\tlight.color = vec3( 0.0 );\\\\n\\\\t\\\\t\\\\tlight.visible = false;\\\\n\\\\t\\\\t}\\\\n\\\\t}\\\\n#endif\\\\n#if NUM_RECT_AREA_LIGHTS > 0\\\\n\\\\tstruct RectAreaLight {\\\\n\\\\t\\\\tvec3 color;\\\\n\\\\t\\\\tvec3 position;\\\\n\\\\t\\\\tvec3 halfWidth;\\\\n\\\\t\\\\tvec3 halfHeight;\\\\n\\\\t};\\\\n\\\\tuniform sampler2D ltc_1;\\\\tuniform sampler2D ltc_2;\\\\n\\\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\\\n#endif\\\\n#if NUM_HEMI_LIGHTS > 0\\\\n\\\\tstruct HemisphereLight {\\\\n\\\\t\\\\tvec3 direction;\\\\n\\\\t\\\\tvec3 skyColor;\\\\n\\\\t\\\\tvec3 groundColor;\\\\n\\\\t};\\\\n\\\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\\\n\\\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\\\n\\\\t\\\\tfloat dotNL = dot( normal, hemiLight.direction );\\\\n\\\\t\\\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\\\n\\\\t\\\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\\\n\\\\t\\\\treturn irradiance;\\\\n\\\\t}\\\\n#endif\\\",lights_toon_fragment:or=\\\"ToonMaterial material;\\\\nmaterial.diffuseColor = diffuseColor.rgb;\\\",lights_toon_pars_fragment:lr=\\\"varying vec3 vViewPosition;\\\\nstruct ToonMaterial {\\\\n\\\\tvec3 diffuseColor;\\\\n};\\\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\\\\n\\\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\\\n}\\\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\\\n}\\\\n#define RE_Direct\\\\t\\\\t\\\\t\\\\tRE_Direct_Toon\\\\n#define RE_IndirectDiffuse\\\\t\\\\tRE_IndirectDiffuse_Toon\\\",lights_phong_fragment:cr=\\\"BlinnPhongMaterial material;\\\\nmaterial.diffuseColor = diffuseColor.rgb;\\\\nmaterial.specularColor = specular;\\\\nmaterial.specularShininess = shininess;\\\\nmaterial.specularStrength = specularStrength;\\\",lights_phong_pars_fragment:hr=\\\"varying vec3 vViewPosition;\\\\nstruct BlinnPhongMaterial {\\\\n\\\\tvec3 diffuseColor;\\\\n\\\\tvec3 specularColor;\\\\n\\\\tfloat specularShininess;\\\\n\\\\tfloat specularStrength;\\\\n};\\\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\\\n\\\\tvec3 irradiance = dotNL * directLight.color;\\\\n\\\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\\\n\\\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\\\\n}\\\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\\\n}\\\\n#define RE_Direct\\\\t\\\\t\\\\t\\\\tRE_Direct_BlinnPhong\\\\n#define RE_IndirectDiffuse\\\\t\\\\tRE_IndirectDiffuse_BlinnPhong\\\",lights_physical_fragment:ur=\\\"PhysicalMaterial material;\\\\nmaterial.diffuseColor = diffuseColor.rgb;\\\\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\\\nmaterial.metalness = metalnessFactor;\\\\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\\\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\\\nmaterial.roughness = min( material.roughness, 1.0 );\\\\n#ifdef IOR\\\\n\\\\tmaterial.ior = ior;\\\\n\\\\t#ifdef USE_SPECULAR\\\\n\\\\t\\\\tfloat specularIntensityFactor = specularIntensity;\\\\n\\\\t\\\\tvec3 specularColorFactor = specularColor;\\\\n\\\\t\\\\t#ifdef USE_SPECULAR_COLORMAP\\\\n\\\\t\\\\t\\\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\t#ifdef USE_SPECULAR_INTENSITYMAP\\\\n\\\\t\\\\t\\\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\\\n\\\\t#else\\\\n\\\\t\\\\tfloat specularIntensityFactor = 1.0;\\\\n\\\\t\\\\tvec3 specularColorFactor = vec3( 1.0 );\\\\n\\\\t\\\\tmaterial.specularF90 = 1.0;\\\\n\\\\t#endif\\\\n\\\\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\\\\n\\\\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\\\\n#else\\\\n\\\\tmaterial.specularColor = vec3( 0.04 );\\\\n\\\\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\\\\n\\\\tmaterial.specularF90 = 1.0;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT\\\\n\\\\tmaterial.clearcoat = clearcoat;\\\\n\\\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\\\n\\\\tmaterial.clearcoatF0 = vec3( 0.04 );\\\\n\\\\tmaterial.clearcoatF90 = 1.0;\\\\n\\\\t#ifdef USE_CLEARCOATMAP\\\\n\\\\t\\\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\\\n\\\\t\\\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\\\\n\\\\t#endif\\\\n\\\\tmaterial.clearcoat = saturate( material.clearcoat );\\\\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\\\\n\\\\tmaterial.clearcoatRoughness += geometryRoughness;\\\\n\\\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\\\n#endif\\\\n#ifdef USE_DISPERSION\\\\n\\\\tmaterial.dispersion = dispersion;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCE\\\\n\\\\tmaterial.iridescence = iridescence;\\\\n\\\\tmaterial.iridescenceIOR = iridescenceIOR;\\\\n\\\\t#ifdef USE_IRIDESCENCEMAP\\\\n\\\\t\\\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\\\n\\\\t\\\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\\\n\\\\t#else\\\\n\\\\t\\\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\\\n\\\\t#endif\\\\n#endif\\\\n#ifdef USE_SHEEN\\\\n\\\\tmaterial.sheenColor = sheenColor;\\\\n\\\\t#ifdef USE_SHEEN_COLORMAP\\\\n\\\\t\\\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\\\n\\\\t#endif\\\\n\\\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\\\\n\\\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\\\n\\\\t\\\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\\\n\\\\t#endif\\\\n#endif\\\\n#ifdef USE_ANISOTROPY\\\\n\\\\t#ifdef USE_ANISOTROPYMAP\\\\n\\\\t\\\\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\\\\n\\\\t\\\\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\\\\n\\\\t\\\\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\\\\n\\\\t#else\\\\n\\\\t\\\\tvec2 anisotropyV = anisotropyVector;\\\\n\\\\t#endif\\\\n\\\\tmaterial.anisotropy = length( anisotropyV );\\\\n\\\\tif( material.anisotropy == 0.0 ) {\\\\n\\\\t\\\\tanisotropyV = vec2( 1.0, 0.0 );\\\\n\\\\t} else {\\\\n\\\\t\\\\tanisotropyV /= material.anisotropy;\\\\n\\\\t\\\\tmaterial.anisotropy = saturate( material.anisotropy );\\\\n\\\\t}\\\\n\\\\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\\\\n\\\\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\\\\n\\\\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\\\\n#endif\\\",lights_physical_pars_fragment:dr=\\\"uniform sampler2D dfgLUT;\\\\nstruct PhysicalMaterial {\\\\n\\\\tvec3 diffuseColor;\\\\n\\\\tvec3 diffuseContribution;\\\\n\\\\tvec3 specularColor;\\\\n\\\\tvec3 specularColorBlended;\\\\n\\\\tfloat roughness;\\\\n\\\\tfloat metalness;\\\\n\\\\tfloat specularF90;\\\\n\\\\tfloat dispersion;\\\\n\\\\t#ifdef USE_CLEARCOAT\\\\n\\\\t\\\\tfloat clearcoat;\\\\n\\\\t\\\\tfloat clearcoatRoughness;\\\\n\\\\t\\\\tvec3 clearcoatF0;\\\\n\\\\t\\\\tfloat clearcoatF90;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_IRIDESCENCE\\\\n\\\\t\\\\tfloat iridescence;\\\\n\\\\t\\\\tfloat iridescenceIOR;\\\\n\\\\t\\\\tfloat iridescenceThickness;\\\\n\\\\t\\\\tvec3 iridescenceFresnel;\\\\n\\\\t\\\\tvec3 iridescenceF0;\\\\n\\\\t\\\\tvec3 iridescenceFresnelDielectric;\\\\n\\\\t\\\\tvec3 iridescenceFresnelMetallic;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_SHEEN\\\\n\\\\t\\\\tvec3 sheenColor;\\\\n\\\\t\\\\tfloat sheenRoughness;\\\\n\\\\t#endif\\\\n\\\\t#ifdef IOR\\\\n\\\\t\\\\tfloat ior;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_TRANSMISSION\\\\n\\\\t\\\\tfloat transmission;\\\\n\\\\t\\\\tfloat transmissionAlpha;\\\\n\\\\t\\\\tfloat thickness;\\\\n\\\\t\\\\tfloat attenuationDistance;\\\\n\\\\t\\\\tvec3 attenuationColor;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_ANISOTROPY\\\\n\\\\t\\\\tfloat anisotropy;\\\\n\\\\t\\\\tfloat alphaT;\\\\n\\\\t\\\\tvec3 anisotropyT;\\\\n\\\\t\\\\tvec3 anisotropyB;\\\\n\\\\t#endif\\\\n};\\\\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\\\\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\\\\nvec3 sheenSpecularDirect = vec3( 0.0 );\\\\nvec3 sheenSpecularIndirect = vec3(0.0 );\\\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\\\n    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\\\n    float x2 = x * x;\\\\n    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\\\n    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\\\n}\\\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\\\n\\\\tfloat a2 = pow2( alpha );\\\\n\\\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\\\n\\\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\\\n\\\\treturn 0.5 / max( gv + gl, EPSILON );\\\\n}\\\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\\\n\\\\tfloat a2 = pow2( alpha );\\\\n\\\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\\\n\\\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\\\n}\\\\n#ifdef USE_ANISOTROPY\\\\n\\\\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\\\\n\\\\t\\\\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\\\\n\\\\t\\\\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\\\\n\\\\t\\\\tfloat v = 0.5 / ( gv + gl );\\\\n\\\\t\\\\treturn v;\\\\n\\\\t}\\\\n\\\\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\\\\n\\\\t\\\\tfloat a2 = alphaT * alphaB;\\\\n\\\\t\\\\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\\\\n\\\\t\\\\thighp float v2 = dot( v, v );\\\\n\\\\t\\\\tfloat w2 = a2 / v2;\\\\n\\\\t\\\\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\\\\n\\\\t}\\\\n#endif\\\\n#ifdef USE_CLEARCOAT\\\\n\\\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\\\n\\\\t\\\\tvec3 f0 = material.clearcoatF0;\\\\n\\\\t\\\\tfloat f90 = material.clearcoatF90;\\\\n\\\\t\\\\tfloat roughness = material.clearcoatRoughness;\\\\n\\\\t\\\\tfloat alpha = pow2( roughness );\\\\n\\\\t\\\\tvec3 halfDir = normalize( lightDir + viewDir );\\\\n\\\\t\\\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\\\n\\\\t\\\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\\\n\\\\t\\\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\\\n\\\\t\\\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\\\n\\\\t\\\\tvec3 F = F_Schlick( f0, f90, dotVH );\\\\n\\\\t\\\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\\\n\\\\t\\\\tfloat D = D_GGX( alpha, dotNH );\\\\n\\\\t\\\\treturn F * ( V * D );\\\\n\\\\t}\\\\n#endif\\\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\\\n\\\\tvec3 f0 = material.specularColorBlended;\\\\n\\\\tfloat f90 = material.specularF90;\\\\n\\\\tfloat roughness = material.roughness;\\\\n\\\\tfloat alpha = pow2( roughness );\\\\n\\\\tvec3 halfDir = normalize( lightDir + viewDir );\\\\n\\\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\\\n\\\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\\\n\\\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\\\n\\\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\\\n\\\\tvec3 F = F_Schlick( f0, f90, dotVH );\\\\n\\\\t#ifdef USE_IRIDESCENCE\\\\n\\\\t\\\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_ANISOTROPY\\\\n\\\\t\\\\tfloat dotTL = dot( material.anisotropyT, lightDir );\\\\n\\\\t\\\\tfloat dotTV = dot( material.anisotropyT, viewDir );\\\\n\\\\t\\\\tfloat dotTH = dot( material.anisotropyT, halfDir );\\\\n\\\\t\\\\tfloat dotBL = dot( material.anisotropyB, lightDir );\\\\n\\\\t\\\\tfloat dotBV = dot( material.anisotropyB, viewDir );\\\\n\\\\t\\\\tfloat dotBH = dot( material.anisotropyB, halfDir );\\\\n\\\\t\\\\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\\\\n\\\\t\\\\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\\\\n\\\\t#else\\\\n\\\\t\\\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\\\n\\\\t\\\\tfloat D = D_GGX( alpha, dotNH );\\\\n\\\\t#endif\\\\n\\\\treturn F * ( V * D );\\\\n}\\\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\\\n\\\\tconst float LUT_SIZE = 64.0;\\\\n\\\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\\\n\\\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\\\n\\\\tfloat dotNV = saturate( dot( N, V ) );\\\\n\\\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\\\n\\\\tuv = uv * LUT_SCALE + LUT_BIAS;\\\\n\\\\treturn uv;\\\\n}\\\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\\\n\\\\tfloat l = length( f );\\\\n\\\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\\\n}\\\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\\\n\\\\tfloat x = dot( v1, v2 );\\\\n\\\\tfloat y = abs( x );\\\\n\\\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\\\n\\\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\\\n\\\\tfloat v = a / b;\\\\n\\\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\\\n\\\\treturn cross( v1, v2 ) * theta_sintheta;\\\\n}\\\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\\\n\\\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\\\n\\\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\\\n\\\\tvec3 lightNormal = cross( v1, v2 );\\\\n\\\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\\\n\\\\tvec3 T1, T2;\\\\n\\\\tT1 = normalize( V - N * dot( V, N ) );\\\\n\\\\tT2 = - cross( N, T1 );\\\\n\\\\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\\\\n\\\\tvec3 coords[ 4 ];\\\\n\\\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\\\n\\\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\\\n\\\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\\\n\\\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\\\n\\\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\\\n\\\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\\\n\\\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\\\n\\\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\\\n\\\\tvec3 vectorFormFactor = vec3( 0.0 );\\\\n\\\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\\\n\\\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\\\n\\\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\\\n\\\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\\\n\\\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\\\n\\\\treturn vec3( result );\\\\n}\\\\n#if defined( USE_SHEEN )\\\\nfloat D_Charlie( float roughness, float dotNH ) {\\\\n\\\\tfloat alpha = pow2( roughness );\\\\n\\\\tfloat invAlpha = 1.0 / alpha;\\\\n\\\\tfloat cos2h = dotNH * dotNH;\\\\n\\\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\\\n\\\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\\\n}\\\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\\\n\\\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\\\n}\\\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\\\n\\\\tvec3 halfDir = normalize( lightDir + viewDir );\\\\n\\\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\\\n\\\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\\\n\\\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\\\n\\\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\\\n\\\\tfloat V = V_Neubelt( dotNV, dotNL );\\\\n\\\\treturn sheenColor * ( D * V );\\\\n}\\\\n#endif\\\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\\\n\\\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\\\n\\\\tfloat r2 = roughness * roughness;\\\\n\\\\tfloat rInv = 1.0 / ( roughness + 0.1 );\\\\n\\\\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\\\\n\\\\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\\\\n\\\\tfloat DG = exp( a * dotNV + b );\\\\n\\\\treturn saturate( DG );\\\\n}\\\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\\\n\\\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\\\n\\\\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\\\\n\\\\treturn specularColor * fab.x + specularF90 * fab.y;\\\\n}\\\\n#ifdef USE_IRIDESCENCE\\\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\\\n#else\\\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\\\n#endif\\\\n\\\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\\\n\\\\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\\\\n\\\\t#ifdef USE_IRIDESCENCE\\\\n\\\\t\\\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\\\n\\\\t#else\\\\n\\\\t\\\\tvec3 Fr = specularColor;\\\\n\\\\t#endif\\\\n\\\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\\\n\\\\tfloat Ess = fab.x + fab.y;\\\\n\\\\tfloat Ems = 1.0 - Ess;\\\\n\\\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\\\n\\\\tsingleScatter += FssEss;\\\\n\\\\tmultiScatter += Fms * Ems;\\\\n}\\\\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\\\n\\\\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\\\\n\\\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\\\n\\\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\\\n\\\\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\\\\n\\\\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\\\\n\\\\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\\\\n\\\\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\\\\n\\\\tfloat Ess_V = dfgV.x + dfgV.y;\\\\n\\\\tfloat Ess_L = dfgL.x + dfgL.y;\\\\n\\\\tfloat Ems_V = 1.0 - Ess_V;\\\\n\\\\tfloat Ems_L = 1.0 - Ess_L;\\\\n\\\\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\\\\n\\\\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\\\\n\\\\tfloat compensationFactor = Ems_V * Ems_L;\\\\n\\\\tvec3 multiScatter = Fms * compensationFactor;\\\\n\\\\treturn singleScatter + multiScatter;\\\\n}\\\\n#if NUM_RECT_AREA_LIGHTS > 0\\\\n\\\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\t\\\\tvec3 normal = geometryNormal;\\\\n\\\\t\\\\tvec3 viewDir = geometryViewDir;\\\\n\\\\t\\\\tvec3 position = geometryPosition;\\\\n\\\\t\\\\tvec3 lightPos = rectAreaLight.position;\\\\n\\\\t\\\\tvec3 halfWidth = rectAreaLight.halfWidth;\\\\n\\\\t\\\\tvec3 halfHeight = rectAreaLight.halfHeight;\\\\n\\\\t\\\\tvec3 lightColor = rectAreaLight.color;\\\\n\\\\t\\\\tfloat roughness = material.roughness;\\\\n\\\\t\\\\tvec3 rectCoords[ 4 ];\\\\n\\\\t\\\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\\\t\\\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\\\n\\\\t\\\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\\\n\\\\t\\\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\\\n\\\\t\\\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\\\n\\\\t\\\\tvec4 t1 = texture2D( ltc_1, uv );\\\\n\\\\t\\\\tvec4 t2 = texture2D( ltc_2, uv );\\\\n\\\\t\\\\tmat3 mInv = mat3(\\\\n\\\\t\\\\t\\\\tvec3( t1.x, 0, t1.y ),\\\\n\\\\t\\\\t\\\\tvec3(    0, 1,    0 ),\\\\n\\\\t\\\\t\\\\tvec3( t1.z, 0, t1.w )\\\\n\\\\t\\\\t);\\\\n\\\\t\\\\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\\\\n\\\\t\\\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\\\n\\\\t\\\\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\\\n\\\\t}\\\\n#endif\\\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\\\\n\\\\tvec3 irradiance = dotNL * directLight.color;\\\\n\\\\t#ifdef USE_CLEARCOAT\\\\n\\\\t\\\\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\\\\n\\\\t\\\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\\\n\\\\t\\\\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_SHEEN\\\\n \\\\n \\\\t\\\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\\\n \\\\n \\\\t\\\\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\\\n \\\\t\\\\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\\\\n \\\\n \\\\t\\\\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\\\\n \\\\n \\\\t\\\\tirradiance *= sheenEnergyComp;\\\\n \\\\n \\\\t#endif\\\\n\\\\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\\\\n\\\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\\\\n}\\\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\\\n\\\\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\\\\n\\\\t#ifdef USE_SHEEN\\\\n\\\\t\\\\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\\\n\\\\t\\\\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\\\\n\\\\t\\\\tdiffuse *= sheenEnergyComp;\\\\n\\\\t#endif\\\\n\\\\treflectedLight.indirectDiffuse += diffuse;\\\\n}\\\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\\\n\\\\t#ifdef USE_CLEARCOAT\\\\n\\\\t\\\\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_SHEEN\\\\n\\\\t\\\\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\\\\n \\\\t#endif\\\\n\\\\tvec3 singleScatteringDielectric = vec3( 0.0 );\\\\n\\\\tvec3 multiScatteringDielectric = vec3( 0.0 );\\\\n\\\\tvec3 singleScatteringMetallic = vec3( 0.0 );\\\\n\\\\tvec3 multiScatteringMetallic = vec3( 0.0 );\\\\n\\\\t#ifdef USE_IRIDESCENCE\\\\n\\\\t\\\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\\\\n\\\\t\\\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\\\\n\\\\t#else\\\\n\\\\t\\\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\\\\n\\\\t\\\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\\\\n\\\\t#endif\\\\n\\\\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\\\\n\\\\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\\\\n\\\\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\\\\n\\\\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\\\\n\\\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\\\n\\\\tvec3 indirectSpecular = radiance * singleScattering;\\\\n\\\\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\\\\n\\\\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\\\\n\\\\t#ifdef USE_SHEEN\\\\n\\\\t\\\\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\\\\n\\\\t\\\\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\\\\n\\\\t\\\\tindirectSpecular *= sheenEnergyComp;\\\\n\\\\t\\\\tindirectDiffuse *= sheenEnergyComp;\\\\n\\\\t#endif\\\\n\\\\treflectedLight.indirectSpecular += indirectSpecular;\\\\n\\\\treflectedLight.indirectDiffuse += indirectDiffuse;\\\\n}\\\\n#define RE_Direct\\\\t\\\\t\\\\t\\\\tRE_Direct_Physical\\\\n#define RE_Direct_RectArea\\\\t\\\\tRE_Direct_RectArea_Physical\\\\n#define RE_IndirectDiffuse\\\\t\\\\tRE_IndirectDiffuse_Physical\\\\n#define RE_IndirectSpecular\\\\t\\\\tRE_IndirectSpecular_Physical\\\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\\\n\\\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\\\n}\\\",lights_fragment_begin:pr=\\\"\\\\nvec3 geometryPosition = - vViewPosition;\\\\nvec3 geometryNormal = normal;\\\\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\\\nvec3 geometryClearcoatNormal = vec3( 0.0 );\\\\n#ifdef USE_CLEARCOAT\\\\n\\\\tgeometryClearcoatNormal = clearcoatNormal;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCE\\\\n\\\\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\\\\n\\\\tif ( material.iridescenceThickness == 0.0 ) {\\\\n\\\\t\\\\tmaterial.iridescence = 0.0;\\\\n\\\\t} else {\\\\n\\\\t\\\\tmaterial.iridescence = saturate( material.iridescence );\\\\n\\\\t}\\\\n\\\\tif ( material.iridescence > 0.0 ) {\\\\n\\\\t\\\\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\\\n\\\\t\\\\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\\\\n\\\\t\\\\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\\\\n\\\\t\\\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\\\n\\\\t}\\\\n#endif\\\\nIncidentLight directLight;\\\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\\\n\\\\tPointLight pointLight;\\\\n\\\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\\\n\\\\tPointLightShadow pointLightShadow;\\\\n\\\\t#endif\\\\n\\\\t#pragma unroll_loop_start\\\\n\\\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\\\n\\\\t\\\\tpointLight = pointLights[ i ];\\\\n\\\\t\\\\tgetPointLightInfo( pointLight, geometryPosition, directLight );\\\\n\\\\t\\\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\\\\n\\\\t\\\\tpointLightShadow = pointLightShadows[ i ];\\\\n\\\\t\\\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\\\n\\\\t}\\\\n\\\\t#pragma unroll_loop_end\\\\n#endif\\\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\\\n\\\\tSpotLight spotLight;\\\\n\\\\tvec4 spotColor;\\\\n\\\\tvec3 spotLightCoord;\\\\n\\\\tbool inSpotLightMap;\\\\n\\\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\\\n\\\\tSpotLightShadow spotLightShadow;\\\\n\\\\t#endif\\\\n\\\\t#pragma unroll_loop_start\\\\n\\\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\\\n\\\\t\\\\tspotLight = spotLights[ i ];\\\\n\\\\t\\\\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\\\\n\\\\t\\\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\\\n\\\\t\\\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\\\n\\\\t\\\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\\\n\\\\t\\\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\\\n\\\\t\\\\t\\\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\\\n\\\\t\\\\t\\\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\\\n\\\\t\\\\t\\\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\\\n\\\\t\\\\t\\\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\t#undef SPOT_LIGHT_MAP_INDEX\\\\n\\\\t\\\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\\\n\\\\t\\\\tspotLightShadow = spotLightShadows[ i ];\\\\n\\\\t\\\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\\\n\\\\t}\\\\n\\\\t#pragma unroll_loop_end\\\\n#endif\\\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\\\n\\\\tDirectionalLight directionalLight;\\\\n\\\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\\\n\\\\tDirectionalLightShadow directionalLightShadow;\\\\n\\\\t#endif\\\\n\\\\t#pragma unroll_loop_start\\\\n\\\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\\\n\\\\t\\\\tdirectionalLight = directionalLights[ i ];\\\\n\\\\t\\\\tgetDirectionalLightInfo( directionalLight, directLight );\\\\n\\\\t\\\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\\\n\\\\t\\\\tdirectionalLightShadow = directionalLightShadows[ i ];\\\\n\\\\t\\\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\\\n\\\\t}\\\\n\\\\t#pragma unroll_loop_end\\\\n#endif\\\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\\\n\\\\tRectAreaLight rectAreaLight;\\\\n\\\\t#pragma unroll_loop_start\\\\n\\\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\\\n\\\\t\\\\trectAreaLight = rectAreaLights[ i ];\\\\n\\\\t\\\\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\\\n\\\\t}\\\\n\\\\t#pragma unroll_loop_end\\\\n#endif\\\\n#if defined( RE_IndirectDiffuse )\\\\n\\\\tvec3 iblIrradiance = vec3( 0.0 );\\\\n\\\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\\\n\\\\t#if defined( USE_LIGHT_PROBES )\\\\n\\\\t\\\\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\\\\n\\\\t#endif\\\\n\\\\t#if ( NUM_HEMI_LIGHTS > 0 )\\\\n\\\\t\\\\t#pragma unroll_loop_start\\\\n\\\\t\\\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\\\n\\\\t\\\\t\\\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\t#pragma unroll_loop_end\\\\n\\\\t#endif\\\\n#endif\\\\n#if defined( RE_IndirectSpecular )\\\\n\\\\tvec3 radiance = vec3( 0.0 );\\\\n\\\\tvec3 clearcoatRadiance = vec3( 0.0 );\\\\n#endif\\\",lights_fragment_maps:fr=\\\"#if defined( RE_IndirectDiffuse )\\\\n\\\\t#ifdef USE_LIGHTMAP\\\\n\\\\t\\\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\\\n\\\\t\\\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\\\n\\\\t\\\\tirradiance += lightMapIrradiance;\\\\n\\\\t#endif\\\\n\\\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\\\n\\\\t\\\\tiblIrradiance += getIBLIrradiance( geometryNormal );\\\\n\\\\t#endif\\\\n#endif\\\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\\\n\\\\t#ifdef USE_ANISOTROPY\\\\n\\\\t\\\\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\\\\n\\\\t#else\\\\n\\\\t\\\\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_CLEARCOAT\\\\n\\\\t\\\\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\\\\n\\\\t#endif\\\\n#endif\\\",lights_fragment_end:mr=\\\"#if defined( RE_IndirectDiffuse )\\\\n\\\\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\\\n#endif\\\\n#if defined( RE_IndirectSpecular )\\\\n\\\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\\\\n#endif\\\",logdepthbuf_fragment:gr=\\\"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\\\\n\\\\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\\\n#endif\\\",logdepthbuf_pars_fragment:_r=\\\"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\\\\n\\\\tuniform float logDepthBufFC;\\\\n\\\\tvarying float vFragDepth;\\\\n\\\\tvarying float vIsPerspective;\\\\n#endif\\\",logdepthbuf_pars_vertex:vr=\\\"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\\\\n\\\\tvarying float vFragDepth;\\\\n\\\\tvarying float vIsPerspective;\\\\n#endif\\\",logdepthbuf_vertex:xr=\\\"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\\\\n\\\\tvFragDepth = 1.0 + gl_Position.w;\\\\n\\\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\\\n#endif\\\",map_fragment:yr=\\\"#ifdef USE_MAP\\\\n\\\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\\\n\\\\t#ifdef DECODE_VIDEO_TEXTURE\\\\n\\\\t\\\\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\\\\n\\\\t#endif\\\\n\\\\tdiffuseColor *= sampledDiffuseColor;\\\\n#endif\\\",map_pars_fragment:Mr=\\\"#ifdef USE_MAP\\\\n\\\\tuniform sampler2D map;\\\\n#endif\\\",map_particle_fragment:Sr=\\\"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\\\n\\\\t#if defined( USE_POINTS_UV )\\\\n\\\\t\\\\tvec2 uv = vUv;\\\\n\\\\t#else\\\\n\\\\t\\\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\\\n\\\\t#endif\\\\n#endif\\\\n#ifdef USE_MAP\\\\n\\\\tdiffuseColor *= texture2D( map, uv );\\\\n#endif\\\\n#ifdef USE_ALPHAMAP\\\\n\\\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\\\n#endif\\\",map_particle_pars_fragment:Tr=\\\"#if defined( USE_POINTS_UV )\\\\n\\\\tvarying vec2 vUv;\\\\n#else\\\\n\\\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\\\n\\\\t\\\\tuniform mat3 uvTransform;\\\\n\\\\t#endif\\\\n#endif\\\\n#ifdef USE_MAP\\\\n\\\\tuniform sampler2D map;\\\\n#endif\\\\n#ifdef USE_ALPHAMAP\\\\n\\\\tuniform sampler2D alphaMap;\\\\n#endif\\\",metalnessmap_fragment:br=\\\"float metalnessFactor = metalness;\\\\n#ifdef USE_METALNESSMAP\\\\n\\\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\\\n\\\\tmetalnessFactor *= texelMetalness.b;\\\\n#endif\\\",metalnessmap_pars_fragment:Er=\\\"#ifdef USE_METALNESSMAP\\\\n\\\\tuniform sampler2D metalnessMap;\\\\n#endif\\\",morphinstance_vertex:Ar=\\\"#ifdef USE_INSTANCING_MORPH\\\\n\\\\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\\\\n\\\\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\\\\n\\\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\\\n\\\\t\\\\tmorphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\\\\n\\\\t}\\\\n#endif\\\",morphcolor_vertex:wr=\\\"#if defined( USE_MORPHCOLORS )\\\\n\\\\tvColor *= morphTargetBaseInfluence;\\\\n\\\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\\\n\\\\t\\\\t#if defined( USE_COLOR_ALPHA )\\\\n\\\\t\\\\t\\\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\\\n\\\\t\\\\t#elif defined( USE_COLOR )\\\\n\\\\t\\\\t\\\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\\\n\\\\t\\\\t#endif\\\\n\\\\t}\\\\n#endif\\\",morphnormal_vertex:Rr=\\\"#ifdef USE_MORPHNORMALS\\\\n\\\\tobjectNormal *= morphTargetBaseInfluence;\\\\n\\\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\\\n\\\\t\\\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\\\n\\\\t}\\\\n#endif\\\",morphtarget_pars_vertex:Cr=\\\"#ifdef USE_MORPHTARGETS\\\\n\\\\t#ifndef USE_INSTANCING_MORPH\\\\n\\\\t\\\\tuniform float morphTargetBaseInfluence;\\\\n\\\\t\\\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\\\n\\\\t#endif\\\\n\\\\tuniform sampler2DArray morphTargetsTexture;\\\\n\\\\tuniform ivec2 morphTargetsTextureSize;\\\\n\\\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\\\n\\\\t\\\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\\\n\\\\t\\\\tint y = texelIndex / morphTargetsTextureSize.x;\\\\n\\\\t\\\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\\\n\\\\t\\\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\\\n\\\\t\\\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\\\n\\\\t}\\\\n#endif\\\",morphtarget_vertex:Pr=\\\"#ifdef USE_MORPHTARGETS\\\\n\\\\ttransformed *= morphTargetBaseInfluence;\\\\n\\\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\\\n\\\\t\\\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\\\n\\\\t}\\\\n#endif\\\",normal_fragment_begin:Ir=\\\"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\\\n#ifdef FLAT_SHADED\\\\n\\\\tvec3 fdx = dFdx( vViewPosition );\\\\n\\\\tvec3 fdy = dFdy( vViewPosition );\\\\n\\\\tvec3 normal = normalize( cross( fdx, fdy ) );\\\\n#else\\\\n\\\\tvec3 normal = normalize( vNormal );\\\\n\\\\t#ifdef DOUBLE_SIDED\\\\n\\\\t\\\\tnormal *= faceDirection;\\\\n\\\\t#endif\\\\n#endif\\\\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\\\\n\\\\t#ifdef USE_TANGENT\\\\n\\\\t\\\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\\\n\\\\t#else\\\\n\\\\t\\\\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\\\\n\\\\t\\\\t#if defined( USE_NORMALMAP )\\\\n\\\\t\\\\t\\\\tvNormalMapUv\\\\n\\\\t\\\\t#elif defined( USE_CLEARCOAT_NORMALMAP )\\\\n\\\\t\\\\t\\\\tvClearcoatNormalMapUv\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\tvUv\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\t);\\\\n\\\\t#endif\\\\n\\\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\\\n\\\\t\\\\ttbn[0] *= faceDirection;\\\\n\\\\t\\\\ttbn[1] *= faceDirection;\\\\n\\\\t#endif\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_NORMALMAP\\\\n\\\\t#ifdef USE_TANGENT\\\\n\\\\t\\\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\\\n\\\\t#else\\\\n\\\\t\\\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\\\n\\\\t#endif\\\\n\\\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\\\n\\\\t\\\\ttbn2[0] *= faceDirection;\\\\n\\\\t\\\\ttbn2[1] *= faceDirection;\\\\n\\\\t#endif\\\\n#endif\\\\nvec3 nonPerturbedNormal = normal;\\\",normal_fragment_maps:Lr=\\\"#ifdef USE_NORMALMAP_OBJECTSPACE\\\\n\\\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\\\n\\\\t#ifdef FLIP_SIDED\\\\n\\\\t\\\\tnormal = - normal;\\\\n\\\\t#endif\\\\n\\\\t#ifdef DOUBLE_SIDED\\\\n\\\\t\\\\tnormal = normal * faceDirection;\\\\n\\\\t#endif\\\\n\\\\tnormal = normalize( normalMatrix * normal );\\\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\\\n\\\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\\\n\\\\tmapN.xy *= normalScale;\\\\n\\\\tnormal = normalize( tbn * mapN );\\\\n#elif defined( USE_BUMPMAP )\\\\n\\\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\\\n#endif\\\",normal_pars_fragment:Nr=\\\"#ifndef FLAT_SHADED\\\\n\\\\tvarying vec3 vNormal;\\\\n\\\\t#ifdef USE_TANGENT\\\\n\\\\t\\\\tvarying vec3 vTangent;\\\\n\\\\t\\\\tvarying vec3 vBitangent;\\\\n\\\\t#endif\\\\n#endif\\\",normal_pars_vertex:Ur=\\\"#ifndef FLAT_SHADED\\\\n\\\\tvarying vec3 vNormal;\\\\n\\\\t#ifdef USE_TANGENT\\\\n\\\\t\\\\tvarying vec3 vTangent;\\\\n\\\\t\\\\tvarying vec3 vBitangent;\\\\n\\\\t#endif\\\\n#endif\\\",normal_vertex:Dr=\\\"#ifndef FLAT_SHADED\\\\n\\\\tvNormal = normalize( transformedNormal );\\\\n\\\\t#ifdef USE_TANGENT\\\\n\\\\t\\\\tvTangent = normalize( transformedTangent );\\\\n\\\\t\\\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\\\n\\\\t#endif\\\\n#endif\\\",normalmap_pars_fragment:Or=\\\"#ifdef USE_NORMALMAP\\\\n\\\\tuniform sampler2D normalMap;\\\\n\\\\tuniform vec2 normalScale;\\\\n#endif\\\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\\\n\\\\tuniform mat3 normalMatrix;\\\\n#endif\\\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\\\\n\\\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\\\n\\\\t\\\\tvec3 q0 = dFdx( eye_pos.xyz );\\\\n\\\\t\\\\tvec3 q1 = dFdy( eye_pos.xyz );\\\\n\\\\t\\\\tvec2 st0 = dFdx( uv.st );\\\\n\\\\t\\\\tvec2 st1 = dFdy( uv.st );\\\\n\\\\t\\\\tvec3 N = surf_norm;\\\\n\\\\t\\\\tvec3 q1perp = cross( q1, N );\\\\n\\\\t\\\\tvec3 q0perp = cross( N, q0 );\\\\n\\\\t\\\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\\\n\\\\t\\\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\\\n\\\\t\\\\tfloat det = max( dot( T, T ), dot( B, B ) );\\\\n\\\\t\\\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\\\n\\\\t\\\\treturn mat3( T * scale, B * scale, N );\\\\n\\\\t}\\\\n#endif\\\",clearcoat_normal_fragment_begin:Fr=\\\"#ifdef USE_CLEARCOAT\\\\n\\\\tvec3 clearcoatNormal = nonPerturbedNormal;\\\\n#endif\\\",clearcoat_normal_fragment_maps:Br=\\\"#ifdef USE_CLEARCOAT_NORMALMAP\\\\n\\\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\\\n\\\\tclearcoatMapN.xy *= clearcoatNormalScale;\\\\n\\\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\\\n#endif\\\",clearcoat_pars_fragment:zr=\\\"#ifdef USE_CLEARCOATMAP\\\\n\\\\tuniform sampler2D clearcoatMap;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_NORMALMAP\\\\n\\\\tuniform sampler2D clearcoatNormalMap;\\\\n\\\\tuniform vec2 clearcoatNormalScale;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\\\n\\\\tuniform sampler2D clearcoatRoughnessMap;\\\\n#endif\\\",iridescence_pars_fragment:kr=\\\"#ifdef USE_IRIDESCENCEMAP\\\\n\\\\tuniform sampler2D iridescenceMap;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\\\n\\\\tuniform sampler2D iridescenceThicknessMap;\\\\n#endif\\\",opaque_fragment:Vr=\\\"#ifdef OPAQUE\\\\ndiffuseColor.a = 1.0;\\\\n#endif\\\\n#ifdef USE_TRANSMISSION\\\\ndiffuseColor.a *= material.transmissionAlpha;\\\\n#endif\\\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\\\",packing:Hr=\\\"vec3 packNormalToRGB( const in vec3 normal ) {\\\\n\\\\treturn normalize( normal ) * 0.5 + 0.5;\\\\n}\\\\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\\\\n\\\\treturn 2.0 * rgb.xyz - 1.0;\\\\n}\\\\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\\\\nconst float Inv255 = 1. / 255.;\\\\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\\\\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\\\\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\\\\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\\\\nvec4 packDepthToRGBA( const in float v ) {\\\\n\\\\tif( v <= 0.0 )\\\\n\\\\t\\\\treturn vec4( 0., 0., 0., 0. );\\\\n\\\\tif( v >= 1.0 )\\\\n\\\\t\\\\treturn vec4( 1., 1., 1., 1. );\\\\n\\\\tfloat vuf;\\\\n\\\\tfloat af = modf( v * PackFactors.a, vuf );\\\\n\\\\tfloat bf = modf( vuf * ShiftRight8, vuf );\\\\n\\\\tfloat gf = modf( vuf * ShiftRight8, vuf );\\\\n\\\\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\\\\n}\\\\nvec3 packDepthToRGB( const in float v ) {\\\\n\\\\tif( v <= 0.0 )\\\\n\\\\t\\\\treturn vec3( 0., 0., 0. );\\\\n\\\\tif( v >= 1.0 )\\\\n\\\\t\\\\treturn vec3( 1., 1., 1. );\\\\n\\\\tfloat vuf;\\\\n\\\\tfloat bf = modf( v * PackFactors.b, vuf );\\\\n\\\\tfloat gf = modf( vuf * ShiftRight8, vuf );\\\\n\\\\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\\\\n}\\\\nvec2 packDepthToRG( const in float v ) {\\\\n\\\\tif( v <= 0.0 )\\\\n\\\\t\\\\treturn vec2( 0., 0. );\\\\n\\\\tif( v >= 1.0 )\\\\n\\\\t\\\\treturn vec2( 1., 1. );\\\\n\\\\tfloat vuf;\\\\n\\\\tfloat gf = modf( v * 256., vuf );\\\\n\\\\treturn vec2( vuf * Inv255, gf );\\\\n}\\\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\\\n\\\\treturn dot( v, UnpackFactors4 );\\\\n}\\\\nfloat unpackRGBToDepth( const in vec3 v ) {\\\\n\\\\treturn dot( v, UnpackFactors3 );\\\\n}\\\\nfloat unpackRGToDepth( const in vec2 v ) {\\\\n\\\\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\\\\n}\\\\nvec4 pack2HalfToRGBA( const in vec2 v ) {\\\\n\\\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\\\\n\\\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\\\\n}\\\\nvec2 unpackRGBATo2Half( const in vec4 v ) {\\\\n\\\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\\\n}\\\\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\\\\n\\\\treturn ( viewZ + near ) / ( near - far );\\\\n}\\\\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\\\\n\\\\treturn depth * ( near - far ) - near;\\\\n}\\\\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\\\\n\\\\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\\\\n}\\\\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\\\\n\\\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\\\n}\\\",premultiplied_alpha_fragment:Gr=\\\"#ifdef PREMULTIPLIED_ALPHA\\\\n\\\\tgl_FragColor.rgb *= gl_FragColor.a;\\\\n#endif\\\",project_vertex:Wr=\\\"vec4 mvPosition = vec4( transformed, 1.0 );\\\\n#ifdef USE_BATCHING\\\\n\\\\tmvPosition = batchingMatrix * mvPosition;\\\\n#endif\\\\n#ifdef USE_INSTANCING\\\\n\\\\tmvPosition = instanceMatrix * mvPosition;\\\\n#endif\\\\nmvPosition = modelViewMatrix * mvPosition;\\\\ngl_Position = projectionMatrix * mvPosition;\\\",dithering_fragment:Xr=\\\"#ifdef DITHERING\\\\n\\\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\\\n#endif\\\",dithering_pars_fragment:jr=\\\"#ifdef DITHERING\\\\n\\\\tvec3 dithering( vec3 color ) {\\\\n\\\\t\\\\tfloat grid_position = rand( gl_FragCoord.xy );\\\\n\\\\t\\\\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\\\\n\\\\t\\\\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\\\\n\\\\t\\\\treturn color + dither_shift_RGB;\\\\n\\\\t}\\\\n#endif\\\",roughnessmap_fragment:qr=\\\"float roughnessFactor = roughness;\\\\n#ifdef USE_ROUGHNESSMAP\\\\n\\\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\\\n\\\\troughnessFactor *= texelRoughness.g;\\\\n#endif\\\",roughnessmap_pars_fragment:Yr=\\\"#ifdef USE_ROUGHNESSMAP\\\\n\\\\tuniform sampler2D roughnessMap;\\\\n#endif\\\",shadowmap_pars_fragment:Kr=\\\"#if NUM_SPOT_LIGHT_COORDS > 0\\\\n\\\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\\\n#endif\\\\n#if NUM_SPOT_LIGHT_MAPS > 0\\\\n\\\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\\\n#endif\\\\n#ifdef USE_SHADOWMAP\\\\n\\\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\\\n\\\\t\\\\t#if defined( SHADOWMAP_TYPE_PCF )\\\\n\\\\t\\\\t\\\\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\\\n\\\\t\\\\tstruct DirectionalLightShadow {\\\\n\\\\t\\\\t\\\\tfloat shadowIntensity;\\\\n\\\\t\\\\t\\\\tfloat shadowBias;\\\\n\\\\t\\\\t\\\\tfloat shadowNormalBias;\\\\n\\\\t\\\\t\\\\tfloat shadowRadius;\\\\n\\\\t\\\\t\\\\tvec2 shadowMapSize;\\\\n\\\\t\\\\t};\\\\n\\\\t\\\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\\\n\\\\t#endif\\\\n\\\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\\\n\\\\t\\\\t#if defined( SHADOWMAP_TYPE_PCF )\\\\n\\\\t\\\\t\\\\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tstruct SpotLightShadow {\\\\n\\\\t\\\\t\\\\tfloat shadowIntensity;\\\\n\\\\t\\\\t\\\\tfloat shadowBias;\\\\n\\\\t\\\\t\\\\tfloat shadowNormalBias;\\\\n\\\\t\\\\t\\\\tfloat shadowRadius;\\\\n\\\\t\\\\t\\\\tvec2 shadowMapSize;\\\\n\\\\t\\\\t};\\\\n\\\\t\\\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\\\n\\\\t#endif\\\\n\\\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\\\n\\\\t\\\\t#if defined( SHADOWMAP_TYPE_PCF )\\\\n\\\\t\\\\t\\\\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\\\n\\\\t\\\\t#elif defined( SHADOWMAP_TYPE_BASIC )\\\\n\\\\t\\\\t\\\\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\\\n\\\\t\\\\tstruct PointLightShadow {\\\\n\\\\t\\\\t\\\\tfloat shadowIntensity;\\\\n\\\\t\\\\t\\\\tfloat shadowBias;\\\\n\\\\t\\\\t\\\\tfloat shadowNormalBias;\\\\n\\\\t\\\\t\\\\tfloat shadowRadius;\\\\n\\\\t\\\\t\\\\tvec2 shadowMapSize;\\\\n\\\\t\\\\t\\\\tfloat shadowCameraNear;\\\\n\\\\t\\\\t\\\\tfloat shadowCameraFar;\\\\n\\\\t\\\\t};\\\\n\\\\t\\\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\\\n\\\\t#endif\\\\n\\\\t#if defined( SHADOWMAP_TYPE_PCF )\\\\n\\\\t\\\\tfloat interleavedGradientNoise( vec2 position ) {\\\\n\\\\t\\\\t\\\\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\\\\n\\\\t\\\\t\\\\tconst float goldenAngle = 2.399963229728653;\\\\n\\\\t\\\\t\\\\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\\\\n\\\\t\\\\t\\\\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\\\\n\\\\t\\\\t\\\\treturn vec2( cos( theta ), sin( theta ) ) * r;\\\\n\\\\t\\\\t}\\\\n\\\\t#endif\\\\n\\\\t#if defined( SHADOWMAP_TYPE_PCF )\\\\n\\\\t\\\\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\\\n\\\\t\\\\t\\\\tfloat shadow = 1.0;\\\\n\\\\t\\\\t\\\\tshadowCoord.xyz /= shadowCoord.w;\\\\n\\\\t\\\\t\\\\tshadowCoord.z += shadowBias;\\\\n\\\\t\\\\t\\\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\\\n\\\\t\\\\t\\\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\\\n\\\\t\\\\t\\\\tif ( frustumTest ) {\\\\n\\\\t\\\\t\\\\t\\\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\\\n\\\\t\\\\t\\\\t\\\\tfloat radius = shadowRadius * texelSize.x;\\\\n\\\\t\\\\t\\\\t\\\\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\\\\n\\\\t\\\\t\\\\t\\\\tshadow = (\\\\n\\\\t\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\\\\n\\\\t\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\\\\n\\\\t\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\\\\n\\\\t\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\\\\n\\\\t\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\\\\n\\\\t\\\\t\\\\t\\\\t) * 0.2;\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\treturn mix( 1.0, shadow, shadowIntensity );\\\\n\\\\t\\\\t}\\\\n\\\\t#elif defined( SHADOWMAP_TYPE_VSM )\\\\n\\\\t\\\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\\\n\\\\t\\\\t\\\\tfloat shadow = 1.0;\\\\n\\\\t\\\\t\\\\tshadowCoord.xyz /= shadowCoord.w;\\\\n\\\\t\\\\t\\\\tshadowCoord.z += shadowBias;\\\\n\\\\t\\\\t\\\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\\\n\\\\t\\\\t\\\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\\\n\\\\t\\\\t\\\\tif ( frustumTest ) {\\\\n\\\\t\\\\t\\\\t\\\\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\\\\n\\\\t\\\\t\\\\t\\\\tfloat mean = distribution.x;\\\\n\\\\t\\\\t\\\\t\\\\tfloat variance = distribution.y * distribution.y;\\\\n\\\\t\\\\t\\\\t\\\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tfloat hard_shadow = step( mean, shadowCoord.z );\\\\n\\\\t\\\\t\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tfloat hard_shadow = step( shadowCoord.z, mean );\\\\n\\\\t\\\\t\\\\t\\\\t#endif\\\\n\\\\t\\\\t\\\\t\\\\tif ( hard_shadow == 1.0 ) {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tshadow = 1.0;\\\\n\\\\t\\\\t\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tvariance = max( variance, 0.0000001 );\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tfloat d = shadowCoord.z - mean;\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tfloat p_max = variance / ( variance + d * d );\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tshadow = max( hard_shadow, p_max );\\\\n\\\\t\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\treturn mix( 1.0, shadow, shadowIntensity );\\\\n\\\\t\\\\t}\\\\n\\\\t#else\\\\n\\\\t\\\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\\\n\\\\t\\\\t\\\\tfloat shadow = 1.0;\\\\n\\\\t\\\\t\\\\tshadowCoord.xyz /= shadowCoord.w;\\\\n\\\\t\\\\t\\\\tshadowCoord.z += shadowBias;\\\\n\\\\t\\\\t\\\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\\\n\\\\t\\\\t\\\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\\\n\\\\t\\\\t\\\\tif ( frustumTest ) {\\\\n\\\\t\\\\t\\\\t\\\\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\\\\n\\\\t\\\\t\\\\t\\\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tshadow = step( depth, shadowCoord.z );\\\\n\\\\t\\\\t\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\t\\\\t\\\\tshadow = step( shadowCoord.z, depth );\\\\n\\\\t\\\\t\\\\t\\\\t#endif\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\treturn mix( 1.0, shadow, shadowIntensity );\\\\n\\\\t\\\\t}\\\\n\\\\t#endif\\\\n\\\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\\\n\\\\t#if defined( SHADOWMAP_TYPE_PCF )\\\\n\\\\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\\\n\\\\t\\\\tfloat shadow = 1.0;\\\\n\\\\t\\\\tvec3 lightToPosition = shadowCoord.xyz;\\\\n\\\\t\\\\tvec3 bd3D = normalize( lightToPosition );\\\\n\\\\t\\\\tvec3 absVec = abs( lightToPosition );\\\\n\\\\t\\\\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\\\\n\\\\t\\\\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\\\\n\\\\t\\\\t\\\\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\\\\n\\\\t\\\\t\\\\tdp += shadowBias;\\\\n\\\\t\\\\t\\\\tfloat texelSize = shadowRadius / shadowMapSize.x;\\\\n\\\\t\\\\t\\\\tvec3 absDir = abs( bd3D );\\\\n\\\\t\\\\t\\\\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\\\\n\\\\t\\\\t\\\\ttangent = normalize( cross( bd3D, tangent ) );\\\\n\\\\t\\\\t\\\\tvec3 bitangent = cross( bd3D, tangent );\\\\n\\\\t\\\\t\\\\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\\\\n\\\\t\\\\t\\\\tshadow = (\\\\n\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\\\\n\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\\\\n\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\\\\n\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\\\\n\\\\t\\\\t\\\\t\\\\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\\\\n\\\\t\\\\t\\\\t) * 0.2;\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\treturn mix( 1.0, shadow, shadowIntensity );\\\\n\\\\t}\\\\n\\\\t#elif defined( SHADOWMAP_TYPE_BASIC )\\\\n\\\\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\\\n\\\\t\\\\tfloat shadow = 1.0;\\\\n\\\\t\\\\tvec3 lightToPosition = shadowCoord.xyz;\\\\n\\\\t\\\\tvec3 bd3D = normalize( lightToPosition );\\\\n\\\\t\\\\tvec3 absVec = abs( lightToPosition );\\\\n\\\\t\\\\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\\\\n\\\\t\\\\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\\\\n\\\\t\\\\t\\\\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\\\\n\\\\t\\\\t\\\\tdp += shadowBias;\\\\n\\\\t\\\\t\\\\tfloat depth = textureCube( shadowMap, bd3D ).r;\\\\n\\\\t\\\\t\\\\t#ifdef USE_REVERSED_DEPTH_BUFFER\\\\n\\\\t\\\\t\\\\t\\\\tshadow = step( depth, dp );\\\\n\\\\t\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\t\\\\tshadow = step( dp, depth );\\\\n\\\\t\\\\t\\\\t#endif\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\treturn mix( 1.0, shadow, shadowIntensity );\\\\n\\\\t}\\\\n\\\\t#endif\\\\n\\\\t#endif\\\\n#endif\\\",shadowmap_pars_vertex:Jr=\\\"#if NUM_SPOT_LIGHT_COORDS > 0\\\\n\\\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\\\n\\\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\\\n#endif\\\\n#ifdef USE_SHADOWMAP\\\\n\\\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\\\n\\\\t\\\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\\\n\\\\t\\\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\\\n\\\\t\\\\tstruct DirectionalLightShadow {\\\\n\\\\t\\\\t\\\\tfloat shadowIntensity;\\\\n\\\\t\\\\t\\\\tfloat shadowBias;\\\\n\\\\t\\\\t\\\\tfloat shadowNormalBias;\\\\n\\\\t\\\\t\\\\tfloat shadowRadius;\\\\n\\\\t\\\\t\\\\tvec2 shadowMapSize;\\\\n\\\\t\\\\t};\\\\n\\\\t\\\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\\\n\\\\t#endif\\\\n\\\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\\\n\\\\t\\\\tstruct SpotLightShadow {\\\\n\\\\t\\\\t\\\\tfloat shadowIntensity;\\\\n\\\\t\\\\t\\\\tfloat shadowBias;\\\\n\\\\t\\\\t\\\\tfloat shadowNormalBias;\\\\n\\\\t\\\\t\\\\tfloat shadowRadius;\\\\n\\\\t\\\\t\\\\tvec2 shadowMapSize;\\\\n\\\\t\\\\t};\\\\n\\\\t\\\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\\\n\\\\t#endif\\\\n\\\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\\\n\\\\t\\\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\\\n\\\\t\\\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\\\n\\\\t\\\\tstruct PointLightShadow {\\\\n\\\\t\\\\t\\\\tfloat shadowIntensity;\\\\n\\\\t\\\\t\\\\tfloat shadowBias;\\\\n\\\\t\\\\t\\\\tfloat shadowNormalBias;\\\\n\\\\t\\\\t\\\\tfloat shadowRadius;\\\\n\\\\t\\\\t\\\\tvec2 shadowMapSize;\\\\n\\\\t\\\\t\\\\tfloat shadowCameraNear;\\\\n\\\\t\\\\t\\\\tfloat shadowCameraFar;\\\\n\\\\t\\\\t};\\\\n\\\\t\\\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\\\n\\\\t#endif\\\\n#endif\\\",shadowmap_vertex:Zr=\\\"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\\\n\\\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\\\n\\\\tvec4 shadowWorldPosition;\\\\n#endif\\\\n#if defined( USE_SHADOWMAP )\\\\n\\\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\\\n\\\\t\\\\t#pragma unroll_loop_start\\\\n\\\\t\\\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\\\n\\\\t\\\\t\\\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\\\n\\\\t\\\\t\\\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\t#pragma unroll_loop_end\\\\n\\\\t#endif\\\\n\\\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\\\n\\\\t\\\\t#pragma unroll_loop_start\\\\n\\\\t\\\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\\\n\\\\t\\\\t\\\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\\\n\\\\t\\\\t\\\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\\\n\\\\t\\\\t}\\\\n\\\\t\\\\t#pragma unroll_loop_end\\\\n\\\\t#endif\\\\n#endif\\\\n#if NUM_SPOT_LIGHT_COORDS > 0\\\\n\\\\t#pragma unroll_loop_start\\\\n\\\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\\\n\\\\t\\\\tshadowWorldPosition = worldPosition;\\\\n\\\\t\\\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\\\n\\\\t\\\\t\\\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\\\n\\\\t}\\\\n\\\\t#pragma unroll_loop_end\\\\n#endif\\\",shadowmask_pars_fragment:$r=\\\"float getShadowMask() {\\\\n\\\\tfloat shadow = 1.0;\\\\n\\\\t#ifdef USE_SHADOWMAP\\\\n\\\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\\\n\\\\tDirectionalLightShadow directionalLight;\\\\n\\\\t#pragma unroll_loop_start\\\\n\\\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\\\n\\\\t\\\\tdirectionalLight = directionalLightShadows[ i ];\\\\n\\\\t\\\\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\\\n\\\\t}\\\\n\\\\t#pragma unroll_loop_end\\\\n\\\\t#endif\\\\n\\\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\\\n\\\\tSpotLightShadow spotLight;\\\\n\\\\t#pragma unroll_loop_start\\\\n\\\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\\\n\\\\t\\\\tspotLight = spotLightShadows[ i ];\\\\n\\\\t\\\\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\\\n\\\\t}\\\\n\\\\t#pragma unroll_loop_end\\\\n\\\\t#endif\\\\n\\\\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\\\\n\\\\tPointLightShadow pointLight;\\\\n\\\\t#pragma unroll_loop_start\\\\n\\\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\\\n\\\\t\\\\tpointLight = pointLightShadows[ i ];\\\\n\\\\t\\\\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\\\n\\\\t}\\\\n\\\\t#pragma unroll_loop_end\\\\n\\\\t#endif\\\\n\\\\t#endif\\\\n\\\\treturn shadow;\\\\n}\\\",skinbase_vertex:Qr=\\\"#ifdef USE_SKINNING\\\\n\\\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\\\n\\\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\\\n\\\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\\\n\\\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\\\n#endif\\\",skinning_pars_vertex:ts=\\\"#ifdef USE_SKINNING\\\\n\\\\tuniform mat4 bindMatrix;\\\\n\\\\tuniform mat4 bindMatrixInverse;\\\\n\\\\tuniform highp sampler2D boneTexture;\\\\n\\\\tmat4 getBoneMatrix( const in float i ) {\\\\n\\\\t\\\\tint size = textureSize( boneTexture, 0 ).x;\\\\n\\\\t\\\\tint j = int( i ) * 4;\\\\n\\\\t\\\\tint x = j % size;\\\\n\\\\t\\\\tint y = j / size;\\\\n\\\\t\\\\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\\\\n\\\\t\\\\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\\\\n\\\\t\\\\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\\\\n\\\\t\\\\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\\\\n\\\\t\\\\treturn mat4( v1, v2, v3, v4 );\\\\n\\\\t}\\\\n#endif\\\",skinning_vertex:es=\\\"#ifdef USE_SKINNING\\\\n\\\\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\\\\n\\\\tvec4 skinned = vec4( 0.0 );\\\\n\\\\tskinned += boneMatX * skinVertex * skinWeight.x;\\\\n\\\\tskinned += boneMatY * skinVertex * skinWeight.y;\\\\n\\\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\\\n\\\\tskinned += boneMatW * skinVertex * skinWeight.w;\\\\n\\\\ttransformed = ( bindMatrixInverse * skinned ).xyz;\\\\n#endif\\\",skinnormal_vertex:ns=\\\"#ifdef USE_SKINNING\\\\n\\\\tmat4 skinMatrix = mat4( 0.0 );\\\\n\\\\tskinMatrix += skinWeight.x * boneMatX;\\\\n\\\\tskinMatrix += skinWeight.y * boneMatY;\\\\n\\\\tskinMatrix += skinWeight.z * boneMatZ;\\\\n\\\\tskinMatrix += skinWeight.w * boneMatW;\\\\n\\\\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\\\\n\\\\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\\\\n\\\\t#ifdef USE_TANGENT\\\\n\\\\t\\\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\\\n\\\\t#endif\\\\n#endif\\\",specularmap_fragment:is=\\\"float specularStrength;\\\\n#ifdef USE_SPECULARMAP\\\\n\\\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\\\n\\\\tspecularStrength = texelSpecular.r;\\\\n#else\\\\n\\\\tspecularStrength = 1.0;\\\\n#endif\\\",specularmap_pars_fragment:rs=\\\"#ifdef USE_SPECULARMAP\\\\n\\\\tuniform sampler2D specularMap;\\\\n#endif\\\",tonemapping_fragment:ss=\\\"#if defined( TONE_MAPPING )\\\\n\\\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\\\n#endif\\\",tonemapping_pars_fragment:as=\\\"#ifndef saturate\\\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\\\n#endif\\\\nuniform float toneMappingExposure;\\\\nvec3 LinearToneMapping( vec3 color ) {\\\\n\\\\treturn saturate( toneMappingExposure * color );\\\\n}\\\\nvec3 ReinhardToneMapping( vec3 color ) {\\\\n\\\\tcolor *= toneMappingExposure;\\\\n\\\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\\\n}\\\\nvec3 CineonToneMapping( vec3 color ) {\\\\n\\\\tcolor *= toneMappingExposure;\\\\n\\\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\\\n\\\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\\\n}\\\\nvec3 RRTAndODTFit( vec3 v ) {\\\\n\\\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\\\n\\\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\\\n\\\\treturn a / b;\\\\n}\\\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\\\n\\\\tconst mat3 ACESInputMat = mat3(\\\\n\\\\t\\\\tvec3( 0.59719, 0.07600, 0.02840 ),\\\\t\\\\tvec3( 0.35458, 0.90834, 0.13383 ),\\\\n\\\\t\\\\tvec3( 0.04823, 0.01566, 0.83777 )\\\\n\\\\t);\\\\n\\\\tconst mat3 ACESOutputMat = mat3(\\\\n\\\\t\\\\tvec3(  1.60475, -0.10208, -0.00327 ),\\\\t\\\\tvec3( -0.53108,  1.10813, -0.07276 ),\\\\n\\\\t\\\\tvec3( -0.07367, -0.00605,  1.07602 )\\\\n\\\\t);\\\\n\\\\tcolor *= toneMappingExposure / 0.6;\\\\n\\\\tcolor = ACESInputMat * color;\\\\n\\\\tcolor = RRTAndODTFit( color );\\\\n\\\\tcolor = ACESOutputMat * color;\\\\n\\\\treturn saturate( color );\\\\n}\\\\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\\\\n\\\\tvec3( 1.6605, - 0.1246, - 0.0182 ),\\\\n\\\\tvec3( - 0.5876, 1.1329, - 0.1006 ),\\\\n\\\\tvec3( - 0.0728, - 0.0083, 1.1187 )\\\\n);\\\\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\\\\n\\\\tvec3( 0.6274, 0.0691, 0.0164 ),\\\\n\\\\tvec3( 0.3293, 0.9195, 0.0880 ),\\\\n\\\\tvec3( 0.0433, 0.0113, 0.8956 )\\\\n);\\\\nvec3 agxDefaultContrastApprox( vec3 x ) {\\\\n\\\\tvec3 x2 = x * x;\\\\n\\\\tvec3 x4 = x2 * x2;\\\\n\\\\treturn + 15.5 * x4 * x2\\\\n\\\\t\\\\t- 40.14 * x4 * x\\\\n\\\\t\\\\t+ 31.96 * x4\\\\n\\\\t\\\\t- 6.868 * x2 * x\\\\n\\\\t\\\\t+ 0.4298 * x2\\\\n\\\\t\\\\t+ 0.1191 * x\\\\n\\\\t\\\\t- 0.00232;\\\\n}\\\\nvec3 AgXToneMapping( vec3 color ) {\\\\n\\\\tconst mat3 AgXInsetMatrix = mat3(\\\\n\\\\t\\\\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\\\\n\\\\t\\\\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\\\\n\\\\t\\\\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\\\\n\\\\t);\\\\n\\\\tconst mat3 AgXOutsetMatrix = mat3(\\\\n\\\\t\\\\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\\\\n\\\\t\\\\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\\\\n\\\\t\\\\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\\\\n\\\\t);\\\\n\\\\tconst float AgxMinEv = - 12.47393;\\\\tconst float AgxMaxEv = 4.026069;\\\\n\\\\tcolor *= toneMappingExposure;\\\\n\\\\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\\\\n\\\\tcolor = AgXInsetMatrix * color;\\\\n\\\\tcolor = max( color, 1e-10 );\\\\tcolor = log2( color );\\\\n\\\\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\\\\n\\\\tcolor = clamp( color, 0.0, 1.0 );\\\\n\\\\tcolor = agxDefaultContrastApprox( color );\\\\n\\\\tcolor = AgXOutsetMatrix * color;\\\\n\\\\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\\\\n\\\\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\\\\n\\\\tcolor = clamp( color, 0.0, 1.0 );\\\\n\\\\treturn color;\\\\n}\\\\nvec3 NeutralToneMapping( vec3 color ) {\\\\n\\\\tconst float StartCompression = 0.8 - 0.04;\\\\n\\\\tconst float Desaturation = 0.15;\\\\n\\\\tcolor *= toneMappingExposure;\\\\n\\\\tfloat x = min( color.r, min( color.g, color.b ) );\\\\n\\\\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\\\\n\\\\tcolor -= offset;\\\\n\\\\tfloat peak = max( color.r, max( color.g, color.b ) );\\\\n\\\\tif ( peak < StartCompression ) return color;\\\\n\\\\tfloat d = 1. - StartCompression;\\\\n\\\\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\\\\n\\\\tcolor *= newPeak / peak;\\\\n\\\\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\\\\n\\\\treturn mix( color, vec3( newPeak ), g );\\\\n}\\\\nvec3 CustomToneMapping( vec3 color ) { return color; }\\\",transmission_fragment:os=\\\"#ifdef USE_TRANSMISSION\\\\n\\\\tmaterial.transmission = transmission;\\\\n\\\\tmaterial.transmissionAlpha = 1.0;\\\\n\\\\tmaterial.thickness = thickness;\\\\n\\\\tmaterial.attenuationDistance = attenuationDistance;\\\\n\\\\tmaterial.attenuationColor = attenuationColor;\\\\n\\\\t#ifdef USE_TRANSMISSIONMAP\\\\n\\\\t\\\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_THICKNESSMAP\\\\n\\\\t\\\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\\\n\\\\t#endif\\\\n\\\\tvec3 pos = vWorldPosition;\\\\n\\\\tvec3 v = normalize( cameraPosition - pos );\\\\n\\\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\\\n\\\\tvec4 transmitted = getIBLVolumeRefraction(\\\\n\\\\t\\\\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\\\\n\\\\t\\\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\\\\n\\\\t\\\\tmaterial.attenuationColor, material.attenuationDistance );\\\\n\\\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\\\\n\\\\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\\\\n#endif\\\",transmission_pars_fragment:ls=\\\"#ifdef USE_TRANSMISSION\\\\n\\\\tuniform float transmission;\\\\n\\\\tuniform float thickness;\\\\n\\\\tuniform float attenuationDistance;\\\\n\\\\tuniform vec3 attenuationColor;\\\\n\\\\t#ifdef USE_TRANSMISSIONMAP\\\\n\\\\t\\\\tuniform sampler2D transmissionMap;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_THICKNESSMAP\\\\n\\\\t\\\\tuniform sampler2D thicknessMap;\\\\n\\\\t#endif\\\\n\\\\tuniform vec2 transmissionSamplerSize;\\\\n\\\\tuniform sampler2D transmissionSamplerMap;\\\\n\\\\tuniform mat4 modelMatrix;\\\\n\\\\tuniform mat4 projectionMatrix;\\\\n\\\\tvarying vec3 vWorldPosition;\\\\n\\\\tfloat w0( float a ) {\\\\n\\\\t\\\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\\\n\\\\t}\\\\n\\\\tfloat w1( float a ) {\\\\n\\\\t\\\\treturn ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );\\\\n\\\\t}\\\\n\\\\tfloat w2( float a ){\\\\n\\\\t\\\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\\\n\\\\t}\\\\n\\\\tfloat w3( float a ) {\\\\n\\\\t\\\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\\\n\\\\t}\\\\n\\\\tfloat g0( float a ) {\\\\n\\\\t\\\\treturn w0( a ) + w1( a );\\\\n\\\\t}\\\\n\\\\tfloat g1( float a ) {\\\\n\\\\t\\\\treturn w2( a ) + w3( a );\\\\n\\\\t}\\\\n\\\\tfloat h0( float a ) {\\\\n\\\\t\\\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\\\n\\\\t}\\\\n\\\\tfloat h1( float a ) {\\\\n\\\\t\\\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\\\n\\\\t}\\\\n\\\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\\\\n\\\\t\\\\tuv = uv * texelSize.zw + 0.5;\\\\n\\\\t\\\\tvec2 iuv = floor( uv );\\\\n\\\\t\\\\tvec2 fuv = fract( uv );\\\\n\\\\t\\\\tfloat g0x = g0( fuv.x );\\\\n\\\\t\\\\tfloat g1x = g1( fuv.x );\\\\n\\\\t\\\\tfloat h0x = h0( fuv.x );\\\\n\\\\t\\\\tfloat h1x = h1( fuv.x );\\\\n\\\\t\\\\tfloat h0y = h0( fuv.y );\\\\n\\\\t\\\\tfloat h1y = h1( fuv.y );\\\\n\\\\t\\\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\\\n\\\\t\\\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\\\n\\\\t\\\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\\\n\\\\t\\\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\\\n\\\\t\\\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\\\n\\\\t\\\\t\\\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\\\n\\\\t}\\\\n\\\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\\\n\\\\t\\\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\\\n\\\\t\\\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\\\n\\\\t\\\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\\\n\\\\t\\\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\\\n\\\\t\\\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\\\\n\\\\t\\\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\\\\n\\\\t\\\\treturn mix( fSample, cSample, fract( lod ) );\\\\n\\\\t}\\\\n\\\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\\\n\\\\t\\\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\\\n\\\\t\\\\tvec3 modelScale;\\\\n\\\\t\\\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\\\n\\\\t\\\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\\\n\\\\t\\\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\\\n\\\\t\\\\treturn normalize( refractionVector ) * thickness * modelScale;\\\\n\\\\t}\\\\n\\\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\\\n\\\\t\\\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\\\n\\\\t}\\\\n\\\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\\\n\\\\t\\\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\\\n\\\\t\\\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\\\n\\\\t}\\\\n\\\\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\\\n\\\\t\\\\tif ( isinf( attenuationDistance ) ) {\\\\n\\\\t\\\\t\\\\treturn vec3( 1.0 );\\\\n\\\\t\\\\t} else {\\\\n\\\\t\\\\t\\\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\\\n\\\\t\\\\t\\\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\\\t\\\\t\\\\treturn transmittance;\\\\n\\\\t\\\\t}\\\\n\\\\t}\\\\n\\\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\\\n\\\\t\\\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\\\n\\\\t\\\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\\\\n\\\\t\\\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\\\n\\\\t\\\\tvec4 transmittedLight;\\\\n\\\\t\\\\tvec3 transmittance;\\\\n\\\\t\\\\t#ifdef USE_DISPERSION\\\\n\\\\t\\\\t\\\\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\\\\n\\\\t\\\\t\\\\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\\\\n\\\\t\\\\t\\\\tfor ( int i = 0; i < 3; i ++ ) {\\\\n\\\\t\\\\t\\\\t\\\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\\\\n\\\\t\\\\t\\\\t\\\\tvec3 refractedRayExit = position + transmissionRay;\\\\n\\\\t\\\\t\\\\t\\\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\\\n\\\\t\\\\t\\\\t\\\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\\\n\\\\t\\\\t\\\\t\\\\trefractionCoords += 1.0;\\\\n\\\\t\\\\t\\\\t\\\\trefractionCoords /= 2.0;\\\\n\\\\t\\\\t\\\\t\\\\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\\\\n\\\\t\\\\t\\\\t\\\\ttransmittedLight[ i ] = transmissionSample[ i ];\\\\n\\\\t\\\\t\\\\t\\\\ttransmittedLight.a += transmissionSample.a;\\\\n\\\\t\\\\t\\\\t\\\\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\\\\n\\\\t\\\\t\\\\t}\\\\n\\\\t\\\\t\\\\ttransmittedLight.a /= 3.0;\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\\\n\\\\t\\\\t\\\\tvec3 refractedRayExit = position + transmissionRay;\\\\n\\\\t\\\\t\\\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\\\n\\\\t\\\\t\\\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\\\n\\\\t\\\\t\\\\trefractionCoords += 1.0;\\\\n\\\\t\\\\t\\\\trefractionCoords /= 2.0;\\\\n\\\\t\\\\t\\\\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\\\n\\\\t\\\\t\\\\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\\\n\\\\t\\\\t#endif\\\\n\\\\t\\\\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\\\\n\\\\t\\\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\\\n\\\\t\\\\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\\\\n\\\\t\\\\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\\\\n\\\\t}\\\\n#endif\\\",uv_pars_fragment:cs=\\\"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\\\n\\\\tvarying vec2 vUv;\\\\n#endif\\\\n#ifdef USE_MAP\\\\n\\\\tvarying vec2 vMapUv;\\\\n#endif\\\\n#ifdef USE_ALPHAMAP\\\\n\\\\tvarying vec2 vAlphaMapUv;\\\\n#endif\\\\n#ifdef USE_LIGHTMAP\\\\n\\\\tvarying vec2 vLightMapUv;\\\\n#endif\\\\n#ifdef USE_AOMAP\\\\n\\\\tvarying vec2 vAoMapUv;\\\\n#endif\\\\n#ifdef USE_BUMPMAP\\\\n\\\\tvarying vec2 vBumpMapUv;\\\\n#endif\\\\n#ifdef USE_NORMALMAP\\\\n\\\\tvarying vec2 vNormalMapUv;\\\\n#endif\\\\n#ifdef USE_EMISSIVEMAP\\\\n\\\\tvarying vec2 vEmissiveMapUv;\\\\n#endif\\\\n#ifdef USE_METALNESSMAP\\\\n\\\\tvarying vec2 vMetalnessMapUv;\\\\n#endif\\\\n#ifdef USE_ROUGHNESSMAP\\\\n\\\\tvarying vec2 vRoughnessMapUv;\\\\n#endif\\\\n#ifdef USE_ANISOTROPYMAP\\\\n\\\\tvarying vec2 vAnisotropyMapUv;\\\\n#endif\\\\n#ifdef USE_CLEARCOATMAP\\\\n\\\\tvarying vec2 vClearcoatMapUv;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_NORMALMAP\\\\n\\\\tvarying vec2 vClearcoatNormalMapUv;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\\\n\\\\tvarying vec2 vClearcoatRoughnessMapUv;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCEMAP\\\\n\\\\tvarying vec2 vIridescenceMapUv;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\\\n\\\\tvarying vec2 vIridescenceThicknessMapUv;\\\\n#endif\\\\n#ifdef USE_SHEEN_COLORMAP\\\\n\\\\tvarying vec2 vSheenColorMapUv;\\\\n#endif\\\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\\\n\\\\tvarying vec2 vSheenRoughnessMapUv;\\\\n#endif\\\\n#ifdef USE_SPECULARMAP\\\\n\\\\tvarying vec2 vSpecularMapUv;\\\\n#endif\\\\n#ifdef USE_SPECULAR_COLORMAP\\\\n\\\\tvarying vec2 vSpecularColorMapUv;\\\\n#endif\\\\n#ifdef USE_SPECULAR_INTENSITYMAP\\\\n\\\\tvarying vec2 vSpecularIntensityMapUv;\\\\n#endif\\\\n#ifdef USE_TRANSMISSIONMAP\\\\n\\\\tuniform mat3 transmissionMapTransform;\\\\n\\\\tvarying vec2 vTransmissionMapUv;\\\\n#endif\\\\n#ifdef USE_THICKNESSMAP\\\\n\\\\tuniform mat3 thicknessMapTransform;\\\\n\\\\tvarying vec2 vThicknessMapUv;\\\\n#endif\\\",uv_pars_vertex:hs=\\\"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\\\n\\\\tvarying vec2 vUv;\\\\n#endif\\\\n#ifdef USE_MAP\\\\n\\\\tuniform mat3 mapTransform;\\\\n\\\\tvarying vec2 vMapUv;\\\\n#endif\\\\n#ifdef USE_ALPHAMAP\\\\n\\\\tuniform mat3 alphaMapTransform;\\\\n\\\\tvarying vec2 vAlphaMapUv;\\\\n#endif\\\\n#ifdef USE_LIGHTMAP\\\\n\\\\tuniform mat3 lightMapTransform;\\\\n\\\\tvarying vec2 vLightMapUv;\\\\n#endif\\\\n#ifdef USE_AOMAP\\\\n\\\\tuniform mat3 aoMapTransform;\\\\n\\\\tvarying vec2 vAoMapUv;\\\\n#endif\\\\n#ifdef USE_BUMPMAP\\\\n\\\\tuniform mat3 bumpMapTransform;\\\\n\\\\tvarying vec2 vBumpMapUv;\\\\n#endif\\\\n#ifdef USE_NORMALMAP\\\\n\\\\tuniform mat3 normalMapTransform;\\\\n\\\\tvarying vec2 vNormalMapUv;\\\\n#endif\\\\n#ifdef USE_DISPLACEMENTMAP\\\\n\\\\tuniform mat3 displacementMapTransform;\\\\n\\\\tvarying vec2 vDisplacementMapUv;\\\\n#endif\\\\n#ifdef USE_EMISSIVEMAP\\\\n\\\\tuniform mat3 emissiveMapTransform;\\\\n\\\\tvarying vec2 vEmissiveMapUv;\\\\n#endif\\\\n#ifdef USE_METALNESSMAP\\\\n\\\\tuniform mat3 metalnessMapTransform;\\\\n\\\\tvarying vec2 vMetalnessMapUv;\\\\n#endif\\\\n#ifdef USE_ROUGHNESSMAP\\\\n\\\\tuniform mat3 roughnessMapTransform;\\\\n\\\\tvarying vec2 vRoughnessMapUv;\\\\n#endif\\\\n#ifdef USE_ANISOTROPYMAP\\\\n\\\\tuniform mat3 anisotropyMapTransform;\\\\n\\\\tvarying vec2 vAnisotropyMapUv;\\\\n#endif\\\\n#ifdef USE_CLEARCOATMAP\\\\n\\\\tuniform mat3 clearcoatMapTransform;\\\\n\\\\tvarying vec2 vClearcoatMapUv;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_NORMALMAP\\\\n\\\\tuniform mat3 clearcoatNormalMapTransform;\\\\n\\\\tvarying vec2 vClearcoatNormalMapUv;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\\\n\\\\tuniform mat3 clearcoatRoughnessMapTransform;\\\\n\\\\tvarying vec2 vClearcoatRoughnessMapUv;\\\\n#endif\\\\n#ifdef USE_SHEEN_COLORMAP\\\\n\\\\tuniform mat3 sheenColorMapTransform;\\\\n\\\\tvarying vec2 vSheenColorMapUv;\\\\n#endif\\\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\\\n\\\\tuniform mat3 sheenRoughnessMapTransform;\\\\n\\\\tvarying vec2 vSheenRoughnessMapUv;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCEMAP\\\\n\\\\tuniform mat3 iridescenceMapTransform;\\\\n\\\\tvarying vec2 vIridescenceMapUv;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\\\n\\\\tuniform mat3 iridescenceThicknessMapTransform;\\\\n\\\\tvarying vec2 vIridescenceThicknessMapUv;\\\\n#endif\\\\n#ifdef USE_SPECULARMAP\\\\n\\\\tuniform mat3 specularMapTransform;\\\\n\\\\tvarying vec2 vSpecularMapUv;\\\\n#endif\\\\n#ifdef USE_SPECULAR_COLORMAP\\\\n\\\\tuniform mat3 specularColorMapTransform;\\\\n\\\\tvarying vec2 vSpecularColorMapUv;\\\\n#endif\\\\n#ifdef USE_SPECULAR_INTENSITYMAP\\\\n\\\\tuniform mat3 specularIntensityMapTransform;\\\\n\\\\tvarying vec2 vSpecularIntensityMapUv;\\\\n#endif\\\\n#ifdef USE_TRANSMISSIONMAP\\\\n\\\\tuniform mat3 transmissionMapTransform;\\\\n\\\\tvarying vec2 vTransmissionMapUv;\\\\n#endif\\\\n#ifdef USE_THICKNESSMAP\\\\n\\\\tuniform mat3 thicknessMapTransform;\\\\n\\\\tvarying vec2 vThicknessMapUv;\\\\n#endif\\\",uv_vertex:us=\\\"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\\\\n\\\\tvUv = vec3( uv, 1 ).xy;\\\\n#endif\\\\n#ifdef USE_MAP\\\\n\\\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_ALPHAMAP\\\\n\\\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_LIGHTMAP\\\\n\\\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_AOMAP\\\\n\\\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_BUMPMAP\\\\n\\\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_NORMALMAP\\\\n\\\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_DISPLACEMENTMAP\\\\n\\\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_EMISSIVEMAP\\\\n\\\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_METALNESSMAP\\\\n\\\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_ROUGHNESSMAP\\\\n\\\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_ANISOTROPYMAP\\\\n\\\\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_CLEARCOATMAP\\\\n\\\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_NORMALMAP\\\\n\\\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\\\n\\\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCEMAP\\\\n\\\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\\\n\\\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_SHEEN_COLORMAP\\\\n\\\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\\\n\\\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_SPECULARMAP\\\\n\\\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_SPECULAR_COLORMAP\\\\n\\\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_SPECULAR_INTENSITYMAP\\\\n\\\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_TRANSMISSIONMAP\\\\n\\\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\\\n#endif\\\\n#ifdef USE_THICKNESSMAP\\\\n\\\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\\\n#endif\\\",worldpos_vertex:ds=\\\"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\\\n\\\\tvec4 worldPosition = vec4( transformed, 1.0 );\\\\n\\\\t#ifdef USE_BATCHING\\\\n\\\\t\\\\tworldPosition = batchingMatrix * worldPosition;\\\\n\\\\t#endif\\\\n\\\\t#ifdef USE_INSTANCING\\\\n\\\\t\\\\tworldPosition = instanceMatrix * worldPosition;\\\\n\\\\t#endif\\\\n\\\\tworldPosition = modelMatrix * worldPosition;\\\\n#endif\\\",background_vert:jp,background_frag:qp,backgroundCube_vert:Yp,backgroundCube_frag:Kp,cube_vert:Jp,cube_frag:Zp,depth_vert:$p,depth_frag:Qp,distance_vert:tf,distance_frag:ef,equirect_vert:nf,equirect_frag:rf,linedashed_vert:sf,linedashed_frag:af,meshbasic_vert:of,meshbasic_frag:lf,meshlambert_vert:cf,meshlambert_frag:hf,meshmatcap_vert:uf,meshmatcap_frag:df,meshnormal_vert:pf,meshnormal_frag:ff,meshphong_vert:mf,meshphong_frag:gf,meshphysical_vert:_f,meshphysical_frag:vf,meshtoon_vert:xf,meshtoon_frag:yf,points_vert:Mf,points_frag:Sf,shadow_vert:Tf,shadow_frag:bf,sprite_vert:Ef,sprite_frag:Af},Rf={common:{diffuse:{value:new uh(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Il},alphaMap:{value:null},alphaMapTransform:{value:new Il},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Il}},envmap:{envMap:{value:null},envMapRotation:{value:new Il},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Il}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Il}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Il},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Il},normalScale:{value:new Al(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Il},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Il}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Il}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Il}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new uh(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new uh(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Il},alphaTest:{value:0},uvTransform:{value:new Il}},sprite:{diffuse:{value:new uh(16777215)},opacity:{value:1},center:{value:new Al(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Il},alphaMap:{value:null},alphaMapTransform:{value:new Il},alphaTest:{value:0}}},Cf={basic:{uniforms:k([Rf.common,Rf.specularmap,Rf.envmap,Rf.aomap,Rf.lightmap,Rf.fog]),vertexShader:wf.meshbasic_vert,fragmentShader:wf.meshbasic_frag},lambert:{uniforms:k([Rf.common,Rf.specularmap,Rf.envmap,Rf.aomap,Rf.lightmap,Rf.emissivemap,Rf.bumpmap,Rf.normalmap,Rf.displacementmap,Rf.fog,Rf.lights,{emissive:{value:new uh(0)}}]),vertexShader:wf.meshlambert_vert,fragmentShader:wf.meshlambert_frag},phong:{uniforms:k([Rf.common,Rf.specularmap,Rf.envmap,Rf.aomap,Rf.lightmap,Rf.emissivemap,Rf.bumpmap,Rf.normalmap,Rf.displacementmap,Rf.fog,Rf.lights,{emissive:{value:new uh(0)},specular:{value:new uh(1118481)},shininess:{value:30}}]),vertexShader:wf.meshphong_vert,fragmentShader:wf.meshphong_frag},standard:{uniforms:k([Rf.common,Rf.envmap,Rf.aomap,Rf.lightmap,Rf.emissivemap,Rf.bumpmap,Rf.normalmap,Rf.displacementmap,Rf.roughnessmap,Rf.metalnessmap,Rf.fog,Rf.lights,{emissive:{value:new uh(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wf.meshphysical_vert,fragmentShader:wf.meshphysical_frag},toon:{uniforms:k([Rf.common,Rf.aomap,Rf.lightmap,Rf.emissivemap,Rf.bumpmap,Rf.normalmap,Rf.displacementmap,Rf.gradientmap,Rf.fog,Rf.lights,{emissive:{value:new uh(0)}}]),vertexShader:wf.meshtoon_vert,fragmentShader:wf.meshtoon_frag},matcap:{uniforms:k([Rf.common,Rf.bumpmap,Rf.normalmap,Rf.displacementmap,Rf.fog,{matcap:{value:null}}]),vertexShader:wf.meshmatcap_vert,fragmentShader:wf.meshmatcap_frag},points:{uniforms:k([Rf.points,Rf.fog]),vertexShader:wf.points_vert,fragmentShader:wf.points_frag},dashed:{uniforms:k([Rf.common,Rf.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wf.linedashed_vert,fragmentShader:wf.linedashed_frag},depth:{uniforms:k([Rf.common,Rf.displacementmap]),vertexShader:wf.depth_vert,fragmentShader:wf.depth_frag},normal:{uniforms:k([Rf.common,Rf.bumpmap,Rf.normalmap,Rf.displacementmap,{opacity:{value:1}}]),vertexShader:wf.meshnormal_vert,fragmentShader:wf.meshnormal_frag},sprite:{uniforms:k([Rf.sprite,Rf.fog]),vertexShader:wf.sprite_vert,fragmentShader:wf.sprite_frag},background:{uniforms:{uvTransform:{value:new Il},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wf.background_vert,fragmentShader:wf.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Il}},vertexShader:wf.backgroundCube_vert,fragmentShader:wf.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wf.cube_vert,fragmentShader:wf.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wf.equirect_vert,fragmentShader:wf.equirect_frag},distance:{uniforms:k([Rf.common,Rf.displacementmap,{referencePosition:{value:new Rl},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wf.distance_vert,fragmentShader:wf.distance_frag},shadow:{uniforms:k([Rf.lights,Rf.fog,{color:{value:new uh(0)},opacity:{value:1}}]),vertexShader:wf.shadow_vert,fragmentShader:wf.shadow_frag}};Cf.physical={uniforms:k([Cf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Il},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Il},clearcoatNormalScale:{value:new Al(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Il},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Il},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Il},sheen:{value:0},sheenColor:{value:new uh(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Il},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Il},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Il},transmissionSamplerSize:{value:new Al},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Il},attenuationDistance:{value:0},attenuationColor:{value:new uh(0)},specularColor:{value:new uh(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Il},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Il},anisotropyVector:{value:new Al},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Il}}]),vertexShader:wf.meshphysical_vert,fragmentShader:wf.meshphysical_frag};const Pf={r:0,b:0,g:0},If=new Pc,Lf=new yc,Nf=4,Uf=[.125,.215,.35,.446,.526,.582],Df=20,Of=256,Ff=new xp,Bf=new uh;let zf=null,kf=0,Vf=0,Hf=!1;const Gf=new Rl;class Wf{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(t,e=0,n=.1,i=100,r={}){const{size:s=256,position:a=Gf}=r;zf=this._renderer.getRenderTarget(),kf=this._renderer.getActiveCubeFace(),Vf=this._renderer.getActiveMipmapLevel(),Hf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(t,n,i,o,a),e>0&&this._blur(o,0,0,e),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=ae(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=se(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodMeshes.length;t++)this._lodMeshes[t].geometry.dispose()}_cleanup(t){this._renderer.setRenderTarget(zf,kf,Vf),this._renderer.xr.enabled=Hf,t.scissorTest=!1,ne(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===_a||t.mapping===va?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),zf=this._renderer.getRenderTarget(),kf=this._renderer.getActiveCubeFace(),Vf=this._renderer.getActiveMipmapLevel(),Hf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Ra,minFilter:Ra,generateMipmaps:!1,type:Ba,format:ja,colorSpace:nl,depthBuffer:!1},i=ee(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=ee(t,e,n);const{_lodMax:i}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=te(i)),this._blurMaterial=re(i,t,e),this._ggxMaterial=ie(i,t,e)}return i}_compileMaterial(t){const e=new Hh(new Ph,t);this._renderer.compile(e,Ff)}_sceneToCubeUV(t,e,n,i,r){const s=new Jh(90,1,e,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,c=l.autoClear,h=l.toneMapping;l.getClearColor(Bf),l.toneMapping=0,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(i),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new Hh(new Gh,new mh({name:\\\"PMREM.Background\\\",side:1,depthWrite:!1,depthTest:!1})));const u=this._backgroundBox,d=u.material;let p=!1;const f=t.background;f?f.isColor&&(d.color.copy(f),t.background=null,p=!0):(d.color.copy(Bf),p=!0);for(let e=0;6>e;e++){const n=e%3;0===n?(s.up.set(0,a[e],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x+o[e],r.y,r.z)):1===n?(s.up.set(0,0,a[e]),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y+o[e],r.z)):(s.up.set(0,a[e],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y,r.z+o[e]));const c=this._cubeSize;ne(i,n*c,e>2?c:0,c,c),l.setRenderTarget(i),p&&l.render(u,s),l.render(t,s)}l.toneMapping=h,l.autoClear=c,t.background=f}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===_a||t.mapping===va;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=ae()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=se());const r=i?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=r,r.uniforms.envMap.value=t;const a=this._cubeSize;ne(e,0,0,3*a,2*a),n.setRenderTarget(e),n.render(s,Ff)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodMeshes.length;for(let e=1;i>e;e++)this._applyGGXFilter(t,e-1,e);e.autoClear=n}_applyGGXFilter(t,e,n){const i=this._renderer,r=this._pingPongRenderTarget,s=this._ggxMaterial,a=this._lodMeshes[n];a.material=s;const o=s.uniforms,l=n/(this._lodMeshes.length-1),c=e/(this._lodMeshes.length-1),h=Math.sqrt(l*l-c*c)*(0+1.25*l),{_lodMax:u}=this,d=this._sizeLods[n],p=3*d*(n>u-4?n-u+4:0),f=4*(this._cubeSize-d);o.envMap.value=t.texture,o.roughness.value=h,o.mipInt.value=u-e,ne(r,p,f,3*d,2*d),i.setRenderTarget(r),i.render(a,Ff),o.envMap.value=r.texture,o.roughness.value=0,o.mipInt.value=u-n,ne(t,p,f,3*d,2*d),i.setRenderTarget(t),i.render(a,Ff)}_blur(t,e,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,i,\\\"latitudinal\\\",r),this._halfBlur(s,t,n,n,i,\\\"longitudinal\\\",r)}_halfBlur(t,e,n,i,r,o,l){const c=this._renderer,h=this._blurMaterial;\\\"latitudinal\\\"!==o&&\\\"longitudinal\\\"!==o&&a(\\\"blur direction must be either latitudinal or longitudinal!\\\");const u=this._lodMeshes[i];u.material=h;const d=h.uniforms,p=this._sizeLods[n]-1,f=isFinite(r)?Math.PI/(2*p):2*Math.PI/39,m=r/f,g=isFinite(r)?1+Math.floor(3*m):Df;g>Df&&s(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to 20`);const _=[];let v=0;for(let t=0;Df>t;++t){const e=t/m,n=Math.exp(-e*e/2);_.push(n),0===t?v+=n:g>t&&(v+=2*n)}for(let t=0;t<_.length;t++)_[t]=_[t]/v;d.envMap.value=t.texture,d.samples.value=g,d.weights.value=_,d.latitudinal.value=\\\"latitudinal\\\"===o,l&&(d.poleAxis.value=l);const{_lodMax:x}=this;d.dTheta.value=f,d.mipInt.value=x-n;const y=this._sizeLods[i];ne(e,3*y*(i>x-4?i-x+4:0),4*(this._cubeSize-y),3*y,2*y),c.setRenderTarget(e),c.render(u,Ff)}}const Xf={[oa]:\\\"LINEAR_TONE_MAPPING\\\",[la]:\\\"REINHARD_TONE_MAPPING\\\",[ca]:\\\"CINEON_TONE_MAPPING\\\",[ha]:\\\"ACES_FILMIC_TONE_MAPPING\\\",[da]:\\\"AGX_TONE_MAPPING\\\",[pa]:\\\"NEUTRAL_TONE_MAPPING\\\",[ua]:\\\"CUSTOM_TONE_MAPPING\\\"},jf=new Hl,qf=new ad(1,1),Yf=new jl,Kf=new ql,Jf=new tu,Zf=[],$f=[],Qf=new Float32Array(16),tm=new Float32Array(9),em=new Float32Array(4);class nm{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=ze(e.type)}}class im{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=an(e.type)}}class rm{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(t,e[s.id],n)}}}const sm=/(\\\\w+)(\\\\])?(\\\\[|\\\\.)?/g;class am{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;n>i;++i){const n=t.getActiveUniform(e,i);ln(n,t.getUniformLocation(e,n.name),this)}const i=[],r=[];for(const e of this.seq)e.type===t.SAMPLER_2D_SHADOW||e.type===t.SAMPLER_CUBE_SHADOW||e.type===t.SAMPLER_2D_ARRAY_SHADOW?i.push(e):r.push(e);i.length>0&&(this.seq=i.concat(r))}setValue(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,s=e.length;r!==s;++r){const s=e[r],a=n[s.id];!1!==a.needsUpdate&&s.setValue(t,a.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n}}const om=37297;let lm=0;const cm=new Il,hm={[oa]:\\\"Linear\\\",[la]:\\\"Reinhard\\\",[ca]:\\\"Cineon\\\",[ha]:\\\"ACESFilmic\\\",[da]:\\\"AgX\\\",[pa]:\\\"Neutral\\\",[ua]:\\\"Custom\\\"},um=new Rl,dm=/^[ \\\\t]*#include +<([\\\\w\\\\d./]+)>/gm,pm=new Map,fm=/#pragma unroll_loop_start\\\\s+for\\\\s*\\\\(\\\\s*int\\\\s+i\\\\s*=\\\\s*(\\\\d+)\\\\s*;\\\\s*i\\\\s*<\\\\s*(\\\\d+)\\\\s*;\\\\s*i\\\\s*\\\\+\\\\+\\\\s*\\\\)\\\\s*{([\\\\s\\\\S]+?)}\\\\s+#pragma unroll_loop_end/g,mm={[_s]:\\\"SHADOWMAP_TYPE_PCF\\\",[xs]:\\\"SHADOWMAP_TYPE_VSM\\\"},gm={[_a]:\\\"ENVMAP_TYPE_CUBE\\\",[va]:\\\"ENVMAP_TYPE_CUBE\\\",[Ma]:\\\"ENVMAP_TYPE_CUBE_UV\\\"},_m={[va]:\\\"ENVMAP_MODE_REFRACTION\\\"},vm={[ia]:\\\"ENVMAP_BLENDING_MULTIPLY\\\",[ra]:\\\"ENVMAP_BLENDING_MIX\\\",[sa]:\\\"ENVMAP_BLENDING_ADD\\\"};let xm=0;class ym{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(t);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return void 0===n&&(n=new Mm(t),e.set(t,n)),n}}class Mm{constructor(t){this.id=xm++,this.code=t,this.usedTimes=0}}let Sm=0;const Tm=\\\"void main() {\\\\n\\\\tgl_Position = vec4( position, 1.0 );\\\\n}\\\",bm=\\\"uniform sampler2D shadow_pass;\\\\nuniform vec2 resolution;\\\\nuniform float radius;\\\\nvoid main() {\\\\n\\\\tconst float samples = float( VSM_SAMPLES );\\\\n\\\\tfloat mean = 0.0;\\\\n\\\\tfloat squared_mean = 0.0;\\\\n\\\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\\\n\\\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\\\n\\\\tfor ( float i = 0.0; i < samples; i ++ ) {\\\\n\\\\t\\\\tfloat uvOffset = uvStart + i * uvStride;\\\\n\\\\t\\\\t#ifdef HORIZONTAL_PASS\\\\n\\\\t\\\\t\\\\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\\\\n\\\\t\\\\t\\\\tmean += distribution.x;\\\\n\\\\t\\\\t\\\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\\\n\\\\t\\\\t#else\\\\n\\\\t\\\\t\\\\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\\\\n\\\\t\\\\t\\\\tmean += depth;\\\\n\\\\t\\\\t\\\\tsquared_mean += depth * depth;\\\\n\\\\t\\\\t#endif\\\\n\\\\t}\\\\n\\\\tmean = mean / samples;\\\\n\\\\tsquared_mean = squared_mean / samples;\\\\n\\\\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\\\\n\\\\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\\\\n}\\\",Em=[new Rl(1,0,0),new Rl(-1,0,0),new Rl(0,1,0),new Rl(0,-1,0),new Rl(0,0,1),new Rl(0,0,-1)],Am=[new Rl(0,-1,0),new Rl(0,-1,0),new Rl(0,0,1),new Rl(0,0,-1),new Rl(0,-1,0),new Rl(0,-1,0)],wm=new yc,Rm=new Rl,Cm=new Rl,Pm={[Ks]:1,[Zs]:6,[Qs]:7,[$s]:5,[Js]:0,[ea]:2,[na]:4,[ta]:3},Im=\\\"\\\\nvoid main() {\\\\n\\\\n\\\\tgl_Position = vec4( position, 1.0 );\\\\n\\\\n}\\\",Lm=\\\"\\\\nuniform sampler2DArray depthColor;\\\\nuniform float depthWidth;\\\\nuniform float depthHeight;\\\\n\\\\nvoid main() {\\\\n\\\\n\\\\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\\\\n\\\\n\\\\tif ( coord.x >= 1.0 ) {\\\\n\\\\n\\\\t\\\\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\\\\n\\\\n\\\\t} else {\\\\n\\\\n\\\\t\\\\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\\\\n\\\\n\\\\t}\\\\n\\\\n}\\\";class Nm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(null===this.texture){const n=new ld(t.texture);t.depthNear===e.depthNear&&t.depthFar===e.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,n=new Xh({vertexShader:Im,fragmentShader:Lm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Hh(new Id(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Um extends yl{constructor(t,e){function n(t){const e=A.indexOf(t.inputSource);if(-1===e)return;const n=E[e];void 0!==n&&(n.update(t.inputSource,t.frame,p||h),n.dispatchEvent({type:t.type,data:t.inputSource}))}function i(){l.removeEventListener(\\\"select\\\",n),l.removeEventListener(\\\"selectstart\\\",n),l.removeEventListener(\\\"selectend\\\",n),l.removeEventListener(\\\"squeeze\\\",n),l.removeEventListener(\\\"squeezestart\\\",n),l.removeEventListener(\\\"squeezeend\\\",n),l.removeEventListener(\\\"end\\\",i),l.removeEventListener(\\\"inputsourceschange\\\",r);for(let t=0;t<E.length;t++){const e=A[t];null!==e&&(A[t]=null,E[t].disconnect(e))}N=null,U=null,y.reset();for(const t in M)delete M[t];t.setRenderTarget(T),_=null,g=null,m=null,l=null,b=null,B.stop(),o.isPresenting=!1,t.setPixelRatio(R),t.setSize(w.width,w.height,!1),o.dispatchEvent({type:\\\"sessionend\\\"})}function r(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=A.indexOf(n);0>i||(A[i]=null,E[i].disconnect(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let i=A.indexOf(n);if(-1===i){for(let t=0;t<E.length;t++){if(t>=A.length){A.push(n),i=t;break}if(null===A[t]){A[t]=n,i=t;break}}if(-1===i)break}const r=E[i];r&&r.connect(n)}}function a(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}super();const o=this;let l=null,c=1,h=null,u=\\\"local-floor\\\",d=1,p=null,f=null,m=null,g=null,_=null,v=null;const x=\\\"undefined\\\"!=typeof XRWebGLBinding,y=new Nm,M={},S=e.getContextAttributes();let T=null,b=null;const E=[],A=[],w=new Al;let R=null;const C=new Jh;C.viewport=new Gl;const P=new Jh;P.viewport=new Gl;const I=[C,P],L=new Ap;let N=null,U=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=E[t];return void 0===e&&(e=new ru,E[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=E[t];return void 0===e&&(e=new ru,E[t]=e),e.getGripSpace()},this.getHand=function(t){let e=E[t];return void 0===e&&(e=new ru,E[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){c=t,!0===o.isPresenting&&s(\\\"WebXRManager: Cannot change framebuffer scale while presenting.\\\")},this.setReferenceSpaceType=function(t){u=t,!0===o.isPresenting&&s(\\\"WebXRManager: Cannot change reference space type while presenting.\\\")},this.getReferenceSpace=function(){return p||h},this.setReferenceSpace=function(t){p=t},this.getBaseLayer=function(){return null!==g?g:_},this.getBinding=function(){return null===m&&x&&(m=new XRWebGLBinding(l,e)),m},this.getFrame=function(){return v},this.getSession=function(){return l},this.setSession=async function(s){if(l=s,null!==l){if(T=t.getRenderTarget(),l.addEventListener(\\\"select\\\",n),l.addEventListener(\\\"selectstart\\\",n),l.addEventListener(\\\"selectend\\\",n),l.addEventListener(\\\"squeeze\\\",n),l.addEventListener(\\\"squeezestart\\\",n),l.addEventListener(\\\"squeezeend\\\",n),l.addEventListener(\\\"end\\\",i),l.addEventListener(\\\"inputsourceschange\\\",r),!0!==S.xrCompatible&&await e.makeXRCompatible(),R=t.getPixelRatio(),t.getSize(w),x&&\\\"createProjectionLayer\\\"in XRWebGLBinding.prototype){let n=null,i=null,r=null;S.depth&&(r=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=S.stencil?Ya:qa,i=S.stencil?Va:Oa);const s={colorFormat:e.RGBA8,depthFormat:r,scaleFactor:c};m=this.getBinding(),g=m.createProjectionLayer(s),l.updateRenderState({layers:[g]}),t.setPixelRatio(1),t.setSize(g.textureWidth,g.textureHeight,!1),b=new Xl(g.textureWidth,g.textureHeight,{format:ja,type:Ia,depthTexture:new ad(g.textureWidth,g.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:!1===g.ignoreDepthValues,resolveStencilBuffer:!1===g.ignoreDepthValues})}else{const n={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:c};_=new XRWebGLLayer(l,e,n),l.updateRenderState({baseLayer:_}),t.setPixelRatio(1),t.setSize(_.framebufferWidth,_.framebufferHeight,!1),b=new Xl(_.framebufferWidth,_.framebufferHeight,{format:ja,type:Ia,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:!1===_.ignoreDepthValues,resolveStencilBuffer:!1===_.ignoreDepthValues})}b.isXRRenderTarget=!0,this.setFoveation(d),p=null,h=await l.requestReferenceSpace(u),B.setContext(l),B.start(),o.isPresenting=!0,o.dispatchEvent({type:\\\"sessionstart\\\"})}},this.getEnvironmentBlendMode=function(){if(null!==l)return l.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};const D=new Rl,O=new Rl;this.updateCamera=function(t){if(null===l)return;let e=t.near,n=t.far;null!==y.texture&&(y.depthNear>0&&(e=y.depthNear),y.depthFar>0&&(n=y.depthFar)),L.near=P.near=C.near=e,L.far=P.far=C.far=n,N===L.near&&U===L.far||(l.updateRenderState({depthNear:L.near,depthFar:L.far}),N=L.near,U=L.far),L.layers.mask=6|t.layers.mask,C.layers.mask=3&L.layers.mask,P.layers.mask=5&L.layers.mask;const i=t.parent,r=L.cameras;a(L,i);for(let t=0;t<r.length;t++)a(r[t],i);2===r.length?function(t,e,n){D.setFromMatrixPosition(e.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);const i=D.distanceTo(O),r=e.projectionMatrix.elements,s=n.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(s[8]+1)/s[0],d=a*h,p=a*u,f=i/(-h+u),m=f*-h;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=a+f,n=o+f,r=d-m,s=p+(i-m),h=l*o/n*e,u=c*o/n*e;t.projectionMatrix.makePerspective(r,s,h,u,e,n),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(L,C,P):L.projectionMatrix.copy(C.projectionMatrix),function(t,e,n){null===n?t.matrix.copy(e.matrixWorld):(t.matrix.copy(n.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*bl*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,L,i)},this.getCamera=function(){return L},this.getFoveation=function(){if(null!==g||null!==_)return d},this.setFoveation=function(t){d=t,null!==g&&(g.fixedFoveation=t),null!==_&&void 0!==_.fixedFoveation&&(_.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==y.texture},this.getDepthSensingMesh=function(){return y.getMesh(L)},this.getCameraTexture=function(t){return M[t]};let F=null;const B=new jt;B.setAnimationLoop(function(e,n){if(f=n.getViewerPose(p||h),v=n,null!==f){const e=f.views;null!==_&&(t.setRenderTargetFramebuffer(b,_.framebuffer),t.setRenderTarget(b));let n=!1;e.length!==L.cameras.length&&(L.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let s=null;if(null!==_)s=_.getViewport(r);else{const e=m.getViewSubImage(g,r);s=e.viewport,0===i&&(t.setRenderTargetTextures(b,e.colorTexture,e.depthStencilTexture),t.setRenderTarget(b))}let a=I[i];void 0===a&&(a=new Jh,a.layers.enable(i),a.viewport=new Gl,I[i]=a),a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(r.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(s.x,s.y,s.width,s.height),0===i&&(L.matrix.copy(a.matrix),L.matrix.decompose(L.position,L.quaternion,L.scale)),!0===n&&L.cameras.push(a)}const i=l.enabledFeatures;if(i&&i.includes(\\\"depth-sensing\\\")&&\\\"gpu-optimized\\\"==l.depthUsage&&x){m=o.getBinding();const t=m.getDepthInformation(e[0]);t&&t.isValid&&t.texture&&y.init(t,l.renderState)}if(i&&i.includes(\\\"camera-access\\\")&&x){t.state.unbindTexture(),m=o.getBinding();for(let t=0;t<e.length;t++){const n=e[t].camera;if(n){let t=M[n];t||(t=new ld,M[n]=t);const e=m.getCameraImage(n);t.sourceTexture=e}}}}for(let t=0;t<E.length;t++){const e=A[t],i=E[t];null!==e&&void 0!==i&&i.update(e,n,p||h)}F&&F(e,n),n.detectedPlanes&&o.dispatchEvent({type:\\\"planesdetected\\\",data:n}),v=null}),this.setAnimationLoop=function(t){F=t},this.dispose=function(){}}}const Dm=new Pc,Om=new yc,Fm=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Bm=null;class zm{constructor(t={}){function e(){return null===$?lt:1}function n(t,e){return E.getContext(t,e)}function c(){Mt=new ce(te),Mt.init(),Ht=new Yn(te,Mt),St=new Zt(te,Mt,t,Ht),Tt=new jn(te,Mt),St.reversedDepthBuffer&&D&&Tt.buffers.depth.setReversed(!0),bt=new de(te),Et=new Un,At=new qn(te,Mt,Tt,Et,St,Ht,bt),wt=new Qt(Y),Rt=new le(Y),Ct=new qt(te),Gt=new Kt(te,Ct),Pt=new he(te,Ct,bt,Gt),It=new fe(te,Pt,Ct,bt),zt=new pe(te,St,At),Ot=new $t(Et),Lt=new Nn(Y,wt,Rt,Mt,St,Gt,Ot),Nt=new Kn(Y,Et),Ut=new Bn,Dt=new Wn(Mt),Bt=new Yt(Y,wt,Rt,Tt,It,F,I),Ft=new Xn(Y,It,St),Wt=new Jn(te,bt,St,Tt),kt=new Jt(te,Mt,bt),Vt=new ue(te,Mt,bt),bt.programs=Lt.programs,Y.capabilities=St,Y.extensions=Mt,Y.properties=Et,Y.renderLists=Ut,Y.shadowMap=Ft,Y.state=Tt,Y.info=bt}function h(t){t.preventDefault(),r(\\\"WebGLRenderer: Context Lost.\\\"),K=!0}function u(){r(\\\"WebGLRenderer: Context Restored.\\\"),K=!1;const t=bt.autoReset,e=Ft.enabled,n=Ft.autoUpdate,i=Ft.needsUpdate,s=Ft.type;c(),bt.autoReset=t,Ft.enabled=e,Ft.autoUpdate=n,Ft.needsUpdate=i,Ft.type=s}function d(t){a(\\\"WebGLRenderer: A WebGL context could not be created. Reason: \\\",t.statusMessage)}function p(t){const e=t.target;e.removeEventListener(\\\"dispose\\\",p),function(t){(function(t){const e=Et.get(t).programs;void 0!==e&&(e.forEach(function(t){Lt.releaseProgram(t)}),t.isShaderMaterial&&Lt.releaseShaderCache(t))})(t),Et.remove(t)}(e)}function f(t,e,n){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,S(t,e,n),t.side=0,t.needsUpdate=!0,S(t,e,n),t.side=2):S(t,e,n)}function m(){ie.stop()}function g(){ie.start()}function _(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)W.pushLight(t),t.castShadow&&W.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||ft.intersectsSprite(t)){i&&xt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(_t);const e=It.update(t),r=t.material;r.visible&&G.push(t,e,r,n,xt.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||ft.intersectsObject(t))){const e=It.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),xt.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),xt.copy(e.boundingSphere.center)),xt.applyMatrix4(t.matrixWorld).applyMatrix4(_t)),Array.isArray(r)){const i=e.groups;for(let s=0,a=i.length;a>s;s++){const a=i[s],o=r[a.materialIndex];o&&o.visible&&G.push(t,e,o,n,xt.z,a)}}else r.visible&&G.push(t,e,r,n,xt.z,null)}const r=t.children;for(let t=0,s=r.length;s>t;t++)_(r[t],e,n,i)}function v(t,e,n,i){const{opaque:r,transmissive:s,transparent:a}=t;W.setupLightsView(n),!0===mt&&Ot.setGlobalState(Y.clippingPlanes,n),i&&Tt.viewport(et.copy(i)),r.length>0&&y(r,e,n),s.length>0&&y(s,e,n),a.length>0&&y(a,e,n),Tt.buffers.depth.setTest(!0),Tt.buffers.depth.setMask(!0),Tt.buffers.color.setMask(!0),Tt.setPolygonOffset(!1)}function x(t,e,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;if(void 0===W.state.transmissionRenderTarget[i.id]){const t=Mt.has(\\\"EXT_color_buffer_half_float\\\")||Mt.has(\\\"EXT_color_buffer_float\\\");W.state.transmissionRenderTarget[i.id]=new Xl(1,1,{generateMipmaps:!0,type:t?Ba:Ia,minFilter:Pa,samples:St.samples,stencilBuffer:R,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dl.workingColorSpace})}const r=W.state.transmissionRenderTarget[i.id],s=i.viewport||et;r.setSize(s.z*Y.transmissionResolutionScale,s.w*Y.transmissionResolutionScale);const a=Y.getRenderTarget(),o=Y.getActiveCubeFace(),l=Y.getActiveMipmapLevel();Y.setRenderTarget(r),Y.getClearColor(rt),st=Y.getClearAlpha(),1>st&&Y.setClearColor(16777215,.5),Y.clear(),Xt&&Bt.render(n);const c=Y.toneMapping;Y.toneMapping=0;const h=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),W.setupLightsView(i),!0===mt&&Ot.setGlobalState(Y.clippingPlanes,i),y(t,n,i),At.updateMultisampleRenderTarget(r),At.updateRenderTargetMipmap(r),!1===Mt.has(\\\"WEBGL_multisampled_render_to_texture\\\")){let t=!1;for(let r=0,s=e.length;s>r;r++){const s=e[r],{object:a,geometry:o,material:l,group:c}=s;if(2===l.side&&a.layers.test(i.layers)){const e=l.side;l.side=1,l.needsUpdate=!0,M(a,n,i,o,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(At.updateMultisampleRenderTarget(r),At.updateRenderTargetMipmap(r))}Y.setRenderTarget(a,o,l),Y.setClearColor(rt,st),void 0!==h&&(i.viewport=h),Y.toneMapping=c}function y(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;s>r;r++){const s=t[r],{object:a,geometry:o,group:l}=s;let c=s.material;!0===c.allowOverride&&null!==i&&(c=i),a.layers.test(n.layers)&&M(a,e,n,o,c,l)}}function M(t,e,n,i,r,s){t.onBeforeRender(Y,e,n,i,r,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(Y,e,n,i,t,s),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,Y.renderBufferDirect(n,e,i,r,t,s),r.side=0,r.needsUpdate=!0,Y.renderBufferDirect(n,e,i,r,t,s),r.side=2):Y.renderBufferDirect(n,e,i,r,t,s),t.onAfterRender(Y,e,n,i,r,s)}function S(t,e,n){!0!==e.isScene&&(e=yt);const i=Et.get(t),r=W.state.lights,s=W.state.shadowsArray,a=r.state.version,o=Lt.getParameters(t,r.state,s,e,n),l=Lt.getProgramCacheKey(o);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?Rt:wt).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener(\\\"dispose\\\",p),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===a)return b(t,o),h}else o.uniforms=Lt.getUniforms(t),t.onBeforeCompile(o,Y),h=Lt.acquireProgram(o,l),c.set(l,h),i.uniforms=o.uniforms;const u=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=Ot.uniform),b(t,o),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=a,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotLightMatrix.value=r.state.spotLightMatrix,u.spotLightMap.value=r.state.spotLightMap,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function T(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=am.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function b(t,e){const n=Et.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}const{canvas:E=i(),context:A=null,depth:w=!0,stencil:R=!1,alpha:C=!1,antialias:P=!1,premultipliedAlpha:I=!0,preserveDrawingBuffer:L=!1,powerPreference:N=\\\"default\\\",failIfMajorPerformanceCaveat:U=!1,reversedDepthBuffer:D=!1,outputBufferType:O=Ia}=t;let F;if(this.isWebGLRenderer=!0,null!==A){if(\\\"undefined\\\"!=typeof WebGLRenderingContext&&A instanceof WebGLRenderingContext)throw new Error(\\\"THREE.WebGLRenderer: WebGL 1 is not supported since r163.\\\");F=A.getContextAttributes().alpha}else F=C;const B=O,z=new Set([Qa,$a,Ja]),k=new Set([Ia,Oa,Ua,Va,za,ka]),V=new Uint32Array(4),H=new Int32Array(4);let G=null,W=null;const X=[],j=[];let q=null;this.domElement=E,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const Y=this;let K=!1;this._outputColorSpace=el;let J=0,Z=0,$=null,Q=-1,tt=null;const et=new Gl,nt=new Gl;let it=null;const rt=new uh(0);let st=0,at=E.width,ot=E.height,lt=1,ct=null,ht=null;const ut=new Gl(0,0,at,ot),dt=new Gl(0,0,at,ot);let pt=!1;const ft=new ku;let mt=!1,gt=!1;const _t=new yc,vt=new Rl,xt=new Gl,yt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Mt,St,Tt,bt,Et,At,wt,Rt,Ct,Pt,It,Lt,Nt,Ut,Dt,Ot,Ft,Bt,zt,kt,Vt,Ht,Gt,Wt,Xt=!1,te=A;try{const t={alpha:!0,depth:w,stencil:R,antialias:P,premultipliedAlpha:I,preserveDrawingBuffer:L,powerPreference:N,failIfMajorPerformanceCaveat:U};if(\\\"setAttribute\\\"in E&&E.setAttribute(\\\"data-engine\\\",`three.js r${ps}`),E.addEventListener(\\\"webglcontextlost\\\",h,!1),E.addEventListener(\\\"webglcontextrestored\\\",u,!1),E.addEventListener(\\\"webglcontextcreationerror\\\",d,!1),null===te){const e=\\\"webgl2\\\";if(te=n(e,t),null===te)throw n(e)?new Error(\\\"Error creating WebGL context with your selected attributes.\\\"):new Error(\\\"Error creating WebGL context.\\\")}}catch(t){throw a(\\\"WebGLRenderer: \\\"+t.message),t}c(),B!==Ia&&(q=new me(B,E.width,E.height,w,R));const ee=new Um(Y,te);this.xr=ee,this.getContext=function(){return te},this.getContextAttributes=function(){return te.getContextAttributes()},this.forceContextLoss=function(){const t=Mt.get(\\\"WEBGL_lose_context\\\");t&&t.loseContext()},this.forceContextRestore=function(){const t=Mt.get(\\\"WEBGL_lose_context\\\");t&&t.restoreContext()},this.getPixelRatio=function(){return lt},this.setPixelRatio=function(t){void 0!==t&&(lt=t,this.setSize(at,ot,!1))},this.getSize=function(t){return t.set(at,ot)},this.setSize=function(t,e,n=!0){ee.isPresenting?s(\\\"WebGLRenderer: Can't change size while VR device is presenting.\\\"):(at=t,ot=e,E.width=Math.floor(t*lt),E.height=Math.floor(e*lt),!0===n&&(E.style.width=t+\\\"px\\\",E.style.height=e+\\\"px\\\"),null!==q&&q.setSize(E.width,E.height),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(at*lt,ot*lt).floor()},this.setDrawingBufferSize=function(t,e,n){at=t,ot=e,lt=n,E.width=Math.floor(t*n),E.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.setEffects=function(t){if(B!==Ia){if(t)for(let e=0;e<t.length&&!0!==t[e].isOutputPass;e++);q.setEffects(t||[])}},this.getCurrentViewport=function(t){return t.copy(et)},this.getViewport=function(t){return t.copy(ut)},this.setViewport=function(t,e,n,i){t.isVector4?ut.set(t.x,t.y,t.z,t.w):ut.set(t,e,n,i),Tt.viewport(et.copy(ut).multiplyScalar(lt).round())},this.getScissor=function(t){return t.copy(dt)},this.setScissor=function(t,e,n,i){t.isVector4?dt.set(t.x,t.y,t.z,t.w):dt.set(t,e,n,i),Tt.scissor(nt.copy(dt).multiplyScalar(lt).round())},this.getScissorTest=function(){return pt},this.setScissorTest=function(t){Tt.setScissorTest(pt=t)},this.setOpaqueSort=function(t){ct=t},this.setTransparentSort=function(t){ht=t},this.getClearColor=function(t){return t.copy(Bt.getClearColor())},this.setClearColor=function(){Bt.setClearColor(...arguments)},this.getClearAlpha=function(){return Bt.getClearAlpha()},this.setClearAlpha=function(){Bt.setClearAlpha(...arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;if(t){let t=!1;if(null!==$){const e=$.texture.format;t=z.has(e)}if(t){const t=$.texture.type,e=k.has(t),n=Bt.getClearColor(),i=Bt.getClearAlpha(),r=n.r,s=n.g,a=n.b;e?(V[0]=r,V[1]=s,V[2]=a,V[3]=i,te.clearBufferuiv(te.COLOR,0,V)):(H[0]=r,H[1]=s,H[2]=a,H[3]=i,te.clearBufferiv(te.COLOR,0,H))}else i|=te.COLOR_BUFFER_BIT}e&&(i|=te.DEPTH_BUFFER_BIT),n&&(i|=te.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),te.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){E.removeEventListener(\\\"webglcontextlost\\\",h,!1),E.removeEventListener(\\\"webglcontextrestored\\\",u,!1),E.removeEventListener(\\\"webglcontextcreationerror\\\",d,!1),Bt.dispose(),Ut.dispose(),Dt.dispose(),Et.dispose(),wt.dispose(),Rt.dispose(),It.dispose(),Gt.dispose(),Wt.dispose(),Lt.dispose(),ee.dispose(),ee.removeEventListener(\\\"sessionstart\\\",m),ee.removeEventListener(\\\"sessionend\\\",g),ie.stop()},this.renderBufferDirect=function(t,n,i,r,s,a){null===n&&(n=yt);const l=s.isMesh&&0>s.matrixWorld.determinant(),c=function(t,e,n,i,r){!0!==e.isScene&&(e=yt),At.resetTextureUnits();const s=e.fog,a=i.isMeshStandardMaterial?e.environment:null,o=null===$?Y.outputColorSpace:!0===$.isXRRenderTarget?$.texture.colorSpace:nl,l=(i.isMeshStandardMaterial?Rt:wt).get(i.envMap||a),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=0;i.toneMapped&&(null!==$&&!0!==$.isXRRenderTarget||(f=Y.toneMapping));const m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==m?m.length:0,_=Et.get(i),v=W.state.lights;if(!0===mt&&(!0===gt||t!==tt)){const e=t===tt&&i.id===Q;Ot.setState(i,t,e)}let x=!1;i.version===_.__version?_.needsLights&&_.lightsStateVersion!==v.state.version||_.outputColorSpace!==o||r.isBatchedMesh&&!1===_.batching?x=!0:r.isBatchedMesh||!0!==_.batching?r.isBatchedMesh&&!0===_.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===_.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===_.instancing?x=!0:r.isInstancedMesh||!0!==_.instancing?r.isSkinnedMesh&&!1===_.skinning?x=!0:r.isSkinnedMesh||!0!==_.skinning?r.isInstancedMesh&&!0===_.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===_.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===_.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===_.instancingMorph&&null!==r.morphTexture||_.envMap!==l||!0===i.fog&&_.fog!==s?x=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===Ot.numPlanes&&_.numIntersection===Ot.numIntersection?(_.vertexAlphas!==c||_.vertexTangents!==h||_.morphTargets!==u||_.morphNormals!==d||_.morphColors!==p||_.toneMapping!==f||_.morphTargetsCount!==g)&&(x=!0):x=!0:x=!0:x=!0:x=!0:(x=!0,_.__version=i.version);let y=_.currentProgram;!0===x&&(y=S(i,e,r));let M=!1,b=!1,E=!1;const A=y.getUniforms(),w=_.uniforms;if(Tt.useProgram(y.program)&&(M=!0,b=!0,E=!0),i.id!==Q&&(Q=i.id,b=!0),M||tt!==t){Tt.buffers.depth.getReversed()&&!0!==t.reversedDepth&&(t._reversedDepth=!0,t.updateProjectionMatrix()),A.setValue(te,\\\"projectionMatrix\\\",t.projectionMatrix),A.setValue(te,\\\"viewMatrix\\\",t.matrixWorldInverse);const e=A.map.cameraPosition;void 0!==e&&e.setValue(te,vt.setFromMatrixPosition(t.matrixWorld)),St.logarithmicDepthBuffer&&A.setValue(te,\\\"logDepthBufFC\\\",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&A.setValue(te,\\\"isOrthographic\\\",!0===t.isOrthographicCamera),tt!==t&&(tt=t,b=!0,E=!0)}if(_.needsLights&&(v.state.directionalShadowMap.length>0&&A.setValue(te,\\\"directionalShadowMap\\\",v.state.directionalShadowMap,At),v.state.spotShadowMap.length>0&&A.setValue(te,\\\"spotShadowMap\\\",v.state.spotShadowMap,At),v.state.pointShadowMap.length>0&&A.setValue(te,\\\"pointShadowMap\\\",v.state.pointShadowMap,At)),r.isSkinnedMesh){A.setOptional(te,r,\\\"bindMatrix\\\"),A.setOptional(te,r,\\\"bindMatrixInverse\\\");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),A.setValue(te,\\\"boneTexture\\\",t.boneTexture,At))}r.isBatchedMesh&&(A.setOptional(te,r,\\\"batchingTexture\\\"),A.setValue(te,\\\"batchingTexture\\\",r._matricesTexture,At),A.setOptional(te,r,\\\"batchingIdTexture\\\"),A.setValue(te,\\\"batchingIdTexture\\\",r._indirectTexture,At),A.setOptional(te,r,\\\"batchingColorTexture\\\"),null!==r._colorsTexture&&A.setValue(te,\\\"batchingColorTexture\\\",r._colorsTexture,At));const R=n.morphAttributes;var C,P;if(void 0===R.position&&void 0===R.normal&&void 0===R.color||zt.update(r,n,y),(b||_.receiveShadow!==r.receiveShadow)&&(_.receiveShadow=r.receiveShadow,A.setValue(te,\\\"receiveShadow\\\",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(w.envMap.value=l,w.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(w.envMapIntensity.value=e.environmentIntensity),void 0!==w.dfgLUT&&(w.dfgLUT.value=Zn()),b&&(A.setValue(te,\\\"toneMappingExposure\\\",Y.toneMappingExposure),_.needsLights&&(P=E,(C=w).ambientLightColor.needsUpdate=P,C.lightProbe.needsUpdate=P,C.directionalLights.needsUpdate=P,C.directionalLightShadows.needsUpdate=P,C.pointLights.needsUpdate=P,C.pointLightShadows.needsUpdate=P,C.spotLights.needsUpdate=P,C.spotLightShadows.needsUpdate=P,C.rectAreaLights.needsUpdate=P,C.hemisphereLights.needsUpdate=P),s&&!0===i.fog&&Nt.refreshFogUniforms(w,s),Nt.refreshMaterialUniforms(w,i,lt,ot,W.state.transmissionRenderTarget[t.id]),am.upload(te,T(_),w,At)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(am.upload(te,T(_),w,At),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&A.setValue(te,\\\"center\\\",r.center),A.setValue(te,\\\"modelViewMatrix\\\",r.modelViewMatrix),A.setValue(te,\\\"normalMatrix\\\",r.normalMatrix),A.setValue(te,\\\"modelMatrix\\\",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;n>e;e++){const n=t[e];Wt.update(n,y),Wt.bind(n,y)}}return y}(t,n,i,r,s);Tt.setMaterial(r,l);let h=i.index,u=1;if(!0===r.wireframe){if(h=Pt.getWireframeAttribute(i),void 0===h)return;u=2}const d=i.drawRange,p=i.attributes.position;let f=d.start*u,m=(d.start+d.count)*u;null!==a&&(f=Math.max(f,a.start*u),m=Math.min(m,(a.start+a.count)*u)),null!==h?(f=Math.max(f,0),m=Math.min(m,h.count)):null!=p&&(f=Math.max(f,0),m=Math.min(m,p.count));const g=m-f;if(0>g||g===1/0)return;let _;Gt.setup(s,r,c,i,h);let v=kt;if(null!==h&&(_=Ct.get(h),v=Vt,v.setIndex(_)),s.isMesh)!0===r.wireframe?(Tt.setLineWidth(r.wireframeLinewidth*e()),v.setMode(te.LINES)):v.setMode(te.TRIANGLES);else if(s.isLine){let t=r.linewidth;void 0===t&&(t=1),Tt.setLineWidth(t*e()),s.isLineSegments?v.setMode(te.LINES):s.isLineLoop?v.setMode(te.LINE_LOOP):v.setMode(te.LINE_STRIP)}else s.isPoints?v.setMode(te.POINTS):s.isSprite&&v.setMode(te.TRIANGLES);if(s.isBatchedMesh)if(null!==s._multiDrawInstances)o(\\\"WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.\\\"),v.renderMultiDrawInstances(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount,s._multiDrawInstances);else if(Mt.get(\\\"WEBGL_multi_draw\\\"))v.renderMultiDraw(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount);else{const t=s._multiDrawStarts,e=s._multiDrawCounts,n=s._multiDrawCount,i=h?Ct.get(h).bytesPerElement:1,a=Et.get(r).currentProgram.getUniforms();for(let r=0;n>r;r++)a.setValue(te,\\\"_gl_DrawID\\\",r),v.render(t[r]/i,e[r])}else if(s.isInstancedMesh)v.renderInstances(f,g,s.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);v.renderInstances(f,g,e)}else v.render(f,g)},this.compile=function(t,e,n=null){null===n&&(n=t),W=Dt.get(n),W.init(e),j.push(W),n.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(W.pushLight(t),t.castShadow&&W.pushShadow(t))}),t!==n&&t.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(W.pushLight(t),t.castShadow&&W.pushShadow(t))}),W.setupLights();const i=new Set;return t.traverse(function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const s=e[r];f(s,n,t),i.add(s)}else f(e,n,t),i.add(e)}),W=j.pop(),i},this.compileAsync=function(t,e,n=null){const i=this.compile(t,e,n);return new Promise(e=>{function n(){i.forEach(function(t){Et.get(t).currentProgram.isReady()&&i.delete(t)}),0!==i.size?setTimeout(n,10):e(t)}null!==Mt.get(\\\"KHR_parallel_shader_compile\\\")?n():setTimeout(n,10)})};let ne=null;const ie=new jt;ie.setAnimationLoop(function(t){ne&&ne(t)}),\\\"undefined\\\"!=typeof self&&ie.setContext(self),this.setAnimationLoop=function(t){ne=t,ee.setAnimationLoop(t),null===t?ie.stop():ie.start()},ee.addEventListener(\\\"sessionstart\\\",m),ee.addEventListener(\\\"sessionend\\\",g),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void a(\\\"WebGLRenderer.render: camera is not an instance of THREE.Camera.\\\");if(!0===K)return;const n=!0===ee.enabled&&!0===ee.isPresenting,i=null!==q&&(null===$||n)&&q.begin(Y,$);if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0!==ee.enabled||!0!==ee.isPresenting||null!==q&&!1!==q.isCompositing()||(!0===ee.cameraAutoUpdate&&ee.updateCamera(e),e=ee.getCamera()),!0===t.isScene&&t.onBeforeRender(Y,t,e,$),W=Dt.get(t,j.length),W.init(e),j.push(W),_t.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),ft.setFromProjectionMatrix(_t,_l,e.reversedDepth),gt=this.localClippingEnabled,mt=Ot.init(this.clippingPlanes,gt),G=Ut.get(t,X.length),G.init(),X.push(G),!0===ee.enabled&&!0===ee.isPresenting){const t=Y.xr.getDepthSensingMesh();null!==t&&_(t,e,-1/0,Y.sortObjects)}_(t,e,0,Y.sortObjects),G.finish(),!0===Y.sortObjects&&G.sort(ct,ht),Xt=!1===ee.enabled||!1===ee.isPresenting||!1===ee.hasDepthSensing(),Xt&&Bt.addToRenderList(G,t),this.info.render.frame++,!0===mt&&Ot.beginShadows();const r=W.state.shadowsArray;if(Ft.render(r,t,e),!0===mt&&Ot.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1===(i&&q.hasRenderPass())){const n=G.opaque,i=G.transmissive;if(W.setupLights(),e.isArrayCamera){const r=e.cameras;if(i.length>0)for(let e=0,s=r.length;s>e;e++)x(n,i,t,r[e]);Xt&&Bt.render(t);for(let e=0,n=r.length;n>e;e++){const n=r[e];v(G,t,n,n.viewport)}}else i.length>0&&x(n,i,t,e),Xt&&Bt.render(t),v(G,t,e)}null!==$&&0===Z&&(At.updateMultisampleRenderTarget($),At.updateRenderTargetMipmap($)),i&&q.end(Y),!0===t.isScene&&t.onAfterRender(Y,t,e),Gt.resetDefaultState(),Q=-1,tt=null,j.pop(),j.length>0?(W=j[j.length-1],!0===mt&&Ot.setGlobalState(Y.clippingPlanes,W.state.camera)):W=null,X.pop(),G=X.length>0?X[X.length-1]:null},this.getActiveCubeFace=function(){return J},this.getActiveMipmapLevel=function(){return Z},this.getRenderTarget=function(){return $},this.setRenderTargetTextures=function(t,e,n){const i=Et.get(t);i.__autoAllocateDepthBuffer=!1===t.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),Et.get(t.texture).__webglTexture=e,Et.get(t.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(t,e){const n=Et.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e};const re=te.createFramebuffer();this.setRenderTarget=function(t,e=0,n=0){$=t,J=e,Z=n;let i=null,r=!1,s=!1;if(t){const a=Et.get(t);if(void 0!==a.__useDefaultFramebuffer)return Tt.bindFramebuffer(te.FRAMEBUFFER,a.__webglFramebuffer),et.copy(t.viewport),nt.copy(t.scissor),it=t.scissorTest,Tt.viewport(et),Tt.scissor(nt),Tt.setScissorTest(it),void(Q=-1);if(void 0===a.__webglFramebuffer)At.setupRenderTarget(t);else if(a.__hasExternalTextures)At.rebindTextures(t,Et.get(t.texture).__webglTexture,Et.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(a.__boundDepthTexture!==e){if(null!==e&&Et.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error(\\\"WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.\\\");At.setupDepthRenderbuffer(t)}}const o=t.texture;(o.isData3DTexture||o.isDataArrayTexture||o.isCompressedArrayTexture)&&(s=!0);const l=Et.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=Array.isArray(l[e])?l[e][n]:l[e],r=!0):i=t.samples>0&&!1===At.useMultisampledRTT(t)?Et.get(t).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,et.copy(t.viewport),nt.copy(t.scissor),it=t.scissorTest}else et.copy(ut).multiplyScalar(lt).floor(),nt.copy(dt).multiplyScalar(lt).floor(),it=pt;if(0!==n&&(i=re),Tt.bindFramebuffer(te.FRAMEBUFFER,i)&&Tt.drawBuffers(t,i),Tt.viewport(et),Tt.scissor(nt),Tt.setScissorTest(it),r){const i=Et.get(t.texture);te.framebufferTexture2D(te.FRAMEBUFFER,te.COLOR_ATTACHMENT0,te.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(s){const i=e;for(let e=0;e<t.textures.length;e++){const r=Et.get(t.textures[e]);te.framebufferTextureLayer(te.FRAMEBUFFER,te.COLOR_ATTACHMENT0+e,r.__webglTexture,n,i)}}else if(null!==t&&0!==n){const e=Et.get(t.texture);te.framebufferTexture2D(te.FRAMEBUFFER,te.COLOR_ATTACHMENT0,te.TEXTURE_2D,e.__webglTexture,n)}Q=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,o,l=0){if(!t||!t.isWebGLRenderTarget)return void a(\\\"WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.\\\");let c=Et.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(c=c[o]),c){Tt.bindFramebuffer(te.FRAMEBUFFER,c);try{const o=t.textures[l],c=o.format,h=o.type;if(!St.textureFormatReadable(c))return void a(\\\"WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.\\\");if(!St.textureTypeReadable(h))return void a(\\\"WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.\\\");0>e||e>t.width-i||0>n||n>t.height-r||(t.textures.length>1&&te.readBuffer(te.COLOR_ATTACHMENT0+l),te.readPixels(e,n,i,r,Ht.convert(c),Ht.convert(h),s))}finally{const t=null!==$?Et.get($).__webglFramebuffer:null;Tt.bindFramebuffer(te.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,n,i,r,s,a,o=0){if(!t||!t.isWebGLRenderTarget)throw new Error(\\\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.\\\");let c=Et.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(c=c[a]),c){if(0>e||e>t.width-i||0>n||n>t.height-r)throw new Error(\\\"THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.\\\");{Tt.bindFramebuffer(te.FRAMEBUFFER,c);const a=t.textures[o],h=a.format,u=a.type;if(!St.textureFormatReadable(h))throw new Error(\\\"THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.\\\");if(!St.textureTypeReadable(u))throw new Error(\\\"THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.\\\");const d=te.createBuffer();te.bindBuffer(te.PIXEL_PACK_BUFFER,d),te.bufferData(te.PIXEL_PACK_BUFFER,s.byteLength,te.STREAM_READ),t.textures.length>1&&te.readBuffer(te.COLOR_ATTACHMENT0+o),te.readPixels(e,n,i,r,Ht.convert(h),Ht.convert(u),0);const p=null!==$?Et.get($).__webglFramebuffer:null;Tt.bindFramebuffer(te.FRAMEBUFFER,p);const f=te.fenceSync(te.SYNC_GPU_COMMANDS_COMPLETE,0);return te.flush(),await l(te,f,4),te.bindBuffer(te.PIXEL_PACK_BUFFER,d),te.getBufferSubData(te.PIXEL_PACK_BUFFER,0,s),te.deleteBuffer(d),te.deleteSync(f),s}}},this.copyFramebufferToTexture=function(t,e=null,n=0){const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i),a=null!==e?e.x:0,o=null!==e?e.y:0;At.setTexture2D(t,0),te.copyTexSubImage2D(te.TEXTURE_2D,n,0,0,a,o,r,s),Tt.unbindTexture()};const se=te.createFramebuffer(),ae=te.createFramebuffer();this.copyTextureToTexture=function(t,e,n=null,i=null,r=0,s=null){let a,l,c,h,u,d,p,f,m;null===s&&(0!==r?(o(\\\"WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.\\\"),s=r,r=0):s=0);const g=t.isCompressedTexture?t.mipmaps[s]:t.image;if(null!==n)a=n.max.x-n.min.x,l=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,h=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{const e=Math.pow(2,-r);a=Math.floor(g.width*e),l=Math.floor(g.height*e),c=t.isDataArrayTexture?g.depth:t.isData3DTexture?Math.floor(g.depth*e):1,h=0,u=0,d=0}null!==i?(p=i.x,f=i.y,m=i.z):(p=0,f=0,m=0);const _=Ht.convert(e.format),v=Ht.convert(e.type);let x;e.isData3DTexture?(At.setTexture3D(e,0),x=te.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(At.setTexture2DArray(e,0),x=te.TEXTURE_2D_ARRAY):(At.setTexture2D(e,0),x=te.TEXTURE_2D),te.pixelStorei(te.UNPACK_FLIP_Y_WEBGL,e.flipY),te.pixelStorei(te.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),te.pixelStorei(te.UNPACK_ALIGNMENT,e.unpackAlignment);const y=te.getParameter(te.UNPACK_ROW_LENGTH),M=te.getParameter(te.UNPACK_IMAGE_HEIGHT),S=te.getParameter(te.UNPACK_SKIP_PIXELS),T=te.getParameter(te.UNPACK_SKIP_ROWS),b=te.getParameter(te.UNPACK_SKIP_IMAGES);te.pixelStorei(te.UNPACK_ROW_LENGTH,g.width),te.pixelStorei(te.UNPACK_IMAGE_HEIGHT,g.height),te.pixelStorei(te.UNPACK_SKIP_PIXELS,h),te.pixelStorei(te.UNPACK_SKIP_ROWS,u),te.pixelStorei(te.UNPACK_SKIP_IMAGES,d);const E=t.isDataArrayTexture||t.isData3DTexture,A=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const n=Et.get(t),i=Et.get(e),o=Et.get(n.__renderTarget),g=Et.get(i.__renderTarget);Tt.bindFramebuffer(te.READ_FRAMEBUFFER,o.__webglFramebuffer),Tt.bindFramebuffer(te.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;c>n;n++)E&&(te.framebufferTextureLayer(te.READ_FRAMEBUFFER,te.COLOR_ATTACHMENT0,Et.get(t).__webglTexture,r,d+n),te.framebufferTextureLayer(te.DRAW_FRAMEBUFFER,te.COLOR_ATTACHMENT0,Et.get(e).__webglTexture,s,m+n)),te.blitFramebuffer(h,u,a,l,p,f,a,l,te.DEPTH_BUFFER_BIT,te.NEAREST);Tt.bindFramebuffer(te.READ_FRAMEBUFFER,null),Tt.bindFramebuffer(te.DRAW_FRAMEBUFFER,null)}else if(0!==r||t.isRenderTargetTexture||Et.has(t)){const n=Et.get(t),i=Et.get(e);Tt.bindFramebuffer(te.READ_FRAMEBUFFER,se),Tt.bindFramebuffer(te.DRAW_FRAMEBUFFER,ae);for(let t=0;c>t;t++)E?te.framebufferTextureLayer(te.READ_FRAMEBUFFER,te.COLOR_ATTACHMENT0,n.__webglTexture,r,d+t):te.framebufferTexture2D(te.READ_FRAMEBUFFER,te.COLOR_ATTACHMENT0,te.TEXTURE_2D,n.__webglTexture,r),A?te.framebufferTextureLayer(te.DRAW_FRAMEBUFFER,te.COLOR_ATTACHMENT0,i.__webglTexture,s,m+t):te.framebufferTexture2D(te.DRAW_FRAMEBUFFER,te.COLOR_ATTACHMENT0,te.TEXTURE_2D,i.__webglTexture,s),0!==r?te.blitFramebuffer(h,u,a,l,p,f,a,l,te.COLOR_BUFFER_BIT,te.NEAREST):A?te.copyTexSubImage3D(x,s,p,f,m+t,h,u,a,l):te.copyTexSubImage2D(x,s,p,f,h,u,a,l);Tt.bindFramebuffer(te.READ_FRAMEBUFFER,null),Tt.bindFramebuffer(te.DRAW_FRAMEBUFFER,null)}else A?t.isDataTexture||t.isData3DTexture?te.texSubImage3D(x,s,p,f,m,a,l,c,_,v,g.data):e.isCompressedArrayTexture?te.compressedTexSubImage3D(x,s,p,f,m,a,l,c,_,g.data):te.texSubImage3D(x,s,p,f,m,a,l,c,_,v,g):t.isDataTexture?te.texSubImage2D(te.TEXTURE_2D,s,p,f,a,l,_,v,g.data):t.isCompressedTexture?te.compressedTexSubImage2D(te.TEXTURE_2D,s,p,f,g.width,g.height,_,g.data):te.texSubImage2D(te.TEXTURE_2D,s,p,f,a,l,_,v,g);te.pixelStorei(te.UNPACK_ROW_LENGTH,y),te.pixelStorei(te.UNPACK_IMAGE_HEIGHT,M),te.pixelStorei(te.UNPACK_SKIP_PIXELS,S),te.pixelStorei(te.UNPACK_SKIP_ROWS,T),te.pixelStorei(te.UNPACK_SKIP_IMAGES,b),0===s&&e.generateMipmaps&&te.generateMipmap(x),Tt.unbindTexture()},this.initRenderTarget=function(t){void 0===Et.get(t).__webglFramebuffer&&At.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?At.setTextureCube(t,0):t.isData3DTexture?At.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?At.setTexture2DArray(t,0):At.setTexture2D(t,0),Tt.unbindTexture()},this.resetState=function(){J=0,Z=0,$=null,Tt.reset(),Gt.reset()},\\\"undefined\\\"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\\\"observe\\\",{detail:this}))}get coordinateSystem(){return _l}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Dl._getDrawingBufferColorSpace(t),e.unpackColorSpace=Dl._getUnpackColorSpace()}}class GLTFLoader extends ip{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Wm(t)}),this.register(function(t){return new Xm(t)}),this.register(function(t){return new tg(t)}),this.register(function(t){return new eg(t)}),this.register(function(t){return new ng(t)}),this.register(function(t){return new qm(t)}),this.register(function(t){return new Ym(t)}),this.register(function(t){return new Km(t)}),this.register(function(t){return new Jm(t)}),this.register(function(t){return new Gm(t)}),this.register(function(t){return new Zm(t)}),this.register(function(t){return new jm(t)}),this.register(function(t){return new Qm(t)}),this.register(function(t){return new $m(t)}),this.register(function(t){return new Vm(t)}),this.register(function(t){return new ig(t)}),this.register(function(t){return new rg(t)})}load(t,e,n,i){const r=this;let s;if(\\\"\\\"!==this.resourcePath)s=this.resourcePath;else if(\\\"\\\"!==this.path){const e=Tp.extractUrlBase(t);s=Tp.resolveURL(e,this.path)}else s=Tp.extractUrlBase(t);this.manager.itemStart(t);const a=function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)},o=new ap(this.manager);o.setPath(this.path),o.setResponseType(\\\"arraybuffer\\\"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(n){try{r.parse(n,s,function(n){e(n),r.manager.itemEnd(t)},a)}catch(t){a(t)}},n,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,i){let r;const s={},a={},o=new TextDecoder;if(\\\"string\\\"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===sg){try{s[km.KHR_BINARY_GLTF]=new lg(t)}catch(t){return void(i&&i(t))}r=JSON.parse(s[km.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(t));else r=t;if(void 0===r.asset||2>r.asset.version[0])return void(i&&i(new Error(\\\"THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.\\\")));const l=new Eg(r,{path:e||this.resourcePath||\\\"\\\",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](l);e.name,a[e.name]=e,s[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],n=r.extensionsRequired||[];switch(e){case km.KHR_MATERIALS_UNLIT:s[e]=new Hm;break;case km.KHR_DRACO_MESH_COMPRESSION:s[e]=new cg(r,this.dracoLoader);break;case km.KHR_TEXTURE_TRANSFORM:s[e]=new hg;break;case km.KHR_MESH_QUANTIZATION:s[e]=new ug;break;default:n.indexOf(e)>=0&&a[e]}}l.setExtensions(s),l.setPlugins(a),l.parse(n,i)}parseAsync(t,e){const n=this;return new Promise(function(i,r){n.parse(t,e,i,r)})}}const km={KHR_BINARY_GLTF:\\\"KHR_binary_glTF\\\",KHR_DRACO_MESH_COMPRESSION:\\\"KHR_draco_mesh_compression\\\",KHR_LIGHTS_PUNCTUAL:\\\"KHR_lights_punctual\\\",KHR_MATERIALS_CLEARCOAT:\\\"KHR_materials_clearcoat\\\",KHR_MATERIALS_DISPERSION:\\\"KHR_materials_dispersion\\\",KHR_MATERIALS_IOR:\\\"KHR_materials_ior\\\",KHR_MATERIALS_SHEEN:\\\"KHR_materials_sheen\\\",KHR_MATERIALS_SPECULAR:\\\"KHR_materials_specular\\\",KHR_MATERIALS_TRANSMISSION:\\\"KHR_materials_transmission\\\",KHR_MATERIALS_IRIDESCENCE:\\\"KHR_materials_iridescence\\\",KHR_MATERIALS_ANISOTROPY:\\\"KHR_materials_anisotropy\\\",KHR_MATERIALS_UNLIT:\\\"KHR_materials_unlit\\\",KHR_MATERIALS_VOLUME:\\\"KHR_materials_volume\\\",KHR_TEXTURE_BASISU:\\\"KHR_texture_basisu\\\",KHR_TEXTURE_TRANSFORM:\\\"KHR_texture_transform\\\",KHR_MESH_QUANTIZATION:\\\"KHR_mesh_quantization\\\",KHR_MATERIALS_EMISSIVE_STRENGTH:\\\"KHR_materials_emissive_strength\\\",EXT_MATERIALS_BUMP:\\\"EXT_materials_bump\\\",EXT_TEXTURE_WEBP:\\\"EXT_texture_webp\\\",EXT_TEXTURE_AVIF:\\\"EXT_texture_avif\\\",EXT_MESHOPT_COMPRESSION:\\\"EXT_meshopt_compression\\\",EXT_MESH_GPU_INSTANCING:\\\"EXT_mesh_gpu_instancing\\\"};class Vm{constructor(t){this.parser=t,this.name=km.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,i=e.length;i>n;n++){const i=e[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n=\\\"light:\\\"+t;let i=e.cache.get(n);if(i)return i;const r=e.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let a;const o=new uh(16777215);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],nl);const l=void 0!==s.range?s.range:0;switch(s.type){case\\\"directional\\\":a=new Mp(o),a.target.position.set(0,0,-1),a.add(a.target);break;case\\\"point\\\":a=new vp(o),a.distance=l;break;case\\\"spot\\\":a=new gp(o),a.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error(\\\"THREE.GLTFLoader: Unexpected light type: \\\"+s.type)}return a.position.set(0,0,0),ni(a,s),void 0!==s.intensity&&(a.intensity=s.intensity),a.name=e.createUniqueName(s.name||\\\"light_\\\"+t),i=Promise.resolve(a),e.cache.add(n,i),i}getDependency(t,e){if(\\\"light\\\"===t)return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,i=n.json.nodes[t],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(t){return n._getNodeRef(e.cache,r,t)})}}class Hm{constructor(){this.name=km.KHR_MATERIALS_UNLIT}getMaterialType(){return mh}extendParams(t,e,n){const i=[];t.color=new uh(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;t.color.setRGB(e[0],e[1],e[2],nl),t.opacity=e[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(t,\\\"map\\\",r.baseColorTexture,el))}return Promise.all(i)}}class Gm{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(e.emissiveIntensity=i),Promise.resolve()}}class Wm{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(e,\\\"clearcoatMap\\\",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(e,\\\"clearcoatRoughnessMap\\\",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(e,\\\"clearcoatNormalMap\\\",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const t=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Al(t,t)}return Promise.all(r)}}class Xm{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_DISPERSION}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class jm{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(e.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(e,\\\"iridescenceMap\\\",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(e.iridescenceIOR=s.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(e,\\\"iridescenceThicknessMap\\\",s.iridescenceThicknessTexture)),Promise.all(r)}}class qm{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_SHEEN}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new uh(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const t=s.sheenColorFactor;e.sheenColor.setRGB(t[0],t[1],t[2],nl)}return void 0!==s.sheenRoughnessFactor&&(e.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(e,\\\"sheenColorMap\\\",s.sheenColorTexture,el)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(e,\\\"sheenRoughnessMap\\\",s.sheenRoughnessTexture)),Promise.all(r)}}class Ym{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(e.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(e,\\\"transmissionMap\\\",s.transmissionTexture)),Promise.all(r)}}class Km{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_VOLUME}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(e,\\\"thicknessMap\\\",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return e.attenuationColor=(new uh).setRGB(a[0],a[1],a[2],nl),Promise.all(r)}}class Jm{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_IOR}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class Zm{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_SPECULAR}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(e,\\\"specularIntensityMap\\\",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return e.specularColor=(new uh).setRGB(a[0],a[1],a[2],nl),void 0!==s.specularColorTexture&&r.push(n.assignTexture(e,\\\"specularColorMap\\\",s.specularColorTexture,el)),Promise.all(r)}}class $m{constructor(t){this.parser=t,this.name=km.EXT_MATERIALS_BUMP}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return e.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(e,\\\"bumpMap\\\",s.bumpTexture)),Promise.all(r)}}class Qm{constructor(t){this.parser=t,this.name=km.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?Ud:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(e.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(e.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(e,\\\"anisotropyMap\\\",s.anisotropyTexture)),Promise.all(r)}}class tg{constructor(t){this.parser=t,this.name=km.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,i=n.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error(\\\"THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures\\\");return null}return e.loadTextureImage(t,r.source,s)}}class eg{constructor(t){this.parser=t,this.name=km.EXT_TEXTURE_WEBP}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(o=t)}return n.loadTextureImage(t,s.source,o)}}class ng{constructor(t){this.parser=t,this.name=km.EXT_TEXTURE_AVIF}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=i.images[s.source];let o=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(o=t)}return n.loadTextureImage(t,s.source,o)}}class ig{constructor(t){this.name=km.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],i=this.parser.getDependency(\\\"buffer\\\",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error(\\\"THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files\\\");return null}return i.then(function(e){const n=t.byteOffset||0,i=t.byteLength||0,s=t.count,a=t.byteStride,o=new Uint8Array(e,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,a,o,t.mode,t.filter).then(function(t){return t.buffer}):r.ready.then(function(){const e=new ArrayBuffer(s*a);return r.decodeGltfBuffer(new Uint8Array(e),s,a,o,t.mode,t.filter),e})})}return null}}class rg{constructor(t){this.name=km.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=e.meshes[n.mesh];for(const t of i.primitives)if(t.mode!==mg.TRIANGLES&&t.mode!==mg.TRIANGLE_STRIP&&t.mode!==mg.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=n.extensions[this.name].attributes,s=[],a={};for(const t in r)s.push(this.parser.getDependency(\\\"accessor\\\",r[t]).then(e=>(a[t]=e,a[t])));return 1>s.length?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then(t=>{const e=t.pop(),n=e.isGroup?e.children:[e],i=t[0].count,r=[];for(const t of n){const e=new yc,n=new Rl,s=new wl,o=new Rl(1,1,1),l=new Lu(t.geometry,t.material,i);for(let t=0;i>t;t++)a.TRANSLATION&&n.fromBufferAttribute(a.TRANSLATION,t),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,t),a.SCALE&&o.fromBufferAttribute(a.SCALE,t),l.setMatrixAt(t,e.compose(n,s,o));for(const e in a)if(\\\"_COLOR_0\\\"===e){const t=a[e];l.instanceColor=new bu(t.array,t.itemSize,t.normalized)}else\\\"TRANSLATION\\\"!==e&&\\\"ROTATION\\\"!==e&&\\\"SCALE\\\"!==e&&t.geometry.setAttribute(e,a[e]);qc.prototype.copy.call(l,t),this.parser.assignFinalMaterial(l),r.push(l)}return e.isGroup?(e.clear(),e.add(...r),e):r[0]}))}}const sg=\\\"glTF\\\",ag=12,og={JSON:1313821514,BIN:5130562};class lg{constructor(t){this.name=km.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,ag),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==sg)throw new Error(\\\"THREE.GLTFLoader: Unsupported glTF-Binary header.\\\");if(2>this.header.version)throw new Error(\\\"THREE.GLTFLoader: Legacy binary file detected.\\\");const i=this.header.length-ag,r=new DataView(t,ag);let s=0;for(;i>s;){const e=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,i===og.JSON){const i=new Uint8Array(t,ag+s,e);this.content=n.decode(i)}else if(i===og.BIN){const n=ag+s;this.body=t.slice(n,n+e)}s+=e}if(null===this.content)throw new Error(\\\"THREE.GLTFLoader: JSON content not found.\\\")}}class cg{constructor(t,e){if(!e)throw new Error(\\\"THREE.GLTFLoader: No DRACOLoader instance provided.\\\");this.name=km.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,i=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},o={},l={};for(const t in s){const e=yg[t]||t.toLowerCase();a[e]=s[t]}for(const e in t.attributes){const i=yg[e]||e.toLowerCase();if(void 0!==s[e]){const r=n.accessors[t.attributes[e]],s=gg[r.componentType];l[i]=s.name,o[i]=!0===r.normalized}}return e.getDependency(\\\"bufferView\\\",r).then(function(t){return new Promise(function(e,n){i.decodeDracoFile(t,function(t){for(const e in t.attributes){const n=t.attributes[e],i=o[e];void 0!==i&&(n.normalized=i)}e(t)},a,l,nl,n)})})}}class hg{constructor(){this.name=km.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class ug{constructor(){this.name=km.KHR_MESH_QUANTIZATION}}class dg extends Vd{constructor(t,e,n,i){super(t,e,n,i)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i;for(let t=0;t!==i;t++)e[t]=n[r+t];return e}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=2*a,l=3*a,c=i-e,h=(n-e)/c,u=h*h,d=u*h,p=t*l,f=p-l,m=-2*d+3*u,g=d-u,_=1-m,v=g-u+h;for(let t=0;t!==a;t++){const e=s[f+t+a],n=s[f+t+o]*c,i=s[p+t+a],l=s[p+t]*c;r[t]=_*e+v*n+m*i+g*l}return r}}const pg=new wl;class fg extends dg{interpolate_(t,e,n,i){const r=super.interpolate_(t,e,n,i);return pg.fromArray(r).normalize().toArray(r),r}}const mg={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},gg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},_g={9728:Ea,9729:Ra,9984:Aa,9985:Ca,9986:wa,9987:Pa},vg={33071:Ta,33648:ba,10497:Sa},xg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},yg={POSITION:\\\"position\\\",NORMAL:\\\"normal\\\",TANGENT:\\\"tangent\\\",TEXCOORD_0:\\\"uv\\\",TEXCOORD_1:\\\"uv1\\\",TEXCOORD_2:\\\"uv2\\\",TEXCOORD_3:\\\"uv3\\\",COLOR_0:\\\"color\\\",WEIGHTS_0:\\\"skinWeight\\\",JOINTS_0:\\\"skinIndex\\\"},Mg={scale:\\\"scale\\\",translation:\\\"position\\\",rotation:\\\"quaternion\\\",weights:\\\"morphTargetInfluences\\\"},Sg={CUBICSPLINE:void 0,LINEAR:Vo,STEP:ko},Tg={OPAQUE:\\\"OPAQUE\\\",MASK:\\\"MASK\\\",BLEND:\\\"BLEND\\\"},bg=new yc;class Eg{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Qn,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if(\\\"undefined\\\"!=typeof navigator){const t=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(t);const e=t.match(/Version\\\\/(\\\\d+)/);i=n&&e?parseInt(e[1],10):-1,r=t.indexOf(\\\"Firefox\\\")>-1,s=r?t.match(/Firefox\\\\/([0-9]+)\\\\./)[1]:-1}\\\"undefined\\\"==typeof createImageBitmap||n&&17>i||r&&98>s?this.textureLoader=new cp(this.options.manager):this.textureLoader=new Ep(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ap(this.options.manager),this.fileLoader.setResponseType(\\\"arraybuffer\\\"),\\\"use-credentials\\\"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(t){return t._markDefs&&t._markDefs()}),Promise.all(this._invokeAll(function(t){return t.beforeRoot&&t.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(\\\"scene\\\"),n.getDependencies(\\\"animation\\\"),n.getDependencies(\\\"camera\\\")])}).then(function(e){const s={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:n,userData:{}};return ei(r,s,i),ni(s,i),Promise.all(n._invokeAll(function(t){return t.afterRoot&&t.afterRoot(s)})).then(function(){for(const t of s.scenes)t.updateMatrixWorld();t(s)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=e.length;i>n;n++){const i=e[n].joints;for(let e=0,n=i.length;n>e;e++)t[i[e]].isBone=!0}for(let e=0,i=t.length;i>e;e++){const i=t[e];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(1>=t.refs[e])return n;const i=n.clone(),r=(t,e)=>{const n=this.associations.get(t);null!=n&&this.associations.set(e,n);for(const[n,i]of t.children.entries())r(i,e.children[n])};return r(n,i),i.name+=\\\"_instance_\\\"+t.uses[e]++,i}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const i=t(e[n]);if(i)return i}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let i=0;i<e.length;i++){const r=t(e[i]);r&&n.push(r)}return n}getDependency(t,e){const n=t+\\\":\\\"+e;let i=this.cache.get(n);if(!i){switch(t){case\\\"scene\\\":i=this.loadScene(e);break;case\\\"node\\\":i=this._invokeOne(function(t){return t.loadNode&&t.loadNode(e)});break;case\\\"mesh\\\":i=this._invokeOne(function(t){return t.loadMesh&&t.loadMesh(e)});break;case\\\"accessor\\\":i=this.loadAccessor(e);break;case\\\"bufferView\\\":i=this._invokeOne(function(t){return t.loadBufferView&&t.loadBufferView(e)});break;case\\\"buffer\\\":i=this.loadBuffer(e);break;case\\\"material\\\":i=this._invokeOne(function(t){return t.loadMaterial&&t.loadMaterial(e)});break;case\\\"texture\\\":i=this._invokeOne(function(t){return t.loadTexture&&t.loadTexture(e)});break;case\\\"skin\\\":i=this.loadSkin(e);break;case\\\"animation\\\":i=this._invokeOne(function(t){return t.loadAnimation&&t.loadAnimation(e)});break;case\\\"camera\\\":i=this.loadCamera(e);break;default:if(i=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(t,e)}),!i)throw new Error(\\\"Unknown type: \\\"+t)}this.cache.add(n,i)}return i}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,i=this.json[t+(\\\"mesh\\\"===t?\\\"es\\\":\\\"s\\\")]||[];e=Promise.all(i.map(function(e,i){return n.getDependency(t,i)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&\\\"arraybuffer\\\"!==e.type)throw new Error(\\\"THREE.GLTFLoader: \\\"+e.type+\\\" buffer type is not supported.\\\");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[km.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(t,r){n.load(Tp.resolveURL(e.uri,i.path),t,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer \\\"'+e.uri+'\\\".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency(\\\"buffer\\\",e.buffer).then(function(t){const n=e.byteLength||0,i=e.byteOffset||0;return t.slice(i,i+n)})}loadAccessor(t){const e=this,n=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse){const t=xg[i.type],e=gg[i.componentType],n=!0===i.normalized,r=new e(i.count*t);return Promise.resolve(new xh(r,t,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency(\\\"bufferView\\\",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency(\\\"bufferView\\\",i.sparse.indices.bufferView)),r.push(this.getDependency(\\\"bufferView\\\",i.sparse.values.bufferView))),Promise.all(r).then(function(t){const r=t[0],s=xg[i.type],a=gg[i.componentType],o=a.BYTES_PER_ELEMENT,l=o*s,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,u=!0===i.normalized;let d,p;if(h&&h!==l){const t=Math.floor(c/h),n=\\\"InterleavedBuffer:\\\"+i.bufferView+\\\":\\\"+i.componentType+\\\":\\\"+t+\\\":\\\"+i.count;let l=e.cache.get(n);l||(d=new a(r,t*h,i.count*h/o),l=new au(d,h/o),e.cache.add(n,l)),p=new lu(l,s,c%h/o,u)}else d=null===r?new a(i.count*s):new a(r,c,i.count*s),p=new xh(d,s,u);if(void 0!==i.sparse){const e=xg.SCALAR,n=gg[i.sparse.indices.componentType],o=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(t[1],o,i.sparse.count*e),h=new a(t[2],l,i.sparse.count*s);null!==r&&(p=new xh(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let t=0,e=c.length;e>t;t++){const e=c[t];if(p.setX(e,h[t*s]),2>s||p.setY(e,h[t*s+1]),3>s||p.setZ(e,h[t*s+2]),4>s||p.setW(e,h[t*s+3]),s>=5)throw new Error(\\\"THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.\\\")}p.normalized=u}return p})}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let s=this.textureLoader;if(r.uri){const t=n.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,i,s)}loadTextureImage(t,e,n){const i=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+\\\":\\\"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(e,n).then(function(e){e.flipY=!1,e.name=s.name||a.name||\\\"\\\",\\\"\\\"===e.name&&\\\"string\\\"==typeof a.uri&&!1===a.uri.startsWith(\\\"data:image/\\\")&&(e.name=a.uri);const n=(r.samplers||{})[s.sampler]||{};return e.magFilter=_g[n.magFilter]||Ra,e.minFilter=_g[n.minFilter]||Pa,e.wrapS=vg[n.wrapS]||Sa,e.wrapT=vg[n.wrapT]||Sa,e.generateMipmaps=!e.isCompressedTexture&&e.minFilter!==Ea&&e.minFilter!==Ra,i.associations.set(e,{textures:t}),e}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(t,e){const n=this.json,i=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then(t=>t.clone());const r=n.images[t],s=self.URL||self.webkitURL;let a=r.uri||\\\"\\\",o=!1;if(void 0!==r.bufferView)a=this.getDependency(\\\"bufferView\\\",r.bufferView).then(function(t){o=!0;const e=new Blob([t],{type:r.mimeType});return a=s.createObjectURL(e),a});else if(void 0===r.uri)throw new Error(\\\"THREE.GLTFLoader: Image \\\"+t+\\\" is missing URI and bufferView\\\");const l=Promise.resolve(a).then(function(t){return new Promise(function(n,r){let s=n;!0===e.isImageBitmapLoader&&(s=function(t){const e=new Hl(t);e.needsUpdate=!0,n(e)}),e.load(Tp.resolveURL(t,i.path),s,void 0,r)})}).then(function(t){return!0===o&&s.revokeObjectURL(a),ni(t,r),t.userData.mimeType=r.mimeType||li(r.uri),t}).catch(function(t){throw t});return this.sourceCache[t]=l,l}assignTexture(t,e,n,i){const r=this;return this.getDependency(\\\"texture\\\",n.index).then(function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[km.KHR_TEXTURE_TRANSFORM]){const t=void 0!==n.extensions?n.extensions[km.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[km.KHR_TEXTURE_TRANSFORM].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==i&&(s.colorSpace=i),t[e]=s,s})}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const i=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t=\\\"PointsMaterial:\\\"+n.uuid;let e=this.cache.get(t);e||(e=new td,fh.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t=\\\"LineBasicMaterial:\\\"+n.uuid;let e=this.cache.get(t);e||(e=new Vu,fh.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,this.cache.add(t,e)),n=e}if(i||r||s){let t=\\\"ClonedMaterial:\\\"+n.uuid+\\\":\\\";i&&(t+=\\\"derivative-tangents:\\\"),r&&(t+=\\\"vertex-colors:\\\"),s&&(t+=\\\"flat-shading:\\\");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}t.material=n}getMaterialType(){return Nd}loadMaterial(t){const e=this,n=this.json,i=this.extensions,r=n.materials[t];let s;const a={},o=[];if((r.extensions||{})[km.KHR_MATERIALS_UNLIT]){const t=i[km.KHR_MATERIALS_UNLIT];s=t.getMaterialType(),o.push(t.extendParams(a,r,e))}else{const n=r.pbrMetallicRoughness||{};if(a.color=new uh(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;a.color.setRGB(t[0],t[1],t[2],nl),a.opacity=t[3]}void 0!==n.baseColorTexture&&o.push(e.assignTexture(a,\\\"map\\\",n.baseColorTexture,el)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(e.assignTexture(a,\\\"metalnessMap\\\",n.metallicRoughnessTexture)),o.push(e.assignTexture(a,\\\"roughnessMap\\\",n.metallicRoughnessTexture))),s=this._invokeOne(function(e){return e.getMaterialType&&e.getMaterialType(t)}),o.push(Promise.all(this._invokeAll(function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)})))}!0===r.doubleSided&&(a.side=2);const l=r.alphaMode||Tg.OPAQUE;if(l===Tg.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===Tg.MASK&&(a.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==mh&&(o.push(e.assignTexture(a,\\\"normalMap\\\",r.normalTexture)),a.normalScale=new Al(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;a.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&s!==mh&&(o.push(e.assignTexture(a,\\\"aoMap\\\",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(a.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==mh){const t=r.emissiveFactor;a.emissive=(new uh).setRGB(t[0],t[1],t[2],nl)}return void 0!==r.emissiveTexture&&s!==mh&&o.push(e.assignTexture(a,\\\"emissiveMap\\\",r.emissiveTexture,el)),Promise.all(o).then(function(){const n=new s(a);return r.name&&(n.name=r.name),ni(n,r),e.associations.set(n,{materials:t}),r.extensions&&ei(i,n,r),n})}createUniqueName(t){const e=zp.sanitizeNodeName(t||\\\"\\\");return e in this.nodeNamesUsed?e+\\\"_\\\"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){function e(t){return i[km.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,n).then(function(e){return hi(e,t,n)})}const n=this,i=this.extensions,r=this.primitiveCache,s=[];for(let i=0,a=t.length;a>i;i++){const a=t[i],o=si(a),l=r[o];if(l)s.push(l.promise);else{let t;t=a.extensions&&a.extensions[km.KHR_DRACO_MESH_COMPRESSION]?e(a):hi(new Ph,a,n),r[o]={primitive:a,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,n=this.json,i=this.extensions,r=n.meshes[t],s=r.primitives,a=[];for(let t=0,e=s.length;e>t;t++){const e=void 0===s[t].material?ti(this.cache):this.getDependency(\\\"material\\\",s[t].material);a.push(e)}return a.push(e.loadGeometries(s)),Promise.all(a).then(function(n){const a=n.slice(0,n.length-1),o=n[n.length-1],l=[];for(let n=0,c=o.length;c>n;n++){const c=o[n],h=s[n];let u;const d=a[n];if(h.mode===mg.TRIANGLES||h.mode===mg.TRIANGLE_STRIP||h.mode===mg.TRIANGLE_FAN||void 0===h.mode)u=!0===r.isSkinnedMesh?new vu(c,d):new Hh(c,d),!0===u.isSkinnedMesh&&u.normalizeSkinWeights(),h.mode===mg.TRIANGLE_STRIP?u.geometry=$n(u.geometry,1):h.mode===mg.TRIANGLE_FAN&&(u.geometry=$n(u.geometry,2));else if(h.mode===mg.LINES)u=new $u(c,d);else if(h.mode===mg.LINE_STRIP)u=new Ku(c,d);else if(h.mode===mg.LINE_LOOP)u=new Qu(c,d);else{if(h.mode!==mg.POINTS)throw new Error(\\\"THREE.GLTFLoader: Primitive mode unsupported: \\\"+h.mode);u=new sd(c,d)}Object.keys(u.geometry.morphAttributes).length>0&&ri(u,r),u.name=e.createUniqueName(r.name||\\\"mesh_\\\"+t),ni(u,r),h.extensions&&ei(i,u,h),e.assignFinalMaterial(u),l.push(u)}for(let n=0,i=l.length;i>n;n++)e.associations.set(l[n],{meshes:t,primitives:n});if(1===l.length)return r.extensions&&ei(i,l[0],r),l[0];const c=new nu;r.extensions&&ei(i,c,r),e.associations.set(c,{meshes:t});for(let t=0,e=l.length;e>t;t++)c.add(l[t]);return c})}loadCamera(t){let e;const n=this.json.cameras[t],i=n[n.type];if(i)return\\\"perspective\\\"===n.type?e=new Jh(El.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):\\\"orthographic\\\"===n.type&&(e=new xp(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),ni(e,n),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],n=[];for(let t=0,i=e.joints.length;i>t;t++)n.push(this._loadNodeShallow(e.joints[t]));return void 0!==e.inverseBindMatrices?n.push(this.getDependency(\\\"accessor\\\",e.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(t){const e=t.pop(),n=t,i=[],r=[];for(let t=0,s=n.length;s>t;t++){const s=n[t];if(s){i.push(s);const n=new yc;null!==e&&n.fromArray(e.array,16*t),r.push(n)}}return new Tu(i,r)})}loadAnimation(t){const e=this.json,n=this,i=e.animations[t],r=i.name?i.name:\\\"animation_\\\"+t,s=[],a=[],o=[],l=[],c=[];for(let t=0,e=i.channels.length;e>t;t++){const e=i.channels[t],n=i.samplers[e.sampler],r=e.target,h=r.node,u=void 0!==i.parameters?i.parameters[n.input]:n.input,d=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(s.push(this.getDependency(\\\"node\\\",h)),a.push(this.getDependency(\\\"accessor\\\",u)),o.push(this.getDependency(\\\"accessor\\\",d)),l.push(n),c.push(r))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(c)]).then(function(t){const e=t[0],s=t[1],a=t[2],o=t[3],l=t[4],c=[];for(let t=0,i=e.length;i>t;t++){const i=e[t],r=s[t],h=a[t],u=o[t],d=l[t];if(void 0===i)continue;i.updateMatrix&&i.updateMatrix();const p=n._createAnimationTracks(i,r,h,u,d);if(p)for(let t=0;t<p.length;t++)c.push(p[t])}const h=new Qd(r,void 0,c);return ni(h,i),h})}createNodeMesh(t){const e=this.json,n=this,i=e.nodes[t];return void 0===i.mesh?null:n.getDependency(\\\"mesh\\\",i.mesh).then(function(t){const e=n._getNodeRef(n.meshCache,i.mesh,t);return void 0!==i.weights&&e.traverse(function(t){if(t.isMesh)for(let e=0,n=i.weights.length;n>e;e++)t.morphTargetInfluences[e]=i.weights[e]}),e})}loadNode(t){const e=this,n=this.json.nodes[t],i=e._loadNodeShallow(t),r=[],s=n.children||[];for(let t=0,n=s.length;n>t;t++)r.push(e.getDependency(\\\"node\\\",s[t]));const a=void 0===n.skin?Promise.resolve(null):e.getDependency(\\\"skin\\\",n.skin);return Promise.all([i,Promise.all(r),a]).then(function(t){const e=t[0],n=t[1],i=t[2];null!==i&&e.traverse(function(t){t.isSkinnedMesh&&t.bind(i,bg)});for(let t=0,i=n.length;i>t;t++)e.add(n[t]);return e})}_loadNodeShallow(t){const e=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const r=e.nodes[t],s=r.name?i.createUniqueName(r.name):\\\"\\\",a=[],o=i._invokeOne(function(e){return e.createNodeMesh&&e.createNodeMesh(t)});return o&&a.push(o),void 0!==r.camera&&a.push(i.getDependency(\\\"camera\\\",r.camera).then(function(t){return i._getNodeRef(i.cameraCache,r.camera,t)})),i._invokeAll(function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)}).forEach(function(t){a.push(t)}),this.nodeCache[t]=Promise.all(a).then(function(e){let a;if(a=!0===r.isBone?new xu:e.length>1?new nu:1===e.length?e[0]:new qc,a!==e[0])for(let t=0,n=e.length;n>t;t++)a.add(e[t]);if(r.name&&(a.userData.name=r.name,a.name=s),ni(a,r),r.extensions&&ei(n,a,r),void 0!==r.matrix){const t=new yc;t.fromArray(r.matrix),a.applyMatrix4(t)}else void 0!==r.translation&&a.position.fromArray(r.translation),void 0!==r.rotation&&a.quaternion.fromArray(r.rotation),void 0!==r.scale&&a.scale.fromArray(r.scale);if(i.associations.has(a)){if(void 0!==r.mesh&&i.meshCache.refs[r.mesh]>1){const t=i.associations.get(a);i.associations.set(a,{...t})}}else i.associations.set(a,{});return i.associations.get(a).nodes=t,a}),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],i=this,r=new nu;n.name&&(r.name=i.createUniqueName(n.name)),ni(r,n),n.extensions&&ei(e,r,n);const s=n.nodes||[],a=[];for(let t=0,e=s.length;e>t;t++)a.push(i.getDependency(\\\"node\\\",s[t]));return Promise.all(a).then(function(t){for(let e=0,n=t.length;n>e;e++)r.add(t[e]);return i.associations=(t=>{const e=new Map;for(const[t,n]of i.associations)(t instanceof fh||t instanceof Hl)&&e.set(t,n);return t.traverse(t=>{const n=i.associations.get(t);null!=n&&e.set(t,n)}),e})(r),r})}_createAnimationTracks(t,e,n,i,r){const s=[],a=t.name?t.name:t.uuid,o=[];let l;switch(Mg[r.path]===Mg.weights?t.traverse(function(t){t.morphTargetInfluences&&o.push(t.name?t.name:t.uuid)}):o.push(a),Mg[r.path]){case Mg.weights:l=Yd;break;case Mg.rotation:l=Jd;break;case Mg.translation:case Mg.scale:l=$d;break;default:l=1===n.itemSize?Yd:$d}const c=void 0!==i.interpolation?Sg[i.interpolation]:Vo,h=this._getArrayFromAccessor(n);for(let t=0,n=o.length;n>t;t++){const n=new l(o[t]+\\\".\\\"+Mg[r.path],e.array,h,c);\\\"CUBICSPLINE\\\"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const t=oi(e.constructor),n=new Float32Array(e.length);for(let i=0,r=e.length;r>i;i++)n[i]=e[i]*t;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(t){return new(this instanceof Jd?fg:dg)(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}const Ag=el;class wg extends ip{constructor(t){super(t),this.defaultDPI=90,this.defaultUnit=\\\"px\\\"}load(t,e,n,i){const r=this,s=new ap(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(n){try{e(r.parse(n))}catch(e){i&&i(e),r.manager.itemError(t)}},n,i)}parse(t){function e(t,e,i,r,s,a,o,l){if(0==e||0==i)return void t.lineTo(l.x,l.y);r=r*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const c=(o.x-l.x)/2,h=(o.y-l.y)/2,u=Math.cos(r)*c+Math.sin(r)*h,d=-Math.sin(r)*c+Math.cos(r)*h;let p=e*e,f=i*i;const m=u*u,g=d*d,_=m/p+g/f;if(_>1){const t=Math.sqrt(_);p=(e*=t)*e,f=(i*=t)*i}const v=p*g+f*m,x=(p*f-v)/v;let y=Math.sqrt(Math.max(0,x));s===a&&(y=-y);const M=y*e*d/i,S=-y*i*u/e,T=Math.cos(r)*M-Math.sin(r)*S+(o.x+l.x)/2,b=Math.sin(r)*M+Math.cos(r)*S+(o.y+l.y)/2,E=n(1,0,(u-M)/e,(d-S)/i),A=n((u-M)/e,(d-S)/i,(-u-M)/e,(-d-S)/i)%(2*Math.PI);t.currentPath.absellipse(T,b,e,i,E,E+A,0===a,r)}function n(t,e,n,i){const r=t*n+e*i,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+i*i);let a=Math.acos(Math.max(-1,Math.min(1,r/s)));return 0>t*i-e*n&&(a=-a),a}function i(t,e){function n(n,i,r){void 0===r&&(r=function(t){return t.startsWith(\\\"url\\\"),t}),t.hasAttribute(n)&&(e[i]=r(t.getAttribute(n))),s[i]&&(e[i]=r(s[i])),t.style&&\\\"\\\"!==t.style[n]&&(e[i]=r(t.style[n]))}function i(t){return Math.max(0,Math.min(1,a(t)))}function r(t){return Math.max(0,a(t))}e=Object.assign({},e);let s={};if(t.hasAttribute(\\\"class\\\")){const e=t.getAttribute(\\\"class\\\").split(/\\\\s/).filter(Boolean).map(t=>t.trim());for(let t=0;t<e.length;t++)s=Object.assign(s,m[\\\".\\\"+e[t]])}return t.hasAttribute(\\\"id\\\")&&(s=Object.assign(s,m[\\\"#\\\"+t.getAttribute(\\\"id\\\")])),n(\\\"fill\\\",\\\"fill\\\"),n(\\\"fill-opacity\\\",\\\"fillOpacity\\\",i),n(\\\"fill-rule\\\",\\\"fillRule\\\"),n(\\\"opacity\\\",\\\"opacity\\\",i),n(\\\"stroke\\\",\\\"stroke\\\"),n(\\\"stroke-opacity\\\",\\\"strokeOpacity\\\",i),n(\\\"stroke-width\\\",\\\"strokeWidth\\\",r),n(\\\"stroke-linejoin\\\",\\\"strokeLineJoin\\\"),n(\\\"stroke-linecap\\\",\\\"strokeLineCap\\\"),n(\\\"stroke-miterlimit\\\",\\\"strokeMiterLimit\\\",r),n(\\\"visibility\\\",\\\"visibility\\\"),e}function r(t,e){return t-(e-t)}function s(t,e,n){function i(t,e,n){const i=new SyntaxError('Unexpected character \\\"'+t+'\\\" at index '+e+\\\".\\\");throw i.partial=n,i}function r(){\\\"\\\"!==l&&(\\\"\\\"===c?h.push(Number(l)):h.push(Number(l)*Math.pow(10,Number(c)))),l=\\\"\\\",c=\\\"\\\"}if(\\\"string\\\"!=typeof t)throw new TypeError(\\\"Invalid input: \\\"+typeof t);const s={WHITESPACE:/[ \\\\t\\\\r\\\\n]/,DIGIT:/[\\\\d]/,SIGN:/[-+]/,POINT:/\\\\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let a=0,o=!0,l=\\\"\\\",c=\\\"\\\";const h=[];let u;const d=t.length;for(let p=0;d>p;p++)if(u=t[p],Array.isArray(e)&&e.includes(h.length%n)&&s.FLAGS.test(u))a=1,l=u,r();else{if(0===a){if(s.WHITESPACE.test(u))continue;if(s.DIGIT.test(u)||s.SIGN.test(u)){a=1,l=u;continue}if(s.POINT.test(u)){a=2,l=u;continue}s.COMMA.test(u)&&(o&&i(u,p,h),o=!0)}if(1===a){if(s.DIGIT.test(u)){l+=u;continue}if(s.POINT.test(u)){l+=u,a=2;continue}if(s.EXP.test(u)){a=3;continue}s.SIGN.test(u)&&1===l.length&&s.SIGN.test(l[0])&&i(u,p,h)}if(2===a){if(s.DIGIT.test(u)){l+=u;continue}if(s.EXP.test(u)){a=3;continue}s.POINT.test(u)&&\\\".\\\"===l[l.length-1]&&i(u,p,h)}if(3===a){if(s.DIGIT.test(u)){c+=u;continue}if(s.SIGN.test(u)){if(\\\"\\\"===c){c+=u;continue}1===c.length&&s.SIGN.test(c)&&i(u,p,h)}}s.WHITESPACE.test(u)?(r(),a=0,o=!1):s.COMMA.test(u)?(r(),a=0,o=!0):s.SIGN.test(u)?(r(),a=1,l=u):s.POINT.test(u)?(r(),a=2,l=u):i(u,p,h)}return r(),h}function a(t){let e,n=\\\"px\\\";if(\\\"string\\\"==typeof t||t instanceof String)for(let e=0,i=d.length;i>e;e++){const i=d[e];if(t.endsWith(i)){n=i,t=t.substring(0,t.length-i.length);break}}return\\\"px\\\"===n&&\\\"px\\\"!==u.defaultUnit?e=p.in[u.defaultUnit]/u.defaultDPI:(e=p[n][u.defaultUnit],0>e&&(e=p[n].in*u.defaultDPI)),e*parseFloat(t)}function o(t){const e=t.elements;return 0>e[0]*e[4]-e[1]*e[3]}function l(t){const e=t.elements,n=e[0]*e[3]+e[1]*e[4];if(0===n)return!1;const i=c(t),r=h(t);return Math.abs(n/(i*r))>Number.EPSILON}function c(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function h(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const u=this,d=[\\\"mm\\\",\\\"cm\\\",\\\"in\\\",\\\"pt\\\",\\\"pc\\\",\\\"px\\\"],p={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}},f=[],m={},g=[],_=new Il,v=new Il,x=new Il,y=new Il,M=new Al,S=new Rl,T=new Il,b=(new DOMParser).parseFromString(t,\\\"image/svg+xml\\\");return function t(n,u){if(1!==n.nodeType)return;const d=function(t){if(!(t.hasAttribute(\\\"transform\\\")||\\\"use\\\"===t.nodeName&&(t.hasAttribute(\\\"x\\\")||t.hasAttribute(\\\"y\\\"))))return null;const e=function(t){const e=new Il,n=_;if(\\\"use\\\"===t.nodeName&&(t.hasAttribute(\\\"x\\\")||t.hasAttribute(\\\"y\\\"))){const n=a(t.getAttribute(\\\"x\\\")||0),i=a(t.getAttribute(\\\"y\\\")||0);e.translate(n,i)}if(t.hasAttribute(\\\"transform\\\")){const i=t.getAttribute(\\\"transform\\\").split(\\\")\\\");for(let t=i.length-1;t>=0;t--){const r=i[t].trim();if(\\\"\\\"===r)continue;const a=r.indexOf(\\\"(\\\"),o=r.length;if(a>0&&o>a){const t=r.slice(0,a),e=s(r.slice(a+1));switch(n.identity(),t){case\\\"translate\\\":if(e.length>=1){const t=e[0];let i=0;2>e.length||(i=e[1]),n.translate(t,i)}break;case\\\"rotate\\\":if(e.length>=1){let t=0,i=0,r=0;t=e[0]*Math.PI/180,3>e.length||(i=e[1],r=e[2]),v.makeTranslation(-i,-r),x.makeRotation(t),y.multiplyMatrices(x,v),v.makeTranslation(i,r),n.multiplyMatrices(v,y)}break;case\\\"scale\\\":if(e.length>=1){const t=e[0];let i=t;2>e.length||(i=e[1]),n.scale(t,i)}break;case\\\"skewX\\\":1===e.length&&n.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case\\\"skewY\\\":1===e.length&&n.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case\\\"matrix\\\":6===e.length&&n.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(n)}}return e}(t);return g.length>0&&e.premultiply(g[g.length-1]),T.copy(e),g.push(e),e}(n);let p=!1,b=null;switch(n.nodeName){case\\\"svg\\\":case\\\"g\\\":u=i(n,u);break;case\\\"style\\\":!function(t){if(t.sheet&&t.sheet.cssRules&&t.sheet.cssRules.length)for(let e=0;e<t.sheet.cssRules.length;e++){const n=t.sheet.cssRules[e];if(1!==n.type)continue;const i=n.selectorText.split(/,/gm).filter(Boolean).map(t=>t.trim());for(let t=0;t<i.length;t++){const e=Object.fromEntries(Object.entries(n.style).filter(([,t])=>\\\"\\\"!==t));m[i[t]]=Object.assign(m[i[t]]||{},e)}}}(n);break;case\\\"path\\\":u=i(n,u),n.hasAttribute(\\\"d\\\")&&(b=function(t){const n=new Xp,i=new Al,a=new Al,o=new Al;let l=!0,c=!1;const h=t.getAttribute(\\\"d\\\");if(\\\"\\\"===h||\\\"none\\\"===h)return null;const u=h.match(/[a-df-z][^a-df-z]*/gi);for(let t=0,h=u.length;h>t;t++){const h=u[t],d=h.charAt(0),p=h.slice(1).trim();let f;switch(!0===l&&(c=!0,l=!1),d){case\\\"M\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=2)i.x=f[t+0],i.y=f[t+1],a.x=i.x,a.y=i.y,0===t?n.moveTo(i.x,i.y):n.lineTo(i.x,i.y),0===t&&o.copy(i);break;case\\\"H\\\":f=s(p);for(let t=0,e=f.length;e>t;t++)i.x=f[t],a.x=i.x,a.y=i.y,n.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case\\\"V\\\":f=s(p);for(let t=0,e=f.length;e>t;t++)i.y=f[t],a.x=i.x,a.y=i.y,n.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case\\\"L\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=2)i.x=f[t+0],i.y=f[t+1],a.x=i.x,a.y=i.y,n.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case\\\"C\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=6)n.bezierCurveTo(f[t+0],f[t+1],f[t+2],f[t+3],f[t+4],f[t+5]),a.x=f[t+2],a.y=f[t+3],i.x=f[t+4],i.y=f[t+5],0===t&&!0===c&&o.copy(i);break;case\\\"S\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=4)n.bezierCurveTo(r(i.x,a.x),r(i.y,a.y),f[t+0],f[t+1],f[t+2],f[t+3]),a.x=f[t+0],a.y=f[t+1],i.x=f[t+2],i.y=f[t+3],0===t&&!0===c&&o.copy(i);break;case\\\"Q\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=4)n.quadraticCurveTo(f[t+0],f[t+1],f[t+2],f[t+3]),a.x=f[t+0],a.y=f[t+1],i.x=f[t+2],i.y=f[t+3],0===t&&!0===c&&o.copy(i);break;case\\\"T\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=2){const e=r(i.x,a.x),s=r(i.y,a.y);n.quadraticCurveTo(e,s,f[t+0],f[t+1]),a.x=e,a.y=s,i.x=f[t+0],i.y=f[t+1],0===t&&!0===c&&o.copy(i)}break;case\\\"A\\\":f=s(p,[3,4],7);for(let t=0,r=f.length;r>t;t+=7){if(f[t+5]==i.x&&f[t+6]==i.y)continue;const r=i.clone();i.x=f[t+5],i.y=f[t+6],a.x=i.x,a.y=i.y,e(n,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,i),0===t&&!0===c&&o.copy(i)}break;case\\\"m\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=2)i.x+=f[t+0],i.y+=f[t+1],a.x=i.x,a.y=i.y,0===t?n.moveTo(i.x,i.y):n.lineTo(i.x,i.y),0===t&&o.copy(i);break;case\\\"h\\\":f=s(p);for(let t=0,e=f.length;e>t;t++)i.x+=f[t],a.x=i.x,a.y=i.y,n.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case\\\"v\\\":f=s(p);for(let t=0,e=f.length;e>t;t++)i.y+=f[t],a.x=i.x,a.y=i.y,n.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case\\\"l\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=2)i.x+=f[t+0],i.y+=f[t+1],a.x=i.x,a.y=i.y,n.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case\\\"c\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=6)n.bezierCurveTo(i.x+f[t+0],i.y+f[t+1],i.x+f[t+2],i.y+f[t+3],i.x+f[t+4],i.y+f[t+5]),a.x=i.x+f[t+2],a.y=i.y+f[t+3],i.x+=f[t+4],i.y+=f[t+5],0===t&&!0===c&&o.copy(i);break;case\\\"s\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=4)n.bezierCurveTo(r(i.x,a.x),r(i.y,a.y),i.x+f[t+0],i.y+f[t+1],i.x+f[t+2],i.y+f[t+3]),a.x=i.x+f[t+0],a.y=i.y+f[t+1],i.x+=f[t+2],i.y+=f[t+3],0===t&&!0===c&&o.copy(i);break;case\\\"q\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=4)n.quadraticCurveTo(i.x+f[t+0],i.y+f[t+1],i.x+f[t+2],i.y+f[t+3]),a.x=i.x+f[t+0],a.y=i.y+f[t+1],i.x+=f[t+2],i.y+=f[t+3],0===t&&!0===c&&o.copy(i);break;case\\\"t\\\":f=s(p);for(let t=0,e=f.length;e>t;t+=2){const e=r(i.x,a.x),s=r(i.y,a.y);n.quadraticCurveTo(e,s,i.x+f[t+0],i.y+f[t+1]),a.x=e,a.y=s,i.x=i.x+f[t+0],i.y=i.y+f[t+1],0===t&&!0===c&&o.copy(i)}break;case\\\"a\\\":f=s(p,[3,4],7);for(let t=0,r=f.length;r>t;t+=7){if(0==f[t+5]&&0==f[t+6])continue;const r=i.clone();i.x+=f[t+5],i.y+=f[t+6],a.x=i.x,a.y=i.y,e(n,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,i),0===t&&!0===c&&o.copy(i)}break;case\\\"Z\\\":case\\\"z\\\":n.currentPath.autoClose=!0,n.currentPath.curves.length>0&&(i.copy(o),n.currentPath.currentPoint.copy(i),l=!0)}c=!1}return n}(n));break;case\\\"rect\\\":u=i(n,u),b=function(t){const e=a(t.getAttribute(\\\"x\\\")||0),n=a(t.getAttribute(\\\"y\\\")||0),i=a(t.getAttribute(\\\"rx\\\")||t.getAttribute(\\\"ry\\\")||0),r=a(t.getAttribute(\\\"ry\\\")||t.getAttribute(\\\"rx\\\")||0),s=a(t.getAttribute(\\\"width\\\")),o=a(t.getAttribute(\\\"height\\\")),l=.448084975506,c=new Xp;return c.moveTo(e+i,n),c.lineTo(e+s-i,n),(0!==i||0!==r)&&c.bezierCurveTo(e+s-i*l,n,e+s,n+r*l,e+s,n+r),c.lineTo(e+s,n+o-r),(0!==i||0!==r)&&c.bezierCurveTo(e+s,n+o-r*l,e+s-i*l,n+o,e+s-i,n+o),c.lineTo(e+i,n+o),(0!==i||0!==r)&&c.bezierCurveTo(e+i*l,n+o,e,n+o-r*l,e,n+o-r),c.lineTo(e,n+r),(0!==i||0!==r)&&c.bezierCurveTo(e,n+r*l,e+i*l,n,e+i,n),c}(n);break;case\\\"polygon\\\":u=i(n,u),b=function(t){const e=new Xp;let n=0;return t.getAttribute(\\\"points\\\").replace(/([+-]?\\\\d*\\\\.?\\\\d+(?:e[+-]?\\\\d+)?)(?:,|\\\\s)([+-]?\\\\d*\\\\.?\\\\d+(?:e[+-]?\\\\d+)?)/g,function(t,i,r){const s=a(i),o=a(r);0===n?e.moveTo(s,o):e.lineTo(s,o),n++}),e.currentPath.autoClose=!0,e}(n);break;case\\\"polyline\\\":u=i(n,u),b=function(t){const e=new Xp;let n=0;return t.getAttribute(\\\"points\\\").replace(/([+-]?\\\\d*\\\\.?\\\\d+(?:e[+-]?\\\\d+)?)(?:,|\\\\s)([+-]?\\\\d*\\\\.?\\\\d+(?:e[+-]?\\\\d+)?)/g,function(t,i,r){const s=a(i),o=a(r);0===n?e.moveTo(s,o):e.lineTo(s,o),n++}),e.currentPath.autoClose=!1,e}(n);break;case\\\"circle\\\":u=i(n,u),b=function(t){const e=a(t.getAttribute(\\\"cx\\\")||0),n=a(t.getAttribute(\\\"cy\\\")||0),i=a(t.getAttribute(\\\"r\\\")||0),r=new Ed;r.absarc(e,n,i,0,2*Math.PI);const s=new Xp;return s.subPaths.push(r),s}(n);break;case\\\"ellipse\\\":u=i(n,u),b=function(t){const e=a(t.getAttribute(\\\"cx\\\")||0),n=a(t.getAttribute(\\\"cy\\\")||0),i=a(t.getAttribute(\\\"rx\\\")||0),r=a(t.getAttribute(\\\"ry\\\")||0),s=new Ed;s.absellipse(e,n,i,r,0,2*Math.PI);const o=new Xp;return o.subPaths.push(s),o}(n);break;case\\\"line\\\":u=i(n,u),b=function(t){const e=a(t.getAttribute(\\\"x1\\\")||0),n=a(t.getAttribute(\\\"y1\\\")||0),i=a(t.getAttribute(\\\"x2\\\")||0),r=a(t.getAttribute(\\\"y2\\\")||0),s=new Xp;return s.moveTo(e,n),s.lineTo(i,r),s.currentPath.autoClose=!1,s}(n);break;case\\\"defs\\\":p=!0;break;case\\\"use\\\":u=i(n,u);const o=(n.getAttributeNS(\\\"http://www.w3.org/1999/xlink\\\",\\\"href\\\")||\\\"\\\").substring(1),l=n.viewportElement.getElementById(o);l&&t(l,u)}b&&(void 0!==u.fill&&\\\"none\\\"!==u.fill&&b.color.setStyle(u.fill,Ag),function(t,e){function n(t){S.set(t.x,t.y,1).applyMatrix3(e),t.set(S.x,S.y)}function i(t){const n=t.xRadius,i=t.yRadius,r=Math.cos(t.aRotation),s=Math.sin(t.aRotation),a=new Rl(n*r,n*s,0),l=new Rl(-i*s,i*r,0),c=a.applyMatrix3(e),h=l.applyMatrix3(e),u=_.set(c.x,h.x,0,c.y,h.y,0,0,0,1),d=v.copy(u).invert(),p=x.copy(d).transpose().multiply(d).elements,f=function(t,e,n){let i,r,s,a,o;const l=t+n,c=t-n,h=Math.sqrt(c*c+4*e*e);return l>0?(i=.5*(l+h),o=1/i,r=t*o*n-e*o*e):0>l?r=.5*(l-h):(i=.5*h,r=-.5*h),s=c>0?c+h:c-h,Math.abs(s)>2*Math.abs(e)?(o=-2*e/s,a=1/Math.sqrt(1+o*o),s=o*a):0===Math.abs(e)?(s=1,a=0):(o=-.5*s/e,s=1/Math.sqrt(1+o*o),a=o*s),c>0&&(o=s,s=-a,a=o),{rt1:i,rt2:r,cs:s,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);if(t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs),(t.aEndAngle-t.aStartAngle)%(2*Math.PI)>=Number.EPSILON){const n=v.set(m,0,0,0,g,0,0,0,1),i=x.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),r=n.multiply(i).multiply(u),s=t=>{const{x:e,y:n}=new Rl(Math.cos(t),Math.sin(t),0).applyMatrix3(r);return Math.atan2(n,e)};t.aStartAngle=s(t.aStartAngle),t.aEndAngle=s(t.aEndAngle),o(e)&&(t.aClockwise=!t.aClockwise)}}function r(t){const n=c(e),i=h(e);t.xRadius*=n,t.yRadius*=i;const r=n>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=r,o(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const s=t.subPaths;for(let t=0,a=s.length;a>t;t++){const a=s[t].curves;for(let t=0;t<a.length;t++){const s=a[t];s.isLineCurve?(n(s.v1),n(s.v2)):s.isCubicBezierCurve?(n(s.v0),n(s.v1),n(s.v2),n(s.v3)):s.isQuadraticBezierCurve?(n(s.v0),n(s.v1),n(s.v2)):s.isEllipseCurve&&(M.set(s.aX,s.aY),n(M),s.aX=M.x,s.aY=M.y,l(e)?i(s):r(s))}}}(b,T),f.push(b),b.userData={node:n,style:u});const E=n.childNodes;for(let e=0;e<E.length;e++){const n=E[e];p&&\\\"style\\\"!==n.nodeName&&\\\"defs\\\"!==n.nodeName||t(n,u)}d&&(g.pop(),g.length>0?T.copy(g[g.length-1]):T.identity())}(b.documentElement,{fill:\\\"#000\\\",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:\\\"miter\\\",strokeLineCap:\\\"butt\\\",strokeMiterLimit:4}),{paths:f,xml:b.documentElement}}static createShapes(t){function e(t,e,i,s){const o=t.x,l=e.x,c=i.x,h=s.x,d=t.y,p=e.y,f=i.y,m=s.y,g=(h-c)*(d-f)-(m-f)*(o-c),_=(m-f)*(l-o)-(h-c)*(p-d),v=g/_,x=((l-o)*(d-f)-(p-d)*(o-c))/_;if(0===_&&0!==g||0>=v||v>=1||0>x||x>1)return null;if(0===g&&0===_){for(let c=0;2>c;c++){if(n(0===c?i:s,t,e),u.loc==r){const t=0===c?i:s;return{x:t.x,y:t.y,t:u.t}}if(u.loc==a)return{x:+(o+u.t*(l-o)).toPrecision(10),y:+(d+u.t*(p-d)).toPrecision(10),t:u.t}}return null}for(let a=0;2>a;a++)if(n(0===a?i:s,t,e),u.loc==r){const t=0===a?i:s;return{x:t.x,y:t.y,t:u.t}}return{x:+(o+v*(l-o)).toPrecision(10),y:+(d+v*(p-d)).toPrecision(10),t:v}}function n(t,e,n){const i=n.x-e.x,d=n.y-e.y,p=t.x-e.x,f=t.y-e.y,m=i*f-p*d;if(t.x===e.x&&t.y===e.y)return u.loc=r,void(u.t=0);if(t.x===n.x&&t.y===n.y)return u.loc=s,void(u.t=1);if(m<-Number.EPSILON)return void(u.loc=o);if(m>Number.EPSILON)return void(u.loc=l);if(0>i*p||0>d*f)return void(u.loc=c);if(Math.sqrt(i*i+d*d)<Math.sqrt(p*p+f*f))return void(u.loc=h);let g;g=0!==i?p/i:f/d,u.loc=a,u.t=g}const i=999999999,r=0,s=1,a=2,o=3,l=4,c=5,h=6,u={loc:r,t:0};let d=i,p=-999999999,f=t.subPaths.map(t=>{const e=t.getPoints();let n=-999999999,r=i,s=-999999999,a=i;for(let t=0;t<e.length;t++){const i=e[t];i.y>n&&(n=i.y),i.y<r&&(r=i.y),i.x>s&&(s=i.x),i.x<a&&(a=i.x)}return p>s||(p=s+1),a>d||(d=a-1),{curves:t.curves,points:e,isCW:Rd.isClockWise(e),identifier:-1,boundingBox:new Wp(new Al(a,r),new Al(s,n))}});f=f.filter(t=>t.points.length>1);for(let t=0;t<f.length;t++)f[t].identifier=t;const m=f.map(n=>function(t,n,i,r,s){null!=s&&\\\"\\\"!==s||(s=\\\"nonzero\\\");const a=new Al;t.boundingBox.getCenter(a);const o=function(t,n,i){const r=new Al;n.getCenter(r);const s=[];return i.forEach(n=>{n.boundingBox.containsPoint(r)&&function(t,n){const i=[],r=[];for(let s=1;t.length>s;s++){const a=t[s-1],o=t[s];for(let t=1;t<n.length;t++){const s=e(a,o,n[t-1],n[t]);null!==s&&void 0===i.find(t=>t.t<=s.t+Number.EPSILON&&t.t>=s.t-Number.EPSILON)&&(i.push(s),r.push(new Al(s.x,s.y)))}}return r}(t,n.points).forEach(t=>{s.push({identifier:n.identifier,isCW:n.isCW,point:t})})}),s.sort((t,e)=>t.point.x-e.point.x),s}([new Al(i,a.y),new Al(r,a.y)],t.boundingBox,n);o.sort((t,e)=>t.point.x-e.point.x);const l=[],c=[];o.forEach(e=>{e.identifier===t.identifier?l.push(e):c.push(e)});const h=l[0].point.x,u=[];let d=0;for(;d<c.length&&c[d].point.x<h;)u.length>0&&u[u.length-1]===c[d].identifier?u.pop():u.push(c[d].identifier),d++;if(u.push(t.identifier),\\\"evenodd\\\"===s){const e=u.length%2==0,n=u[u.length-2];return{identifier:t.identifier,isHole:e,for:n}}if(\\\"nonzero\\\"===s){let e=!0,i=null,r=null;for(let t=0;t<u.length;t++){const s=u[t];e?(r=n[s].isCW,e=!1,i=s):r!==n[s].isCW&&(r=n[s].isCW,e=!0)}return{identifier:t.identifier,isHole:e,for:i}}}(n,f,d,p,t.userData?t.userData.style.fillRule:void 0)),g=[];return f.forEach(t=>{if(!m[t.identifier].isHole){const e=new Ad;e.curves=t.curves,m.filter(e=>e.isHole&&e.for===t.identifier).forEach(t=>{const n=f[t.identifier],i=new Ed;i.curves=n.curves,e.holes.push(i)}),g.push(e)}}),g}static getStrokeStyle(t,e,n,i,r){return{strokeColor:e=void 0!==e?e:\\\"#000\\\",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:n=void 0!==n?n:\\\"miter\\\",strokeLineCap:i=void 0!==i?i:\\\"butt\\\",strokeMiterLimit:r=void 0!==r?r:4}}static pointsToStroke(t,e,n,i){const r=[],s=[],a=[];if(0===wg.pointsToStrokeWithBuffers(t,e,n,i,r,s,a))return null;const o=new Ph;return o.setAttribute(\\\"position\\\",new Sh(r,3)),o.setAttribute(\\\"normal\\\",new Sh(s,3)),o.setAttribute(\\\"uv\\\",new Sh(a,2)),o}static pointsToStrokeWithBuffers(t,e,n,i,r,s,a,o){function l(t,e,n){return n.subVectors(e,t),n.set(-n.y,n.x).normalize()}function c(t,e,n){r&&(r[j]=t.x,r[j+1]=t.y,r[j+2]=0,s&&(s[j]=0,s[j+1]=0,s[j+2]=1),j+=3,a&&(a[q]=e,a[q+1]=n,q+=2)),X+=3}function h(t,e,i,r,s){m.copy(e).sub(t).normalize(),g.copy(i).sub(t).normalize();let a=Math.PI;const o=m.dot(g);1>Math.abs(o)&&(a=Math.abs(Math.acos(o))),a/=n,_.copy(e);for(let e=0,i=n-1;i>e;e++)v.copy(_).rotateAround(t,a),c(_,r,s),c(v,r,s),c(t,r,.5),_.copy(v);c(v,r,s),c(i,r,s),c(t,r,.5)}function u(){c(T,G,1),c(S,G,0),c(A,z,0),c(T,G,1),c(A,z,0),c(w,z,1)}function d(t,e,n){e?t?(c(T,G,1),c(S,G,0),c(A,z,0),c(T,G,1),c(A,z,0),c(P,z,1),c(A,n,0),c(R,n,0),c(P,n,.5)):(c(T,G,1),c(S,G,0),c(w,z,1),c(S,G,0),c(P,z,0),c(w,z,1),c(w,n,1),c(P,n,0),c(C,n,1)):t?(c(A,n,0),c(R,n,0),c(U,n,.5)):(c(w,n,1),c(C,n,0),c(U,n,.5))}function p(t,e){e&&(t?(c(T,G,1),c(S,G,0),c(A,z,0),c(T,G,1),c(A,z,0),c(P,z,1),c(A,G,0),c(U,z,.5),c(P,z,1),c(U,z,.5),c(R,G,0),c(P,z,1)):(c(T,G,1),c(S,G,0),c(w,z,1),c(S,G,0),c(P,z,0),c(w,z,1),c(w,G,1),c(P,z,0),c(U,z,.5),c(U,z,.5),c(P,z,0),c(C,G,1)))}function f(t,n,i,s,o,l){switch(e.strokeLineCap){case\\\"round\\\":o?h(t,i,n,l,.5):h(t,n,i,l,.5);break;case\\\"square\\\":if(o)m.subVectors(n,t),g.set(m.y,-m.x),_.addVectors(m,g).add(t),v.subVectors(g,m).add(t),s?(_.toArray(r,3),v.toArray(r,0),v.toArray(r,9)):(_.toArray(r,3),1===a[7]?v.toArray(r,9):_.toArray(r,9),v.toArray(r,0));else{m.subVectors(i,t),g.set(m.y,-m.x),_.addVectors(m,g).add(t),v.subVectors(g,m).add(t);const e=r.length;s?(_.toArray(r,e-3),v.toArray(r,e-6),v.toArray(r,e-12)):(v.toArray(r,e-6),_.toArray(r,e-3),v.toArray(r,e-12))}}}const m=new Al,g=new Al,_=new Al,v=new Al,x=new Al,y=new Al,M=new Al,S=new Al,T=new Al,b=new Al,E=new Al,A=new Al,w=new Al,R=new Al,C=new Al,P=new Al,I=new Al;n=void 0!==n?n:12,i=void 0!==i?i:.001,o=void 0!==o?o:0;const L=(t=function(t){let e=!1;for(let n=1,r=t.length-1;r>n;n++)if(t[n].distanceTo(t[n+1])<i){e=!0;break}if(!e)return t;const n=[];n.push(t[0]);for(let e=1,r=t.length-1;r>e;e++)t[e].distanceTo(t[e+1])<i||n.push(t[e]);return n.push(t[t.length-1]),n}(t)).length;if(2>L)return 0;const N=t[0].equals(t[L-1]);let U,D,O=t[0];const F=e.strokeWidth/2,B=1/(L-1);let z,k,V,H,G=0,W=!1,X=0,j=3*o,q=2*o;l(t[0],t[1],m).multiplyScalar(F),S.copy(t[0]).sub(m),T.copy(t[0]).add(m),b.copy(S),E.copy(T);for(let n=1;L>n;n++){U=t[n],D=n===L-1?N?t[1]:void 0:t[n+1];const i=m;if(l(O,U,i),_.copy(i).multiplyScalar(F),A.copy(U).sub(_),w.copy(U).add(_),z=G+B,k=!1,void 0!==D){l(U,D,g),_.copy(g).multiplyScalar(F),R.copy(U).sub(_),C.copy(U).add(_),V=!0,_.subVectors(D,O),0>i.dot(_)&&(V=!1),1===n&&(W=V),_.subVectors(D,U),_.normalize();const t=Math.abs(i.dot(_));if(t>Number.EPSILON){const n=F/t;_.multiplyScalar(-n),v.subVectors(U,O),x.copy(v).setLength(n).add(_),P.copy(x).negate();const i=x.length(),r=v.length();v.divideScalar(r),y.subVectors(D,U);const s=y.length();switch(y.divideScalar(s),v.dot(P)<r&&y.dot(P)<s&&(k=!0),I.copy(x).add(U),P.add(U),H=!1,k?V?(C.copy(P),w.copy(P)):(R.copy(P),A.copy(P)):u(),e.strokeLineJoin){case\\\"bevel\\\":d(V,k,z);break;case\\\"round\\\":p(V,k),V?h(U,A,R,z,0):h(U,C,w,z,1);break;default:const t=F*e.strokeMiterLimit/i;if(1>t){if(\\\"miter-clip\\\"!==e.strokeLineJoin){d(V,k,z);break}p(V,k),V?(y.subVectors(I,A).multiplyScalar(t).add(A),M.subVectors(I,R).multiplyScalar(t).add(R),c(A,z,0),c(y,z,0),c(U,z,.5),c(U,z,.5),c(y,z,0),c(M,z,0),c(U,z,.5),c(M,z,0),c(R,z,0)):(y.subVectors(I,w).multiplyScalar(t).add(w),M.subVectors(I,C).multiplyScalar(t).add(C),c(w,z,1),c(y,z,1),c(U,z,.5),c(U,z,.5),c(y,z,1),c(M,z,1),c(U,z,.5),c(M,z,1),c(C,z,1))}else k?(V?(c(T,G,1),c(S,G,0),c(I,z,0),c(T,G,1),c(I,z,0),c(P,z,1)):(c(T,G,1),c(S,G,0),c(I,z,1),c(S,G,0),c(P,z,0),c(I,z,1)),V?R.copy(I):C.copy(I)):V?(c(A,z,0),c(I,z,0),c(U,z,.5),c(U,z,.5),c(I,z,0),c(R,z,0)):(c(w,z,1),c(I,z,1),c(U,z,.5),c(U,z,.5),c(I,z,1),c(C,z,1)),H=!0}}else u()}else u();N||n!==L-1||f(t[0],b,E,V,!0,G),G=z,O=U,S.copy(R),T.copy(C)}if(N){if(k&&r){let t=I,e=P;W!==V&&(t=P,e=I),V?(H||W)&&(e.toArray(r,0),e.toArray(r,9),H&&t.toArray(r,3)):!H&&W||(e.toArray(r,3),e.toArray(r,9),H&&t.toArray(r,0))}}else f(U,A,w,V,!1,z);return X}}const THREE={Scene:su,PerspectiveCamera:Jh,WebGLRenderer:zm,AmbientLight:Sp,DirectionalLight:Mp,Box3:Yl,Vector3:Rl,Vector2:Al,Color:uh,Group:nu,MeshNormalMaterial:Od,MeshStandardMaterial:Nd,MeshPhongMaterial:Dd,MeshLambertMaterial:Fd,MeshPhysicalMaterial:Ud,MeshMatcapMaterial:kd,ShaderMaterial:Xh,Texture:Hl,TextureLoader:cp,RepeatWrapping:Sa,ClampToEdgeWrapping:Ta,EquirectangularReflectionMapping:xa,ACESFilmicToneMapping:4,NoToneMapping:0,SRGBColorSpace:el,LinearSRGBColorSpace:nl,RGBAFormat:ja,LinearMipmapLinearFilter:Pa,LinearFilter:Ra,NearestFilter:Ea,FrontSide:0,BackSide:1,DoubleSide:2,Mesh:Hh,Shape:Ad,ExtrudeGeometry:Cd,AnimationMixer:Hp,Quaternion:wl,Euler:Pc};export{ha as ACESFilmicToneMapping,Sp as AmbientLight,Hp as AnimationMixer,Ms as BackSide,Yl as Box3,Ta as ClampToEdgeWrapping,uh as Color,Mp as DirectionalLight,Ss as DoubleSide,xa as EquirectangularReflectionMapping,Pc as Euler,Cd as ExtrudeGeometry,ys as FrontSide,GLTFLoader,nu as Group,Ra as LinearFilter,Pa as LinearMipmapLinearFilter,nl as LinearSRGBColorSpace,Hh as Mesh,Fd as MeshLambertMaterial,kd as MeshMatcapMaterial,Od as MeshNormalMaterial,Dd as MeshPhongMaterial,Ud as MeshPhysicalMaterial,Nd as MeshStandardMaterial,Ea as NearestFilter,aa as NoToneMapping,Jh as PerspectiveCamera,wl as Quaternion,ja as RGBAFormat,Sa as RepeatWrapping,el as SRGBColorSpace,wg as SVGLoader,su as Scene,Xh as ShaderMaterial,Ad as Shape,THREE,Hl as Texture,cp as TextureLoader,Al as Vector2,Rl as Vector3,zm as WebGLRenderer};\"\n    }\n  ]\n} as const;\n","import type { ValidFPS, ScaleRange } from \"./types\";\n\n/**\n * Current version of the Unicorn Studio SDK being used.\n */\nexport const UNICORN_STUDIO_VERSION = \"2.4.0\";\n\n/**\n * Official CDN URL for the Unicorn Studio SDK script.\n *\n * @remarks\n * This remains available as an override for `sdkUrl`, but the package now\n * loads its bundled SDK files by default.\n */\nexport const UNICORN_STUDIO_CDN_URL = `https://cdn.jsdelivr.net/gh/hiunicornstudio/unicornstudio.js@v${UNICORN_STUDIO_VERSION}/dist/unicornStudio.umd.js`;\n\n/**\n * CDN URL for the Unicorn Studio model-renderer extension module.\n *\n * @remarks\n * Used by the bundled SDK loader to redirect dynamic imports to local blob URLs.\n */\nexport const UNICORN_STUDIO_MODEL_RENDERER_URL = `https://cdn.jsdelivr.net/gh/hiunicornstudio/unicornstudio.js@v${UNICORN_STUDIO_VERSION}/extensions/model-renderer.js`;\n\n/**\n * Default values for UnicornScene component props.\n *\n * @remarks\n * These defaults are used when optional props are not provided to the component.\n */\nexport const DEFAULT_VALUES = {\n  /** Default container width */\n  width: \"100%\" as const,\n  /** Default container height */\n  height: \"100%\" as const,\n  /** Default rendering scale (0.25 to 1.0) */\n  scale: 1 as ScaleRange,\n  /** Default production mode setting */\n  production: true,\n  /** Default device pixel ratio */\n  dpi: 1.5,\n  /** Default frames per second */\n  fps: 60 as ValidFPS,\n  /** Default alt text for accessibility */\n  altText: \"Scene\",\n  /** Default CSS class name */\n  className: \"\",\n  /** Default paused state */\n  paused: false,\n  /** Default lazy loading setting */\n  lazyLoad: true,\n  /** Default setting for showing placeholder on error */\n  showPlaceholderOnError: true,\n  /** Default setting for showing placeholder while loading */\n  showPlaceholderWhileLoading: true,\n} as const;\n\n/**\n * Array of valid FPS values supported by Unicorn Studio.\n *\n * @remarks\n * Only these specific frame rates are supported: 15, 24, 30, 60, and 120.\n */\nexport const VALID_FPS = [15, 24, 30, 60, 120] as const;\n","import { BUNDLED_UNICORN_SDK } from \"./sdk-bundle\";\nimport { UNICORN_STUDIO_MODEL_RENDERER_URL } from \"./constants\";\n\nexport interface BundledUnicornStudioImportMap {\n  imports: Record<string, string>;\n}\n\nconst SCRIPT_ERROR_MESSAGE = \"Failed to load UnicornStudio script\";\nconst MISSING_BUNDLED_SDK_MESSAGE =\n  \"Bundled Unicorn Studio SDK files are missing. Add vendor/unicornstudio/unicornStudio.umd.js and the two extension files in vendor/unicornstudio/extensions/, or pass sdkUrl to load the SDK from a custom URL.\";\n\nconst externalScriptPromises = new Map<string, Promise<void>>();\nlet bundledScriptPromise: Promise<void> | null = null;\n\nfunction createLoadError(message: string = SCRIPT_ERROR_MESSAGE): Error {\n  return new Error(message);\n}\n\nfunction assertBrowserEnvironment() {\n  if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n    throw createLoadError(\n      \"UnicornStudio SDK can only be loaded in the browser\",\n    );\n  }\n}\n\nfunction assertSdkAvailable() {\n  if (!window.UnicornStudio?.addScene) {\n    throw createLoadError(\"UnicornStudio global not found after script load\");\n  }\n}\n\nfunction getExternalScript(scriptUrl: string): HTMLScriptElement | null {\n  return document.querySelector(`script[src=\"${scriptUrl}\"]`);\n}\n\nfunction getBundledScript(id: string): HTMLScriptElement | null {\n  return document.querySelector(`script[data-unicorn-sdk-id=\"${id}\"]`);\n}\n\nfunction loadExternalScript(scriptUrl: string): Promise<void> {\n  assertBrowserEnvironment();\n\n  if (window.UnicornStudio?.addScene) {\n    return Promise.resolve();\n  }\n\n  const existingScript = getExternalScript(scriptUrl);\n  if (existingScript?.dataset.loaded === \"true\") {\n    try {\n      assertSdkAvailable();\n      return Promise.resolve();\n    } catch (error) {\n      return Promise.reject(\n        error instanceof Error ? error : createLoadError(scriptUrl),\n      );\n    }\n  }\n\n  const existingPromise = externalScriptPromises.get(scriptUrl);\n  if (existingPromise) {\n    return existingPromise;\n  }\n\n  const promise = new Promise<void>((resolve, reject) => {\n    const script = existingScript ?? document.createElement(\"script\");\n\n    const cleanup = () => {\n      script.removeEventListener(\"load\", handleLoad);\n      script.removeEventListener(\"error\", handleError);\n    };\n\n    const handleLoad = () => {\n      cleanup();\n      script.dataset.loaded = \"true\";\n\n      try {\n        assertSdkAvailable();\n        resolve();\n      } catch (error) {\n        reject(error instanceof Error ? error : createLoadError());\n      }\n    };\n\n    const handleError = () => {\n      cleanup();\n      reject(createLoadError());\n    };\n\n    script.addEventListener(\"load\", handleLoad);\n    script.addEventListener(\"error\", handleError);\n\n    if (!existingScript) {\n      script.src = scriptUrl;\n      script.async = true;\n      document.head.appendChild(script);\n    }\n  }).catch((error) => {\n    externalScriptPromises.delete(scriptUrl);\n    throw error;\n  });\n\n  externalScriptPromises.set(scriptUrl, promise);\n  return promise;\n}\n\nfunction injectBundledCoreScript(content: string) {\n  const existingScript = getBundledScript(\"core\");\n  if (existingScript?.dataset.loaded === \"true\") {\n    return;\n  }\n\n  const script = existingScript ?? document.createElement(\"script\");\n  script.type = \"text/javascript\";\n  script.dataset.unicornSdkId = \"core\";\n  script.text = content;\n  script.dataset.loaded = \"true\";\n\n  if (!existingScript) {\n    document.head.appendChild(script);\n  }\n}\n\nfunction createModuleBlobUrl(content: string): string {\n  const blob = new Blob([content], { type: \"text/javascript\" });\n  return URL.createObjectURL(blob);\n}\n\nfunction rewriteModelRendererImport(\n  modelRendererContent: string,\n  threeBundleUrl: string,\n): string {\n  return modelRendererContent.replace(\n    /from\\s*[\"']\\.\\/three-bundle\\.js[\"']/,\n    `from \"${threeBundleUrl}\"`,\n  );\n}\n\nfunction injectBundledExtensionImportMap(modelRendererUrl: string) {\n  const existingScript = getBundledScript(\"import-map\");\n  if (existingScript) {\n    return;\n  }\n\n  const script = document.createElement(\"script\");\n  script.type = \"importmap\";\n  script.dataset.unicornSdkId = \"import-map\";\n  script.textContent = JSON.stringify({\n    imports: {\n      [UNICORN_STUDIO_MODEL_RENDERER_URL]: modelRendererUrl,\n    },\n  } satisfies BundledUnicornStudioImportMap);\n  document.head.appendChild(script);\n}\n\nfunction setupBundledExtensions(\n  threeBundleContent: string,\n  modelRendererContent: string,\n) {\n  const threeBundleUrl = createModuleBlobUrl(threeBundleContent);\n  const modelRendererUrl = createModuleBlobUrl(\n    rewriteModelRendererImport(modelRendererContent, threeBundleUrl),\n  );\n\n  injectBundledExtensionImportMap(modelRendererUrl);\n}\n\nfunction loadBundledSdk(): Promise<void> {\n  assertBrowserEnvironment();\n\n  if (window.UnicornStudio?.addScene) {\n    return Promise.resolve();\n  }\n\n  if (bundledScriptPromise) {\n    return bundledScriptPromise;\n  }\n\n  bundledScriptPromise = Promise.resolve()\n    .then(() => {\n      if (!BUNDLED_UNICORN_SDK.available) {\n        throw createLoadError(MISSING_BUNDLED_SDK_MESSAGE);\n      }\n\n      const coreScript = BUNDLED_UNICORN_SDK.scripts.find(\n        (script) => script.id === \"core\",\n      );\n      const threeBundleScript = BUNDLED_UNICORN_SDK.scripts.find(\n        (script) => script.id === \"three-bundle\",\n      );\n      const modelRendererScript = BUNDLED_UNICORN_SDK.scripts.find(\n        (script) => script.id === \"model-renderer\",\n      );\n\n      if (\n        !coreScript?.content.trim() ||\n        !threeBundleScript?.content.trim() ||\n        !modelRendererScript?.content.trim()\n      ) {\n        throw createLoadError(MISSING_BUNDLED_SDK_MESSAGE);\n      }\n\n      setupBundledExtensions(\n        threeBundleScript.content,\n        modelRendererScript.content,\n      );\n      injectBundledCoreScript(coreScript.content);\n\n      assertSdkAvailable();\n    })\n    .catch((error) => {\n      bundledScriptPromise = null;\n      throw error instanceof Error ? error : createLoadError();\n    });\n\n  return bundledScriptPromise;\n}\n\nexport function loadUnicornStudioSdk(sdkUrl?: string): Promise<void> {\n  return sdkUrl ? loadExternalScript(sdkUrl) : loadBundledSdk();\n}\n","import { useEffect, useRef, useState, useCallback, useMemo } from \"react\";\nimport type {\n  UnicornStudioScene,\n  UnicornSceneConfig,\n  UnicornVariables,\n  UnicornVariableChangeCallback,\n  ValidFPS,\n  ScaleRange,\n} from \"./types\";\nimport { validateParameters } from \"./utils\";\n\n/**\n * Sanitizes error messages to avoid exposing internal URLs or sensitive details.\n */\nfunction sanitizeErrorMessage(message: string): string {\n  if (message.includes(\"404\") || message.includes(\"Failed to fetch\")) {\n    return \"Resource not found\";\n  }\n  if (message.includes(\"Network\") || message.includes(\"network\")) {\n    return \"Network error occurred\";\n  }\n  if (message.includes(\"timeout\")) {\n    return \"Loading timeout\";\n  }\n  // For all other errors, redact obvious URLs and file paths to avoid leaking internals.\n  const urlPattern = /\\bhttps?:\\/\\/[^\\s)]+/gi;\n  const filePathPattern = /\\b(?:[A-Za-z]:\\\\|\\/)[^\\s)]+/g;\n\n  let sanitized = message.replaceAll(urlPattern, \"[redacted]\");\n  sanitized = sanitized.replaceAll(filePathPattern, \"[redacted]\");\n\n  return sanitized;\n}\n\n/**\n * Builds the scene configuration object from the given parameters and DOM element.\n *\n * @throws If neither `jsonFilePath` nor `projectId` is provided\n */\nfunction buildSceneConfig(\n  element: HTMLDivElement,\n  params: {\n    jsonFilePath?: string;\n    projectId?: string;\n    scale: ScaleRange;\n    dpi: number;\n    fps: ValidFPS;\n    lazyLoad: boolean;\n    altText: string;\n    ariaLabel: string;\n    production?: boolean;\n    variables?: UnicornVariables;\n    preset?: string;\n  },\n): UnicornSceneConfig {\n  const elementId =\n    element.id || `unicorn-${Math.random().toString(36).slice(2, 11)}`;\n\n  if (!element.id) {\n    element.id = elementId;\n  }\n\n  const config: UnicornSceneConfig = {\n    elementId,\n    scale: params.scale,\n    dpi: params.dpi,\n    fps: params.fps,\n    lazyLoad: params.lazyLoad,\n    altText: params.altText,\n    ariaLabel: params.ariaLabel,\n    production: params.production,\n  };\n\n  if (params.variables) {\n    config.initialVariables = params.variables;\n  }\n\n  if (params.preset) {\n    config.initialPreset = params.preset;\n  }\n\n  if (params.jsonFilePath) {\n    config.filePath = params.jsonFilePath;\n  } else if (params.projectId) {\n    config.projectId = params.projectId;\n  } else {\n    throw new Error(\"No project ID or JSON file path provided\");\n  }\n\n  return config;\n}\n\nconst INIT_TIMEOUT_MS = 15000;\n\n/**\n * Wraps a promise with a timeout, rejecting if it doesn't resolve in time.\n * Ensures the timer is always cleaned up.\n */\nasync function withTimeout<T>(\n  promise: Promise<T>,\n  ms: number = INIT_TIMEOUT_MS,\n): Promise<T> {\n  let timeoutId: ReturnType<typeof setTimeout> | undefined;\n  const timeoutPromise = new Promise<never>((_, reject) => {\n    timeoutId = setTimeout(\n      () => reject(new Error(\"Scene initialization timeout\")),\n      ms,\n    );\n  });\n\n  try {\n    return await Promise.race([promise, timeoutPromise]);\n  } finally {\n    if (timeoutId) clearTimeout(timeoutId);\n  }\n}\n\n/**\n * Parameters for the useUnicornScene hook.\n */\nexport interface UseUnicornSceneParams {\n  /**\n   * React ref to the container element where the scene will be rendered.\n   */\n  elementRef: React.RefObject<HTMLDivElement | null>;\n\n  /**\n   * The Unicorn Studio project ID to load.\n   */\n  projectId?: string;\n\n  /**\n   * Path to a local JSON file containing the scene data.\n   */\n  jsonFilePath?: string;\n\n  /**\n   * Whether to use production mode for the scene.\n   */\n  production?: boolean;\n\n  /**\n   * Rendering scale factor (0.25 to 1.0).\n   */\n  scale: ScaleRange;\n\n  /**\n   * Device pixel ratio for rendering.\n   */\n  dpi: number;\n\n  /**\n   * Target frames per second for the animation.\n   */\n  fps: ValidFPS;\n\n  /**\n   * Whether to lazy load the scene when it enters the viewport.\n   */\n  lazyLoad: boolean;\n\n  /**\n   * Alt text for accessibility.\n   */\n  altText: string;\n\n  /**\n   * ARIA label for the scene container.\n   */\n  ariaLabel: string;\n\n  /**\n   * Whether the Unicorn Studio SDK script has finished loading.\n   */\n  isScriptLoaded: boolean;\n\n  /**\n   * Whether the scene animation is paused.\n   */\n  paused?: boolean;\n\n  /**\n   * Values for variables authored and published with the scene.\n   *\n   * @remarks\n   * Applied as `initialVariables` on creation, then synced to the live scene\n   * via `setVariables()` when the values change, without re-initializing.\n   */\n  variables?: UnicornVariables;\n\n  /**\n   * Authored preset ID or name, applied as `initialPreset` on creation and\n   * synced via `setPreset()` when it changes.\n   */\n  preset?: string;\n\n  /**\n   * Callback fired when a scene variable changes.\n   */\n  onVariableChange?: UnicornVariableChangeCallback;\n\n  /**\n   * Callback fired when the scene has loaded successfully.\n   */\n  onLoad?: () => void;\n\n  /**\n   * Callback fired when an error occurs during scene loading.\n   *\n   * @param error - The error that occurred\n   */\n  onError?: (error: Error) => void;\n\n  /**\n   * Optional ref that receives the active Unicorn Studio scene instance.\n   */\n  sceneRef?: React.Ref<UnicornStudioScene | null>;\n}\n\n/**\n * Synchronizes an external React ref (callback or object ref) with the given scene instance.\n *\n * @param ref - A React ref callback or mutable object ref to receive the scene instance; if `undefined`, no action is taken\n * @param value - The current `UnicornStudioScene` instance or `null` to clear the ref\n */\nfunction assignSceneRef(\n  ref: React.Ref<UnicornStudioScene | null> | undefined,\n  value: UnicornStudioScene | null,\n) {\n  if (!ref) return;\n\n  if (typeof ref === \"function\") {\n    ref(value);\n    return;\n  }\n\n  (ref as React.MutableRefObject<UnicornStudioScene | null>).current = value;\n}\n\n/**\n * The variable/preset values a scene was created with, used to detect props\n * that changed while `addScene()` was still in flight.\n */\ninterface CreatedWith {\n  preset?: string;\n  variablesKey?: string;\n}\n\nfunction snapshotCreatedWith(\n  preset: string | undefined,\n  variables: UnicornVariables | undefined,\n): CreatedWith {\n  return {\n    preset,\n    variablesKey: variables ? JSON.stringify(variables) : undefined,\n  };\n}\n\n/**\n * Applies variables and presets that changed while the scene was being created.\n *\n * @remarks\n * The sync effects no-op while the scene ref is still `null`, so a prop change\n * during the `addScene()` await would otherwise never reach the loaded scene.\n */\nfunction replaySceneDrift(\n  scene: UnicornStudioScene,\n  createdWith: CreatedWith,\n  latestPreset: string | undefined,\n  latestVariables: UnicornVariables | undefined,\n): void {\n  if (latestPreset && latestPreset !== createdWith.preset) {\n    scene.setPreset?.(latestPreset);\n  }\n\n  if (\n    latestVariables &&\n    JSON.stringify(latestVariables) !== createdWith.variablesKey\n  ) {\n    scene.setVariables?.(latestVariables);\n  }\n}\n\n/**\n * Hook for managing a Unicorn Studio scene lifecycle.\n *\n * @remarks\n * This hook handles scene initialization, configuration updates, pause state synchronization,\n * and cleanup. It is framework-agnostic and used internally by both React and Next.js components.\n *\n * The hook will automatically:\n * - Initialize the scene when the SDK script loads\n * - Re-initialize when configuration changes\n * - Sync the paused state with the scene\n * - Clean up resources on unmount\n *\n * @param params - The hook parameters\n * @returns An object containing any initialization error\n *\n * @example\n * ```tsx\n * const { error } = useUnicornScene({\n *   elementRef,\n *   projectId: \"my-project-id\",\n *   scale: 1,\n *   dpi: 1.5,\n *   fps: 60,\n *   lazyLoad: true,\n *   altText: \"My Scene\",\n *   ariaLabel: \"Interactive animation\",\n *   isScriptLoaded: true,\n *   onLoad: () => console.log(\"Scene loaded!\"),\n *   onError: (err) => console.error(err),\n * });\n * ```\n */\nexport function useUnicornScene({\n  elementRef,\n  projectId,\n  jsonFilePath,\n  production,\n  scale,\n  dpi,\n  fps,\n  lazyLoad,\n  altText,\n  ariaLabel,\n  isScriptLoaded,\n  paused,\n  variables,\n  preset,\n  onVariableChange,\n  onLoad,\n  onError,\n  sceneRef,\n}: UseUnicornSceneParams): { error: Error | null } {\n  const internalSceneRef = useRef<UnicornStudioScene | null>(null);\n  const [initError, setInitError] = useState<Error | null>(null);\n  const initializationKeyRef = useRef<string>(\"\");\n  const isInitializingRef = useRef(false);\n\n  // Stable refs for callbacks and sceneRef so they never trigger re-initialization\n  const onLoadRef = useRef(onLoad);\n  onLoadRef.current = onLoad;\n  const onErrorRef = useRef(onError);\n  onErrorRef.current = onError;\n  const onVariableChangeRef = useRef(onVariableChange);\n  onVariableChangeRef.current = onVariableChange;\n\n  // Variables and preset are synced to the live scene without re-initializing,\n  // so the init effect reads them from refs instead of depending on them.\n  const variablesRef = useRef(variables);\n  variablesRef.current = variables;\n  const presetRef = useRef(preset);\n  presetRef.current = preset;\n\n  // Serialized so inline object literals don't retrigger the sync effect on\n  // every render.\n  const variablesKey = variables ? JSON.stringify(variables) : undefined;\n\n  const variableUnsubscribeRef = useRef<(() => void) | null>(null);\n  const sceneRefRef = useRef(sceneRef);\n  const prevSceneRef = useRef(sceneRef);\n\n  // Sync external sceneRef when the prop changes: null the old ref and\n  // forward the current scene (if any) to the new one.\n  if (sceneRef !== prevSceneRef.current) {\n    assignSceneRef(prevSceneRef.current, null);\n    sceneRefRef.current = sceneRef;\n    prevSceneRef.current = sceneRef;\n    assignSceneRef(sceneRef, internalSceneRef.current);\n  }\n\n  // Validate parameters early and memoize the result to prevent loops\n  const validationError = useMemo(() => {\n    return validateParameters(scale, fps);\n  }, [scale, fps]);\n\n  const prevValidationError = useRef<string | null>(null);\n\n  useEffect(() => {\n    if (validationError !== prevValidationError.current) {\n      prevValidationError.current = validationError;\n\n      if (validationError) {\n        const error = new Error(validationError);\n        setInitError(error);\n        onErrorRef.current?.(error);\n      } else {\n        setInitError(null);\n      }\n    }\n  }, [validationError]);\n\n  const destroyScene = useCallback(() => {\n    variableUnsubscribeRef.current?.();\n    variableUnsubscribeRef.current = null;\n    if (internalSceneRef.current?.destroy) {\n      internalSceneRef.current.destroy();\n      internalSceneRef.current = null;\n      assignSceneRef(sceneRefRef.current, null);\n    }\n    isInitializingRef.current = false;\n  }, []);\n\n  useEffect(() => {\n    let ignore = false;\n\n    async function initializeScene() {\n      if (!elementRef.current || !isScriptLoaded || validationError) return;\n\n      // Prevent multiple concurrent initializations\n      if (isInitializingRef.current) return;\n\n      // Create a unique key for this configuration\n      const currentKey = `${projectId || \"\"}-${jsonFilePath || \"\"}-${scale}-${dpi}-${fps}-${production ? \"prod\" : \"dev\"}`;\n\n      // Check if we're already initialized with this exact configuration\n      if (\n        initializationKeyRef.current === currentKey &&\n        internalSceneRef.current\n      ) {\n        return;\n      }\n\n      // Update the initialization key\n      initializationKeyRef.current = currentKey;\n\n      try {\n        destroyScene();\n\n        // Set the flag after destroyScene() which unconditionally clears it\n        isInitializingRef.current = true;\n\n        if (!window.UnicornStudio?.addScene) {\n          throw new Error(\"UnicornStudio.addScene not found\");\n        }\n\n        // Snapshot what the scene is created with, so anything that changed\n        // while addScene() was in flight can be replayed once it resolves.\n        const initialVariables = variablesRef.current;\n        const initialPreset = presetRef.current;\n        const createdWith = snapshotCreatedWith(\n          initialPreset,\n          initialVariables,\n        );\n\n        const sceneConfig = buildSceneConfig(elementRef.current, {\n          jsonFilePath,\n          projectId,\n          scale,\n          dpi,\n          fps,\n          lazyLoad,\n          altText,\n          ariaLabel,\n          production,\n          variables: initialVariables,\n          preset: initialPreset,\n        });\n\n        const scene = await withTimeout(\n          window.UnicornStudio.addScene(sceneConfig),\n        );\n\n        // If the effect cleaned up while we were awaiting, destroy and bail\n        if (ignore) {\n          scene?.destroy();\n          return;\n        }\n\n        if (scene) {\n          internalSceneRef.current = scene;\n          assignSceneRef(sceneRefRef.current, scene);\n          variableUnsubscribeRef.current =\n            scene.onVariableChange?.((name, value, values) =>\n              onVariableChangeRef.current?.(name, value, values),\n            ) ?? null;\n\n          replaySceneDrift(\n            scene,\n            createdWith,\n            presetRef.current,\n            variablesRef.current,\n          );\n\n          setInitError(null);\n          isInitializingRef.current = false;\n          onLoadRef.current?.();\n        } else {\n          isInitializingRef.current = false;\n          throw new Error(\"Failed to initialize scene\");\n        }\n      } catch (error) {\n        if (ignore) return;\n\n        const err = error instanceof Error ? error : new Error(\"Unknown error\");\n        const sanitizedError = new Error(sanitizeErrorMessage(err.message));\n        setInitError(sanitizedError);\n        isInitializingRef.current = false;\n        onErrorRef.current?.(sanitizedError);\n      }\n    }\n\n    if (isScriptLoaded) {\n      void initializeScene();\n    }\n\n    return () => {\n      ignore = true;\n      destroyScene();\n    };\n  }, [\n    isScriptLoaded,\n    elementRef,\n    jsonFilePath,\n    projectId,\n    production,\n    scale,\n    dpi,\n    fps,\n    lazyLoad,\n    altText,\n    ariaLabel,\n    destroyScene,\n    validationError,\n  ]);\n\n  // Sync paused state with scene\n  useEffect(() => {\n    if (internalSceneRef.current && paused !== undefined) {\n      internalSceneRef.current.paused = paused;\n    }\n  }, [paused]);\n\n  // Sync variable values with the live scene. Initial values are delivered\n  // via `initialVariables` in the scene config, so this only applies changes\n  // made after the scene has loaded.\n  useEffect(() => {\n    if (variablesKey !== undefined && variablesRef.current) {\n      internalSceneRef.current?.setVariables?.(variablesRef.current);\n    }\n  }, [variablesKey]);\n\n  // Sync preset with the live scene. The initial preset is delivered via\n  // `initialPreset` in the scene config.\n  useEffect(() => {\n    if (preset) {\n      internalSceneRef.current?.setPreset?.(preset);\n    }\n  }, [preset]);\n\n  // Observe container resize and call scene.resize() so the canvas adapts\n  useEffect(() => {\n    const el = elementRef.current;\n    if (!el || typeof ResizeObserver === \"undefined\") return;\n\n    const observer = new ResizeObserver(() => {\n      internalSceneRef.current?.resize?.();\n    });\n\n    observer.observe(el);\n\n    return () => {\n      observer.disconnect();\n    };\n  }, [elementRef]);\n\n  return { error: initError };\n}\n","import { VALID_FPS } from \"./constants\";\nimport type { ScaleRange, ValidFPS } from \"./types\";\n\n/**\n * Checks if WebGL is supported in the current browser environment.\n *\n * @remarks\n * During server-side rendering (SSR), this function returns `true` to assume\n * WebGL support until client-side hydration can verify.\n *\n * @returns `true` if WebGL is supported or during SSR, `false` otherwise\n *\n * @example\n * ```tsx\n * if (!isWebGLSupported()) {\n *   return <FallbackContent />;\n * }\n * ```\n */\nexport function isWebGLSupported(): boolean {\n  if (typeof window === \"undefined\") return true; // Assume supported during SSR\n\n  try {\n    const canvas = document.createElement(\"canvas\");\n    const gl =\n      canvas.getContext(\"webgl\") || canvas.getContext(\"experimental-webgl\");\n    return !!gl;\n  } catch (e) {\n    return false;\n  }\n}\n\n/**\n * Validates if the given FPS value is one of the allowed values.\n *\n * @param fps - The frames per second value to validate\n * @returns `true` if the FPS value is valid (15, 24, 30, 60, or 120)\n *\n * @example\n * ```ts\n * validateFPS(60);  // true\n * validateFPS(45);  // false\n * ```\n */\nexport function validateFPS(fps: number): fps is ValidFPS {\n  return VALID_FPS.includes(fps as ValidFPS);\n}\n\n/**\n * Validates if the given scale value is within the allowed range.\n *\n * @param scale - The scale value to validate\n * @returns `true` if the scale is between 0.25 and 1.0 (inclusive)\n *\n * @example\n * ```ts\n * validateScale(1);     // true\n * validateScale(0.5);   // true\n * validateScale(0.1);   // false\n * validateScale(1.5);   // false\n * ```\n */\nexport function validateScale(scale: number): scale is ScaleRange {\n  return scale >= 0.25 && scale <= 1.0;\n}\n\n/**\n * Validates both scale and FPS parameters and returns an error message if invalid.\n *\n * @param scale - The scale value to validate (must be between 0.25 and 1.0)\n * @param fps - The frames per second value to validate (must be 15, 24, 30, 60, or 120)\n * @returns An error message string if validation fails, or `null` if both parameters are valid\n *\n * @example\n * ```ts\n * validateParameters(1, 60);    // null (valid)\n * validateParameters(0.1, 60);  // \"Invalid scale: 0.1. Scale must be between 0.25 and 1.0\"\n * validateParameters(1, 45);    // \"Invalid fps: 45. FPS must be one of: 15, 24, 30, 60, 120\"\n * ```\n */\nexport function validateParameters(scale: number, fps: number): string | null {\n  if (!validateScale(scale)) {\n    return `Invalid scale: ${scale}. Scale must be between 0.25 and 1.0`;\n  }\n  if (!validateFPS(fps)) {\n    return `Invalid fps: ${fps}. FPS must be one of: 15, 24, 30, 60, 120`;\n  }\n  return null;\n}\n","/**\n * Inline styles used by the UnicornScene component.\n *\n * @remarks\n * These styles provide the base layout and error display styling.\n * The container uses CSS custom properties (`--unicorn-width` and `--unicorn-height`)\n * for dynamic dimension handling.\n */\nexport const unicornStyles = {\n  /**\n   * Styles for the main scene container element.\n   *\n   * @remarks\n   * Uses CSS custom properties for width and height to allow dynamic sizing.\n   */\n  container: {\n    position: \"relative\" as const,\n    width: \"var(--unicorn-width)\",\n    height: \"var(--unicorn-height)\",\n  },\n\n  /**\n   * Styles for the error message wrapper.\n   */\n  errorWrapper: {\n    display: \"flex\",\n    alignItems: \"center\",\n    justifyContent: \"center\",\n    height: \"100%\",\n  },\n\n  /**\n   * Styles for the error message box.\n   */\n  errorBox: {\n    textAlign: \"center\" as const,\n    padding: \"1rem\",\n    borderRadius: \"0.5rem\",\n    backgroundColor: \"rgb(254 242 242)\",\n    color: \"rgb(239 68 68)\",\n  },\n\n  /**\n   * Styles for the error title text.\n   */\n  errorTitle: {\n    fontWeight: \"600\",\n    marginBottom: \"0.25rem\",\n  },\n\n  /**\n   * Styles for the error message text.\n   */\n  errorMessage: {\n    fontSize: \"0.875rem\",\n    marginTop: \"0.25rem\",\n  },\n};\n"],"mappings":";AAAA,SAAS,UAAAA,SAAQ,YAAAC,WAAU,aAAAC,kBAAiB;;;ACA5C,SAAS,aAAAC,YAAW,YAAAC,WAAU,eAAAC,oBAAmB;;;ACe1C,IAAM,sBAA+C;AAAA,EAC1D,aAAa;AAAA,EACb,WAAW;AAAA,IACT;AAAA,MACE,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,WAAW;AAAA,IACb;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,WAAW;AAAA,IACb;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,WAAW;AAAA,IACb;AAAA,EACF;AACF;;;AC7BO,IAAM,yBAAyB;AAS/B,IAAM,yBAAyB,iEAAiE,sBAAsB;AAQtH,IAAM,oCAAoC,iEAAiE,sBAAsB;AAQjI,IAAM,iBAAiB;AAAA;AAAA,EAE5B,OAAO;AAAA;AAAA,EAEP,QAAQ;AAAA;AAAA,EAER,OAAO;AAAA;AAAA,EAEP,YAAY;AAAA;AAAA,EAEZ,KAAK;AAAA;AAAA,EAEL,KAAK;AAAA;AAAA,EAEL,SAAS;AAAA;AAAA,EAET,WAAW;AAAA;AAAA,EAEX,QAAQ;AAAA;AAAA,EAER,UAAU;AAAA;AAAA,EAEV,wBAAwB;AAAA;AAAA,EAExB,6BAA6B;AAC/B;AAQO,IAAM,YAAY,CAAC,IAAI,IAAI,IAAI,IAAI,GAAG;;;ACxD7C,IAAM,uBAAuB;AAC7B,IAAM,8BACJ;AAEF,IAAM,yBAAyB,oBAAI,IAA2B;AAC9D,IAAI,uBAA6C;AAEjD,SAAS,gBAAgB,UAAkB,sBAA6B;AACtE,SAAO,IAAI,MAAM,OAAO;AAC1B;AAEA,SAAS,2BAA2B;AAClC,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,aAAa;AACpE,UAAM;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,qBAAqB;AA1B9B;AA2BE,MAAI,GAAC,YAAO,kBAAP,mBAAsB,WAAU;AACnC,UAAM,gBAAgB,kDAAkD;AAAA,EAC1E;AACF;AAEA,SAAS,kBAAkB,WAA6C;AACtE,SAAO,SAAS,cAAc,eAAe,SAAS,IAAI;AAC5D;AAEA,SAAS,iBAAiB,IAAsC;AAC9D,SAAO,SAAS,cAAc,+BAA+B,EAAE,IAAI;AACrE;AAEA,SAAS,mBAAmB,WAAkC;AAxC9D;AAyCE,2BAAyB;AAEzB,OAAI,YAAO,kBAAP,mBAAsB,UAAU;AAClC,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,QAAM,iBAAiB,kBAAkB,SAAS;AAClD,OAAI,iDAAgB,QAAQ,YAAW,QAAQ;AAC7C,QAAI;AACF,yBAAmB;AACnB,aAAO,QAAQ,QAAQ;AAAA,IACzB,SAAS,OAAO;AACd,aAAO,QAAQ;AAAA,QACb,iBAAiB,QAAQ,QAAQ,gBAAgB,SAAS;AAAA,MAC5D;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kBAAkB,uBAAuB,IAAI,SAAS;AAC5D,MAAI,iBAAiB;AACnB,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,IAAI,QAAc,CAAC,SAAS,WAAW;AACrD,UAAM,SAAS,0CAAkB,SAAS,cAAc,QAAQ;AAEhE,UAAM,UAAU,MAAM;AACpB,aAAO,oBAAoB,QAAQ,UAAU;AAC7C,aAAO,oBAAoB,SAAS,WAAW;AAAA,IACjD;AAEA,UAAM,aAAa,MAAM;AACvB,cAAQ;AACR,aAAO,QAAQ,SAAS;AAExB,UAAI;AACF,2BAAmB;AACnB,gBAAQ;AAAA,MACV,SAAS,OAAO;AACd,eAAO,iBAAiB,QAAQ,QAAQ,gBAAgB,CAAC;AAAA,MAC3D;AAAA,IACF;AAEA,UAAM,cAAc,MAAM;AACxB,cAAQ;AACR,aAAO,gBAAgB,CAAC;AAAA,IAC1B;AAEA,WAAO,iBAAiB,QAAQ,UAAU;AAC1C,WAAO,iBAAiB,SAAS,WAAW;AAE5C,QAAI,CAAC,gBAAgB;AACnB,aAAO,MAAM;AACb,aAAO,QAAQ;AACf,eAAS,KAAK,YAAY,MAAM;AAAA,IAClC;AAAA,EACF,CAAC,EAAE,MAAM,CAAC,UAAU;AAClB,2BAAuB,OAAO,SAAS;AACvC,UAAM;AAAA,EACR,CAAC;AAED,yBAAuB,IAAI,WAAW,OAAO;AAC7C,SAAO;AACT;AAEA,SAAS,wBAAwB,SAAiB;AAChD,QAAM,iBAAiB,iBAAiB,MAAM;AAC9C,OAAI,iDAAgB,QAAQ,YAAW,QAAQ;AAC7C;AAAA,EACF;AAEA,QAAM,SAAS,0CAAkB,SAAS,cAAc,QAAQ;AAChE,SAAO,OAAO;AACd,SAAO,QAAQ,eAAe;AAC9B,SAAO,OAAO;AACd,SAAO,QAAQ,SAAS;AAExB,MAAI,CAAC,gBAAgB;AACnB,aAAS,KAAK,YAAY,MAAM;AAAA,EAClC;AACF;AAEA,SAAS,oBAAoB,SAAyB;AACpD,QAAM,OAAO,IAAI,KAAK,CAAC,OAAO,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5D,SAAO,IAAI,gBAAgB,IAAI;AACjC;AAEA,SAAS,2BACP,sBACA,gBACQ;AACR,SAAO,qBAAqB;AAAA,IAC1B;AAAA,IACA,SAAS,cAAc;AAAA,EACzB;AACF;AAEA,SAAS,gCAAgC,kBAA0B;AACjE,QAAM,iBAAiB,iBAAiB,YAAY;AACpD,MAAI,gBAAgB;AAClB;AAAA,EACF;AAEA,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,OAAO;AACd,SAAO,QAAQ,eAAe;AAC9B,SAAO,cAAc,KAAK,UAAU;AAAA,IAClC,SAAS;AAAA,MACP,CAAC,iCAAiC,GAAG;AAAA,IACvC;AAAA,EACF,CAAyC;AACzC,WAAS,KAAK,YAAY,MAAM;AAClC;AAEA,SAAS,uBACP,oBACA,sBACA;AACA,QAAM,iBAAiB,oBAAoB,kBAAkB;AAC7D,QAAM,mBAAmB;AAAA,IACvB,2BAA2B,sBAAsB,cAAc;AAAA,EACjE;AAEA,kCAAgC,gBAAgB;AAClD;AAEA,SAAS,iBAAgC;AAvKzC;AAwKE,2BAAyB;AAEzB,OAAI,YAAO,kBAAP,mBAAsB,UAAU;AAClC,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,MAAI,sBAAsB;AACxB,WAAO;AAAA,EACT;AAEA,yBAAuB,QAAQ,QAAQ,EACpC,KAAK,MAAM;AACV,QAAI,CAAC,oBAAoB,WAAW;AAClC,YAAM,gBAAgB,2BAA2B;AAAA,IACnD;AAEA,UAAM,aAAa,oBAAoB,QAAQ;AAAA,MAC7C,CAAC,WAAW,OAAO,OAAO;AAAA,IAC5B;AACA,UAAM,oBAAoB,oBAAoB,QAAQ;AAAA,MACpD,CAAC,WAAW,OAAO,OAAO;AAAA,IAC5B;AACA,UAAM,sBAAsB,oBAAoB,QAAQ;AAAA,MACtD,CAAC,WAAW,OAAO,OAAO;AAAA,IAC5B;AAEA,QACE,EAAC,yCAAY,QAAQ,WACrB,EAAC,uDAAmB,QAAQ,WAC5B,EAAC,2DAAqB,QAAQ,SAC9B;AACA,YAAM,gBAAgB,2BAA2B;AAAA,IACnD;AAEA;AAAA,MACE,kBAAkB;AAAA,MAClB,oBAAoB;AAAA,IACtB;AACA,4BAAwB,WAAW,OAAO;AAE1C,uBAAmB;AAAA,EACrB,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,2BAAuB;AACvB,UAAM,iBAAiB,QAAQ,QAAQ,gBAAgB;AAAA,EACzD,CAAC;AAEH,SAAO;AACT;AAEO,SAAS,qBAAqB,QAAgC;AACnE,SAAO,SAAS,mBAAmB,MAAM,IAAI,eAAe;AAC9D;;;AC5NA,SAAS,WAAW,QAAQ,UAAU,aAAa,eAAe;;;ACmB3D,SAAS,mBAA4B;AAC1C,MAAI,OAAO,WAAW,YAAa,QAAO;AAE1C,MAAI;AACF,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,UAAM,KACJ,OAAO,WAAW,OAAO,KAAK,OAAO,WAAW,oBAAoB;AACtE,WAAO,CAAC,CAAC;AAAA,EACX,SAAS,GAAG;AACV,WAAO;AAAA,EACT;AACF;AAcO,SAAS,YAAY,KAA8B;AACxD,SAAO,UAAU,SAAS,GAAe;AAC3C;AAgBO,SAAS,cAAc,OAAoC;AAChE,SAAO,SAAS,QAAQ,SAAS;AACnC;AAgBO,SAAS,mBAAmB,OAAe,KAA4B;AAC5E,MAAI,CAAC,cAAc,KAAK,GAAG;AACzB,WAAO,kBAAkB,KAAK;AAAA,EAChC;AACA,MAAI,CAAC,YAAY,GAAG,GAAG;AACrB,WAAO,gBAAgB,GAAG;AAAA,EAC5B;AACA,SAAO;AACT;;;AD1EA,SAAS,qBAAqB,SAAyB;AACrD,MAAI,QAAQ,SAAS,KAAK,KAAK,QAAQ,SAAS,iBAAiB,GAAG;AAClE,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,SAAS,SAAS,KAAK,QAAQ,SAAS,SAAS,GAAG;AAC9D,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,SAAS,SAAS,GAAG;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,aAAa;AACnB,QAAM,kBAAkB;AAExB,MAAI,YAAY,QAAQ,WAAW,YAAY,YAAY;AAC3D,cAAY,UAAU,WAAW,iBAAiB,YAAY;AAE9D,SAAO;AACT;AAOA,SAAS,iBACP,SACA,QAaoB;AACpB,QAAM,YACJ,QAAQ,MAAM,WAAW,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AAElE,MAAI,CAAC,QAAQ,IAAI;AACf,YAAQ,KAAK;AAAA,EACf;AAEA,QAAM,SAA6B;AAAA,IACjC;AAAA,IACA,OAAO,OAAO;AAAA,IACd,KAAK,OAAO;AAAA,IACZ,KAAK,OAAO;AAAA,IACZ,UAAU,OAAO;AAAA,IACjB,SAAS,OAAO;AAAA,IAChB,WAAW,OAAO;AAAA,IAClB,YAAY,OAAO;AAAA,EACrB;AAEA,MAAI,OAAO,WAAW;AACpB,WAAO,mBAAmB,OAAO;AAAA,EACnC;AAEA,MAAI,OAAO,QAAQ;AACjB,WAAO,gBAAgB,OAAO;AAAA,EAChC;AAEA,MAAI,OAAO,cAAc;AACvB,WAAO,WAAW,OAAO;AAAA,EAC3B,WAAW,OAAO,WAAW;AAC3B,WAAO,YAAY,OAAO;AAAA,EAC5B,OAAO;AACL,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AAEA,SAAO;AACT;AAEA,IAAM,kBAAkB;AAMxB,eAAe,YACb,SACA,KAAa,iBACD;AACZ,MAAI;AACJ,QAAM,iBAAiB,IAAI,QAAe,CAAC,GAAG,WAAW;AACvD,gBAAY;AAAA,MACV,MAAM,OAAO,IAAI,MAAM,8BAA8B,CAAC;AAAA,MACtD;AAAA,IACF;AAAA,EACF,CAAC;AAED,MAAI;AACF,WAAO,MAAM,QAAQ,KAAK,CAAC,SAAS,cAAc,CAAC;AAAA,EACrD,UAAE;AACA,QAAI,UAAW,cAAa,SAAS;AAAA,EACvC;AACF;AA8GA,SAAS,eACP,KACA,OACA;AACA,MAAI,CAAC,IAAK;AAEV,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AACT;AAAA,EACF;AAEA,EAAC,IAA0D,UAAU;AACvE;AAWA,SAAS,oBACP,QACA,WACa;AACb,SAAO;AAAA,IACL;AAAA,IACA,cAAc,YAAY,KAAK,UAAU,SAAS,IAAI;AAAA,EACxD;AACF;AASA,SAAS,iBACP,OACA,aACA,cACA,iBACM;AA9QR;AA+QE,MAAI,gBAAgB,iBAAiB,YAAY,QAAQ;AACvD,gBAAM,cAAN,+BAAkB;AAAA,EACpB;AAEA,MACE,mBACA,KAAK,UAAU,eAAe,MAAM,YAAY,cAChD;AACA,gBAAM,iBAAN,+BAAqB;AAAA,EACvB;AACF;AAmCO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAmD;AACjD,QAAM,mBAAmB,OAAkC,IAAI;AAC/D,QAAM,CAAC,WAAW,YAAY,IAAI,SAAuB,IAAI;AAC7D,QAAM,uBAAuB,OAAe,EAAE;AAC9C,QAAM,oBAAoB,OAAO,KAAK;AAGtC,QAAM,YAAY,OAAO,MAAM;AAC/B,YAAU,UAAU;AACpB,QAAM,aAAa,OAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,sBAAsB,OAAO,gBAAgB;AACnD,sBAAoB,UAAU;AAI9B,QAAM,eAAe,OAAO,SAAS;AACrC,eAAa,UAAU;AACvB,QAAM,YAAY,OAAO,MAAM;AAC/B,YAAU,UAAU;AAIpB,QAAM,eAAe,YAAY,KAAK,UAAU,SAAS,IAAI;AAE7D,QAAM,yBAAyB,OAA4B,IAAI;AAC/D,QAAM,cAAc,OAAO,QAAQ;AACnC,QAAM,eAAe,OAAO,QAAQ;AAIpC,MAAI,aAAa,aAAa,SAAS;AACrC,mBAAe,aAAa,SAAS,IAAI;AACzC,gBAAY,UAAU;AACtB,iBAAa,UAAU;AACvB,mBAAe,UAAU,iBAAiB,OAAO;AAAA,EACnD;AAGA,QAAM,kBAAkB,QAAQ,MAAM;AACpC,WAAO,mBAAmB,OAAO,GAAG;AAAA,EACtC,GAAG,CAAC,OAAO,GAAG,CAAC;AAEf,QAAM,sBAAsB,OAAsB,IAAI;AAEtD,YAAU,MAAM;AA5XlB;AA6XI,QAAI,oBAAoB,oBAAoB,SAAS;AACnD,0BAAoB,UAAU;AAE9B,UAAI,iBAAiB;AACnB,cAAM,QAAQ,IAAI,MAAM,eAAe;AACvC,qBAAa,KAAK;AAClB,yBAAW,YAAX,oCAAqB;AAAA,MACvB,OAAO;AACL,qBAAa,IAAI;AAAA,MACnB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,eAAe,CAAC;AAEpB,QAAM,eAAe,YAAY,MAAM;AA1YzC;AA2YI,iCAAuB,YAAvB;AACA,2BAAuB,UAAU;AACjC,SAAI,sBAAiB,YAAjB,mBAA0B,SAAS;AACrC,uBAAiB,QAAQ,QAAQ;AACjC,uBAAiB,UAAU;AAC3B,qBAAe,YAAY,SAAS,IAAI;AAAA,IAC1C;AACA,sBAAkB,UAAU;AAAA,EAC9B,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,QAAI,SAAS;AAEb,mBAAe,kBAAkB;AAxZrC;AAyZM,UAAI,CAAC,WAAW,WAAW,CAAC,kBAAkB,gBAAiB;AAG/D,UAAI,kBAAkB,QAAS;AAG/B,YAAM,aAAa,GAAG,aAAa,EAAE,IAAI,gBAAgB,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI,aAAa,SAAS,KAAK;AAGjH,UACE,qBAAqB,YAAY,cACjC,iBAAiB,SACjB;AACA;AAAA,MACF;AAGA,2BAAqB,UAAU;AAE/B,UAAI;AACF,qBAAa;AAGb,0BAAkB,UAAU;AAE5B,YAAI,GAAC,YAAO,kBAAP,mBAAsB,WAAU;AACnC,gBAAM,IAAI,MAAM,kCAAkC;AAAA,QACpD;AAIA,cAAM,mBAAmB,aAAa;AACtC,cAAM,gBAAgB,UAAU;AAChC,cAAM,cAAc;AAAA,UAClB;AAAA,UACA;AAAA,QACF;AAEA,cAAM,cAAc,iBAAiB,WAAW,SAAS;AAAA,UACvD;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,WAAW;AAAA,UACX,QAAQ;AAAA,QACV,CAAC;AAED,cAAM,QAAQ,MAAM;AAAA,UAClB,OAAO,cAAc,SAAS,WAAW;AAAA,QAC3C;AAGA,YAAI,QAAQ;AACV,yCAAO;AACP;AAAA,QACF;AAEA,YAAI,OAAO;AACT,2BAAiB,UAAU;AAC3B,yBAAe,YAAY,SAAS,KAAK;AACzC,iCAAuB,WACrB,iBAAM,qBAAN;AAAA;AAAA,YAAyB,CAAC,MAAM,OAAO,WAAQ;AA3d3D,kBAAAC;AA4dc,sBAAAA,MAAA,oBAAoB,YAApB,gBAAAA,IAAA,0BAA8B,MAAM,OAAO;AAAA;AAAA,gBAD7C,YAEK;AAEP;AAAA,YACE;AAAA,YACA;AAAA,YACA,UAAU;AAAA,YACV,aAAa;AAAA,UACf;AAEA,uBAAa,IAAI;AACjB,4BAAkB,UAAU;AAC5B,0BAAU,YAAV;AAAA,QACF,OAAO;AACL,4BAAkB,UAAU;AAC5B,gBAAM,IAAI,MAAM,4BAA4B;AAAA,QAC9C;AAAA,MACF,SAAS,OAAO;AACd,YAAI,OAAQ;AAEZ,cAAM,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,eAAe;AACtE,cAAM,iBAAiB,IAAI,MAAM,qBAAqB,IAAI,OAAO,CAAC;AAClE,qBAAa,cAAc;AAC3B,0BAAkB,UAAU;AAC5B,yBAAW,YAAX,oCAAqB;AAAA,MACvB;AAAA,IACF;AAEA,QAAI,gBAAgB;AAClB,WAAK,gBAAgB;AAAA,IACvB;AAEA,WAAO,MAAM;AACX,eAAS;AACT,mBAAa;AAAA,IACf;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAGD,YAAU,MAAM;AACd,QAAI,iBAAiB,WAAW,WAAW,QAAW;AACpD,uBAAiB,QAAQ,SAAS;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAKX,YAAU,MAAM;AA1hBlB;AA2hBI,QAAI,iBAAiB,UAAa,aAAa,SAAS;AACtD,mCAAiB,YAAjB,mBAA0B,iBAA1B,4BAAyC,aAAa;AAAA,IACxD;AAAA,EACF,GAAG,CAAC,YAAY,CAAC;AAIjB,YAAU,MAAM;AAliBlB;AAmiBI,QAAI,QAAQ;AACV,mCAAiB,YAAjB,mBAA0B,cAA1B,4BAAsC;AAAA,IACxC;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAGX,YAAU,MAAM;AACd,UAAM,KAAK,WAAW;AACtB,QAAI,CAAC,MAAM,OAAO,mBAAmB,YAAa;AAElD,UAAM,WAAW,IAAI,eAAe,MAAM;AA7iB9C;AA8iBM,mCAAiB,YAAjB,mBAA0B,WAA1B;AAAA,IACF,CAAC;AAED,aAAS,QAAQ,EAAE;AAEnB,WAAO,MAAM;AACX,eAAS,WAAW;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO,EAAE,OAAO,UAAU;AAC5B;;;AJ9hBO,SAAS,uBAAuB,WASrC;AApCF;AAqCE,QAAM,CAAC,UAAU,WAAW,IAAIC;AAAA,IAC9B,OAAO,WAAW,eAAe,SAAQ,YAAO,kBAAP,mBAAsB,QAAQ;AAAA,EACzE;AACA,QAAM,CAAC,OAAO,QAAQ,IAAIA,UAAuB,IAAI;AAErD,QAAM,mBAAmBC,aAAY,MAAM;AA1C7C,QAAAC;AA2CI,QAAI,OAAO,WAAW,iBAAeA,MAAA,OAAO,kBAAP,gBAAAA,IAAsB,WAAU;AACnE,kBAAY,IAAI;AAChB,eAAS,IAAI;AAAA,IACf;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,oBAAoBD,aAAY,MAAM;AAC1C,aAAS,IAAI,MAAM,qCAAqC,CAAC;AAAA,EAC3D,GAAG,CAAC,CAAC;AAEL,EAAAE,WAAU,MAAM;AArDlB,QAAAD;AAsDI,QAAI,SAAS;AAEb,QAAI,OAAO,WAAW,iBAAeA,MAAA,OAAO,kBAAP,gBAAAA,IAAsB,WAAU;AACnE,kBAAY,IAAI;AAChB,eAAS,IAAI;AACb;AAAA,IACF;AAEA,SAAK,qBAAqB,SAAS,EAChC,KAAK,MAAM;AACV,UAAI,OAAQ;AACZ,kBAAY,IAAI;AAChB,eAAS,IAAI;AAAA,IACf,CAAC,EACA,MAAM,CAAC,cAAc;AACpB,UAAI,OAAQ;AACZ,kBAAY,KAAK;AACjB;AAAA,QACE,qBAAqB,QACjB,YACA,IAAI,MAAM,qCAAqC;AAAA,MACrD;AAAA,IACF,CAAC;AAEH,WAAO,MAAM;AACX,eAAS;AAAA,IACX;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,SAAO,EAAE,UAAU,OAAO,kBAAkB,kBAAkB;AAChE;;;AM5EO,IAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO3B,WAAW;AAAA,IACT,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA;AAAA;AAAA;AAAA,EAKA,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,QAAQ;AAAA,EACV;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,IACT,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,OAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AAAA,IACV,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,WAAW;AAAA,EACb;AACF;;;APgGY,cAsBF,YAtBE;AA3FZ,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ,eAAe;AAAA,EACvB,SAAS,eAAe;AAAA,EACxB,QAAQ,eAAe;AAAA,EACvB,MAAM,eAAe;AAAA,EACrB,MAAM,eAAe;AAAA,EACrB,UAAU,eAAe;AAAA,EACzB;AAAA,EACA,YAAY,eAAe;AAAA,EAC3B,WAAW,eAAe;AAAA,EAC1B,aAAa,eAAe;AAAA,EAC5B,SAAS,eAAe;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,yBAAyB,eAAe;AAAA,EACxC,8BAA8B,eAAe;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,QAAM,aAAaE,QAAuB,IAAI;AAC9C,QAAM,CAAC,eAAe,gBAAgB,IAAIC,UAAS,KAAK;AACxD,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,UAAS,IAAI;AAEzD,QAAM,EAAE,UAAU,OAAO,YAAY,IAAI,uBAAuB,MAAM;AAEtE,QAAM,EAAE,OAAO,WAAW,IAAI,gBAAgB;AAAA,IAC5C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,aAAa;AAAA,IACxB,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,MAAM;AACZ,uBAAiB,IAAI;AACrB;AAAA,IACF;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,QAAQ,eAAe;AAG7B,EAAAC,WAAU,MAAM;AACd,sBAAkB,iBAAiB,CAAC;AAAA,EACtC,GAAG,CAAC,CAAC;AAGL,QAAM,mBACH,eAAe,0BACf,CAAC,kBACC,+BAA+B,CAAC,iBAChC,0BAA0B;AAG/B,QAAM,eAAe,OAAO,UAAU,WAAW,QAAQ;AACzD,QAAM,gBAAgB,OAAO,WAAW,WAAW,SAAS;AAC5D,QAAM,uBACJ,OAAO,UAAU,YAAY,OAAO,WAAW;AAGjD,QAAM,mBAAmB;AAAA,IACvB,mBAAmB,OAAO,UAAU,WAAW,GAAG,KAAK,OAAO;AAAA,IAC9D,oBAAoB,OAAO,WAAW,WAAW,GAAG,MAAM,OAAO;AAAA,EACnE;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,OAAO,EAAE,GAAG,cAAc,WAAW,GAAG,iBAAiB;AAAA,MACzD;AAAA,MAEC;AAAA,4BAAoB,eAAe,yBAClC,oBAAC,SAAI,OAAO,EAAE,UAAU,YAAY,OAAO,EAAE,GAC1C,iBAAO,gBAAgB,WACtB;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,KAAK;AAAA,YACL,OAAO;AAAA,cACL,OAAO,uBAAuB,GAAG,YAAY,OAAO;AAAA,cACpD,QAAQ,uBAAuB,GAAG,aAAa,OAAO;AAAA,cACtD,WAAW;AAAA,YACb;AAAA;AAAA,QACF,IACE,cACF,cACE,uBACF;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,YACX,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAO;AAAA,YACvC,cAAY;AAAA;AAAA,QACd,IACE,MACN;AAAA,QAED,SAAS,CAAC,mBACT,oBAAC,SAAI,OAAO,cAAc,cACxB,+BAAC,SAAI,OAAO,cAAc,UACxB;AAAA,8BAAC,OAAE,OAAO,cAAc,YAAY,iCAAmB;AAAA,UACvD,oBAAC,OAAE,OAAO,cAAc,cAAe,gBAAM,SAAQ;AAAA,WACvD,GACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,gBAAQ;","names":["useRef","useState","useEffect","useEffect","useState","useCallback","_a","useState","useCallback","_a","useEffect","useRef","useState","useEffect"]}